Roundcube Community Forum

 

Javascript events

Started by Omir, June 06, 2014, 08:14:22 AM

Previous topic - Next topic

Omir

Is there a list of available javascript hooks anywhere?

I'm looking for one when a contact is added to a group, I can see here a brief list:
http://trac.roundcube.net/wiki/Plugin_Events#beforeandafter

It makes it sound like you can prefix any event with before, but when I change listupdate to beforelistupdate it stops working?

alec

before- and after- is only for commands. See this.command method in app.js.

Omir

Hmm ok I'm not sure what I'm trying to do is going to be possible then. On the address book screen I want to alter the label to show in brackets how many contacts the group contains.

For this to update after a contact has been drag and dropped into a group. I've tried using the group_addmembers hook but it only allows me to either abort or change the message that is shown client side, I think I need to be able to send some javascript back that will update the label

alec

One way is $RCMAIL->output->command('your_command', $arguments), then on client side you need to define rcube_webmail.prototype.your_command function.

Omir

Hi Alex thanks for reply

When you say to define the client side function rcube_webmail.prototype.your_command, is this different to using the register_command function like follows?

rcmail.register_command('mycommand', mycommand_function, true);

function mycommand_function() {
    alert('test');
}

alec

There's a small difference. To execute mycommand_function() you need $RCMAIL->output->command('command', 'mycommand', $arguments),