[RCD] Pulgin: Sub menues how-to?
cor at xs4all.nl
Fri Sep 27 12:46:17 CEST 2013
> How do I create a plugin that hooks into a plugin that created a settings
> 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
> - 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:
1) 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.
2) 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.
More information about the dev