quick list of area codes and a kludge to print DA numbers for all of them
[freeside.git] / httemplate / elements / selectlayers.html
index 4496892..82f5dd1 100644 (file)
@@ -44,19 +44,25 @@ Example:
                         ...
                       },
 
+    #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) {
 
@@ -86,11 +92,11 @@ Example:
       }
       //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 %>"
@@ -109,8 +115,15 @@ Example:
 
     </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 %>"
@@ -120,7 +133,7 @@ Example:
                   %>"
       >
 
-        <% layer_callback($layer, $layer_fields, $layer_values, $layer_prefix) %>
+        <% &{$layer_callback}($layer, $layer_fields, $layer_values, $layer_prefix) %>
 
       </DIV>
 
@@ -156,6 +169,8 @@ my $layer_fields = $opt{layer_fields};
 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 ) = @_;