diff --git a/etemplate/doc/etemplate.html b/etemplate/doc/etemplate.html
index 1db9a877a8..d5bf10e792 100644
--- a/etemplate/doc/etemplate.html
+++ b/etemplate/doc/etemplate.html
@@ -348,7 +348,7 @@ We are only lacking some way to show if we get more than one match on a search,
}
$content = array(
'msg' => sprintf($this->messages['anz_found'],count($found)),
- 'entry' => $entry // et_media.show.rows uses this, as we put 'entry' in the size-field
+ 'entry' => $entry // et_media.show.rows uses this, as we put 'entry' in the Options-field
);
$this->tmpl->read('et_media.show'); // read the show-template
@@ -363,13 +363,13 @@ We are only lacking some way to show if we get more than one match on a search,
The names in the data-row (last row) of 'et_media.show.rows' are like '${row}[name]'. Variable expansion is performed on each
name and expands that for the first row to '1[name]' which addresses the name in the first match.
as 'et_media.show.rows' contains only one data-row, but fieldnames with variables to expand, that row is autorepeated
- for as many data we put into the content array (or the sub-array if we used the Size-field).
+ for as many data we put into the content array (or the sub-array if we used the Options-field).
To call the show function, we need to make some changes to the edit-function too:
diff --git a/etemplate/doc/referenz.html b/etemplate/doc/referenz.html
index 91c74cdfc1..173ba690c3 100644
--- a/etemplate/doc/referenz.html
+++ b/etemplate/doc/referenz.html
@@ -45,7 +45,7 @@ an eTemplate from the example app in the Tutorial
</columns>
<rows>
<row>
- <description size="ib" span="all" value="eTemplates MediaDB" no_lang="1" id="msg"/>
+ <description options="ib" span="all" value="eTemplates MediaDB" no_lang="1" id="msg"/>
</row>
<row>
<hrule span="all"/>
@@ -197,7 +197,7 @@ implement only a subset of XUL. Here are the main differences:
- Size |
+ Options |
? |
? |
size |
@@ -340,7 +340,7 @@ implement only a subset of XUL. Here are the main differences:
a textual label
The content is taken from the content-array but it can have an own label from
the label attribute too.
- Size: if it contains a 'i' and/or a 'b' the content (not the label) is rendered
+ Options: if it contains a 'i' and/or a 'b' the content (not the label) is rendered
in italic and/or bold.
@@ -352,7 +352,7 @@ implement only a subset of XUL. Here are the main differences:
a single-line input field for text
In the html-UI this is rendered as <input ...>
- Size has 2 comma-separated fields:
+ Options has 2 comma-separated fields:
xml: size: the length in chars of the input-field
xml: maxlength: the maximum length of the input
|
@@ -366,7 +366,7 @@ implement only a subset of XUL. Here are the main differences:
a input-field to enter an integer
In the html-UI this is rendered as <input ...>. There are no checks implemented at the moment,
but the will come in the near future.
- Size has 3 comma-separated fields:
+ Options has 3 comma-separated fields:
xml: min: minimum value, default none
xml: max: maximum value, default none
xml: size: the length in chars of the input-field, default 5
@@ -381,7 +381,7 @@ implement only a subset of XUL. Here are the main differences:
a input-field to enter a float
In the html-UI this is rendered as <input ...>. There are no checks implemented at the moment,
but the will come in the near future.
- Size has 3 comma-separated fields:
+ Options has 3 comma-separated fields:
xml: min: minimum value, default none
xml: max: maximum value, default none
xml: size: the length in chars of the input-field, default 5
@@ -395,7 +395,7 @@ implement only a subset of XUL. Here are the main differences:
a multiline input-field for text
In the html-UI this is rendered as <textarea ...>.
- Size has 2 comma-separated fields:
+ Options has 2 comma-separated fields:
xml: cols: the width of the field in chars
xml: rows: the number of rows
|
@@ -419,8 +419,8 @@ implement only a subset of XUL. Here are the main differences:
a widget in a group of which only one can be checked
In the html-UI this is rendered as <input type="radio" ...>
Unlike XUL (and like html) the radio-buttons are grouped by giving them the same name / id.
- If it is checked, the value is set to what is entered in Size. If the value of the
- content array at index name/id matches size the radiobutton is marked 'checked'.
+ If it is checked, the value is set to what is entered in Options. If the value of the
+ content array at index name/id matches the options-field the radiobutton is marked 'checked'.
@@ -444,7 +444,7 @@ implement only a subset of XUL. Here are the main differences:
a horizontal rule / line
In the html-UI this is rendered as <hr ...>
- Size can contain a width of the rule, default is 100%
+ Options can contain a width of the rule, default is 100%
|
@@ -455,8 +455,8 @@ implement only a subset of XUL. Here are the main differences:
a separate eTemplate to be loaded into this cell
Name xml: id: the name of the etemplate to load
- Size xml: content: if set, the template uses an own sub-array
- of the content array indexed by the value of size (if not the full
+ Options xml: content: if set, the template uses an own sub-array
+ of the content array indexed by the value of this field (if not the full
content-array is used). Variables like $row can be used as descript
for the general attribute Name.
|
@@ -477,7 +477,9 @@ implement only a subset of XUL. Here are the main differences:
<menulist>
<menupopup/>
- </menulist>
+ </menulist>
+ multiselect: options > 1
+ <listbox rows="#"/>
|
yes |
select |
@@ -489,8 +491,15 @@ implement only a subset of XUL. Here are the main differences:
or in an separate array only for select-box-options under the index name, this array is passed
to the exec or show function of the etemplate-class
- Size xml: size: if set and > 1 the selectbox is a multiselection with size lines
-
+ Options in the editor: if set and > 1 the selectbox is a multiselection with options number of lines
+ xml: rows: only for <listbox>: number of rows to show
+ 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'
+ select-account: Select a user and/or group, determined by the options-field:
+ 'accounts' (default), 'groups', 'both'
+ select-percent, select-priority, select-access, select-country, select-state: as you expect
+ by the name
Tabs |
diff --git a/etemplate/inc/class.xul_io.inc.php b/etemplate/inc/class.xul_io.inc.php
index 2644feae75..c3598e244a 100644
--- a/etemplate/inc/class.xul_io.inc.php
+++ b/etemplate/inc/class.xul_io.inc.php
@@ -29,7 +29,8 @@
'span' => 'span,class',
'type' => '', // this is the widget-name => dont write as attr
'disabled' => 'disabled=true',
- 'readonly' => 'readonly=true'
+ 'readonly' => 'readonly=true',
+ 'size' => 'options'
);
$this->widget2xul = array( // how to translate widget-names and widget-spec. attr.
'label' => array(
@@ -56,7 +57,11 @@
'size' => 'min,max,size'
),
'select' => array(
- '.name' => 'menulist,menupopup'
+ '.name' => 'menulist,menupopup',
+ ),
+ 'select-multi' => array( // multiselection, if size > 0
+ '.name' => 'listbox',
+ 'size' => 'rows'
),
'template' => array(
'.name' => 'grid',
@@ -72,6 +77,7 @@
);
$this->xul2widget = array(
'menupopup' => 'select',
+ 'listbox' => 'select',
'description' => 'label'
);
}
@@ -149,15 +155,21 @@
{
list(,$type) = each($type);
}
+ if (substr($type,0,6) == 'select')
+ {
+ $type = $cell['size'] > 1 ? 'select-multi' : 'select';
+ }
$widgetattr2xul = isset($this->widget2xul[$type]) ? $this->widget2xul[$type] : array();
$type = isset($widgetattr2xul['.name']) ? $widgetattr2xul['.name'] : $type;
list($parent,$child,$child2) = explode(',',$type);
- $widget = new xmlnode($child ? $child : $parent);
+ $widget = new xmlnode($parent);
+ if ($child)
+ {
+ $child = new xmlnode($child);
+ }
if ($child2)
{
$child2 = new xmlnode($child2);
- $child = $widget;
- $widget = new xmlnode($parent);
}
if (isset($widgetattr2xul['.set'])) // set default-attr for type
{
@@ -168,8 +180,9 @@
$widget->set_attribute($attr,$val);
}
}
- if ($parent == 'tabbox')
+ switch ($parent)
{
+ case 'tabbox':
$labels = explode('|',$cell['label']); unset($cell['label']);
$helps = explode('|',$cell['help']); unset($cell['help']);
$names = explode('|',$cell['name']); unset($cell['name']);
@@ -184,6 +197,24 @@
$grid->set_attribute('id',$names[$n]);
$child2->add_node($grid);
}
+ break;
+ case 'menulist': // id,options belongs to the 'menupopup' child
+ $child->set_attribute('id',$cell['name']); unset($cell['name']);
+ if (isset($cell['size']) && $cell['size'] != '')
+ {
+ $child->set_attribute('options',$cell['size']); unset($cell['size']);
+ }
+ if ($cell['type'] != 'select') // one of the sub-types
+ {
+ $child->set_attribute('type',$cell['type']);
+ }
+ break;
+ case 'menulist':
+ if ($cell['type'] != 'select') // one of the sub-types
+ {
+ $widget->set_attribute('type',$cell['type']);
+ }
+ break;
}
while (list($attr,$val) = each($cell))
{
@@ -201,21 +232,15 @@
}
$this->set_attributes($widget,$attr,$val,&$spanned);
}
- if ($child && !$child2)
+ if ($child)
{
- $parent = new xmlnode($parent);
- $parent->add_node($widget);
- $xul_row->add_node($parent);
+ $widget->add_node($child);
}
- else
+ if ($child2)
{
- if ($child2)
- {
- $widget->add_node($child);
- $widget->add_node($child2);
- }
- $xul_row->add_node($widget);
+ $widget->add_node($child2);
}
+ $xul_row->add_node($widget);
}
$xul_rows->add_node($xul_row);
}
@@ -233,7 +258,7 @@
$doc->add_root($xul_overlay);
$xml = $doc->dump_mem();
- if ($this->debug)
+ //if ($this->debug)
{
echo "\n" . htmlentities($xml) . "\n
\n";
}
@@ -271,11 +296,15 @@
{
$attr['name'] = $attr['id']; unset($attr['id']);
}
+ if (isset($attr['options']) && $attr['options'] != '')
+ {
+ $attr['size'] = $attr['options']; unset($attr['options']);
+ }
if ($tag == 'grid' && $type == 'complete' && !is_array($tab_attr))
{
$tag = 'template';
}
- if ($tag != 'textbox')
+ if ($tag != 'textbox' && !isset($attr['type']))
{
$attr['type'] = $this->xul2widget[$tag] ? $this->xul2widget[$tag] : $tag;
}
@@ -311,7 +340,6 @@
break;
case 'columns':
case 'rows':
- case 'menulist':
break;
case 'column':
if ($type != 'complete')
@@ -367,6 +395,9 @@
$tab_helps[] = $attr['statustext'];
}
break;
+ case 'menulist':
+ $menulist_attr = $attr; // save for following menupopup
+ break;
case 'textbox':
if ($attr['multiline'])
{
@@ -404,6 +435,16 @@
$attr['label'] = $attr['src'];
unset($attr['src']);
break;
+ case 'listbox':
+ $attr['size'] = $attr['rows'];
+ unset($attr['rows']);
+ break;
+ case 'menupopup':
+ if (is_array($menulist_attr))
+ {
+ $attr += $menulist_attr;
+ }
+ break;
}
$attr['help'] = $attr['statustext']; unset($attr['statustext']);
$spanned = $attr['span'] == 'all' ? $etempl->cols - $col : $attr['span'];