From 1f6bba4aba43b9b542a5672cffe6439846263cf8 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 1 Apr 2009 08:22:01 +0000 Subject: [PATCH] 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. --- etemplate/inc/class.customfields_widget.inc.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/etemplate/inc/class.customfields_widget.inc.php b/etemplate/inc/class.customfields_widget.inc.php index 17e8ee3e03..4ba34fed29 100644 --- a/etemplate/inc/class.customfields_widget.inc.php +++ b/etemplate/inc/class.customfields_widget.inc.php @@ -217,11 +217,13 @@ class customfields_widget $select =& $input; unset($input); $input =& etemplate::empty_cell('hbox'); 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( 'sel_options' => $field['values'], 'size' => $field['rows'], 'no_lang' => True ))); + */ } break; case 'label' : @@ -232,6 +234,7 @@ class customfields_widget { $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'); $m = 0; foreach ($field['values'] as $key => $val) @@ -260,7 +263,7 @@ class customfields_widget { 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); @@ -272,7 +275,7 @@ class customfields_widget ); 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); } @@ -298,16 +301,19 @@ class customfields_widget )); break; 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'); foreach($field['values'] as $label => $js) { if (!$label) // display an readonly input { - $widget =& etemplate::empty_cell('text',$this->prefix.$lname.$label,array( + $tmparray = array( 'size' => $field['len'] ? $field['len'] : 20, 'readonly' => $field['len'] < 0, 'onchange' => $js, - )); + ); + $widget =& etemplate::empty_cell('text',$this->prefix.$lname.$label,$tmparray); } else {