Skip to content
Snippets Groups Projects
Commit 7ff382a4 authored by chris's avatar chris
Browse files

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
parent 44e099ad
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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%;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment