diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-05-20 12:37:18 +0200 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-05-20 12:37:18 +0200 |
commit | 685bdd2e6c508c47a360b2dbf1beea318f7f99cd (patch) | |
tree | 5ea2b62309bfbdbb34552708363700a09901fb05 /lib/plugins/config/settings | |
parent | 3138b5c7607b434fa9b1b8c563ad461985d5b5c8 (diff) | |
download | rpg-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/settings')
-rw-r--r-- | lib/plugins/config/settings/config.class.php | 51 | ||||
-rw-r--r-- | lib/plugins/config/settings/extra.class.php | 5 |
2 files changed, 48 insertions, 8 deletions
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 1ef1662ef..105d6c83a 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -1,8 +1,9 @@ <?php -/* +/** * Configuration Class and generic setting classes * * @author Chris Smith <chris@jalakai.co.uk> + * @author Ben Coburn <btcoburn@silicodon.net> */ if (!class_exists('configuration')) { @@ -51,6 +52,7 @@ if (!class_exists('configuration')) { function retrieve_settings() { global $conf; + $no_default_check = array('setting_fieldset', 'setting_undefined', 'setting_no_class'); if (!$this->_loaded) { $default = array_merge($this->_read_config($this->_default_file), $this->get_plugintpl_default($conf['template'])); @@ -64,14 +66,21 @@ if (!class_exists('configuration')) { if (isset($this->_metadata[$key])) { $class = $this->_metadata[$key][0]; $class = ($class && class_exists('setting_'.$class)) ? 'setting_'.$class : 'setting'; + if ($class=='setting') { + $this->setting[] = new setting_no_class($key,$param); + } $param = $this->_metadata[$key]; array_shift($param); } else { - $class = 'setting'; + $class = 'setting_undefined'; $param = NULL; } + if (!in_array($class, $no_default_check) && !isset($default[$key])) { + $this->setting[] = new setting_no_default($key,$param); + } + $this->setting[$key] = new $class($key,$param); $this->setting[$key]->initialize($default[$key],$local[$key],$protected[$key]); } @@ -223,7 +232,7 @@ if (!class_exists('configuration')) { if (@file_exists(DOKU_PLUGIN.$plugin.$file)){ $meta = array(); @include(DOKU_PLUGIN.$plugin.$file); - @include(DOKU_PLUGIN.$plugin.$class); + @include(DOKU_PLUGIN.$plugin.$class); if (!empty($meta)) { $metadata['plugin'.CM_KEYMARKER.$plugin.CM_KEYMARKER.'plugin_settings_name'] = array('fieldset'); } @@ -240,6 +249,7 @@ if (!class_exists('configuration')) { if (@file_exists(DOKU_TPLINC.$file)){ $meta = array(); @include(DOKU_TPLINC.$file); + @include(DOKU_TPLINC.$class); if (!empty($meta)) { $metadata['tpl'.CM_KEYMARKER.$tpl.CM_KEYMARKER.'template_settings_name'] = array('fieldset'); } @@ -616,6 +626,41 @@ if (!class_exists('setting_dirchoice')) { } +if (!class_exists('setting_hidden')) { + class setting_hidden extends setting { + // Used to explicitly ignore a setting in the configuration manager. + } +} + +if (!class_exists('setting_fieldset')) { + class setting_fieldset extends setting { + // A do-nothing class used to detect the 'fieldset' type. + // Used to start a new settings "display-group". + } +} + +if (!class_exists('setting_undefined')) { + class setting_undefined extends setting_hidden { + // A do-nothing class used to detect settings with no metadata entry. + // Used internaly to hide undefined settings, and generate the undefined settings list. + } +} + +if (!class_exists('setting_no_class')) { + class setting_no_class extends setting_undefined { + // A do-nothing class used to detect settings with a missing setting class. + // Used internaly to hide undefined settings, and generate the undefined settings list. + } +} + +if (!class_exists('setting_no_default')) { + class setting_no_default extends setting_undefined { + // A do-nothing class used to detect settings with no default value. + // Used internaly to hide undefined settings, and generate the undefined settings list. + } +} + + /** * Provide php_strip_whitespace (php5 function) functionality * diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 715acb53b..260f32eaf 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -79,8 +79,3 @@ if (!class_exists('setting_im_convert')) { } } -if (!class_exists('setting_fieldset')) { - class setting_fieldset extends setting_string { - //do-nothing class used to detect the 'fieldset' type. - } -} |