Innovative Computer Solutions,
Development & Technical Support

07975 997026 • enquiries[delete-me]@[delete-me]harpanet.com

User Tools

Site Tools


blog:2013:06:a-better-dokuwiki-configuration-manager-settings-page

A Better DokuWiki Configuration Manager Settings Page

As you add more plugins to DokuWiki, the Configuration Settings (Configuration Manager) page quickly gets very long with all the various settings for each of the plugins.

A very simple addition to DokuWiki would be to have each plugin region show just the heading to begin with, then show the relevant options when the heading is clicked on. In effect, expanding and contracting those sections as required.

It is actually very easy to achieve this with a little bit of javascript, or more correctly, a little bit of jQuery.

But first, a quick intro to how DokuWiki handles plugins… don't fall asleep just yet, this is really quick and easy. (The long version is at https://www.dokuwiki.org/devel:javascript if you're into that!)

For each plugin, DokuWiki automatically looks for a specific javascript file named script.js which it expects to find within the plugin folder. It's that simple - I said it was really quick!

As we are modifying the config plugin that is shipped with DokuWiki, we can find the config plugin at /dokuwiki_folder/lib/plugins/config.

A QUICK NOTE OF CAUTION: There is no script.js file currently in the config plugin folder as of (warning: silly version name coming!!) DokuWiki Weatherwax, but this may change for a future version. If it does, this little feature will be overwritten, but we'll worry about that when the time comes.

All you need now is the file itself. Here it comes. Remember, download this file, and save it into your /dokuwiki_folder/lib/plugins/config folder (where 'dokuwiki_folder' refers to the folder that you have installed DokuWiki into!)

script.js
  jQuery(document).ready(
    function(){
        jQuery("fieldset table").hide();
        jQuery("fieldset legend").css("cursor", "pointer");
 
    jQuery("fieldset legend").click(
        function(){
            jQuery(this).parent().find("table").slideToggle("fast", "linear");
        });
    });

Comments

Instead of creating lib/plugins/config/script.js you could also simply add the code to conf/userscript.js (and create it if it doesn't exist). As all js files are always loaded I think it would be better to make sure that this code is really only executed when the configuration manager is displayed, i.e. use more specific selectors.

1 | 22/08/2013 12:42 |
Michael Hamann


R P X​ A O F M J G A C O
blog/2013/06/a-better-dokuwiki-configuration-manager-settings-page.txt · Last modified: 09/08/2013 09:39 by harpanet