Hi,
[[ I'm happy to work with a consultant to answer this and other
questions, as per my previous email. However, Thomas suggested I send
some questions to the dev list, so I'm doing that. ]]
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.
I see in the "markasjunk" plugin:
function init() { ... $rcmail = rcmail::get_instance(); if ($rcmail->action == '' || $rcmail->action == 'show') { ... $this->add_button(array( 'command' => 'plugin.markasjunk', 'imagepas' => $skin_path.'/junk_pas.png', 'imageact' => $skin_path.'/junk_act.png', 'title' => 'markasjunk.buttontitle'), 'toolbar'); } }
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.
My guess is that I should always print the button, but then modify
some JavaScript code to update the display CSS property based on what
mailbox we are in. Is there a standard hook for doing this? Or a
location where other code does this which would be a logical place to
add? I see that buttons are grayed based on if a message is selected
or not.
Thanks,
David Harris DRH Internet Inc. 972-572-0900
List info: http://lists.roundcube.net/dev/
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/