new sub-type for the nextmatch widget: custom filter. It allows to use any (select-)widget (specified as 1. option) as filterheader for the nextmatch widget. The accountfilter is now only a special case for the customfilter or filterheader.

This commit is contained in:
Ralf Becker 2006-09-12 15:14:39 +00:00
parent aeb51ceee2
commit 03a7efb8a0
2 changed files with 26 additions and 25 deletions

View File

@ -886,14 +886,15 @@ function index($content = 0)
</td>
</tr>
<tr>
<td><b>Nextmatch-<br />SortHeader</b><p><b>Nextmatch-<br />FilterHeader</b><p><b>Nextmatch-<br />AccountFilter</b></td>
<td><b>Nextmatch-<br />SortHeader</b><p><b>Nextmatch-<br />FilterHeader</b><p><b>Nextmatch-<br />Custom FilterHeader</b><p><b>Nextmatch-<br />AccountFilter</b></td>
<td>
&lt;nextmatch type="nextmatch-sortheader" id="col-name" options="DESC" label="ColLabel"/><p>
&lt;nextmatch type="nextmatch-filterheader" id="col-name"/><p>
&lt;nextmatch type="nextmatch-customfilter" id="col-name" options="select-precent"/><p>
&lt;nextmatch type="nextmatch-accountfilter" id="col-name"/>
</td>
<td>no</td>
<td>nextmatch-<br />sortheader<p>nextmatch-<br />filterheader<p>nextmatch-<br />accountfilter</td>
<td>nextmatch-<br />sortheader<p>nextmatch-<br />filterheader<p>nextmatch-<br />customfilter<p>nextmatch-<br />accountfilter</td>
<td>
These widget are an optional part of the nextmatch widget.<p>
<b>nextmatch-sortheader</b><br />
@ -907,10 +908,13 @@ function index($content = 0)
(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>
<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. In all other aspects
it is identical to the filterheader.<p>
<i><u>Note</u>:</i> All three widgets interoperate with the nextmatch-widget which passes the set values as part if
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>
<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>
</tr>

View File

@ -66,10 +66,11 @@
* @var array
*/
var $human_name = array(
'nextmatch' => 'Nextmatch',
'nextmatch-sortheader' => 'Nextmatch Sortheader',
'nextmatch-filterheader' => 'Nextmatch Filterheader',
'nextmatch' => 'Nextmatch',
'nextmatch-sortheader' => 'Nextmatch Sortheader',
'nextmatch-filterheader' => 'Nextmatch Filterheader',
'nextmatch-accountfilter' => 'Nextmatch Accountfilter',
'nextmatch-customfilter' => 'Nextmatch Custom Filterheader',
);
/**
@ -139,8 +140,15 @@
}
return True;
case 'nextmatch-accountfilter': // Option: as for selectbox: [extra-label(default ALL)[,#lines(default 1)]]
$cell['size'] = 'select-account,'.$cell['size'];
// fall through
case 'nextmatch-customfilter': // Option: widget-name, options as for selectbox
list($type,$cell['size']) = explode(',',$cell['size'],2);
// fall through
case 'nextmatch-filterheader': // Option: as for selectbox: [extra-label(default ALL)[,#lines(default 1)]]
$cell['type'] = 'select';
if (!$type) $type = 'select';
$cell['type'] = $type;
if (!$cell['size'])
{
$cell['size'] = 'All';
@ -152,21 +160,6 @@
$cell['onchange'] = $cell['noprint'] = True;
$extension_data['old_value'] = $value = $nm_global['col_filter'][$this->last_part($name)];
return True;
case 'nextmatch-accountfilter': // Option: as for selectbox: [extra-label(default ALL)[,#lines(default 1)]]
$cell['type'] = 'select-account';
$cell['name'] .= '[account]';
if (!$cell['size'])
{
$cell['size'] = 'All';
}
if (!$cell['help'])
{
$cell['help'] = 'select which accounts to show';
}
$cell['onchange'] = $cell['noprint'] = True;
$extension_data['old_value'] = $value = $nm_global['col_filter'][$this->last_part($name)];
return True;
}
if (!$value['filter_onchange']) $value['filter_onchange'] = 'this.form.submit();';
if (!$value['filter2_onchange']) $value['filter2_onchange'] = 'this.form.submit();';
@ -365,6 +358,9 @@
//echo "<p>nextmatch_widget.post_process(type='$extension_data[type]', name='$name',value_in=".print_r($value_in,true).",order='$nm_global[order]'): value = "; _debug_array($value);
switch($extension_data['type'])
{
case 'nextmatch':
break;
case 'nextmatch-sortheader':
if ($value_in)
{
@ -373,9 +369,10 @@
}
return False; // dont report value back, as it's in the wrong location (rows)
default:
case 'select-account': // used by nextmatch-accountfilter
case 'nextmatch-filterheader':
if ($value_in != $extension_data['old_value'] && !(!$value_in && !$extension_data['old_value']))
if ((string)$value_in != (string)$extension_data['old_value'])
{
//echo "<p>setting nm_global[filter][".$this->last_part($name)."]='$value_in' (was '$extension_data[old_value]')</p>\n";
$nm_global['filter'][$this->last_part($name)] = $value_in;