From 07bec1fa34af9dc4167f326e7cb6d71904254cb0 Mon Sep 17 00:00:00 2001
From: Ralf Becker
<?xml version="1.0"?> +<!-- $Id$ --> <overlay> <grid id="et_media.edit" template="" lang="" group="" version="" width="100%"> <columns> @@ -456,7 +457,7 @@ implement only a subset of XUL. Here are the main differences:Template -<grid/> +<grid id="app.name" content="subarr"/> yes template @@ -470,7 +471,7 @@ implement only a subset of XUL. Here are the main differences: Image -<image/> +<image src="foo.gif" id="app.class.method"/> yes image @@ -483,10 +484,17 @@ implement only a subset of XUL. Here are the main differences: Selectbox <menulist>
- <menupopup/>
+ <menupopup id="name" options="Select one"/>
</menulist>multiselect: options > 1
- <listbox rows="#"/> + <listbox rows="#"/>+ Examples for predefined selectboxes:
+ <listbox type="select-cat" rows="5"/>
+ <menulist>
+ <menupopup type="select-account" options="All,both,2"/>
+ </menulist>+ +
yes select @@ -500,23 +508,29 @@ implement only a subset of XUL. Here are the main differences: Options in the editor: if set and > 1 the selectbox is a multiselection with options number of linesxml: rows: only for <listbox>: number of rows to show
+ xml options: only for <menupopup/>: textual label for a first Row, e.g. 'All' or 'None' + (id will be ''), additional attr see sub-types
xml: type: can be set to get several predefined select-contents, in that case you dont need to set - the content as descripted above:
- select-cat: Select a phpgw category, options can be set to -1 to get an additional 'All'
+ the content as descripted above (if set it too its in front of the predefined rows):
+ select-cat: Select a phpgw category
select-account: Select a user and/or group, determined by the options-field: - 'accounts' (default), 'groups', 'both'
+ ,{accounts(default)|groups|both},{0(only lid)|1(only names/default)|2(both)}
select-percent, select-priority, select-access, select-country, select-state: as you expect - by the name + by the name
+ select-year, select-month, select-day: options for year: ,start,end (start and end can be a number of + years from now or if > 100 a absolut year)+ Tabs - <tabbox> @@ -527,9 +541,111 @@ implement only a subset of XUL. Here are the main differences: The tab-widget is implemented as an extension, as html does not have a tab-widget.
+ <tabbox id="name">
<tabs>
- <tab/>
+ <tab label="Tab 1" statustext="Help"/>
+ ...
</tabs>
<tabpanels>
- <grid/>
+ <grid id="app.name.tab1"/>
+ ...
</tabpanels>
</tabbox>The following fields / attributes are in the Editor and internaly in the class separeted by '|', in the xml/xul-file the are attributes of each tab- or grid-tag:
- Label xml: label: the labels of the tabs
+ Label xml: label: the labels of the tabs eg. 'Tab 1|Tab 2|Tab 3'
Help xml: statustext: of the tabs
- Name xml: id: the names/ids of the eTemplates/grid's to fill the bodies of the tabs + Name xml: id: the names/ids of the eTemplates/grid's to fill the bodies of the tabs+ Demo: There is a demo availible: load 'etemplate.tab_widget.test' into the eTemplate editor and + run it with show. + +
+ NextMatch ++ <nextmatch options="notes.index.rows" id="nm"/> + +yes +tab ++ shows a table with some selectboxes, a search-field and arrows to scroll the table +
+ The nextmatch-widget is implemented as an extension.+ Options xml: options: name of the template to display the rows
+ Name xml: id: index into the content-array, it need to be pre-set with some information + for the nextmatch widget and it returns its content with it: ++ + +$content[$id] = array( // I = value set by the app, 0 = value on return / output, + 'get_rows' => // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' + 'filter_label' => // I label for filter (optional) + 'filter_help' => // I help-msg for filter (optional) + 'no_filter2' => True // I disable the 2. filter (params are the same as for filter) + 'template' => // I template to use for the rows, if not set via options + 'start' => // IO position in list + 'cat_id' => // IO category, if not 'no_cat' => True + 'search' => // IO search pattern + 'filter' => // IO filter, if not 'no_filter' => True + 'rows' => // O content set by callback + 'total' => // O the total number of entries +); + +/* + * example: the get_rows function from notes.bo.get_rows (has to be in public_functions !) + */ +function get_rows($query,&$rows,&$readonlys) +{ + $rows = $this->read($query['start'],$query['search'],$query['filter'],$query['cat_id']); + if (!is_array($rows)) + { + $rows = array( ); + } + else + { + array_unshift($rows,0); each($rows); // first entry is not used !!! + } + $readonlys = array( ); // set readonlys to enable/disable our edit/delete-buttons + while (list($n,$note) = each($rows)) + { + if (!$this->check_perms($this->grants[$note['owner_id']],PHPGW_ACL_EDIT)) + { + $readonlys["edit[$note[id]]"] = True; + } + if (!$this->check_perms($this->grants[$note['owner_id']],PHPGW_ACL_DELETE)) + { + $readonlys["delete[$note[id]]"] = True; + } + } + return $this->total_records; +} + +/* + * Example how the nextmatch-widget is used in notes.ui.index: + */ +function index($content = 0) +{ + if (!is_array($content)) + { + $content = array('nm' => $this->session_data); // restore settings from the session + } + if (isset($content['nm']['rows'])) // one of the buttons in the rows is pressed + { + $this->session_data = $values['nm']; // save the settings in the session + unset($this->session_data['rows']); // we dont want to save the content of the rows + $this->save_sessiondata(); + + if (isset($values['nm']['rows']['edit'])) + { + list($id) = each($values['nm']['rows']['edit']); + return $this->edit($id); + } + elseif (isset($values['nm']['rows']['delete'])) + { + list($id) = each($values['nm']['rows']['delete']); + return $this->delete($id); + } + } + $values['nm']['options-filter'] = array ( // set up the data for our filter + 'all' => 'Show all', + 'public' => 'Only yours', + 'private' => 'Private' + ); + $values['nm']['get_rows'] = 'notes.bo.get_rows'; + $values['nm']['no_filter2'] = True; // disable the 2. filter + + $this->tpl->read('notes.index'); + $this->tpl->exec('notes.ui.index',$values); +} +