From 7ff382a42e3947b19e74331aa6394c53df256618 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 31 Jul 2006 12:59:10 +0200 Subject: config plugin update - improvements in handling of default values for multi-checkbox settings (e.g. defaultactions) - minor style tweaks to cater for IE/Win darcs-hash:20060731105910-9b6ab-2e78b4f545b9d8a9f98accc22eeba5701049a037.gz --- lib/plugins/config/settings/config.class.php | 19 ++++++++++++++++--- lib/plugins/config/style.css | 26 +++++++++++++++++++------- 2 files changed, 35 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 10c9f4616..57d27e7eb 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -706,33 +706,46 @@ if (!class_exists('setting_multicheckbox')) { // convert from comma separated list into array + combine complimentary actions $value = $this->_str2array($value); + $default = $this->_str2array($this->_default); $input = ''; foreach ($this->_choices as $choice) { $idx = array_search($choice, $value); + $idx_default = array_search($choice,$default); + $checked = ($idx !== false) ? 'checked="checked"' : ''; + // ideally this would be handled using a second class of "default", however IE6 does not + // correctly support CSS selectors referencing multiple class names on the same element + // (e.g. .default.selection). + $class = (($idx !== false) == (false !== $idx_default)) ? " selectiondefault" : ""; + $prompt = ($plugin->getLang($this->_key.'_'.$choice) ? $plugin->getLang($this->_key.'_'.$choice) : htmlspecialchars($choice)); - $input .= '
'."\n"; + $input .= '
'."\n"; $input .= '\n"; $input .= '\n"; $input .= "
\n"; // remove this action from the disabledactions array if ($idx !== false) unset($value[$idx]); + if ($idx_default !== false) unset($default[$idx_default]); } // handle any remaining values $other = join(',',$value); - $input .= '
'."\n"; + $class = (count($default == count($value)) && (count($value) == count(array_intersect($value,$default)))) ? + " selectiondefault" : ""; + + $input .= '
'."\n"; $input .= '\n"; $input .= '\n"; $input .= "
\n"; - $label = ''; +// $label = ''; + $label = $this->prompt($plugin); return array($label,$input); } diff --git a/lib/plugins/config/style.css b/lib/plugins/config/style.css index ce3dc5e90..b6697fe0c 100644 --- a/lib/plugins/config/style.css +++ b/lib/plugins/config/style.css @@ -12,6 +12,7 @@ width: auto; margin-bottom: 2em; background-color: __medium__; + padding: 0 1em; } #config__manager legend { font-size: 1.25em; @@ -19,7 +20,7 @@ #config__manager form { } #config__manager table { - margin: 0.5em; + margin: 1em 0; width: 100%; } @@ -42,23 +43,25 @@ #config__manager tr.default .input, #config__manager tr.default input, #config__manager tr.default textarea, -#config__manager tr.default select { +#config__manager tr.default select, +#config__manager .selectiondefault { background-color: #ccddff; } #config__manager tr.protected .input, #config__manager tr.protected input, #config__manager tr.protected textarea, -#config__manager tr.protected select { - background-color: #ffcccc; +#config__manager tr.protected select, +#config__manager tr.protected .selection { + background-color: #ffcccc!important; } #config__manager td.error { background-color: red; } #config__manager .selection { - width: 14em; + width: 14.8em; float: left; - padding: 1px 0.3em 1px 0; + margin: 0 0.3em 2px 0; } #config__manager .selection label { @@ -67,13 +70,22 @@ font-size: 90%; } +/* IE6 correction */ +* html #config__manager .selection label { + padding-top: 2px; +} + #config__manager .selection input.checkbox { padding-left: 0.7em; } #config__manager .other { clear: both; - padding-top: 1em; + padding-top: 0.5em; +} + +#config__manager .other label { + padding-left: 2px; font-size: 90%; } -- cgit v1.2.3