[RCU] plugin button to open a webpage

Thomas Bruederli thomas at roundcube.net
Sun Oct 7 15:08:10 CEST 2012


On Fri, Oct 5, 2012 at 9:48 PM,  <john.roman at dreamhost.com> wrote:
> Greetings,
> im not entirely certain its possible, as it would be outside the command
> scope so far as i understand Roundcube, but I'm trying to make a button
> which essentially serves as a link to a webpage outside of the roundcube
> environment.
>
> the code i have so far is:
>
> $this->add_button(array(
>        'type' => 'link',
>        'label' => 'Anti Spam',
>        'command' => 'plugin.as224',
>        'class' => 'rlink',
>        'classact' => 'rlink active',
>        'title' => 'buttontitle',
>        ), 'taskbar');
>
> the command is a registered hook of init() for the plugin, although once the
> hook is called during click, im not certain i have any code thats capable of
> opening the link.  'command' seems limited to things roundcube does
> naturally, or its plugins wish to do.

You can now either add some javascript snippet to handle the command
'plugin.as224' or add the button as follows:

      $this->cal->add_button(array(
             'type' => 'link',
             'label' => 'Anti Spam',
             'name' => 'dummy',
             'class' => 'rlink',
             'classact' => 'rlink active',
             'href' => 'http://someurl',
             'target' => '_blank',
             ), 'taskbar');

Please note the 'name' attribute which is just a dummy values but is
required by the code (the core requires either a command or a name
attribute for a button). Regular link attributes such as 'href' and
'target' are accepted and added to the html output.

Regards,
Thomas


More information about the users mailing list