diff options
author | chris <chris@jalakai.co.uk> | 2006-07-31 12:59:10 +0200 |
---|---|---|
committer | chris <chris@jalakai.co.uk> | 2006-07-31 12:59:10 +0200 |
commit | 7ff382a42e3947b19e74331aa6394c53df256618 (patch) | |
tree | 4b17998fadfb17f7ce29771244de809c251b64da | |
parent | 44e099ad18f30b2f0df3c4a9546e3b254eafb638 (diff) | |
download | rpg-7ff382a42e3947b19e74331aa6394c53df256618.tar.gz rpg-7ff382a42e3947b19e74331aa6394c53df256618.tar.bz2 |
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
-rw-r--r-- | lib/plugins/config/settings/config.class.php | 19 | ||||
-rw-r--r-- | lib/plugins/config/style.css | 26 |
2 files changed, 35 insertions, 10 deletions
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 .= '<div class="selection">'."\n"; + $input .= '<div class="selection'.$class.'">'."\n"; $input .= '<label for="config__'.$key.'_'.$choice.'">'.$prompt."</label>\n"; $input .= '<input id="config__'.$key.'_'.$choice.'" name="config['.$key.'][]" type="checkbox" class="checkbox" value="'.$choice.'" '.$disable.' '.$checked."/>\n"; $input .= "</div>\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 .= '<div class="other">'."\n"; + $class = (count($default == count($value)) && (count($value) == count(array_intersect($value,$default)))) ? + " selectiondefault" : ""; + + $input .= '<div class="other'.$class.'">'."\n"; $input .= '<label for="config__'.$key.'_other">'.$plugin->getLang($key.'_other')."</label>\n"; $input .= '<input id="config__'.$key.'_other" name="config['.$key.'][other]" type="text" class="edit" value="'.htmlspecialchars($other).'" '.$disable." />\n"; $input .= "</div>\n"; - $label = '<label for="config__'.$key.'">'.$this->prompt($plugin).'</label>'; +// $label = '<label for="config__'.$key.'">'.$this->prompt($plugin).'</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%; } |