Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: jamil_isayyed on October 03, 2013, 04:53:51 AM

Title: Creating Window in a plugin (Showing Template view)
Post by: jamil_isayyed on October 03, 2013, 04:53:51 AM
Hello Folks,

i am newbie in writing plugins, i have read all the related documents but i am still missing something. So my plugin has a button in the task bar when the user click it i send an Ajax request to the server and it is handled by the plugin php file. what i want to do there is to open a popup window in the roundcube? how i  should do this? is the php file responsible to build it and show it in the same Page? or i should use the JavaScript?

as testing i used the default plugin page which contains just some text, and after the request nothing happens (it rename the page header but nothing else...), knowing that if i copied the URL to a new browser window will open it and see my text.

so at least for testing how i can show the default plugin template page in the same browser tab? i am using this code to show it:

                $rcmail = rcmail::get_instance();
                $rcmail->output->set_pagetitle('TEST PAGE');
                $rcmail->output->send('my_plugin.plugin');


and whats the best way to build a window pop up in a plugin?

Thanks in advance,
Jamil Isayyed
Title: Re: Creating Window in a plugin (Showing Template view)
Post by: SKaero on October 03, 2013, 07:37:29 AM
You would need to write some javascript to make the popup, right now all your doing is changing the page title.
Title: Re: Creating Window in a plugin (Showing Template view)
Post by: jamil_isayyed on October 03, 2013, 08:25:09 AM
Thanks SKaero for your reply,

in case i want to open a new page (html) templates what i should do? in the documentation the mentioned this
QuoteFinally, to instruct roundcube to show your template:

    $rcmail = rcmail::get_instance();
    $rcmail->output->set_pagetitle('my_title');
    $rcmail->output->send('my_plugin.mytemplate');


is there another way to do it?

Thanks,
Jamil Isayyed
Title: Re: Creating Window in a plugin (Showing Template view)
Post by: SKaero on October 03, 2013, 08:38:14 AM
Are you trying to open a popup, model window, or just a new page?
Title: Re: Creating Window in a plugin (Showing Template view)
Post by: jamil_isayyed on October 03, 2013, 09:08:59 AM
well, i will need both i managed to open a window using JavaScript. but how i can open a new page?
Title: Re: Creating Window in a plugin (Showing Template view)
Post by: SKaero on October 03, 2013, 10:35:35 AM
Take a look at the help plugin I think works similar to the way you want your plugin to.