handling the doubling of select/multiselect -cfs in advanced search,, adding empty entry for radio-cfs in advanced search, allowing to edit readonly cfs when in advanced search.

This commit is contained in:
Klaus Leithoff 2009-04-01 08:22:01 +00:00
parent 4710810a41
commit 1f6bba4aba

View File

@ -217,11 +217,13 @@ class customfields_widget
$select =& $input; unset($input); $select =& $input; unset($input);
$input =& etemplate::empty_cell('hbox'); $input =& etemplate::empty_cell('hbox');
etemplate::add_child($input, $select); unset($select); etemplate::add_child($input, $select); unset($select);
/* the following seem to double the select fields in advanced search.
etemplate::add_child($input, etemplate::empty_cell('select',$this->prefix.$lname,array( etemplate::add_child($input, etemplate::empty_cell('select',$this->prefix.$lname,array(
'sel_options' => $field['values'], 'sel_options' => $field['values'],
'size' => $field['rows'], 'size' => $field['rows'],
'no_lang' => True 'no_lang' => True
))); )));
*/
} }
break; break;
case 'label' : case 'label' :
@ -232,6 +234,7 @@ class customfields_widget
{ {
$field['values'] = $this->_get_options_from_file($field['values']['@']); $field['values'] = $this->_get_options_from_file($field['values']['@']);
} }
if($this->advanced_search && $field['rows'] <= 1) $field['values'][''] = lang('doesn\'t matter');
$input =& etemplate::empty_cell('groupbox'); $input =& etemplate::empty_cell('groupbox');
$m = 0; $m = 0;
foreach ($field['values'] as $key => $val) foreach ($field['values'] as $key => $val)
@ -260,7 +263,7 @@ class customfields_widget
{ {
if (array_key_exists('readonly',$field['values'])) if (array_key_exists('readonly',$field['values']))
{ {
$tmparray['readonly']='readonly'; if(!$this->advanced_search) $tmparray['readonly']='readonly';
} }
} }
$input =& etemplate::empty_cell('text',$this->prefix.$lname,$tmparray); $input =& etemplate::empty_cell('text',$this->prefix.$lname,$tmparray);
@ -272,7 +275,7 @@ class customfields_widget
); );
if (is_array($field['values']) && array_key_exists('readonly',$field['values'])) if (is_array($field['values']) && array_key_exists('readonly',$field['values']))
{ {
$tmparray['readonly']='readonly'; if(!$this->advanced_search) $tmparray['readonly']='readonly';
} }
$input =& etemplate::empty_cell('textarea',$this->prefix.$lname,$tmparray); $input =& etemplate::empty_cell('textarea',$this->prefix.$lname,$tmparray);
} }
@ -298,16 +301,19 @@ class customfields_widget
)); ));
break; break;
case 'button': // button(s) to execute javascript (label=onclick) or textinputs (empty label, readonly with neg. length) case 'button': // button(s) to execute javascript (label=onclick) or textinputs (empty label, readonly with neg. length)
// a button does not seem to be helpful in advanced search ???,
if($this->advanced_search) break;
$input =& etemplate::empty_cell('hbox'); $input =& etemplate::empty_cell('hbox');
foreach($field['values'] as $label => $js) foreach($field['values'] as $label => $js)
{ {
if (!$label) // display an readonly input if (!$label) // display an readonly input
{ {
$widget =& etemplate::empty_cell('text',$this->prefix.$lname.$label,array( $tmparray = array(
'size' => $field['len'] ? $field['len'] : 20, 'size' => $field['len'] ? $field['len'] : 20,
'readonly' => $field['len'] < 0, 'readonly' => $field['len'] < 0,
'onchange' => $js, 'onchange' => $js,
)); );
$widget =& etemplate::empty_cell('text',$this->prefix.$lname.$label,$tmparray);
} }
else else
{ {