- allow to specify to use selectbox, instead of category selection for category

- allow to specify name of action (infolog already uses 'action')
This commit is contained in:
Ralf Becker 2011-05-06 18:10:50 +00:00
parent 8e2479499b
commit 366aa7c05a
4 changed files with 48 additions and 37 deletions

View File

@ -25,6 +25,7 @@
* 'no_filter2' => True// I disable the 2. filter (params are the same as for filter)
* 'no_cat' => True// I disable the cat-selectbox
* 'cat_app' => // I application the cat's should be from, default app in get_rows
* 'cat_is_select' => // I true||'no_lang' use selectbox instead of category selection, default null
* 'template' => // I template to use for the rows, if not set via options
* 'header_left' => // I template to show left of the range-value, left-aligned (optional)
* 'header_right' => // I template to show right of the range-value, right-aligned (optional)
@ -60,6 +61,7 @@
* 'actions' => // I array with actions, see nextmatch_widget::egw_actions
* 'action_links' => // I array with enabled actions or ones which should be checked if they are enabled
* optional, default id of all first level actions plus the ones with enabled='javaScript:...'
* 'action_var' => 'action' // I name of var to return choosen action, default 'action'
* 'action' => // O string selected action
* 'selected' => // O array with selected id's
* 'checkboxes' => // O array with checkbox id as key and boolean checked value
@ -372,6 +374,12 @@ class nextmatch_widget
// keep the editor away from the generated tmpls
$nextmatch->no_onclick = true;
// category is a selectbox, not a category select widget
if ($value['cat_is_select'] && ($cat_widget =& $nextmatch->get_widget_by_name('cat_id')))
{
$cat_widget['type'] = 'select';
if ($value['cat_is_select'] == 'no_lang') $cat_widget['no_lang'] = true;
}
if ($value['lettersearch'])
{
$lettersearch =& $nextmatch->get_widget_by_name('lettersearch'); // hbox for the letters
@ -517,7 +525,8 @@ class nextmatch_widget
$value['rows']['_row_id'] =& $value['row_id'];
// values are NOT yet used on client side, but give warnings if array are not converted to strings
$value['action'] = $value['checkboxes'] = $value['selected'] = '';
$extension_data['action_var'] = !empty($value['action_var']) ? $value['action_var'] : 'action';
$value[$extension_data['action_var']] = $value['checkboxes'] = $value['selected'] = '';
/*
$selected = $checkboxes = array();
foreach((array)$values['selected'] as $id)
@ -604,6 +613,8 @@ class nextmatch_widget
'delete' => 'delete',
'cat' => 'attach', // add as category icon to api
'document' => 'etemplate/merge',
'print'=> 'print',
'copy' => 'copy',
);
$first_level = !$action_links; // add all first level actions
@ -1345,8 +1356,8 @@ class nextmatch_widget
{
self::csv_export($extension_data);
}
// allows return selected as array
$value[$extension_data['action_var']] = $value['nm_action']; //unset($value['nm_action']);
$value['selected'] = $value['selected'] === '' ? array() : boetemplate::csv_split($value['selected']);
$checkboxes = $value['checkboxes'];
$value['checkboxes'] = array();

View File

@ -156,7 +156,7 @@ function nm_action(_action, _senders)
checkboxes_elem.value += checkboxes[i].id + ":" + (checkboxes[i].checked ? "1" : "0") + ";";
var form = document.getElementsByName("eTemplate")[0];
document.getElementById('exec[nm][action]').value = _action.id;
document.getElementById('exec[nm][nm_action]').value = _action.id;
document.getElementById('exec[nm][selected]').value = ids;
if (typeof _action.data.button != 'undefined')
{

View File

@ -1,14 +1,14 @@
<?php
/**
* eGroupWare - eTemplates for Application etemplate
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2011-04-27 09:40
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
* @subpackage setup
* @version $Id$
*/
* EGroupware - eTemplates for Application etemplate
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2011-05-06 19:47
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
* @subpackage setup
* @version $Id$
*/
$templ_version=1;
@ -143,7 +143,7 @@ $templ_data[] = array('name' => 'etemplate.link_widget.to','template' => '','lan
.type_hide { display: none; }
.hide_comment input { display: none; width: 99%; }','modified' => '1260292296',);
$templ_data[] = array('name' => 'etemplate.nextmatch_widget','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:4:{i:0;a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:6:"action";}i:1;a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:8:"selected";}i:2;a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:10:"checkboxes";}i:3;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:8:{s:1:"A";s:3:"35%";s:1:"C";s:3:"35%";s:2:"c1";s:7:"noPrint";s:2:"c2";s:7:"noPrint";s:2:"c5";s:7:"noPrint";s:2:"h5";s:13:",!@bottom_too";s:2:"h3";s:15:",!@lettersearch";s:2:"c3";s:7:"noPrint";}i:1;a:3:{s:1:"A";a:2:{s:4:"type";s:8:"template";s:4:"name";s:12:"@header_left";}s:1:"B";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:5:"align";s:6:"center";i:1;a:4:{s:4:"type";s:5:"label";s:5:"label";s:7:"showing";s:7:"no_lang";s:1:"1";s:4:"name";s:5:"range";}i:2;a:4:{s:4:"type";s:5:"label";s:5:"label";s:2:"of";s:7:"no_lang";s:1:"1";s:4:"name";s:5:"total";}s:4:"span";s:16:",nextmatch-range";}s:1:"C";a:3:{s:4:"type";s:8:"template";s:5:"align";s:5:"right";s:4:"name";s:13:"@header_right";}}i:2;a:3:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"span";s:3:"all";s:5:"align";s:6:"center";s:4:"name";s:33:"etemplate.nextmatch_widget.nm_row";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:8:"onchange";s:1:"1";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:3;a:3:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";s:4:"span";s:3:"all";s:4:"name";s:12:"lettersearch";i:1;a:6:{s:4:"type";s:5:"label";s:5:"label";s:3:"All";s:5:"align";s:5:"right";s:4:"name";s:3:"all";s:6:"needed";s:1:"1";s:4:"span";s:20:",lettersearch_active";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:4;a:3:{s:1:"A";a:5:{s:4:"type";s:8:"template";s:4:"size";s:4:"rows";s:4:"span";s:20:"all,egwGridView_grid";s:5:"align";s:6:"center";s:4:"name";s:9:"@template";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:5;a:3:{s:1:"A";a:5:{s:4:"type";s:8:"template";s:4:"size";s:6:"bottom";s:4:"span";s:3:"all";s:5:"align";s:6:"center";s:4:"name";s:33:"etemplate.nextmatch_widget.nm_row";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:5;s:4:"cols";i:3;s:4:"size";s:4:"100%";}}','size' => '100%','style' => '','modified' => '1155978375',);
$templ_data[] = array('name' => 'etemplate.nextmatch_widget','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:4:{i:0;a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:9:"nm_action";}i:1;a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:8:"selected";}i:2;a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:10:"checkboxes";}i:3;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:8:{s:1:"A";s:3:"35%";s:1:"C";s:3:"35%";s:2:"c1";s:7:"noPrint";s:2:"c2";s:7:"noPrint";s:2:"c5";s:7:"noPrint";s:2:"h5";s:13:",!@bottom_too";s:2:"h3";s:15:",!@lettersearch";s:2:"c3";s:7:"noPrint";}i:1;a:3:{s:1:"A";a:2:{s:4:"type";s:8:"template";s:4:"name";s:12:"@header_left";}s:1:"B";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:5:"align";s:6:"center";i:1;a:4:{s:4:"type";s:5:"label";s:5:"label";s:7:"showing";s:7:"no_lang";s:1:"1";s:4:"name";s:5:"range";}i:2;a:4:{s:4:"type";s:5:"label";s:5:"label";s:2:"of";s:7:"no_lang";s:1:"1";s:4:"name";s:5:"total";}s:4:"span";s:16:",nextmatch-range";}s:1:"C";a:3:{s:4:"type";s:8:"template";s:5:"align";s:5:"right";s:4:"name";s:13:"@header_right";}}i:2;a:3:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"span";s:3:"all";s:5:"align";s:6:"center";s:4:"name";s:33:"etemplate.nextmatch_widget.nm_row";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:8:"onchange";s:1:"1";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:3;a:3:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";s:4:"span";s:3:"all";s:4:"name";s:12:"lettersearch";i:1;a:6:{s:4:"type";s:5:"label";s:5:"label";s:3:"All";s:5:"align";s:5:"right";s:4:"name";s:3:"all";s:6:"needed";s:1:"1";s:4:"span";s:20:",lettersearch_active";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:4;a:3:{s:1:"A";a:5:{s:4:"type";s:8:"template";s:4:"size";s:4:"rows";s:4:"span";s:20:"all,egwGridView_grid";s:5:"align";s:6:"center";s:4:"name";s:9:"@template";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:5;a:3:{s:1:"A";a:5:{s:4:"type";s:8:"template";s:4:"size";s:6:"bottom";s:4:"span";s:3:"all";s:5:"align";s:6:"center";s:4:"name";s:33:"etemplate.nextmatch_widget.nm_row";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:5;s:4:"cols";i:3;s:4:"size";s:4:"100%";}}','size' => '100%','style' => '','modified' => '1155978375',);
$templ_data[] = array('name' => 'etemplate.nextmatch_widget.header_only','template' => '','lang' => '','group' => '0','version' => '0.9.15.002','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:1:"A";s:3:"50%";s:1:"B";s:3:"50%";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:8:"template";s:4:"name";s:12:"@header_left";}s:1:"B";a:3:{s:4:"type";s:8:"template";s:5:"align";s:5:"right";s:4:"name";s:13:"@header_right";}}i:2;a:2:{s:1:"A";a:5:{s:4:"type";s:8:"template";s:4:"size";s:4:"rows";s:4:"span";s:3:"all";s:5:"align";s:6:"center";s:4:"name";s:9:"@template";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:2;s:4:"size";s:4:"100%";}}','size' => '100%','style' => '.activ_sortcolumn { color: red; font-weight: bold; }
.inactiv_sortcolumn { color: green; font-weight: normal; }','modified' => '1075985789',);

View File

@ -19,43 +19,43 @@
</columns>
<rows>
<row class="th" part="header">
<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"/>
<button statustext="go to the first entry" label="First" id="first" image="first.gif" ro_image="first-grey.gif"/>
<button statustext="go to the previous page of entries" label="Left" id="left" image="left.gif" ro_image="left-grey.gif"/>
<menulist>
<menupopup type="select-cat" options="-1,,,$cont[cat_app],$cont[cat_parent]" label="Category" id="cat_id" onchange="1" statustext="select a Category" align="center"/>
<menupopup type="select-cat" align="center" statustext="select a Category" label="Category" id="cat_id" onchange="1" options="-1,,,$cont[cat_app],$cont[cat_parent]"/>
</menulist>
<menulist>
<menupopup label="@filter_label" align="center" id="filter" onchange="@filter_onchange" statustext="@filter_help"/>
<menupopup align="center" statustext="@filter_help" label="@filter_label" id="filter" onchange="@filter_onchange"/>
</menulist>
<menulist>
<menupopup label="@filter2_label" align="center" id="filter2" onchange="@filter2_onchange" statustext="@filter2_help"/>
<menupopup align="center" statustext="@filter2_help" label="@filter2_label" id="filter2" onchange="@filter2_onchange"/>
</menulist>
<textbox align="right" id="search" onchange="1" statustext="a pattern to be searched for" size="12"/>
<button label="Search" id="start_search" statustext="to start the search"/>
<textbox align="right" statustext="a pattern to be searched for" id="search" onchange="1" size="12"/>
<button statustext="to start the search" label="Search" id="start_search"/>
<menulist class="nm_num_rows">
<menupopup id="num_rows" no_lang="1" onchange="1" statustext="How many entries should the list show"/>
<menupopup statustext="How many entries should the list show" id="num_rows" no_lang="1" onchange="1"/>
</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"/>
<button statustext="go to the next page of entries" label="Right" id="right" image="right.gif" ro_image="right-grey.gif"/>
<button statustext="go to the last entry" label="Last" id="last" image="last.gif" ro_image="last-grey.gif"/>
<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">
<button statustext="Select the columns to display in the list" label="Select columns" onclick="document.getElementById(form::name('colselection')).style.display=document.getElementById(form::name('colselection')).style.display=='block' ? 'none' : 'block'; return false;" image="selectcols"/>
<groupbox id="colselection" class="colselection">
<caption label="Select columns"/>
<listbox rows="012" id="selectcols" statustext="Select the columns to display in the list" no_lang="1"/>
<listbox statustext="Select the columns to display in the list" id="selectcols" no_lang="1" rows="012"/>
<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."/>
<button label="Cancel" id="cancel" onclick="document.getElementById(form::name('colselection')).style.display='none'; return false;"/>
<checkbox statustext="Save selected columns as default preference for all users." label="as default" id="default_prefs"/>
</hbox>
</groupbox>
</box>
<button id="export" image="filesave" label="CSV Export"/>
<button label="CSV Export" id="export" image="filesave"/>
</row>
</rows>
</grid>
</template>
<template id="etemplate.nextmatch_widget" template="" lang="" group="0" version="1.9.001">
<hidden id="action"/>
<hidden id="nm_action"/>
<hidden id="selected"/>
<hidden id="checkboxes"/>
<grid width="100%">
@ -68,26 +68,26 @@
<row class="noPrint">
<template id="@header_left"/>
<hbox align="center" class="nextmatch-range">
<description value="showing" no_lang="1" id="range"/>
<description value="of" no_lang="1" id="total"/>
<description value="showing" id="range" no_lang="1"/>
<description value="of" id="total" no_lang="1"/>
</hbox>
<template align="right" id="@header_right"/>
</row>
<row class="noPrint">
<template span="all" align="center" id="etemplate.nextmatch_widget.nm_row"/>
<template align="center" id="etemplate.nextmatch_widget.nm_row" span="all"/>
</row>
<row class="noPrint" disabled="!@lettersearch">
<hbox span="all" id="lettersearch">
<description value="All" align="right" id="all" needed="1" class="lettersearch_active"/>
<hbox id="lettersearch" span="all">
<description align="right" value="All" id="all" needed="1" class="lettersearch_active"/>
</hbox>
</row>
<row>
<template content="rows" span="all" class="egwGridView_grid" align="center" id="@template"/>
<template align="center" id="@template" content="rows" span="all" class="egwGridView_grid"/>
<description/>
<description/>
</row>
<row class="noPrint" disabled="!@bottom_too">
<template content="bottom" span="all" align="center" id="etemplate.nextmatch_widget.nm_row"/>
<template align="center" id="etemplate.nextmatch_widget.nm_row" content="bottom" span="all"/>
</row>
</rows>
</grid>