Hello
I'm writing a plugin to be able to configure some custom quirks of our email solution.
I would need to do sub-menues, similar to the 'Preferences' where you have submenues for 'User Interface','mailbox view', etc.
Just writing a simple plugin based on the 'spamassassin' plugin, was not too hard.
But how do I create sub-menues within a plugin? I couldn't find any template or documentation. Also no other plugins seem to use sub-menues (Well, the sieve filter plugin does for filter-sets etc. but that is done in a way I don't understand).
Is there a plug-in that does sub-menues in an easy way I could use as a template? Could someone help me with a simple template?
Kind regards
I m p r o W a r e A G -
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 07 CH-4133 Pratteln Fax +41 61 826 93 02 Schweiz Web http://www.imp.ch ______________________________________________________
But how do I create sub-menues within a plugin? I couldn't find any template or documentation. Also no other plugins seem to use sub-menues (Well, the sieve filter plugin does for filter-sets etc. but that is done in a way I don't understand).
Is there a plug-in that does sub-menues in an easy way I could use as a template? Could someone help me with a simple template?
It's not entirely clear what you mean with submenus. But since the mention the managesieve plugin, I suppose you mean a box with multiple settings, like the Preferences->Section box. If you read back a week or so ago in the archives of this list, you'll see a discussion started by me about that exact same subject.
This is actually very difficult. To add your settings you basically have 3 options:
the easiest way is to add settings to existing sections under preferences. For instance, you can create a new setting under Prefences->User Interface. Many plugins do this.
you can also add a new section under one of the existing preferences options. For instance, my Message Highlights plugin creates a section under Preferences. There are a few other plugins that do this.
you can create a whole new tab (this is done through javascript), which creates a row in the leftmost preferences box in the larry theme.
I assume you want to do 3). Unfortunately, if you do this, you're completely on your own. You can create a row through JS, but any new boxes, and any content if you click those boxes, have to be created by you through templates, handlers, etc. It is pretty complex especially if you want to create submenus. Im going through this right now myself for some internal plugins. (converting from classic to larry).
I actually created a plugin that does some of 3). My plugin creates a new tab in the leftmost box. Thats all it does. But then you can create other plugins that hook into that plugin so they're shown in a second box on your new tab. It's currently pretty limited, and pretty much mimics the top preferences tab in functionality simply because I could not figure out how to do more complex UI interactions to make it more generic. it is a pretty ugly hack, but afaik it's not possible to make this any easier because roundcube does not really provide the settings infrastructure to accomplish this.
If you want to see what I mean, look at this screenshot: http://grab.by/qxPm
Id love to know from the roundcube devs if there is some easy way to accomplish this. Right now my plugin can only create easy, basic Preferences/User Interface type settings. It cant handle creating more complex UIs with their own save handlers etc.
Cor
Hi Cor
Is there a plug-in that does sub-menues in an easy way I could use as a template? Could someone help me with a simple template?
It's not entirely clear what you mean with submenus. But since the mention the managesieve plugin, I suppose you mean a box with multiple settings, like the Preferences->Section box. If you read back a week or so ago in the archives of this list, you'll see a discussion started by me about that exact same subject.
This is actually very difficult. To add your settings you basically have 3 options:
- the easiest way is to add settings to existing sections under
preferences. For instance, you can create a new setting under Prefences->User Interface. Many plugins do this.
Hmm, not realy what I intended, but that could be an option if it can't easily be done in another way. What plugin could I use as a template to find out how to do this?
- you can also add a new section under one of the existing preferences
options. For instance, my Message Highlights plugin creates a section under Preferences. There are a few other plugins that do this.
That's more what I wanted to do.
- you can create a whole new tab (this is done through javascript), which
creates a row in the leftmost preferences box in the larry theme.
That's what I was trying.
I actually created a plugin that does some of 3). My plugin creates a new tab in the leftmost box. Thats all it does. But then you can create other plugins that hook into that plugin so they're shown in a second box on your new tab. It's currently pretty limited, and pretty much mimics the top preferences tab in functionality simply because I could not figure out how to do more complex UI interactions to make it more generic. it is a pretty ugly hack, but afaik it's not possible to make this any easier because roundcube does not really provide the settings infrastructure to accomplish this.
If you want to see what I mean, look at this screenshot: http://grab.by/qxPm
It looks like you got the missing part of what I wanted to do. I managed to write a plugin, that hooks into the leftmost 'settings' box and where I can display, change and save settings, but I did not manage to create the 'sections' bot, to be able to display different information in different boxes.
How do I create a plugin that hooks into a plugin that created a settings 'tab'?
What I acutaly try to achieve is this structure:
Leftmost Settings-Tab 'Custom Settings' When you select this Tab, this opens a row 'Sections' with:
And possibly if an account has a 'domain manager flag' some more sections like:
I can't use and existing plugins for that purpose, because we use some custom hacked MIMEDefang scripts to add those funcionalities. The Advantage is, that everything is managed from one database.
Mit freundlichen Grüssen
I m p r o W a r e A G -
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 07 CH-4133 Pratteln Fax +41 61 826 93 02 Schweiz Web http://www.imp.ch ______________________________________________________
How do I create a plugin that hooks into a plugin that created a settings 'tab'?
What I acutaly try to achieve is this structure:
Leftmost Settings-Tab 'Custom Settings' When you select this Tab, this opens a row 'Sections' with:
- Anti-Spam Settings
- Anti-Virus Settings
- Personal Black / Whitelist
- Forward your Email
And possibly if an account has a 'domain manager flag' some more sections like:
- Domain Black / Whitelist
- Domain Default Spamsettings
- Domain Defaut AV
Heh, funny. I want to do the _exact_ same. It's really a shame RC doesnt have better support for this. We also have implemented plugins to change spam/virus settings, and to configure personal black/whitelists. Right now they're all over the place, but just like you, id like to get them under 1 tab. This is not easy. I see two ways to do this:
You make one plugin out of the whole thing. So 1 plugin makes the leftmost 'Custom Settings' tab, then creates a section box, and if you click on a section row, you get an iframe with that specific settings group. Sort of like the managesieve plugin, but then much larger.
You create a tab, and then let plugins hook into that tab. This is the direction I was heading, but im hitting a bit of a snag. See, we have 2 types of plugins.
a) simple plugins that just require saving 1 config option. See this screenshot as an example: http://grab.by/qEBG
b) more elaborate plugins, that have their own list box and perhaps their own save handlers. See this screenshot as an example: http://grab.by/qECy
This is getting a bit technical, but it's a dev group so bear with me. With plugin type a) you can just load the required data into an iframe, just like the normal RC code does. This is not that difficult. I have managed to do this, and thats why in my screenshots the Spam/Virus tab contains 2 plugins of type a). The save button just posts to the normal RC save-prefs action, just like the general settings.
But with plugin type b, you click on the "Custom Settings" Tab. So far so good. Then you click the tab of the plugin you need. Lets say blacklist tab. The output of this needs to be loaded as an _action, and then shown in an iframe. So in the iframe I now have a listbox, with an empty area. But then when you click the actual blacklist entry, you really want to send another _action (edit_blacklist or whatever), and show that in a second iframe? Or something? I suppose you could load ajax data and just dump it into a div from within JS.
Im kind of stuck there. Ive been looking for some guidance from the RC devs on how this could be done, but Im not sure they understand what we're trying to do, and the issue im having trying to implement this. And maybe there is a way this can be done that im not seeing.
Cor
On 09/27/2013 12:46 PM, Cor Bosman wrote:
Im kind of stuck there.
If you want an entry in Settings block/list you're on your own, you need to create templates, hooks for other plugins, etc. However, if you just decide to create entries in Settings > Preferences, you have everything built in preferences_list and preferences_sections_list hooks.
Hi A.l.e.c
If you want an entry in Settings block/list you're on your own, you need to create templates, hooks for other plugins, etc. However, if you just decide to create entries in Settings > Preferences, you have everything built in preferences_list and preferences_sections_list hooks.
Could you point me to a plugin that extends the settings > preferences so I have an example how this is done?
It's not obvious where a plugin hooks and all those I have looked at yet, were hooking directly at the leftmost list.
Mit freundlichen Grüssen
I m p r o W a r e A G -
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 07 CH-4133 Pratteln Fax +41 61 826 93 02 Schweiz Web http://www.imp.ch ______________________________________________________
On 09/27/2013 01:21 PM, Benoit Panizzon wrote:
Could you point me to a plugin that extends the settings > preferences so I have an example how this is done?
It's not obvious where a plugin hooks and all those I have looked at yet, were hooking directly at the leftmost list.
It's Kolab Calendar plugin for example.
http://git.kolab.org/roundcubemail-plugins-kolab/tree/plugins/calendar
It's quite big code, just grep for 'preferences' in calendar.php.
On Sep 27, 2013, at 12:58 PM, "A.L.E.C" alec@alec.pl wrote:
On 09/27/2013 12:46 PM, Cor Bosman wrote:
Im kind of stuck there.
If you want an entry in Settings block/list you're on your own, you need to create templates, hooks for other plugins, etc. However, if you just decide to create entries in Settings > Preferences, you have everything built in preferences_list and preferences_sections_list hooks.
Can't this be improved in the future? Is there a reason we cant add a settings block through a hook in PHP? And then have the settings code allow you to add sections to any settings block, including settings blocks added by plugins?
And even better, allow you to specify that a settings section is a 'basic' section, where save-prefs is used, or an 'advanced' section, where you provide your own save/edit handlers.
Cor
Cor Bosman wrote:
On Sep 27, 2013, at 12:58 PM, "A.L.E.C" alec@alec.pl wrote:
On 09/27/2013 12:46 PM, Cor Bosman wrote:
Im kind of stuck there.
If you want an entry in Settings block/list you're on your own, you need to create templates, hooks for other plugins, etc. However, if you just decide to create entries in Settings > Preferences, you have everything built in preferences_list and preferences_sections_list hooks.
Can't this be improved in the future? Is there a reason we cant add a settings block through a hook in PHP? And then have the settings code allow you to add sections to any settings block, including settings blocks added by plugins?
You're too fast for me :-) I still wanted to respond on your question in another thread.
The settings tabs are a bit of a legacy in Roundcube and should be improved by a roundcube:object type of thing that collects all entries using a plugin hook. We're not yet there but expect some changes on this.
~Thomas
Thomas Bruederli wrote:
Cor Bosman wrote:
On Sep 27, 2013, at 12:58 PM, "A.L.E.C" alec@alec.pl wrote:
On 09/27/2013 12:46 PM, Cor Bosman wrote:
Im kind of stuck there.
If you want an entry in Settings block/list you're on your own, you need to create templates, hooks for other plugins, etc. However, if you just decide to create entries in Settings > Preferences, you have everything built in preferences_list and preferences_sections_list hooks.
Can't this be improved in the future? Is there a reason we cant add a settings block through a hook in PHP? And then have the settings code allow you to add sections to any settings block, including settings blocks added by plugins?
You're too fast for me :-) I still wanted to respond on your question in another thread.
The settings tabs are a bit of a legacy in Roundcube and should be improved by a roundcube:object type of thing that collects all entries using a plugin hook. We're not yet there but expect some changes on this.
See https://github.com/roundcube/roundcubemail/commit/c49c35ca0f and https://github.com/roundcube/roundcubemail/commit/cf46aefd9d
Kind regards, Thomas
You're too fast for me :-) I still wanted to respond on your question in another thread.
The settings tabs are a bit of a legacy in Roundcube and should be improved by a roundcube:object type of thing that collects all entries using a plugin hook. We're not yet there but expect some changes on this.
See https://github.com/roundcube/roundcubemail/commit/c49c35ca0f and https://github.com/roundcube/roundcubemail/commit/cf46aefd9d
Great! Thanks. I'll go play with it as soon as I can move my 0.9.x to master :)
Cor
Hi Cor,
On Friday 27 September 2013 12:46:17 Cor Bosman wrote:
We also have implemented plugins to change spam/virus settings, and to configure personal black/whitelists.
Do you have those published as Free Software somewhere?
Kind Regards, Torsten
On 2013-09-30 13:43, Torsten Grote wrote:
Hi Cor,
On Friday 27 September 2013 12:46:17 Cor Bosman wrote:
We also have implemented plugins to change spam/virus settings, and to configure personal black/whitelists.
Do you have those published as Free Software somewhere?
Kind Regards, Torsten
Roundcube Development discussion mailing list dev@lists.roundcube.net http://lists.roundcube.net/mailman/listinfo/dev
You are all welcome to look at my code.
https://github.com/w2c/ispconfig3_roundcube/tree/master/ispconfig3_account
Its a plugin collection for ISPConfig 3 support.
The Account plugin adds sections and also shows how it works. I know its already a litte bit old, I need to recode it at one point but it works in rc 0.8+ classic and larry skin.
Screenshot: http://oi42.tinypic.com/iz8bqf.jpg
You can see the account plugin creating the sections and working with all other plugins.
On Sep 30, 2013, at 1:43 PM, Torsten Grote grote@kolabsys.com wrote:
Hi Cor,
On Friday 27 September 2013 12:46:17 Cor Bosman wrote:
We also have implemented plugins to change spam/virus settings, and to configure personal black/whitelists.
Do you have those published as Free Software somewhere?
There is not much use for it. These plugins use internal APIs to talk to our incoming mail servers. If you want to see how the settings were done, you can check out Horst's stuff?
Cor