From 018e340ac9f0fc9c4b0bd180bd195e7c0fbd3c0e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 5 Aug 2008 09:39:24 +0000 Subject: [PATCH] =?utf8?q?Multibox:=20Einen=20weiteren=20Parameter=20erg?= =?utf8?q?=C3=A4nzt,=20mit=20dem=20gesteuert=20wird,=20ob=20=C3=BCberhaupt?= =?utf8?q?=20zugelassen=20werden=20soll,=20dass=20ein=20Textfeld=20anstell?= =?utf8?q?e=20einer=20Drop-Down-Box=20angezeigt=20wird,=20ohne=20dass=20ma?= =?utf8?q?n=20daf=C3=BCr=20explizit=20mit=20limit=20rumspielen=20muss.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- templates/webpages/generic/multibox.html | 45 ++++++++++--------- templates/webpages/oe/form_header_de.html | 17 +++---- templates/webpages/oe/form_header_master.html | 17 +++---- 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/templates/webpages/generic/multibox.html b/templates/webpages/generic/multibox.html index 018c1c988..b1c615ecd 100644 --- a/templates/webpages/generic/multibox.html +++ b/templates/webpages/generic/multibox.html @@ -6,39 +6,40 @@ decides wether it should be a text field or a drop down box, generates the HTML code, and fixes everything just right. - call: INCLUDE generic/multibox.html var = var, var2 = .... + call: INCLUDE generic/multibox.html var = var, var2 = .... options and variables: - name : name of the select/textfield - id : id of the select/textfield, optional, defaults to name - default : entered/selected value. defaults to a dereference of name, since it is usually set to that for update mechanisms - id_key : key that holds the id in each row. - id_sub : name of a perl sub that calculates the id for each row. will be called with a hashref. - label_key : key that holds the label in each row. - label_sub : name of a perl sub that calculates the label for each row. will be called with a hashref. - DATA : the actual data, expected to be arrayref of hashrefs, usually what's returned by the all_vc routines. - limit : defines the limit of entries, after which a textbox is generated. defaults to vclimit, or, failing to find that, 50. - show_empty : show an empty first line in select boxes. defaults to false - style : additional style information - onChange : java magic on change - select : java function call for a selection popup or other magic + name : name of the select/textfield + id : id of the select/textfield, optional, defaults to name + default : entered/selected value. defaults to a dereference of name, since it is usually set to that for update mechanisms + id_key : key that holds the id in each row. + id_sub : name of a perl sub that calculates the id for each row. will be called with a hashref. + label_key : key that holds the label in each row. + label_sub : name of a perl sub that calculates the label for each row. will be called with a hashref. + DATA : the actual data, expected to be arrayref of hashrefs, usually what's returned by the all_vc routines. + show_empty : show an empty first line in select boxes. defaults to false + style : additional style information + onChange : java magic on change + select : java function call for a selection popup or other magic + allow_textbox : allow to display a textbox instead of a drop down box if there are more entries than 'limit' entries. + limit : defines the limit of entries, after which a textbox is generated. defaults to vclimit, or, failing to find that, 200. -%] -[%- DEFAULT - limit = limit != '' ? limit : 50 - id = id != '' ? id : name +[%- DEFAULT + limit = limit != '' ? limit : vclimit != '' ? vclimit : 200 + id = id != '' ? id : name default = default != '' ? default : $name -%] [%- FOREACH row = DATA %] [%- row.id = row.$id_key != '' ? row.$id_key : $id_sub(row) - row.label = row.$label_key != '' ? row.$label_key - : $label_sub(row) != '' ? $label_sub(row) + row.label = row.$label_key != '' ? row.$label_key + : $label_sub(row) != '' ? $label_sub(row) : row.id row.selected = default == row.id -%] [%- END -%] -[%- IF DATA.size and limit < DATA.size %] - [% END %] [%- ELSE %] - diff --git a/templates/webpages/oe/form_header_master.html b/templates/webpages/oe/form_header_master.html index 1849c46a2..308bd16fe 100644 --- a/templates/webpages/oe/form_header_master.html +++ b/templates/webpages/oe/form_header_master.html @@ -36,14 +36,15 @@ [% IF vc == 'customer' %]Customer[% ELSE %]Vendor[% END %] [%- INCLUDE 'generic/multibox.html' - name = vc, - style = 'width: 250px', - DATA = vc == 'customer' ? ALL_CUSTOMERS : ALL_VENDORS, - id_sub = 'vc_keys', - label_key = 'name', - select = vc_select, - limit = vclimit, - onChange = "document.getElementById('update_button').click();" -%] + name = vc, + style = 'width: 250px', + DATA = vc == 'customer' ? ALL_CUSTOMERS : ALL_VENDORS, + id_sub = 'vc_keys', + label_key = 'name', + select = vc_select, + limit = vclimit, + allow_textbox = 1, + onChange = "document.getElementById('update_button').click();" -%] -- 2.20.1