Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • glob 72 posts 172 karma points
    Aug 03, 2013 @ 10:25
    glob
    0

    Display notification message on umbraco cms

    I want to display notification message like "Node already published, Now u can't published it " on umbraco cms ,before publish event ,  is it possible? how.....?

     

    plz. give me quick reply, if possible.................

  • Jon Dunfee 199 posts 468 karma points
    Aug 04, 2013 @ 20:52
    Jon Dunfee
    0

    Yes, it is.  I'm using similar functionality to prevent folks from publishing locked [by others] content in MyLocks.  The magic starts at the ApplicationEventHandler.

        public class ApplicationEventHandler : IApplicationEventHandler
    {

    ...

    public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication,
    ApplicationContext applicationContext)
    {

    // Tap into events that locking would affect
    PublishingStrategy.Publishing += (sender, e) =>
    {
    if (e.CanCancel && MyLockStorage.HasLockedContent(e.PublishedEntities))
    e.Cancel = true;
    };

    ContentService.Publishing += (sender, e) =>
    {
    if (e.CanCancel && MyLockStorage.HasLockedContent(e.PublishedEntities))
    e.Cancel = true;
    };

    }

    However, now the big let down.  You can't override the message when cancelling a publish event, you'll only get the "Cancelled by 3rd party..etc..etc..".  If you can figure out how to intercept the message and put in your own, I would be keenly interested in it, but for the time being I don't believe what you are wanting to do is feasible with the current codebase without modifying the core or some hellacious hack.

Please Sign in or register to post replies

Write your reply to:

Draft