undo voodoo, find real problem
[freeside.git] / httemplate / edit / elements / edit.html
index 47b2464..537645e 100644 (file)
@@ -3,8 +3,12 @@
 Example:
 
   include( 'elements/edit.html',  
-    'name'  =>
-    'table' =>
+    'name_singular' =>  #singular name for the record
+                        # (preferred, will be pluralized automatically)
+    'name'          =>  #name for the record
+                        # (deprecated, will be pluralized simplistically)
+    'table'         =>
+
     #? 'primary_key' => #required when the dbdef doesn't know...???
     'labels' => {
                   'column' => 'Label',
@@ -212,7 +216,6 @@ Example:
 %     #select(-*)
 %     'options'       => $f->{'options'},
 %     'labels'        => $f->{'labels'},
-%     'empty_label'   => $f->{'empty_label'},
 %     'multiple'      => $f->{'multiple'},
 %     'disable_empty' => $f->{'disable_empty'},
 %     #select-reason
@@ -227,6 +230,15 @@ Example:
 %     'disabled'      => $f->{'disabled'},
 %   );
 %
+%   #selectlayers, others?
+%   $include_common{$_} = $f->{$_}
+%     foreach grep exists($f->{$_}),
+%                  qw( js_only html_only select_only layers_only cell_style);
+%
+%   #select-*
+%   $include_common{$_} = $f->{$_}
+%     foreach grep exists($f->{$_}), qw( empty_label );
+%
 %   #select-table, checkboxes-table
 %   $include_common{$_} = $f->{$_}
 %     foreach grep exists($f->{$_}), qw( table name_col );
@@ -274,7 +286,7 @@ Example:
 %     $g_row++ if $type eq 'title';
 %   } else {
 %     if ( $type eq 'columnstart' ) {
-%       push @g_row_stack, $g_row++;
+%       push @g_row_stack, $g_row;
 %       $g_row = 0;
 %     #} elsif ( $type eq 'columnnext' ) {
 %     } elsif ( $type eq 'columnend' ) {
@@ -358,7 +370,7 @@ Example:
 %     'object'     => $object,
 %     'cgi'        => $cgi,
 %     'onchange'   => $onchange,
-%     'cell_style'   => ( $fieldnum ? 'border-top:1px solid black' : '' ),
+%     ( $fieldnum ? ('cell_style' => 'border-top:1px solid black') : () ),
 %   );
 
     <% include( @include ) %>
@@ -368,6 +380,7 @@ Example:
       <SCRIPT TYPE="text/javascript">
 
         var <%$field%>_rownum = <% $g_row %>;
+% warn "g_row $g_row\n";
         var <%$field%>_fieldnum = <% $fieldnum %>;
 
         function spawn_<%$field%>(what) {
@@ -616,9 +629,9 @@ my @menubar = ();
 if ( $opt{'menubar'} ) {
   @menubar = @{ $opt{'menubar'} };
 } else {
+  my $items = $opt{'name'} ? $opt{'name'}.'s' : PL($opt{'name_singular'});
   @menubar = (
-    #eventually use Lingua::bs to pluralize
-    "View all $opt{'name'}s" => $viewall_url,
+    "View all $items" => $viewall_url,
   );
 }