X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselectlayers.html;fp=httemplate%2Felements%2Fselectlayers.html;h=4496892ffc6f274ef4d81fcb0f2400c28a45ab6f;hp=0000000000000000000000000000000000000000;hb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;hpb=32b5d3a31f112a381f0a15ac5e3a2204242f3405 diff --git a/httemplate/elements/selectlayers.html b/httemplate/elements/selectlayers.html new file mode 100644 index 000000000..4496892ff --- /dev/null +++ b/httemplate/elements/selectlayers.html @@ -0,0 +1,201 @@ +<%doc> + +Example: + + include( '/elements/selectlayers.html', + 'field' => $key, # SELECT element NAME (passed as form field) + # also used as ID and a unique key for layers and + # functions + 'curr_value' => $selected_layer, + 'options' => [ 'option1', 'option2' ], + 'labels' => { 'option1' => 'Option 1 Label', + 'option2' => 'Option 2 Label', + }, + + #XXX put this handling it its own selectlayers-fields.html element? + 'layer_prefix' => 'prefix_', #optional prefix for fieldnames + 'layer_fields' => [ 'layer' => [ 'fieldname', + { label => 'fieldname2', + type => 'text', #implemented: + # text, money, fixed, + # hidden, checkbox, + # checkbox-multiple, + # select, select-agent, + # select-pkg_class, + # select-part_referral, + # select-table, + #XXX tbd: + # more? + }, + ... + ], + 'layer2' => [ 'l2fieldname', + ... + ], + + #current values for layer fields above + 'layer_values' => { 'layer' => { 'fieldname' => 'current_value', + 'fieldname2' => 'field2value', + ... + }, + 'layer2' => { 'l2fieldname' => 'l2value', + ... + }, + ... + }, + + 'html_between => '', #optional HTML displayed between the SELECT and the + #layers, scalar or coderef ('field' passed as a param) + 'onchange' => '', #javascript code run when the SELECT changes + # ("what" is the element) + 'js_only' => 0, #set true to return only the JS portions + 'html_only' => 0, #set true to return only the HTML portions + ) + +%doc> +% unless ( $opt{html_only} || $opt{js_only} ) { + +% } +% +% unless ( $opt{js_only} ) { + + + +<% ref($between) ? &{$between}($key) : $between %> + +% foreach my $layer ( keys %$options ) { + +