broadband_nas export, #15284
[freeside.git] / httemplate / search / elements / search-html.html
index 98f9c44..d1f4b2f 100644 (file)
 %       }
 %     }
 %
-%     if ( $type eq 'html-print' ) {
-
-        <% $opt{nohtmlheader}
-             ? ''
-             : include( '/elements/header-popup.html', $opt{'title'} )
-        %>
-
-%     } elsif ( $type eq 'select' ) {
-
-        <% $opt{nohtmlheader}
-             ? ''
-             : include( '/elements/header-popup.html', $opt{'title'} )
-        %>
-        <% defined($opt{'html_init'}) 
-              ? ( ref($opt{'html_init'})
-                    ? &{$opt{'html_init'}}()
-                    : $opt{'html_init'}
-                )
-              : ''
-        %>
-
-%     } else {
+%     unless ( $opt{nohtmlheader} ) {
 %
-%       my @menubar = ();
-%       if ( $opt{'menubar'} ) {
-%         @menubar = @{ $opt{'menubar'} };
-%       #} else {
-%       #  @menubar = ( 'Main menu' => $p );
+%       if ( $type eq 'html-print' ) {
+          <& /elements/header-popup.html, $opt{'title'} &>
+%       } else {
+%         if ( $type eq 'select' ) {
+            <&/elements/header-popup.html, $opt{'title'} &>
+%         } else {
+%
+%           my @menubar = ();
+%           if ( $opt{'menubar'} ) {
+%             @menubar = @{ $opt{'menubar'} };
+%           #} else {
+%           #  @menubar = ( 'Main menu' => $p );
+%           }
+
+            <& /elements/header.html, $opt{'title'},
+                 include( '/elements/menubar.html', @menubar )
+            &>
+
+%         }
 %       }
+%
+%     }
+%
+%     unless ( $type eq 'html-print' ) {
 
-        <% $opt{nohtmlheader}
-             ? ''
-             : include( '/elements/header.html', $opt{'title'},
-                          include( '/elements/menubar.html', @menubar )
-                      )
-        %>
+%       if ( $opt{'add_link'} ) { #or after html_init?
+          <A HREF="<%$p%>edit/<% $opt{query}->{table} %>.html"><I>Add a <% $opt{'name_singular'} %></I></A><BR><BR>
+%       }
 
         <% defined($opt{'html_init'}) 
               ? ( ref($opt{'html_init'})
@@ -78,7 +72,7 @@
 
 %     unless ( $total ) { 
 %       unless ( $opt{'disable_nonefound'} ) { 
-          No matching <% $opt{'name'} %> found.<BR>
+          <BR><BR>No matching <% $opt{'name'} %> found.<BR>
 %       } 
 %     }
 %
                 <TR>
 %                 my $h2 = 0;
 %                 my $colspan = 0;
+%                 my @fields = @{ $opt{'sort_fields'} || $opt{'fields'} || [] };
+%                 my $order_by = $cgi->param('order_by');
 %                 foreach my $header ( @{ $opt{header} } ) { 
+%
+%                   my $field = shift @fields;
+%
 %                   $colspan-- if $colspan > 0;
 %                   next if $colspan;
 %
 %                   my $label = ref($header) ? $header->{label} : $header;
+%                   unless ( ref($field) || !$field ) {
+%                     if ( $order_by eq $field ) {
+%                       $cgi->param('order_by', "$field DESC");
+%                     } else {
+%                       $cgi->param('order_by', $field);
+%                     }
+%                     $label = qq(<A HREF="$self_url?). $cgi->query_string.
+%                              qq(">$label</A>);
+%                   }
+%
 %                   $colspan = ref($header) ? $header->{colspan} : 0;
 %                   my $rowspan = 1;
 %                   my $style = '';