[RCD] Button conditional on current mailbox

Thomas Bruederli roundcube at gmail.com
Wed Aug 4 16:27:18 CEST 2010


David Harris wrote:
> I want to add some buttons to the message listing toolbar and the
> message view toolbar, but I want them to be conditional based on the
> mailbox.
> 
> I've been looking at some existing plugins for guidance.
> 
> My problem is that the current mailbox does not appear to be available
> at this step. And if I did conditionally print this button based on
> mailbox, when the user clicks to a different mailbox roundcube displays
> the new data without a page reload, so the button would need to be
> hidden/shown with JavaScript.

Exactly. There's a javascript event to subscribe to:
http://trac.roundcube.net/wiki/Plugin_Events#selectfolder

Or check the archive plugin
http://trac.roundcube.net/browser/trunk/plugins/archive/archive.js#L25
which registers an event listener on the message list and enables/disabled
the button depending on the selection length and the current mailbox:
rcmail.env.mailbox != rcmail.env.archive_folder

That's basically the way to go since the mailbox is changed without a page
reload.

~Thomas
_______________________________________________
List info: http://lists.roundcube.net/dev/



More information about the Dev mailing list