[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:

Or check the archive plugin
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

List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list