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 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'lib/plugins/config/settings') 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); } -- cgit v1.2.3