summaryrefslogtreecommitdiff
path: root/lib/plugins/config/admin.php
diff options
context:
space:
mode:
authorBen Coburn <btcoburn@silicodon.net>2006-05-20 12:37:18 +0200
committerBen Coburn <btcoburn@silicodon.net>2006-05-20 12:37:18 +0200
commit685bdd2e6c508c47a360b2dbf1beea318f7f99cd (patch)
tree5ea2b62309bfbdbb34552708363700a09901fb05 /lib/plugins/config/admin.php
parent3138b5c7607b434fa9b1b8c563ad461985d5b5c8 (diff)
downloadrpg-685bdd2e6c508c47a360b2dbf1beea318f7f99cd.tar.gz
rpg-685bdd2e6c508c47a360b2dbf1beea318f7f99cd.tar.bz2
config plugin ui update 20060520
This patch hides settings that are missing config metadata and optionally provides a list of warnings about settings that are not properly configured. - Warnings about settings are listed if $conf['allowdebug'] is true. - Warnings are listed by the $conf string as it appears in local.php. - Warnings show the $meta string as it would appear in the correct settings metadata file. - There are 3 kinds of warnings. - undefined There is no $meta information defined for this setting. - no class The setting class specified in $meta can not be found. This setting does have a $meta entry. - no default The setting is missing a default value. The setting does have a $meta entry with a valid setting class. - Note: Settings with metadata but other warnings are allowed to appear in the normal config settings list. Also... - Templates can now define their own settings classes. - Removed an XHTML validation error from the first patch. - More language strings to go with the new warnings. The warnings under the 'Undefined Settings' heading are intended to provide developers with a list of any settings that they have forgotten to finish preparing for the config plugin. This list should be blank for stable releases. darcs-hash:20060520103718-05dcb-6d4e6bce78498cbf9d087e27d52e4aa30917b0a5.gz
Diffstat (limited to 'lib/plugins/config/admin.php')
-rw-r--r--lib/plugins/config/admin.php49
1 files changed, 47 insertions, 2 deletions
diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php
index cae1c3e42..649318ef9 100644
--- a/lib/plugins/config/admin.php
+++ b/lib/plugins/config/admin.php
@@ -4,6 +4,7 @@
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Christopher Smith <chris@jalakai.co.uk>
+ * @author Ben Coburn <btcoburn@silicodon.net>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
@@ -91,6 +92,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
* output appropriate html
*/
function html() {
+ $allow_debug = $GLOBALS['conf']['allowdebug']; // avoid global $conf; here.
global $lang;
global $ID;
@@ -112,11 +114,19 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
ptln('<form action="'.wl($ID).'" method="post">');
$this->_print_h1('dokuwiki_settings', $this->getLang('_header_dokuwiki'));
+ $undefined_settings = array();
$in_fieldset = false;
$first_plugin_fieldset = true;
$first_template_fieldset = true;
foreach($this->_config->setting as $setting) {
- if (is_a($setting, 'setting_fieldset')) {
+ if (is_a($setting, 'setting_hidden')) {
+ // skip hidden (and undefined) settings
+ if ($allow_debug && is_a($setting, 'setting_undefined')) {
+ $undefined_settings[] = $setting;
+ } else {
+ continue;
+ }
+ } else if (is_a($setting, 'setting_fieldset')) {
// config setting group
if ($in_fieldset) {
ptln(' </table>');
@@ -131,7 +141,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
$this->_print_h1('template_settings', $this->getLang('_header_template'));
$first_template_fieldset = false;
}
- ptln(' <fieldset name="'.$setting->_key.'" id="'.$setting->_key.'">');
+ ptln(' <fieldset id="'.$setting->_key.'">');
ptln(' <legend>'.$setting->prompt($this).'</legend>');
ptln(' <table class="inline">');
} else {
@@ -153,6 +163,30 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
ptln(' </fieldset>');
}
+ // show undefined settings list
+ if ($allow_debug && !empty($undefined_settings)) {
+ function _setting_natural_comparison($a, $b) { return strnatcmp($a->_key, $b->_key); }
+ usort($undefined_settings, '_setting_natural_comparison');
+ $this->_print_h1('undefined_settings', $this->getLang('_header_undefined'));
+ ptln('<fieldset>');
+ ptln('<table class="inline">');
+ $undefined_setting_match = array();
+ foreach($undefined_settings as $setting) {
+ if (preg_match('/^(?:plugin|tpl)'.CM_KEYMARKER.'.*?'.CM_KEYMARKER.'(.*)$/', $setting->_key, $undefined_setting_match)) {
+ $undefined_setting_key = $undefined_setting_match[1];
+ } else {
+ $undefined_setting_key = $setting->_key;
+ }
+ ptln(' <tr>');
+ ptln(' <td><a class="nolink" title="$meta[\''.$undefined_setting_key.'\']">$'.$this->_config->_name.'[\''.$setting->_out_key().'\']</a></td>');
+ ptln(' <td>'.$this->getLang('_msg_'.get_class($setting)).'</td>');
+ ptln(' </tr>');
+ }
+ ptln('</table>');
+ ptln('</fieldset>');
+ }
+
+ // finish up form
ptln('<p>');
ptln(' <input type="hidden" name="do" value="admin" />');
ptln(' <input type="hidden" name="page" value="config" />');
@@ -270,7 +304,10 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
* @author Ben Coburn <btcoburn@silicodon.net>
*/
function _print_config_toc() {
+ $allow_debug = $GLOBALS['conf']['allowdebug']; // avoid global $conf; here.
+
// gather toc data
+ $has_undefined = false;
$toc = array('conf'=>array(), 'plugin'=>array(), 'template'=>null);
foreach($this->_config->setting as $setting) {
if (is_a($setting, 'setting_fieldset')) {
@@ -281,6 +318,8 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
} else {
$toc['conf'][] = $setting;
}
+ } else if (!$has_undefined && is_a($setting, 'setting_undefined')) {
+ $has_undefined = true;
}
}
@@ -326,6 +365,12 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
'type' => 'ul',
'level' => 2);
}
+ if ($has_undefined && $allow_debug) {
+ $xhtml_toc[] = array('hid' => 'undefined_settings',
+ 'title' => $this->getLang('_header_undefined'),
+ 'type' => 'ul',
+ 'level' => 1);
+ }
// use the xhtml renderer to make the toc
require_once(DOKU_INC.'inc/parser/xhtml.php');