...
},
+ #or manual control, instead of layer_fields and layer_values above
+ #called with args: my( $layer, $layer_fields, $layer_values, $layer_prefix )
+ 'layer_callback' =>
+
'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
+ 'select_only' => 0, #set true to return only the <SELECT> HTML
+ 'layers_only' => 0, #set true to return only the layers <DIV> HTML
)
</%doc>
-% unless ( $opt{html_only} || $opt{js_only} ) {
+% unless ( grep $opt{$_}, qw(html_only js_only select_only layers_only) ) {
<SCRIPT TYPE="text/javascript">
% }
-% unless ( $opt{html_only} ) {
+% unless ( grep $opt{$_}, qw(html_only select_only layers_only) ) {
//alert('start function define');
function <% $key %>changed(what) {
}
//alert('end function define');
% }
-% unless ( $opt{html_only} || $opt{js_only} ) {
+% unless ( grep $opt{$_}, qw(html_only js_only select_only layers_only) ) {
</SCRIPT>
% }
%
-% unless ( $opt{js_only} ) {
+% unless ( grep $opt{$_}, qw(js_only layers_only) ) {
<SELECT NAME = "<% $key %>"
ID = "<% $key %>"
</SELECT>
+% }
+% unless ( grep $opt{$_}, qw(js_only select_only layers_only) ) {
+
<% ref($between) ? &{$between}($key) : $between %>
+% }
+%
+% unless ( grep $opt{$_}, qw(js_only select_only) ) {
+
% foreach my $layer ( keys %$options ) {
<DIV ID="<% $key %>d<% $layer %>"
%>"
>
- <% layer_callback($layer, $layer_fields, $layer_values, $layer_prefix) %>
+ <% &{$layer_callback}($layer, $layer_fields, $layer_values, $layer_prefix) %>
</DIV>
my $layer_values = $opt{layer_values};
my $layer_prefix = $opt{layer_prefix};
+my $layer_callback = $opt{layer_callback} || \&layer_callback;
+
sub layer_callback {
my( $layer, $layer_fields, $layer_values, $layer_prefix ) = @_;