* InfoLog: status filter in index shows now cumulated list of all status translations, if no type is selected (as context menu does too)

This commit is contained in:
Ralf Becker 2012-05-22 17:39:28 +00:00
parent cda03331e2
commit ed5c5593c3
5 changed files with 45 additions and 37 deletions

View File

@ -24,6 +24,9 @@
.inputFullWidth input {
width: 100%;
}
.selectboxFullWidth select {
width: 100%;
}
/*
* mark input as required

View File

@ -1640,6 +1640,42 @@ class infolog_bo
return $status;
}
/**
* Get status of a single or all types
*
* As status value can have different translations depending on type, we list all translations
*
* @param string $type=null
* @param array &$icons=null on return name of icons
* @return array value => (commaseparated) translations
*/
function get_status($type=null, array &$icons=null)
{
// if filtered by type, show only the stati of the filtered type
if ($type && isset($this->status[$type]))
{
$statis = $icons = $this->status[$type];
}
else // show all stati
{
$statis = $icons = array();
foreach($this->status as $t => $stati)
{
if ($t === 'defaults') continue;
foreach($stati as $val => $label)
{
$statis[$val][$label] = lang($label);
if (!isset($icons[$val])) $icons[$val] = $label;
}
}
foreach($statis as $val => &$labels)
{
$labels = implode(', ', $labels);
}
}
return $statis;
}
/**
* Activates an InfoLog entry (setting it's status from template or inactive depending on the completed percentage)
*

View File

@ -451,18 +451,8 @@ class infolog_ui
//echo "rows=<pre>".print_r($rows,True)."</pre>\n";
// if filtered by type, show only the stati of the filtered type
if ($query['col_filter']['info_type'] && isset($this->bo->status[$query['col_filter']['info_type']]))
{
$rows['sel_options']['info_status'] = $this->bo->status[$query['col_filter']['info_type']];
}
else // show all stati
{
$rows['sel_options']['info_status'] = array();
foreach($this->bo->status as $typ => $stati)
{
if ($typ != 'defaults' && !empty($stati)) $rows['sel_options']['info_status'] += $stati;
}
}
$rows['sel_options']['info_status'] = $this->bo->get_status($query['col_filter']['info_type']);
if ($this->bo->history)
{
$rows['sel_options']['info_status']['deleted'] = 'deleted';
@ -960,28 +950,7 @@ else
);
}
// if filtered by type, show only the stati of the filtered type
if ($query['col_filter']['info_type'] && isset($this->bo->status[$query['col_filter']['info_type']]))
{
$statis = $icons = $this->bo->status[$query['col_filter']['info_type']];
}
else // show all stati
{
$statis = $icons = array();
foreach($this->bo->status as $type => $stati)
{
if ($type == 'defaults') continue;
foreach($stati as $val => $label)
{
$statis[$val][$label] = lang($label);
if (!isset($icons[$val])) $icons[$val] = $label;
}
}
foreach($statis as $val => &$labels)
{
$labels = implode(', ', $labels);
}
}
$statis = $this->bo->get_status($query['col_filter']['info_type'], $icons);
foreach($statis as $type => &$data)
{
$data = array(

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@
<row class="th">
<vbox options="0,0">
<nextmatch-filterheader id="info_type" no_lang="1" options="Type"/>
<nextmatch-filterheader align="center" id="info_status" options="Status"/>
<nextmatch-filterheader align="center" id="info_status" options="Status" class="selectboxFullWidth"/>
<nextmatch-sortheader align="right" label="Completed" id="info_percent"/>
</vbox>
<grid width="100%" spacing="0" padding="0">