adaption of the customfields feature to the distinction of detailed/non-detailed prefs of the columnselection

This commit is contained in:
Klaus Leithoff 2007-11-27 11:49:55 +00:00
parent baeef40a16
commit d044541686

View File

@ -341,13 +341,22 @@ class uiinfolog
} }
//echo "<p align=right>template ='".'infolog.index.rows.'.$query['col_filter']['info_type']."'".(!$query['template'] ? ' not' : '')." found</p>\n"; //echo "<p align=right>template ='".'infolog.index.rows.'.$query['col_filter']['info_type']."'".(!$query['template'] ? ' not' : '')." found</p>\n";
} }
// do we need to read the custom fields, depends on the column is enabled and customfields exist // do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific
$columselection = $this->prefs['nextmatch-infolog.index.rows']; // so we have to check that as well
$details = $query['filter2'] == 'all';
$columselection = $this->prefs['nextmatch-infolog.index.rows'.($details?'-details':'')];
//_debug_array($columselection); //_debug_array($columselection);
if ($columselection) if ($columselection)
{ {
if (!isset($query['selectcols'])) $query['selectcols']=$columselection; $query['selectcols']=$columselection;
$columselection = explode(',',$columselection); $columselection = explode(',',$columselection);
} else {
if (isset($query['selectcols']))
{
$columselection =explode(',',$query['selectcols']);
} else {
$columselection=array();
}
} }
$show_custom_fields = (!$columselection || in_array('customfields',$columselection)) && $this->bo->customfields; $show_custom_fields = (!$columselection || in_array('customfields',$columselection)) && $this->bo->customfields;
$lv_customfields=array(); // used to set the visible columns $lv_customfields=array(); // used to set the visible columns
@ -366,13 +375,11 @@ class uiinfolog
{ {
$lv_customfields[$cf]=$cfa; $lv_customfields[$cf]=$cfa;
$readonlys['#'.$cf] = true; $readonlys['#'.$cf] = true;
if (stripos($query['selectcols'],'#'.$cf)===FALSE) $query['selectcols'].=",#".$cf;
} }
} else { } else {
if ($showallcustfields==1 || in_array('#'.$cf,$columselection)) { if ($showallcustfields==1 || in_array('#'.$cf,$columselection)) {
$lv_customfields[$cf]=$cfa; $lv_customfields[$cf]=$cfa;
$readonlys['#'.$cf] = true; $readonlys['#'.$cf] = true;
if (stripos($query['selectcols'],'#'.$cf)===FALSE) $query['selectcols'].=",#".$cf;
} }
} }
// set the array for the available cust-cols // set the array for the available cust-cols
@ -387,7 +394,6 @@ class uiinfolog
$lv_customfields[$name]=$value; $lv_customfields[$name]=$value;
//echo $name."->". $value['label']."<br>"; //echo $name."->". $value['label']."<br>";
$readonlys['#'.$name] = true; $readonlys['#'.$name] = true;
if (stripos($query['selectcols'],'#'.$name)!==FALSE) $query['selectcols'].=",#".$name;
} }
//set the array for the available cust-cols //set the array for the available cust-cols
$cvp['#'.$name] = $value['label']; $cvp['#'.$name] = $value['label'];
@ -637,10 +643,18 @@ class uiinfolog
if ($action == 'sp') if ($action == 'sp')
{ {
$pref = 'nextmatch-infolog.index.rows'.($values['nm']['filter2']=='all'?'-details':''); $pref = 'nextmatch-infolog.index.rows'.($values['nm']['filter2']=='all'?'-details':'');
foreach(array('info_used_time_info_planned_time','info_datemodified','info_owner_info_responsible') as $name) foreach(array('info_used_time_info_planned_time','info_datemodified','info_owner_info_responsible','customfields') as $name)
{ {
$values['main']['no_'.$name] = strpos($this->prefs[$pref],$name) === false; $values['main']['no_'.$name] = strpos($this->prefs[$pref],$name) === false;
} }
if (!$values['main']['no_customfields'])
{
// set the column-header of the main table for the customfields.
foreach($this->bo->customfields as $lname => $data)
{
$values['main']['customfields'].=$lname."\n";
}
}
} }
$values['nm']['header_right'] = 'infolog.index.header_right'; $values['nm']['header_right'] = 'infolog.index.header_right';
if ($extra_app_header) if ($extra_app_header)