mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
users can now switch every single column on or off in all nextmatch lists, admins can configure defaults (plus some bugfixes and other improvments)
This commit is contained in:
parent
389b6d0a7c
commit
6bd5ac2da8
@ -834,6 +834,10 @@ $content[$id] = array( <span>// I = value set by the app, 0 = value on return /
|
||||
'rows' => <span>// O content set by callback</span>
|
||||
'total' => <span>// O the total number of entries</span>
|
||||
'sel_options' => <span>// O additional or changed sel_options set by the callback and merged into $tmpl->sel_options</span>
|
||||
'no_columnselection' => <span>// I turns off the columnselection completly, turned on by default</span>
|
||||
'columnselection-pref' => <span>// I name of the preference (plus 'nextmatch-' prefix), default = template-name</span>
|
||||
'default_cols' => <span>// I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns</span>
|
||||
'options-selectcols' => <span>// I array with name/label pairs for the column-selection, this gets autodetected by default. A name => false suppresses a column completly.</span>
|
||||
);
|
||||
|
||||
<span>/*
|
||||
@ -910,7 +914,7 @@ function index($content = 0)
|
||||
<nextmatch type="nextmatch-accountfilter" id="col-name"/>
|
||||
</td>
|
||||
<td>no</td>
|
||||
<td>nextmatch-<br />sortheader<p>nextmatch-<br />filterheader<p>nextmatch-<br />customfilter<p>nextmatch-<br />accountfilter</td>
|
||||
<td>nextmatch-<br />sortheader<p>nextmatch-<br />filterheader<p>nextmatch-<br />customfilter<p>nextmatch-<br />accountfilter<p>nextmatch-<br />header</td>
|
||||
<td>
|
||||
These widget are an optional part of the nextmatch widget.<p>
|
||||
<b>nextmatch-sortheader</b><br />
|
||||
@ -918,18 +922,23 @@ function index($content = 0)
|
||||
to order the lines of the nextmatch after a certain column. The column-name is given as <b>name</b> (xml:id) the
|
||||
<b>label</b> is show as a link of button (no javascript). One can specify a default sorting: <b>options</b>={DESC|ASC} (default=ASC),
|
||||
to be used when the header is clicked for the first time. Consecutive click on the header change the sorting
|
||||
direction, indicated by a little up- or down-arrow.<p>
|
||||
direction, indicated by a little up- or down-arrow. As a second comma-separated parameter one can specify an extra
|
||||
label for the column-selection.<p>
|
||||
<b>nextmatch-filterheader</b><br />
|
||||
Widget to allow to show only certain row, which match a selected filter-value. The column-name is given as <b>name</b>
|
||||
(xml:id), the options of the displayed selectbox need to be set as for an ordinary selectbox (eg. in the options
|
||||
parameter to the uietemplate::exec function). If no extra-label is given in options, lang('all') will be used for
|
||||
the empty value, which means no filter activ. An (optional) <b>label</b> can be given.<p>
|
||||
the empty value, which means no filter activ. An (optional) <b>label</b> can be given and is also used for the column-selection.<p>
|
||||
<b>nextmatch-customfilter</b><br />
|
||||
The custom filterheader allows to use other (select-)widgets to filter by them. They have to be specified as the first
|
||||
parameter in the comma-separated options attribute. In all other aspects it is identical to the filterheader.<p>
|
||||
<b>nextmatch-accountfilter</b><br />
|
||||
The Accountfilter allows to select users (via the prefered user-selection-method) to filter by them.
|
||||
It's identical to a <b>nextmatch-customfilter</b> with options="select-account".<p>
|
||||
<b>nextmatch-header</b><br />
|
||||
Just a header-label for a nextmatch column. It names the column for the column for the column-selection (in difference to the label).
|
||||
The name is used to hide the column (with a 'no_' prefix) and as the name for the preference.
|
||||
A different label for the column-selection preference can be specified via the option field.<p>
|
||||
<i><u>Note</u>:</i> All four widgets interoperate with the nextmatch-widget which passes the set values as part if
|
||||
the query-parameter to its get_rows function, they are <u>not</u> returned in the rows sub-array.
|
||||
</td>
|
||||
|
@ -133,6 +133,7 @@
|
||||
* accessing the array it can by the index or the key of an array element.
|
||||
* To make it short and clear, use "Row$row" or "$col$row" not "$row" or "$row$col" !!!
|
||||
*
|
||||
* @static
|
||||
* @param sring $name the name to expand
|
||||
* @param int $c is the column index starting with 0 (if you have row-headers, data-cells start at 1)
|
||||
* @param int $row is the row number starting with 0 (if you have col-headers, data-cells start at 1)
|
||||
@ -155,6 +156,7 @@
|
||||
{
|
||||
$cont = array();
|
||||
}
|
||||
if (!is_numeric($c)) $c = boetemplate::chrs2num($c);
|
||||
$col = $this->num2chrs($c-1); // $c-1 to get: 0:'@', 1:'A', ...
|
||||
$col_ = $this->num2chrs($c_-1);
|
||||
$row_cont = $cont[$row];
|
||||
@ -164,7 +166,7 @@
|
||||
}
|
||||
if ($is_index_in_content)
|
||||
{
|
||||
$name = $this->get_array($cont,substr($name,1));
|
||||
$name = boetemplate::get_array($cont,substr($name,1));
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
@ -385,67 +387,84 @@
|
||||
/**
|
||||
* set one or more attibutes for row $n
|
||||
*
|
||||
* @deprecated as it uses this->data
|
||||
* @param int $n numerical row-number starting with 1 (!)
|
||||
* @param string $height percent or pixel or '' for no height
|
||||
* @param string $class name of css class (without the leading '.') or '' for no class
|
||||
* @param string $valign alignment (top,middle,bottom) or '' for none
|
||||
* @param boolean $disabled True or expression or False to disable or enable the row (Only the number 0 means dont change the attribute !!!)
|
||||
* @param string $path='/0' default is the first widget in the tree of children
|
||||
* @return false if $path is no grid or array(height,class,valign,disabled) otherwise
|
||||
*/
|
||||
function set_row_attributes($n,$height=0,$class=0,$valign=0,$disabled=0)
|
||||
function set_row_attributes($n,$height=0,$class=0,$valign=0,$disabled=0,$path='/0')
|
||||
{
|
||||
list($old_height,$old_disabled) = explode(',',$this->data[0]["h$n"]);
|
||||
$grid =& $this->get_widget_by_path($path);
|
||||
if (is_null($grid) || $grid['type'] != 'grid') return false;
|
||||
$grid_attr =& $grid['data'][0];
|
||||
|
||||
list($old_height,$old_disabled) = explode(',',$grid_attr["h$n"]);
|
||||
$disabled = $disabled !== 0 ? $disabled : $old_disabled;
|
||||
$this->data[0]["h$n"] = ($height !== 0 ? $height : $old_height).
|
||||
$grid_attr["h$n"] = ($height !== 0 ? $height : $old_height).
|
||||
($disabled ? ','.$disabled : '');
|
||||
list($old_class,$old_valign) = explode(',',$this->data[0]["c$n"]);
|
||||
list($old_class,$old_valign) = explode(',',$grid_attr["c$n"]);
|
||||
$valign = $valign !== 0 ? $valign : $old_valign;
|
||||
$this->data[0]["c$n"] = ($class !== 0 ? $class : $old_class).
|
||||
$grid_attr["c$n"] = ($class !== 0 ? $class : $old_class).
|
||||
($valign ? ','.$valign : '');
|
||||
|
||||
list($height,$disabled) = explode(',',$grid_attr["h$n"]);
|
||||
list($class,$valign) = explode(',',$grid_attr["c$n"]);
|
||||
return array($height,$class,$valign,$disabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* disables row $n
|
||||
*
|
||||
* @deprecated as it uses this->data
|
||||
* @param int $n numerical row-number starting with 1 (!)
|
||||
* @param boolean $enable=false can be used to re-enable a row if set to True
|
||||
* @param string $path='/0' default is the first widget in the tree of children
|
||||
*/
|
||||
function disable_row($n,$enable=False)
|
||||
function disable_row($n,$enable=False,$path='/0')
|
||||
{
|
||||
$this->set_row_attributes($n,0,0,0,!$enable);
|
||||
$this->set_row_attributes($n,0,0,0,!$enable,$path);
|
||||
}
|
||||
|
||||
/**
|
||||
* set one or more attibutes for column $c
|
||||
*
|
||||
* @deprecated as it uses this->data
|
||||
* @param int/string $c numerical column-number starting with 0 (!), or the char-code starting with 'A'
|
||||
* @param string $width percent or pixel or '' for no height
|
||||
* @param mixed $disabled=0 True or expression or False to disable or enable the column (Only the number 0 means dont change the attribute !!!)
|
||||
* @param string $path='/0' default is the first widget in the tree of children
|
||||
* @return false if $path specifies no grid or array(width,disabled) otherwise
|
||||
*/
|
||||
function set_column_attributes($c,$width=0,$disabled=0)
|
||||
function set_column_attributes($c,$width=0,$disabled=0,$path='/0')
|
||||
{
|
||||
if (is_numeric($c))
|
||||
{
|
||||
$c = $this->num2chrs($c);
|
||||
}
|
||||
list($old_width,$old_disabled) = explode(',',$this->data[0][$c]);
|
||||
$grid =& $this->get_widget_by_path($path);
|
||||
if (is_null($grid) || $grid['type'] != 'grid') return false;
|
||||
$grid_attr =& $grid['data'][0];
|
||||
|
||||
list($old_width,$old_disabled) = explode(',',$grid_attr[$c]);
|
||||
$disabled = $disabled !== 0 ? $disabled : $old_disabled;
|
||||
$this->data[0][$c] = ($width !== 0 ? $width : $old_width).
|
||||
$grid_attr[$c] = ($width !== 0 ? $width : $old_width).
|
||||
($disabled ? ','.$disabled : '');
|
||||
|
||||
//echo "set_column_attributes('$c',,'$path'): ".$grid_attr[$c]."</p>\n"; _debug_array($grid_attr);
|
||||
return explode(',',$grid_attr[$c]);
|
||||
}
|
||||
|
||||
/**
|
||||
* disables column $c
|
||||
*
|
||||
* @deprecated as it uses this->data
|
||||
* @param int/string $c numerical column-number starting with 0 (!), or the char-code starting with 'A'
|
||||
* @param boolean $enable can be used to re-enable a column if set to True
|
||||
*/
|
||||
function disable_column($c,$enable=False)
|
||||
* @param string $path='/0' default is the first widget in the tree of children
|
||||
*/
|
||||
function disable_column($c,$enable=False,$path='/0')
|
||||
{
|
||||
$this->set_column_attributes($c,0,!$enable);
|
||||
$this->set_column_attributes($c,0,!$enable,$path);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -726,6 +745,7 @@
|
||||
}
|
||||
$path = implode('/',$path_parts);
|
||||
if ($path == '/' || $path === '') return $this->children;
|
||||
if (count($path_parts) == 2) return $this->children[$path_parts[1]];
|
||||
|
||||
return $this->widget_tree_walk('get_widget_by_path_helper',$path);
|
||||
}
|
||||
|
@ -20,8 +20,18 @@
|
||||
class editor
|
||||
{
|
||||
var $debug;
|
||||
var $etemplate; // eTemplate we edit
|
||||
var $editor; // editor eTemplate
|
||||
/**
|
||||
* eTemplate we edit
|
||||
*
|
||||
* @var etemplate
|
||||
*/
|
||||
var $etemplate;
|
||||
/**
|
||||
* editor eTemplate
|
||||
*
|
||||
* @var etemplate
|
||||
*/
|
||||
var $editor;
|
||||
var $aligns = array(
|
||||
'' => 'Left',
|
||||
'right' => 'Right',
|
||||
|
@ -75,6 +75,7 @@
|
||||
'nextmatch-filterheader' => 'Nextmatch Filterheader',
|
||||
'nextmatch-accountfilter' => 'Nextmatch Accountfilter',
|
||||
'nextmatch-customfilter' => 'Nextmatch Custom Filterheader',
|
||||
'nextmatch-header' => 'Nextmatch Header',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -88,7 +89,9 @@
|
||||
|
||||
/**
|
||||
* returns last part of a form-name
|
||||
* @internal
|
||||
*
|
||||
* @internal
|
||||
* @return string
|
||||
*/
|
||||
function last_part($name)
|
||||
{
|
||||
@ -106,7 +109,7 @@
|
||||
* @param array &$cell array with the widget, can be modified for ui-independent widgets
|
||||
* @param array &$readonlys names of widgets as key, to be made readonly
|
||||
* @param mixed &$extension_data data the extension can store persisten between pre- and post-process
|
||||
* @param object &$tmpl reference to the template we belong too
|
||||
* @param etemplate &$tmpl reference to the template we belong too
|
||||
* @return boolean true if extra label is allowed, false otherwise
|
||||
*/
|
||||
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||
@ -120,8 +123,12 @@
|
||||
);
|
||||
switch ($cell['type'])
|
||||
{
|
||||
case 'nextmatch-header':
|
||||
$cell['type'] = 'label';
|
||||
return true; // false = no extra label
|
||||
|
||||
case 'nextmatch-sortheader': // Option: default sort: ASC(default) or DESC
|
||||
$extension_data['default_sort'] = preg_match('/^(ASC|DESC)$/i',$cell['size']) ? strtoupper($cell['size']) : 'ASC';
|
||||
$extension_data['default_sort'] = $cell['size']&&preg_match('/^(ASC|DESC)/i',$cell['size'],$matches) ? strtoupper($matches[1]) : 'ASC';
|
||||
$cell['type'] = 'button';
|
||||
$cell['onchange'] = True;
|
||||
if (!$cell['help'])
|
||||
@ -134,7 +141,7 @@
|
||||
unset($cell[1]['align']);
|
||||
$cell[2] = $tmpl->empty_cell('image',$nm_global['sort'] != 'DESC' ? 'down' : 'up');
|
||||
$cell['type'] = 'hbox';
|
||||
$cell['size'] = '2,0,0';
|
||||
$cell['size'] = '2,,0,0';
|
||||
$class = 'activ_sortcolumn';
|
||||
$cell['name'] = $cell['label'] = '';
|
||||
}
|
||||
@ -218,6 +225,11 @@
|
||||
{
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] = $max = $value['num_rows'];
|
||||
}
|
||||
if (!$value['no_columnselection'])
|
||||
{
|
||||
// presetting the options for selectcols empty, so the get_rows function can set it
|
||||
$value['options-selectcols'] = array();
|
||||
}
|
||||
if (!is_object($obj) || !method_exists($obj,$method))
|
||||
{
|
||||
$GLOBALS['egw_info']['etemplate']['validation_errors'][$name] = "nextmatch_widget::pre_process($cell[name]): '$value[get_rows]' is no valid method !!!";
|
||||
@ -333,6 +345,60 @@
|
||||
$cell['obj'] = &$nextmatch;
|
||||
$cell['name'] = $nextmatch->name;
|
||||
}
|
||||
// preset everything for the column selection
|
||||
if (!$value['no_columnselection'])
|
||||
{
|
||||
// fetching column-names & -labels from the template
|
||||
$this->_cols_from_tpl($value['template'],$value['options-selectcols'],$name2col,$value['rows']);
|
||||
//_debug_array($name2col);
|
||||
//_debug_array($value['options-selectcols']);
|
||||
// getting the selected colums from the prefs (or if not set a given default or all)
|
||||
$name = is_object($value['template']) ? $value['template']->name : $value['template'];
|
||||
list($app) = explode('.',$name);
|
||||
if (isset($value['columnselection_pref'])) $name = $value['columnselection_pref'];
|
||||
if (!($value['selectcols'] = $GLOBALS['egw_info']['user']['preferences'][$app]['nextmatch-'.$name]))
|
||||
{
|
||||
$value['selectcols'] = array_keys($value['options-selectcols']);
|
||||
if (isset($value['default_cols']))
|
||||
{
|
||||
if ($value['default_cols']{0} == '!')
|
||||
{
|
||||
$value['selectcols'] = array_diff($value['selectcols'],explode(',',substr($value['default_cols'],1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['selectcols'] = $value['default_cols'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_array($value['selectcols'])) $value['selectcols'] = explode(',',$value['selectcols']);
|
||||
foreach(array_keys($value['options-selectcols']) as $name)
|
||||
{
|
||||
// set 'no_'.$col for each column-name to true, if the column is not selected
|
||||
// (and the value is not set be the get_rows function / programmer!)
|
||||
if (!isset($value['rows']['no_'.$name])) $value['rows']['no_'.$name] = !in_array($name,$value['selectcols']);
|
||||
// setting '@no_'.$name as disabled attr for each column, that has only a single nextmatch-header
|
||||
if (is_object($value['template']))
|
||||
{
|
||||
$col = $name2col[$name];
|
||||
list(,$disabled) = $value['template']->set_column_attributes($col);
|
||||
//echo "<p>$col: $name: $disabled</p>\n";
|
||||
if (!isset($disabled)) $value['template']->set_column_attributes($col,0,'@no_'.$name);
|
||||
}
|
||||
}
|
||||
//_debug_array($value);
|
||||
if (is_object($nextmatch))
|
||||
{
|
||||
$size =& $nextmatch->get_cell_attribute('selectcols','size');
|
||||
if ($size > count($value['options-selectcols'])) $size = '0'.count($value['options-selectcols']);
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
{
|
||||
$nextmatch->disable_cells('default_prefs');
|
||||
}
|
||||
}
|
||||
// should reset on each submit
|
||||
unset($value['default_prefs']);
|
||||
}
|
||||
$cell['type'] = 'template';
|
||||
$cell['label'] = $cell['help'] = '';
|
||||
|
||||
@ -347,6 +413,99 @@
|
||||
|
||||
return False; // NO extra Label
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the column names and labels from the template
|
||||
*
|
||||
* @param etemplate &$tmpl
|
||||
* @param array &$cols here we add the column-name/-label
|
||||
* @param array &$name2col
|
||||
* @param array $content nextmatch content, to be able to resolve labels with @name
|
||||
*/
|
||||
function _cols_from_tpl(&$tmpl,&$cols,&$name2col,&$content)
|
||||
{
|
||||
//_debug_array($cols);
|
||||
// fetching column-names & -labels from the template
|
||||
$cols['__content__'] =& $content;
|
||||
$tmpl->widget_tree_walk(array($this,'_cols_from_tpl_walker'),$cols);
|
||||
unset($cols['__content__']);
|
||||
$name2col = $cols['name2col']; unset($cols['name2col']);
|
||||
//_debug_array($cols);
|
||||
foreach($cols as $name => $label)
|
||||
{
|
||||
if (!$label) unset($cols[$name]);
|
||||
}
|
||||
//_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;
|
||||
$cols = array();
|
||||
foreach($cols2 as $name => $label)
|
||||
{
|
||||
$col = $name;
|
||||
// and replace the column letter then with the name concatinated by an underscore
|
||||
if (is_array($col2names[$name]))
|
||||
{
|
||||
$name = implode('_',$col2names[$name]);
|
||||
$name2col[$name] = $col;
|
||||
}
|
||||
$cols[$name] = $label;
|
||||
}
|
||||
//_debug_array($cols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the column names and labels from the template (callback for etemplate::widget_tree_walk())
|
||||
*
|
||||
* @param array &$widget
|
||||
* @param array &$cols here we add the column-name/-label
|
||||
* @param string $path
|
||||
*/
|
||||
function _cols_from_tpl_walker(&$widget,&$cols,$path)
|
||||
{
|
||||
list($type,$subtype) = explode('-',$widget['type']);
|
||||
if ($type != 'nextmatch' || !$subtype || !$widget['name'] || $widget['disabled'])
|
||||
{
|
||||
return;
|
||||
}
|
||||
$options = explode(',',$widget['size']);
|
||||
if (!($label = $widget['label']) || in_array($subtype,array('header','sortheader')) && $options[1])
|
||||
{
|
||||
if (in_array($subtype,array('customfilter','sortheader'))) $subtype = array_shift($options);
|
||||
|
||||
$label = $options[0];
|
||||
}
|
||||
list(,,$col,$sub) = explode('/',$path);
|
||||
$row = (int)$col;
|
||||
$col = substr($col,$row > 9 ? 2 : 1);
|
||||
if (($label{0} == '@' || strchr($lable,'$') !== false) && is_array($cols['__content__']))
|
||||
{
|
||||
$label = etemplate::expand_name($label,$col,$row,'','',$cols['__content__']);
|
||||
}
|
||||
if (!isset($cols[$widget['name']]) && $label)
|
||||
{
|
||||
$label = substr($label,-3) == '...' ? lang(substr($label,0,-3)) : lang($label);
|
||||
|
||||
if (!$sub)
|
||||
{
|
||||
$cols[$widget['name']] = $label;
|
||||
}
|
||||
elseif (strstr($cols[$col],$label) === false)
|
||||
{
|
||||
$cols[$col] .= ($cols[$col] ? ', ' : '').$label;
|
||||
$cols['name2col'][$col] = $col;
|
||||
}
|
||||
}
|
||||
$cols['name2col'][$widget['name']] = $col;
|
||||
|
||||
//echo "<p>$path: $widget[name] $label</p>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* postprocessing method, called after the submission of the form
|
||||
@ -373,7 +532,7 @@
|
||||
{
|
||||
case 'nextmatch':
|
||||
break;
|
||||
|
||||
|
||||
case 'nextmatch-sortheader':
|
||||
if ($value_in)
|
||||
{
|
||||
@ -391,6 +550,9 @@
|
||||
$nm_global['filter'][$this->last_part($name)] = $value_in;
|
||||
}
|
||||
return False; // dont report value back, as it's in the wrong location (rows)
|
||||
|
||||
case 'nextmatch-header':
|
||||
return False; // nothing to report
|
||||
}
|
||||
$old_value = $extension_data;
|
||||
|
||||
@ -416,6 +578,11 @@
|
||||
$value[$name] = $value['bottom'][$name];
|
||||
}
|
||||
}
|
||||
if ($value['bottom']['savecols'])
|
||||
{
|
||||
$value['selectcols'] = $value['bottom']['selectcols'];
|
||||
$value['default_prefs'] = $value['bottom']['default_prefs'];
|
||||
}
|
||||
unset($value['bottom']);
|
||||
}
|
||||
if (isset($old_value['num_rows']) && !is_null($value['num_rows']) && $value['num_rows'] != $old_value['num_rows'])
|
||||
@ -501,6 +668,17 @@
|
||||
if ($value['searchletter'] === 'all') $value['searchletter'] = false;
|
||||
$loop = True;
|
||||
}
|
||||
if ($value['savecols'])
|
||||
{
|
||||
$name = is_object($extension_data['template']) ? $extension_data['template']->name : $extension_data['template'];
|
||||
list($app) = explode('.',$name);
|
||||
if (isset($extension_data['columnselection_pref'])) $name = $extension_data['columnselection_pref'];
|
||||
$pref = !$GLOBALS['egw_info']['user']['apps']['admin'] && $value['default_prefs'] ? 'default' : 'user';
|
||||
$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->add($app,'nextmatch-'.$name,is_array($value['selectcols']) ?
|
||||
implode(',',$value['selectcols']) : $value['selectcols'],$pref);
|
||||
$GLOBALS['egw']->preferences->save_repository(false,$pref);
|
||||
$loop = True;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
}
|
||||
|
@ -460,6 +460,7 @@
|
||||
if (!is_array($acc))
|
||||
{
|
||||
$data = $GLOBALS['egw']->accounts->get_account_data($id);
|
||||
if (!isset($data[$id])) return '#'.$id;
|
||||
foreach(array('type','lid','firstname','lastname') as $name)
|
||||
{
|
||||
$acc['account_'.$name] = $data[$id][$name];
|
||||
|
@ -142,6 +142,27 @@
|
||||
return $chrs;
|
||||
}
|
||||
|
||||
/**
|
||||
* generates column-names from index: 'A', 'B', ..., 'AA', 'AB', ..., 'ZZ' (not more!)
|
||||
*
|
||||
* @static
|
||||
* @param string $chrs column letter to generate name from 'A' => 1
|
||||
* @return int the index
|
||||
*/
|
||||
function chrs2num($chrs)
|
||||
{
|
||||
$min = ord('A');
|
||||
$max = ord('Z') - $min + 1;
|
||||
|
||||
$num = 1+ord($chrs{0})-$min;
|
||||
if (strlen($chrs) > 1)
|
||||
{
|
||||
$num *= 1 + $max - $min;
|
||||
$num += 1+ord($chrs{1})-$min;
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor for a new / empty cell/widget
|
||||
*
|
||||
@ -906,7 +927,7 @@
|
||||
foreach ($this->db_cols as $db_col => $name)
|
||||
{
|
||||
// escape only backslashes and single quotes (in that order)
|
||||
$str .= "'$name' => '".str_replace(array('\\','\''),array('\\\\','\\\''),$this->db->f($db_col))."',";
|
||||
$str .= "'$name' => '".str_replace(array('\\','\'',"\r"),array('\\\\','\\\'',''),$this->db->f($db_col))."',";
|
||||
}
|
||||
$str .= ");\n\n";
|
||||
fwrite($f,$str);
|
||||
@ -1148,6 +1169,8 @@
|
||||
*
|
||||
* Only some widgets have a sub-tree of children: *box, grid, template, ...
|
||||
* For them we call tree_walk($widget,$func,$extra) instead of func direct
|
||||
*
|
||||
* Please note: as call_user_func_array does not return references, methods ($func is an array) can not either!!!
|
||||
*
|
||||
* @param string/array $func function to use or array($obj,'method')
|
||||
* @param mixed &$extra extra parameter passed to function
|
||||
@ -1168,7 +1191,11 @@
|
||||
{
|
||||
$result =& $this->tree_walk($child,$func,$extra,$path.$c);
|
||||
}
|
||||
else
|
||||
elseif (is_array($func))
|
||||
{
|
||||
$result =& call_user_func_array($func,array(&$child,&$extra,$path.$c));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result =& $func($child,$extra,$path.$c);
|
||||
}
|
||||
@ -1201,7 +1228,14 @@
|
||||
echo "<p><b>boetemplate::tree_walk</b>(, ".print_r($func,true).", ".print_r($extra,true).", ".print_r($opts,true).") func is not callable !!!<br>".function_backtrace()."</p>";
|
||||
return false;
|
||||
}
|
||||
$result =& $func($widget,$extra,$path);
|
||||
if(is_array($func))
|
||||
{
|
||||
$result =& call_user_func_array($func,array(&$widget,&$extra,$path));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result =& $func($widget,$extra,$path);
|
||||
}
|
||||
if (!is_null($result) || is_array($extra) && isset($extra['__RETURN__NOW__']) ||
|
||||
!isset($this->widgets_with_children[$widget['type']]))
|
||||
{
|
||||
@ -1221,6 +1255,10 @@
|
||||
{
|
||||
$result =& $this->tree_walk($child,$func,$extra,$path.'/'.$n);
|
||||
}
|
||||
elseif(is_array($func))
|
||||
{
|
||||
$result =& call_user_func_array($func,array(&$child,&$extra,$path.'/'.$n));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result =& $func($child,$extra,$path.'/'.$n);
|
||||
@ -1244,6 +1282,10 @@
|
||||
{
|
||||
$result =& $this->tree_walk($child,$func,$extra,$path.'/'.$r.$c);
|
||||
}
|
||||
elseif(is_array($func))
|
||||
{
|
||||
$result =& call_user_func_array($func,array(&$child,&$extra,$path.'/'.$r.$c));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result =& $func($child,$extra,$path.'/'.$r.$c);
|
||||
|
@ -211,6 +211,18 @@
|
||||
if (!@$GLOBALS['egw_info']['etemplate']['hooked'] && (int) $output_mode != 1 && (int) $output_mode != -1) // not just returning the html
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['java_script'] .= $this->include_java_script(2);
|
||||
/*
|
||||
if ($GLOBALS['egw_info']['flags']['currentapp'] != 'etemplate')
|
||||
{
|
||||
$css_file = '/etemplate/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/app.css';
|
||||
if (!file_exists(EGW_SERVER_ROOT.$css_file))
|
||||
{
|
||||
$css_file = '/etemplate/templates/default/app.css';
|
||||
}
|
||||
$GLOBALS['egw_info']['flags']['css'] .= '@import('.$GLOBALS['egw_info']['server']['webserver_url'].
|
||||
$css_file.'?'.filemtime(EGW_SERVER_ROOT.$css_file).");\n";
|
||||
}
|
||||
*/
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
}
|
||||
elseif (!isset($GLOBALS['egw_info']['etemplate']['content']))
|
||||
@ -1285,7 +1297,7 @@
|
||||
if ($multiple && !is_array($value)) $value = explode(',',$value);
|
||||
if ($readonly || $cell['noprint'])
|
||||
{
|
||||
foreach($multiple ? $value : array($value) as $val)
|
||||
foreach($multiple || is_array($value) ? $value : array($value) as $val)
|
||||
{
|
||||
if (is_array($sels[$val]))
|
||||
{
|
||||
@ -1321,7 +1333,7 @@
|
||||
if ($multiple && is_numeric($multiple)) // eg. "3+" would give a regular multiselectbox
|
||||
{
|
||||
$html .= $this->html->checkbox_multiselect($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
|
||||
$cell['no_lang'],$options,$multiple,true,$extraStyleMultiselect);
|
||||
$cell['no_lang'],$options,$multiple,$multiple{0}!=='0',$extraStyleMultiselect);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1429,10 +1441,10 @@
|
||||
if ($box_anz > 1 && $orient) // a single cell is NOT placed into a table
|
||||
{
|
||||
$html = $this->html->table($rows,$this->html->formatOptions($cell_options,',,cellpadding,cellspacing').
|
||||
$this->html->formatOptions($class,'class').
|
||||
($type != 'groupbox' && $cell['name'] ? ' id="'.$form_name.'"' : '').
|
||||
($type != 'groupbox' ? $this->html->formatOptions($class,'class').
|
||||
($cell['name'] ? ' id="'.$form_name.'"' : '') : '').
|
||||
($cell['align'] && $orient != 'horizontal' || $sub_cell_has_align ? ' width="100%"' : '')); // alignment only works if table has full width
|
||||
$class = ''; // otherwise we create an extra div
|
||||
if ($type != 'groupbox') $class = ''; // otherwise we create an extra div
|
||||
}
|
||||
// put the class of the box-cell, into the the class of this cell
|
||||
elseif ($box_item_class && $box_anz == 1)
|
||||
@ -1445,7 +1457,9 @@
|
||||
{
|
||||
$label = lang($label);
|
||||
}
|
||||
$html = $this->html->fieldset($html,$label,$cell['name'] ? ' id="'.$form_name.'"' : '');
|
||||
$html = $this->html->fieldset($html,$label,($cell['name'] ? ' id="'.$form_name.'"' : '').
|
||||
($class ? ' class="'.$class.'"' : ''));
|
||||
$class = ''; // otherwise we create an extra div
|
||||
}
|
||||
elseif (!$orient)
|
||||
{
|
||||
|
@ -313,6 +313,7 @@
|
||||
{
|
||||
$xul_grid =& new xmlnode('grid');
|
||||
$this->set_attributes($xul_grid,'width,height,border,class,spacing,padding,overflow',$grid['size']);
|
||||
$this->set_attributes($xul_grid,'id',$grid['name']);
|
||||
|
||||
$xul_columns =& new xmlnode('columns');
|
||||
$xul_rows =& new xmlnode('rows');
|
||||
@ -385,7 +386,7 @@
|
||||
if ($etempl->style != '')
|
||||
{
|
||||
$styles =& new xmlnode('styles');
|
||||
$styles->set_value($etempl->style);
|
||||
$styles->set_value(str_replace("\r",'',$etempl->style));
|
||||
$template->add_node($styles);
|
||||
}
|
||||
$this->xul_overlay->add_node($template);
|
||||
|
File diff suppressed because one or more lines are too long
@ -16,6 +16,7 @@
|
||||
a pattern to be searched for etemplate de ein Muster nach dem gesucht werden soll
|
||||
accesskey etemplate de Tastaturkürzel
|
||||
accesskeys can also be specified with an & in the label (eg. &name) etemplate de Ein Tastaturkürzel kann auch über ein & in der Beschriftung angegeben werden
|
||||
account contactdata etemplate de Kontaktdaten eines Benutzers
|
||||
add a new column (after the existing ones) etemplate de Neue Spalte hinzufügen (hinter den bestehenden)
|
||||
add a new entry of the selected application etemplate de Einen neuen Eintrag der ausgewählten Anwendung hinzufügen
|
||||
add a new multi-column index etemplate de Fügt einen mehrspaltigen Index hinzu
|
||||
@ -35,6 +36,7 @@ application etemplate de Anwendung
|
||||
application name needed to write a langfile or dump the etemplates !!! etemplate de Name der Anwendung benötigt um eine Sprachdatei oder eTemplate-Distibutionsdate zu schreiben !!!
|
||||
applies the changes made etemplate de übernimmt die Änderungen
|
||||
applies the changes to the given version of the template etemplate de übernimmt die Änderungen in die angegebene Version des Templates
|
||||
as default etemplate de als Vorgabe
|
||||
attach etemplate de Anhängen
|
||||
attach file etemplate de Datei anhängen
|
||||
baseline etemplate de Grundlinie
|
||||
@ -73,6 +75,8 @@ comment etemplate de Kommentar
|
||||
confirm etemplate de bestätigen
|
||||
confirmation message or custom javascript (returning true or false) etemplate de Bestätigungsmeldung oder spezielles Javascript (true oder false zurücklieferned)
|
||||
confirmation necesary or custom java-script etemplate de Bestätigung notwendig oder spezielles Javascript
|
||||
contact etemplate de Kontakt
|
||||
contact field to show etemplate de Kontaktfeld zum Anzeigen
|
||||
contact fields etemplate de Kontaktfelder
|
||||
contains etemplate de enthalten
|
||||
create a new table for the application etemplate de Neue Tabelle für die Anwendung anlegen
|
||||
@ -153,6 +157,7 @@ exchange this two columns etemplate de diese beiden Spalten austauschen
|
||||
export the loaded etemplate into a xml-file etemplate de das geladene eTemplate als XML Datei (.xet) exportieren
|
||||
export xml etemplate de XML Export
|
||||
extensions loaded: etemplate de Erweiterungen geladen:
|
||||
field etemplate de Feld
|
||||
field must not be empty !!! etemplate de Das Feld darf nicht leer sein !!!
|
||||
file etemplate de Datei
|
||||
file contains more than one etemplate, last one is shown !!! etemplate de Datei enthält mehr als ein eTemplate, das letzte wird angezeigt !!!
|
||||
@ -237,6 +242,7 @@ nextmatch etemplate de Nextmatch
|
||||
nextmatch accountfilter etemplate de Nextmatch Benutzerfilter
|
||||
nextmatch custom filterheader etemplate de Nextmatch freier Filterkopf
|
||||
nextmatch filterheader etemplate de Nextmatch Filterkopf
|
||||
nextmatch header etemplate de Nextmatch Spaltenkopf
|
||||
nextmatch sortheader etemplate de Nextmatch Sortierkopf
|
||||
no column to swap with !!! etemplate de Keine Spalte um damit zu tauschen !!!
|
||||
no file etemplate de keine Datei
|
||||
@ -280,6 +286,7 @@ remove this link (not the entry itself) etemplate de entfernt diese Verkn
|
||||
returns savely, without deleting etemplate de Abbruch, OHNE zu löschen
|
||||
right etemplate de Rechts
|
||||
row... etemplate de Zeile...
|
||||
save selected columns as default preference for all users. etemplate de Speichert die ausgewählten Spalten als Vorgabe für alle Benutzer.
|
||||
save the changes made and close the window etemplate de speichert die Änderungen uns schließt das Fenster
|
||||
save the etemplate under the above keys (name, ...), change them for a saveas etemplate de Speichert das eTemplate unter den obigen Schlüsseln (name, ...), ändern für ein Speichern unter
|
||||
saves changes to tables_current.inc.php etemplate de speichert die Änderungen in tables_current.inc.php
|
||||
@ -298,19 +305,23 @@ select an application, (*) = uninstalled etemplate de Anwendung ausw
|
||||
select an entry to link with etemplate de Eintrag zum Verküpfen auswählen
|
||||
select an table of the application etemplate de Tabelle der Anwendung auswählen
|
||||
select application etemplate de Anwendung auswählen
|
||||
select application to search etemplate de Anwendung zum Suchen auswählen
|
||||
select category etemplate de Kategorie auswählen
|
||||
select columns etemplate de Spalten auswählen
|
||||
select country etemplate de Land auswählen
|
||||
select day etemplate de Tag auswählen
|
||||
select day of week etemplate de Wochentag auswählen
|
||||
select entry etemplate de Eintrag auswählen
|
||||
select hour etemplate de Stunde auswählen
|
||||
select if content of field should not be translated (label gets always translated) etemplate de abhaken wenn Inhalt des Feldes nicht übersetzt werden soll (Beschriftung wird immer übersetzt)
|
||||
select language etemplate de Sprache auswählen
|
||||
select month etemplate de Monat auswählen
|
||||
select number etemplate de Zahl auswählen
|
||||
select one ... etemplate de Eine auswählen ...
|
||||
select percentage etemplate de Prozente auswählen
|
||||
select priority etemplate de Priorität auswählen
|
||||
select state etemplate de US-State auswählen
|
||||
select the columns to display in the list etemplate de Wählen Sie die Spalten aus, die in der Liste angezeigt werden sollen
|
||||
select the indexed columns in their desired order etemplate de Zu indizierende Spalten in der gewünchten Reihenfolge auswählen
|
||||
select this etemplate to delete it etemplate de dieses eTemplate zum Löschen auswählen
|
||||
select which accounts to show etemplate de Benutzer zum Anzeigen auswählen
|
||||
|
@ -16,6 +16,7 @@
|
||||
a pattern to be searched for etemplate en a pattern to be searched for
|
||||
accesskey etemplate en Accesskey
|
||||
accesskeys can also be specified with an & in the label (eg. &name) etemplate en Accesskeys can also be specified with an & in the label (eg. &Name)
|
||||
account contactdata etemplate en Account contactdata
|
||||
add a new column (after the existing ones) etemplate en Add a new column (after the existing ones)
|
||||
add a new entry of the selected application etemplate en Add a new entry of the selected application
|
||||
add a new multi-column index etemplate en Add a new multi-column index
|
||||
@ -35,6 +36,7 @@ application etemplate en Application
|
||||
application name needed to write a langfile or dump the etemplates !!! etemplate en Application name needed to write a langfile or dump the eTemplates !!!
|
||||
applies the changes made etemplate en applies the changes made
|
||||
applies the changes to the given version of the template etemplate en applies the changes to the given version of the template
|
||||
as default etemplate en as default
|
||||
attach etemplate en Attach
|
||||
attach file etemplate en attach file
|
||||
baseline etemplate en Baseline
|
||||
@ -73,6 +75,8 @@ comment etemplate en Comment
|
||||
confirm etemplate en confirm
|
||||
confirmation message or custom javascript (returning true or false) etemplate en confirmation message or custom javascript (returning true or false)
|
||||
confirmation necesary or custom java-script etemplate en confirmation necesary or custom java-script
|
||||
contact etemplate en Contact
|
||||
contact field to show etemplate en Contact field to show
|
||||
contact fields etemplate en Contact fields
|
||||
contains etemplate en contains
|
||||
create a new table for the application etemplate en Create a new table for the application
|
||||
@ -153,6 +157,7 @@ exchange this two columns etemplate en exchange this two columns
|
||||
export the loaded etemplate into a xml-file etemplate en export the loaded eTemplate into a xml-file
|
||||
export xml etemplate en Export XML
|
||||
extensions loaded: etemplate en Extensions loaded:
|
||||
field etemplate en Field
|
||||
field must not be empty !!! etemplate en Field must not be empty !!!
|
||||
file etemplate en File
|
||||
file contains more than one etemplate, last one is shown !!! etemplate en File contains more than one eTemplate, last one is shown !!!
|
||||
@ -237,6 +242,7 @@ nextmatch etemplate en Nextmatch
|
||||
nextmatch accountfilter etemplate en Nextmatch Accountfilter
|
||||
nextmatch custom filterheader etemplate en Nextmatch Custom Filterheader
|
||||
nextmatch filterheader etemplate en Nextmatch Filterheader
|
||||
nextmatch header etemplate en Nextmatch Header
|
||||
nextmatch sortheader etemplate en Nextmatch Sortheader
|
||||
no column to swap with !!! etemplate en no column to swap with !!!
|
||||
no file etemplate en no file
|
||||
@ -280,6 +286,7 @@ remove this link (not the entry itself) etemplate en Remove this link (not the e
|
||||
returns savely, without deleting etemplate en returns savely, WITHOUT deleting
|
||||
right etemplate en Right
|
||||
row... etemplate en Row...
|
||||
save selected columns as default preference for all users. etemplate en Save selected columns as default preference for all users.
|
||||
save the changes made and close the window etemplate en Save the changes made and close the window
|
||||
save the etemplate under the above keys (name, ...), change them for a saveas etemplate en save the eTemplate under the above keys (name, ...), change them for a SaveAs
|
||||
saves changes to tables_current.inc.php etemplate en saves changes to tables_current.inc.php
|
||||
@ -298,19 +305,23 @@ select an application, (*) = uninstalled etemplate en Select an application, (*)
|
||||
select an entry to link with etemplate en Select an entry to link with
|
||||
select an table of the application etemplate en Select an table of the application
|
||||
select application etemplate en Select Application
|
||||
select application to search etemplate en Select application to search
|
||||
select category etemplate en Select Category
|
||||
select columns etemplate en Select columns
|
||||
select country etemplate en Select Country
|
||||
select day etemplate en Select Day
|
||||
select day of week etemplate en select day of week
|
||||
select entry etemplate en Select entry
|
||||
select hour etemplate en Select hour
|
||||
select if content of field should not be translated (label gets always translated) etemplate en select if content of field should not be translated (label gets always translated)
|
||||
select language etemplate en Select Language
|
||||
select month etemplate en Select Month
|
||||
select number etemplate en Select Number
|
||||
select one ... etemplate en Select One ...
|
||||
select percentage etemplate en Select Percentage
|
||||
select priority etemplate en Select Priority
|
||||
select state etemplate en Select State
|
||||
select the columns to display in the list etemplate en Select the columns to display in the list
|
||||
select the indexed columns in their desired order etemplate en Select the indexed columns in their desired order
|
||||
select this etemplate to delete it etemplate en select this eTemplate to delete it
|
||||
select which accounts to show etemplate en select which accounts to show
|
||||
|
@ -1,5 +1,36 @@
|
||||
/* $Id$ */
|
||||
.redItalic { color: red; font-style: italic; }
|
||||
.gray { color: gray; }
|
||||
|
||||
/* Styles of the eT editor */
|
||||
.clickWidgetToEdit { cursor: pointer; display: inline; }
|
||||
.clickWidgetToEdit:hover { background-color: pink; }
|
||||
|
||||
/* Styles of the nextmatch widget */
|
||||
.activ_sortcolumn { font-weight: bold; }
|
||||
.inactiv_sortcolumn { font-weight: normal; }
|
||||
.lettersearch,.lettersearch_active {
|
||||
background-color: #D3DCE3;
|
||||
width: 25px;
|
||||
border: 1px solid #D3DCE3;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.lettersearch_active {
|
||||
font-weight: bold;
|
||||
background-color: #E8F0F0;
|
||||
}
|
||||
.lettersearch_active,.lettersearch:hover {
|
||||
border: 1px solid black;
|
||||
background-color: #E8F0F0;
|
||||
}
|
||||
.selectcols {
|
||||
position: relative;
|
||||
}
|
||||
.colselection {
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 16px;
|
||||
display: none;
|
||||
}
|
||||
|
BIN
etemplate/templates/default/images/selectcols.png
Normal file
BIN
etemplate/templates/default/images/selectcols.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 205 B |
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="etemplate.nextmatch_widget.nm_row" template="" lang="" group="0" version="1.3.001">
|
||||
<template id="etemplate.nextmatch_widget.nm_row" template="" lang="" group="0" version="1.3.002">
|
||||
<grid width="100%" spacing="0" padding="5">
|
||||
<columns>
|
||||
<column width="1%"/>
|
||||
@ -14,9 +14,10 @@
|
||||
<column/>
|
||||
<column width="1%"/>
|
||||
<column width="1%"/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
<row class="th" disabled="@no_columnselection">
|
||||
<button image="first.gif" ro_image="first-grey.gif" label="First" id="first" statustext="go to the first entry"/>
|
||||
<button image="left.gif" ro_image="left-grey.gif" label="Left" id="left" statustext="go to the previous page of entries"/>
|
||||
<menulist>
|
||||
@ -35,6 +36,18 @@
|
||||
</menulist>
|
||||
<button image="right.gif" ro_image="right-grey.gif" label="Right" id="right" statustext="go to the next page of entries"/>
|
||||
<button image="last.gif" ro_image="last-grey.gif" label="Last" id="last" statustext="go to the last entry"/>
|
||||
<box class="selectcols">
|
||||
<button image="selectcols" label="Select columns" statustext="Select the columns to display in the list" onclick="document.getElementById(form::name('colselection')).style.display=document.getElementById(form::name('colselection')).style.display=='block' ? 'none' : 'block'; return false;"/>
|
||||
<groupbox class="colselection" id="colselection">
|
||||
<caption label="Select columns"/>
|
||||
<listbox rows="012" id="selectcols" statustext="Select the columns to display in the list" no_lang="1"/>
|
||||
<hbox>
|
||||
<button label="Save" id="savecols"/>
|
||||
<button id="cancel" label="Cancel" onclick="document.getElementById(form::name('colselection')).style.display='none'; return false;"/>
|
||||
<checkbox id="default_prefs" label="as default" statustext="Save selected columns as default preference for all users."/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</box>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
@ -92,6 +105,16 @@
|
||||
border: 1px solid black;
|
||||
background-color: #E8F0F0;
|
||||
}
|
||||
.selectcols {
|
||||
position: relative;
|
||||
}
|
||||
.colselection {
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 16px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
</styles>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user