Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r7902 -r8029 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7902) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8029) @@ -1339,17 +1339,9 @@ // b. setting object's titlefield value (in titlebar ONLY) to default in case if object beeing created with no titlefield filled in if( $object_status[ $prefix_data['prefix_special'] ] == 'new' ) { - $title = str_replace('\'#'.$prefix_data['prefix_special'].'_titlefield#\'', '#'.$prefix_data['prefix_special'].'_titlefield#', $title); $new_value = $this->getInfo( $objects[ $prefix_data['prefix_special'] ], 'titlefield' ); - if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) { - $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]); - } - // old format had single quotes in the format - $title = str_replace('\'#'.$prefix_data['prefix_special'].'_titlefield#\'', "'$new_value'", $title); - // new format has no quotes and $new_value should be empty when creating items - if ($new_value) { - $title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', "'$new_value'", $title); - } + if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]); + $title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', $new_value, $title); } } } @@ -1359,24 +1351,19 @@ // 3. find and replace any replacement vars preg_match_all('/#(.*_.*)#/Uis',$title,$rets); - if($rets[1]) - { + if ($rets[1]) { $replacement_vars = array_keys( array_flip($rets[1]) ); - foreach($replacement_vars as $replacement_var) - { + foreach ($replacement_vars as $replacement_var) { $var_info = explode('_',$replacement_var,2); $object =& $objects[ $var_info[0] ]; $new_value = $this->getInfo($object,$var_info[1]); - $title = str_replace('\'#'.$replacement_var.'#\'', "'$new_value'", $title); - if ($new_value) { - $title = str_replace('#'.$replacement_var.'#', "'$new_value'", $title); - } - else { - $title = str_replace('#'.$replacement_var.'#', $new_value, $title); - } + $title = str_replace('#'.$replacement_var.'#', $new_value, $title); } } + // replace trailing spaces inside title preset + '' occurences into single space + $title = preg_replace('/[ ]*\'\'[ ]*/', ' ', $title); + $cut_first = getArrayValue($params,'cut_first'); if( $cut_first && strlen($title) > $cut_first && !preg_match('/(.*)<\/a>/',$title) ) $title = substr($title, 0, $cut_first).' ...'; @@ -1446,6 +1433,7 @@ switch ($element_type) { case 'select': + case 'multiselect': case 'radio': $field_options = $object->GetFieldOptions($field, 'options'); $field_options['options'] = $helper->GetValuesHash( $object->GetDBField($params['value_list_field']) );