Copied to clipboard

Flag this post as spam?

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


  • Ben McKean 272 posts 549 karma points
    May 02, 2012 @ 11:27
    Ben McKean
    0

    ShowSpeechBubble Document_AfterPublish

    Hi

    I've got my own custom event that fires on Document_AfterPublish. It basically checks that a property is ticked and if it is it copies the page over to a different section of the site.

    I can get all that working but I want to be able to show the user a success/fail message in the speech bubble but for the life of me I can't do that. I only ever see the standard "Content published and visiible at your website" message. I have noticed when I've tried to show the speech bubble the standard message pops up a number of times.

    Things I've tried so far picking things up from other posts:

    BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.success, "Title", "Message");
    UmbracoEnsuredPage.Current.ClientTools.ShowSpeechBubble(umbraco.BasePages.BasePage.speechBubbleIcon.success, "Title", "Message");
    StringBuilder infoBoxJS = new StringBuilder();
    infoBoxJS.Append("<script type=\"JavaScript\">");
    infoBoxJS.AppendLine("UmbClientMgr.mainWindow().UmbSpeechBubble.ShowMessage('info', 'Title', 'Message');");
    infoBoxJS.AppendLine("</script>");

    BasePage.Current.ClientScript.RegisterStartupScript(
         this.GetType(),
         "InfoBox",
         infoBoxJS.ToString(),
         false);

    But can't seem to get any of them working. The last solution, I've even tried just adding a JavaScript alert('hello') and can't get that to work so maybe I'm missing something??

    Any help appreciated

    Thanks

    Ben

     

     

  • Ben McKean 272 posts 549 karma points
    May 02, 2012 @ 11:44
    Ben McKean
    0

    Update to this, this works but only if you right click and publish

    BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.success,"Title","Message");

    It doesn't work if you click the "Save & Publish" icon within the page. I was under the impression both should call the "AfterPublish" event? Is this not the case?

  • Ben McKean 272 posts 549 karma points
    May 11, 2012 @ 10:47
    Ben McKean
    0

    For anybody who is interested I managed to ger around this problem (although not a true fix).

    Initially I had my code being called on Document_AfterPublish if the user had checked a checkbox.

    The solution I finally got to was to not have my code get called on the Document_AfterPublish event but to use a customer datatype and call my method from in there. My code and all logic that calls the ShowSpeechBubble still sits outside of my Umbraco site and the custom data type (its compiled in another project).

    I've changed the checkbox to a button and my logic gets called on click of that button.

    Got there in the end ;)

Please Sign in or register to post replies

Write your reply to:

Draft