[[ 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 see when you define a button from a plugin, you can give it a command:
$this->add_button(array(
'command' => 'plugin.markasjunk',
'imagepas' => $skin_path.'/junk_pas.png',
'imageact' => $skin_path.'/junk_act.png',
'title' => 'markasjunk.buttontitle'), 'toolbar');
}
And register a PHP callback to handle that command:
$this->register_action('plugin.markasjunk', array($this,
'request_action'));
I want to define some buttons that execute javascript in the browser,
instead of creating HTTP request to the server to run a PHP callback.
Is there a way that I can register a command name (for example
'plugin.move_to_next_message') along with javascript code to be run
for that command? I could always modify program/js/app.js to add a
new command, but if there is a hook to do this, I'd prefer to do that.
Thanks!
David Harris DRH Internet Inc. 972-572-0900
List info: http://lists.roundcube.net/dev/
David Harris wrote:
[[ 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 see when you define a button from a plugin, you can give it a command:
$this->add_button(array( 'command' => 'plugin.markasjunk', 'imagepas' => $skin_path.'/junk_pas.png', 'imageact' => $skin_path.'/junk_act.png', 'title' => 'markasjunk.buttontitle'), 'toolbar'); }
This is the correct way to add a button server side to the toolbar. What's missing is the registering of the command to the client app. This is done in Javascript using rcmail.register_command('plugin.markasjunk', ...);
See the markasjunk.js script file from the markasjunk plugin.
~Thomas _______________________________________________ List info: http://lists.roundcube.net/dev/