added <listbox> tag for multiline-selects,

moved attributs from <menupopup> to <menulist> (execpt options and id)
added several options for the predefined phpgw selects like cats or accounts
changed the referenz.html accourdingly
This commit is contained in:
Ralf Becker 2002-09-17 09:13:29 +00:00
parent 3b3e08f1aa
commit c51cbb2ae3
3 changed files with 90 additions and 40 deletions

View File

@ -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 <span>// et_media.show.rows uses this, as we put 'entry' in the size-field</span>
'entry' => $entry <span>// et_media.show.rows uses this, as we put 'entry' in the Options-field</span>
);
$this->tmpl->read('et_media.show'); <span>// read the show-template</span>
@ -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.
<li>$content contains again 'msg' which we set to the number of entris found and the above array with the data of all rows under
the key 'entry', as we put that in Size for the field loading the sub-template 'et_media.show.rows'. It not necessary to
put something in Size-field / use a sub-array for a sub-template, but it can be very helpful to organize a complex content-array.
(As an exercice you can remove 'entry' from the Size-field and change the function arrcordingly).
the key 'entry', as we put that in Options for the field loading the sub-template 'et_media.show.rows'. It not necessary to
put something in Options-field / use a sub-array for a sub-template, but it can be very helpful to organize a complex content-array.
(As an exercice you can remove 'entry' from the Options-field and change the function arrcordingly).
<li>we now explizitly read the template 'et_media.show' (the constructor reed 'et_media.edit') and execute it again with
the edit function as callback (because of that, show does NOT need to be listed in public_functions)
<li>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).
</ol>
<p>To call the show function, we need to make some changes to the edit-function too:</p>

View File

@ -45,7 +45,7 @@ an eTemplate from the example app in the <a href="etemplate.html">Tutorial</a>
&lt;/columns>
&lt;rows>
&lt;row>
&lt;description size="ib" span="all" value="eTemplates MediaDB" no_lang="1" id="msg"/>
&lt;description options="ib" span="all" value="eTemplates MediaDB" no_lang="1" id="msg"/>
&lt;/row>
&lt;row>
&lt;hrule span="all"/>
@ -197,7 +197,7 @@ implement only a subset of XUL. Here are the main differences:</p>
</td>
</tr>
<tr>
<td><b>Size</b></td>
<td><b>Options</b></td>
<td>?</td>
<td>?</td>
<td>size</td>
@ -340,7 +340,7 @@ implement only a subset of XUL. Here are the main differences:</p>
<b>a textual label</b><br>
The content is taken from the content-array but it can have an own label from
the label attribute too.<p>
<b>Size</b>: if it contains a 'i' and/or a 'b' the content (not the label) is rendered
<b>Options</b>: if it contains a 'i' and/or a 'b' the content (not the label) is rendered
in italic and/or bold.
</td>
</tr>
@ -352,7 +352,7 @@ implement only a subset of XUL. Here are the main differences:</p>
<td>
<b>a single-line input field for text</b><br>
In the html-UI this is rendered as &lt;input ...><p>
<b>Size</b> has 2 comma-separated fields:<br>
<b>Options</b> has 2 comma-separated fields:<br>
xml: <b>size</b>: the length in chars of the input-field<br>
xml: <b>maxlength</b>: the maximum length of the input
</td>
@ -366,7 +366,7 @@ implement only a subset of XUL. Here are the main differences:</p>
<b>a input-field to enter an integer</b><br>
In the html-UI this is rendered as &lt;input ...>. <i>There are no checks implemented at the moment,
but the will come in the near future.</i><p>
<b>Size</b> has 3 comma-separated fields:<br>
<b>Options</b> has 3 comma-separated fields:<br>
xml: <b>min</b>: minimum value, default none<br>
xml: <b>max</b>: maximum value, default none<br>
xml: <b>size</b>: 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:</p>
<b>a input-field to enter a float</b><br>
In the html-UI this is rendered as &lt;input ...>. <i>There are no checks implemented at the moment,
but the will come in the near future.</i><p>
<b>Size</b> has 3 comma-separated fields:<br>
<b>Options</b> has 3 comma-separated fields:<br>
xml: <b>min</b>: minimum value, default none<br>
xml: <b>max</b>: maximum value, default none<br>
xml: <b>size</b>: 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:</p>
<td>
<b>a multiline input-field for text</b><br>
In the html-UI this is rendered as &lt;textarea ...>.<p>
<b>Size</b> has 2 comma-separated fields:<br>
<b>Options</b> has 2 comma-separated fields:<br>
xml: <b>cols</b>: the width of the field in chars<br>
xml: <b>rows</b>: the number of rows
</td>
@ -419,8 +419,8 @@ implement only a subset of XUL. Here are the main differences:</p>
<b>a widget in a group of which only one can be checked</b><br>
In the html-UI this is rendered as &lt;input type="radio" ...><br>
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 <b>Size</b>. 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 <b>Options</b>. If the value of the
content array at index name/id matches the options-field the radiobutton is marked 'checked'.
</td>
</tr>
<tr>
@ -444,7 +444,7 @@ implement only a subset of XUL. Here are the main differences:</p>
<td>
<b>a horizontal rule / line</b><br>
In the html-UI this is rendered as &lt;hr ...><br>
<b>Size</b> can contain a width of the rule, default is 100%
<b>Options</b> can contain a width of the rule, default is 100%
</td>
</tr>
<tr>
@ -455,8 +455,8 @@ implement only a subset of XUL. Here are the main differences:</p>
<td>
<b>a separate eTemplate to be loaded into this cell</b><br>
<b>Name</b> xml: <b>id</b>: the name of the etemplate to load<br>
<b>Size</b> xml: <b>content</b>: if set, the template uses an own sub-array
of the content array indexed by the value of size (if not the full
<b>Options</b> xml: <b>content</b>: 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.
</td>
@ -477,7 +477,9 @@ implement only a subset of XUL. Here are the main differences:</p>
<td>
&lt;menulist><br>
&nbsp; &lt;menupopup/><br>
&lt;/menulist><br>
&lt;/menulist><p>
<i>multiselect: <b>options</b> > 1</i><br>
&lt;listbox rows="#"/>
</td>
<td>yes</td>
<td>select</td>
@ -489,8 +491,15 @@ implement only a subset of XUL. Here are the main differences:</p>
<li>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
</ol>
<b>Size</b> xml: <b>size</b>: if set and > 1 the selectbox is a multiselection with size lines<br>
</td>
<b>Options</b> <i>in the editor</i>: if set and > 1 the selectbox is a multiselection with options number of lines<p>
xml: <b>rows</b>: <i>only for &lt;listbox></i>: number of rows to show<p>
xml: <b>type</b>: can be set to get several predefined select-contents, in that case you dont need to set
the content as descripted above: <br>
<b>select-cat</b>: Select a phpgw category, options can be set to -1 to get an additional 'All'<br>
<b>select-account</b>: Select a user and/or group, determined by the options-field:
'accounts' (default), 'groups', 'both'<br>
<b>select-percent, select-priority, select-access, select-country, select-state</b>: as you expect
by the name
</tr>
<tr>
<td><b>Tabs</b></td>

View File

@ -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 "<pre>\n" . htmlentities($xml) . "\n</pre>\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'];