Roundcube Community Forum

 

Compose Window Javascript Function

Started by pratik_1712, February 07, 2011, 02:42:55 AM

Previous topic - Next topic

pratik_1712

I want a function to be executed every time the compose window loads up..
I am using the following code but unable to link it to the desired event..

Kindly guide which event to hook up to..??


// In the Plugin
public $task = 'mail';
function init() {
$rcmail = rcmail::get_instance();
if (($rcmail->task == 'mail') && ($rcmail->action == 'compose')) {
$this->include_script('myscript.js');
}
}




document.onLoad = myfunc();

function myfunc()
{
alert('works');
var link = document.createElement('a');
link.setAttribute('href', '#');
link.setAttribute('title','Something');
document.getElementById('messagetoolbar').appendChild(link);
}


This is just coz i am not sure which event to call up..
I tried with 'init' but that didn't worked..

I am looking to add a label or button in the toolbar..

Any help is appreciated..

Thanks and Regards,
Pratik

rosali

Regards,
Rosali

pratik_1712

Thanks a lot.. thats exactly what i needed..
Regards,
Pratik

pratik_1712


$this->add_button(array(
'command' => 'mycommand',
'label' => 'mylabel',
'title' => 'mytitle,
'id' => 'rcmbtn_compose_myid'), 'toolbar');


On the UI the lable value is coming in the [] brackets..
How to remove them..??


[mylabel]


This is the HTML being generated..
I want innerHTML without brackets..

rosali

#4
Brackets indicate that the label is undefined in the plugin localization.
Regards,
Rosali

pratik_1712

thanks.. was happening due to a typo with the name in localization..
Fixed it..