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:
...
$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