"fix nm widget to deal with same header in multiple columns (eg. InfoLog's 2 time columns)"

This commit is contained in:
Ralf Becker 2009-08-25 13:20:25 +00:00
parent d8c99b809e
commit 7d92143b11

View File

@ -570,21 +570,14 @@ class nextmatch_widget
$cols['__content__'] =& $content; $cols['__content__'] =& $content;
$tmpl->widget_tree_walk(array($this,'_cols_from_tpl_walker'),$cols); $tmpl->widget_tree_walk(array($this,'_cols_from_tpl_walker'),$cols);
unset($cols['__content__']); unset($cols['__content__']);
$name2col = is_array($cols['name2col']) ? $cols['name2col'] : array(); unset($cols['name2col']); $col2names = is_array($cols['col2names']) ? $cols['col2names'] : array(); unset($cols['col2names']);
//_debug_array($col2names);
//_debug_array($cols); //_debug_array($cols);
foreach($cols as $name => $label) foreach($cols as $name => $label)
{ {
if (!$label) unset($cols[$name]); if (!$label) unset($cols[$name]);
} }
//_debug_array($cols); //_debug_array($cols);
//_debug_array($name2col);
// now we check if a column of the grid has more then one header
$col2names = array();
foreach($name2col as $name => $col)
{
if ($name != $col) $col2names[$col][] = $name;
}
//_debug_array($col2names);
$cols2 = $cols; $cols2 = $cols;
$cols = array(); $cols = array();
foreach($cols2 as $name => $label) foreach($cols2 as $name => $label)
@ -667,10 +660,9 @@ class nextmatch_widget
elseif (strpos($cols[$col],$label) === false) elseif (strpos($cols[$col],$label) === false)
{ {
$cols[$col] .= ($cols[$col] ? ', ' : '').$label; $cols[$col] .= ($cols[$col] ? ', ' : '').$label;
$cols['name2col'][$col] = $col;
} }
} }
$cols['name2col'][$widget['name']] = $col; $cols['col2names'][$col][] = $widget['name'];
//echo "<p>$path: $widget[name] $label</p>\n"; //echo "<p>$path: $widget[name] $label</p>\n";
} }