Hi!
You can probably attach to the EPiServer.UI.Edit.EditPanel.LoadedPage event where you will get a refrence to the EditPanel instance:
public delegate void LoadedPageEventHandler(EditPanel sender, LoadedPageEventArgs e);
Here you should be able to check your flag and as some sort of a message to the editor.
Regards
Linus Ekström
EPiServer Development Team
Excellent, that was the event I was looking for. However, I still cannot figure out how to add a warning message to the top of the page. I have searched and searched, and I have found another post which asks the same (http://world.episerver.com/Templates/Forum/Pages/thread.aspx?id=31239), but no answers.
Any suggestions?
Hi!
There does not seem to be any public method to add warning messages but you can achieve this by adding a static validator:
void EditPanel_LoadedPage(EPiServer.UI.Edit.EditPanel sender, EPiServer.UI.Edit.LoadedPageEventArgs e)
{
sender.Validators.Add(new StaticValidator("Some error message"));
}
/Linus
One dirty way of doing it is to look at this on page 25
http://www.slideshare.net/EPiServerMeetupOslo/episerver-behind-the-scene
Excellent, thank you very much.
I tried Linus' suggestion, and it works like a charm - just what I needed :-)
During releases, we want to prevent editors from publishing anything for a short period, in order to prevent loss of data (the EPiServer database is replicated between environments).
We have accomplished this attaching to the event DataFactory.Instance.PublishedPage in Global.asax, and in our attached method checking the status of a flag in our database. If the flag is raised, we simply set "e.CancelAction = true" and provide a custom message in "e.CancelReason". All ok so far.
However, in addition to this, we would like to notify the editors that publishing has been disabled as soon as they enter edit mode for an article, to discourage them from doing any work on the content at all (after all, it can't be published anyway). In CMS 4.62, this was easily accomplished by attaching to "Global.EditPageValidators" in Global.asax, like this: Global.EditPageValidators += new PageValidateEventHandler(Global_EditPageValidators); Then, in our attached method, we would set "e.IsValid=false" and provide a custom warning message to "e.ErrorMessage" if the flag in our database was raised.
However, I cannot for the life of me figure out how to accomplish the same thing in CMS 5 R2! It's probably a simple thing, once you know what to attach where, but I'm getting lost in the SDK..
Any help would be much appreciated! :-)
-b