How do you mean you can't use delegates? Why? So you can't intercept the actual save/publish of the page rather than the "click"? Like DataFactory's PublishingPage / PublishedPage?
You could always hook into the Published event and then check the user who published the page? I assume you job runs as a specific user so if anyone else is the user then you know they have clicked "Save and Publish"?
The following code will allow you to hook into the published page event:
DataFactory.Instance.PublishedPage += Instance_PublishedPage;
void Instance_PublishedPage(object sender, PageEventArgs e)
{
}
Hello
Thanks for your answers
Magnus:
If I use delegates I will hook up on the 'DataFactory.Instance.PublishedPage' as David says but I cant distinguish if it's the synch job or if current event is triggered by an editor clicking "Save & Publish". Why I have to separate these two is because different actions must occur.
if(synch)
{
defult settings
}
else
{
overrideing settings
}.
David:
Thank you, yes I have thought of this but.... we are using AD and I thought that I could control which AD group current user is a member of but a member that can synchronize can also be member of a group that not is able to synchronize so this is not bullet proof.
Thats why I wonder if there is a way to find out if an editor has clicked on "Save & Publish"
Thanks for helping me!
this code will do the trick
public class AttachEvents : EPiServer.PlugIn.PlugInAttribute
{
public static void Start()
{
EPiServer.DataFactory.Instance.PublishingPage += new EPiServer.PageEventHandler(Instance_PublishingPage);
}
private static void Instance_PublishingPage(object sender, PageEventArgs e)
{
if (e.RequiredAccess == EPiServer.Security.AccessLevel.NoAccess)
return;
if (HttpContext.Current != null &&
HttpContext.Current.Request.RawUrl.Contains("EditPanel.aspx"))
{
//Save and publish
}
}
}
}
Hello
I wonder, when an editor click "Save & Publish" can I detect this click-event in code behind for current page?
I know that I can override methods like OnSave and OnCreate but I cant use these becasue I have a synch-jobb that creates some pages programaticly so I have to distinguish if an editor is clicking on "Save & Publish" or not. I neither can use delegates (global.asax) for Page events :(
Is it possible to detect this click? Would be glad if someone could help me poinitng me in right direction with some code or relevant links.
Thanks in advance!