I'm making an event handler which will POST to twitter when an article is published in umbraco. I would like to cancel the publish and notifiy the user if the tweet text is too long, I don't see how to set the speechbubble message.
After the event handler cancels, the speech bubble reads "Publishing cancelled by a third party add-in". How can I change that message?
e.Cancel = true; ((umbraco.BasePages.BasePage)sender.HttpContext.CurrentHandler).speechBubble(umbraco.BasePages.BasePage.speechBubbleIcon.error,"Error publishing","The Twitter post will be too long: " + tooLong.ToString() + "chars");
This is not possible as the speechbubble doesn't allow chaining in the current implementation, so the only way to get around that would be a hack where you added the speechbubble with a 30 second timeout (to be shown after the other message) which is not elegant.
We're considering adding speechbubble chaining (growl style) for 4.1 but I think it might be a little too geeky and I prefer the possibility of adding a cancellation message instead.
Event handler & speechbubble message
I'm making an event handler which will POST to twitter when an article is published in umbraco. I would like to cancel the publish and notifiy the user if the tweet text is too long, I don't see how to set the speechbubble message.
After the event handler cancels, the speech bubble reads "Publishing cancelled by a third party add-in". How can I change that message?
This is what I tried:
void Document_BeforePublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
{
...snippet...
e.Cancel = true;
((umbraco.BasePages.BasePage)sender.HttpContext.CurrentHandler).speechBubble(umbraco.BasePages.BasePage.speechBubbleIcon.error,"Error publishing","The Twitter post will be too long: " + tooLong.ToString() + "chars");
...snippet...
}
I think I heard somewhere that that is currently not possible. I tried to use that in my own datatype as well, but never got it working.
I ended up showing the red div at the top (which also shows when you haven't filled a mandatory field).
Do you have an example of how you set that div contents - did you do it directly in the handler or did you need client script?
This is not possible as the speechbubble doesn't allow chaining in the current implementation, so the only way to get around that would be a hack where you added the speechbubble with a 30 second timeout (to be shown after the other message) which is not elegant.
We're considering adding speechbubble chaining (growl style) for 4.1 but I think it might be a little too geeky and I prefer the possibility of adding a cancellation message instead.
I don't think my solution will work on an EventHandler. My datatype adds a CustomValidator to the page. You can't do that with an EventHandler.
Well, I guess I'll add a nicer message then in 4.1. Thanks for the info.
@Niels - I believe Shannon is still planning on including that, based on the implementation he blogged about here: http://farmcode.org/post/2009/04/06/jQuery-popup-bubble-extension.aspx
I've also considered adding a cancel message property to the event args which allows you to provide better feedback, but I've not had time of recent.
is working on a reply...