From: <lei...@us...> - 2009-04-30 07:39:33
|
Author: leithoff Date: Thu Apr 30 09:39:22 2009 New Revision: 26895 URL: http://www.egroupware.org/viewvc/egroupware?rev=3D26895&view=3Drev Log: handling checkbox values in listview, handling radio values display in list= view;handling the doubling of select/multiselect -cfs in advanced search, a= dding empty entry for radio-cfs in advanced search, allowing to edit readon= ly cfs when in advanced search Modified: branches/1.6/etemplate/inc/class.customfields_widget.inc.php Modified: branches/1.6/etemplate/inc/class.customfields_widget.inc.php URL: http://www.egroupware.org/viewvc/egroupware/branches/1.6/etemplate/inc= /class.customfields_widget.inc.php?rev=3D26895&r1=3D26894&r2=3D26895&view= =3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- branches/1.6/etemplate/inc/class.customfields_widget.inc.php (original) +++ branches/1.6/etemplate/inc/class.customfields_widget.inc.php Thu Apr 30= 09:39:22 2009 @@ -186,9 +186,15 @@ ))); } elseif ($type =3D=3D 'customfields-list') { if (isset($value[$this->prefix.$lname]) && $value[$this->prefix.$lname= ] !=3D=3D '') { - etemplate::add_child($cell,$input =3D& etemplate::empty_cell('image',= 'info.png', - array('label'=3D>/*lang("custom fields").": ".*/$field['label'],'wid= th'=3D>"16px", - 'onclick'=3D>"return alert('".lang("custom fields").": ".$field['la= bel']."');"))); + switch ((string)$field['type']) + { + case 'checkbox': + if ($value[$this->prefix.$lname]=3D=3D0) break; + default: + etemplate::add_child($cell,$input =3D& etemplate::empty_cell('image= ','info.png', + array('label'=3D>/*lang("custom fields").": ".*/$field['label'],'w= idth'=3D>"16px", + 'onclick'=3D>"return alert('".lang("custom fields").": ".$field['= label']."');"))); + } } } = @@ -217,29 +223,38 @@ $select =3D& $input; unset($input); $input =3D& 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->p= refix.$lname,array( 'sel_options' =3D> $field['values'], 'size' =3D> $field['rows'], 'no_lang' =3D> True ))); + */ } break; case 'label' : $row_class =3D 'th'; break; case 'radio' : + $showthis =3D '#a#l#l#'; if (count($field['values']) =3D=3D 1 && isset($field['values']['@'])) { $field['values'] =3D $this->_get_options_from_file($field['values'][= '@']); } - $input =3D& etemplate::empty_cell('groupbox'); + if($this->advanced_search && $field['rows'] <=3D 1) $field['values'][= ''] =3D lang('doesn\'t matter'); + if ($readonly) { + $showthis =3D $value[$this->prefix.$lname]; + $input =3D& etemplate::empty_cell('hbox'); + } else { + $input =3D& etemplate::empty_cell('groupbox'); + } $m =3D 0; foreach ($field['values'] as $key =3D> $val) { $radio =3D etemplate::empty_cell('radio',$this->prefix.$lname); $radio['label'] =3D $val; $radio['size'] =3D $key; - etemplate::add_child($input,$radio); + if ($showthis =3D=3D '#a#l#l#' || $showthis =3D=3D $key) etemplate::= add_child($input,$radio); unset($radio); } break; @@ -260,7 +275,7 @@ { if (array_key_exists('readonly',$field['values'])) { - $tmparray['readonly']=3D'readonly'; + if(!$this->advanced_search) $tmparray['readonly']=3D'readonly'; } } $input =3D& etemplate::empty_cell('text',$this->prefix.$lname,$tmpa= rray); @@ -272,7 +287,7 @@ ); if (is_array($field['values']) && array_key_exists('readonly',$fiel= d['values'])) { - $tmparray['readonly']=3D'readonly'; + if(!$this->advanced_search) $tmparray['readonly']=3D'readonly'; } $input =3D& etemplate::empty_cell('textarea',$this->prefix.$lname,$= tmparray); } @@ -298,16 +313,19 @@ )); break; case 'button': // button(s) to execute javascript (label=3Donclick) o= r textinputs (empty label, readonly with neg. length) + // a button does not seem to be helpful in advanced search ???, = + if($this->advanced_search) break; $input =3D& etemplate::empty_cell('hbox'); foreach($field['values'] as $label =3D> $js) { if (!$label) // display an readonly input { - $widget =3D& etemplate::empty_cell('text',$this->prefix.$lname.$lab= el,array( + $tmparray =3D array( 'size' =3D> $field['len'] ? $field['len'] : 20, 'readonly' =3D> $field['len'] < 0, 'onchange' =3D> $js, - )); + ); + $widget =3D& etemplate::empty_cell('text',$this->prefix.$lname.$lab= el,$tmparray); } else { |