fix unapplied payment report, RT#73048, fallout from #25944
[freeside.git] / httemplate / search / elements / search-html.html
index d8ab30a..3ea38ae 100644 (file)
 
               <TD ALIGN="right" CLASS="noprint">
 
-                <% $opt{'download_label'} || 'Download full results' %><BR>
+                <% $opt{'download_label'} || 'Download results:' %>
 
 %               $cgi->param('_type', "$xlsname.xls" ); 
-                as <A HREF="<% "$self_url?". $cgi->query_string %>">Excel spreadsheet</A><BR>
+                <A HREF="<% "$self_url?". $cgi->query_string %>">Spreadsheet</A>&nbsp;|&nbsp;
 
 %               $cgi->param('_type', 'csv'); 
-                as <A HREF="<% "$self_url?". $cgi->query_string %>">CSV file</A><BR>
+                <A HREF="<% "$self_url?". $cgi->query_string %>">CSV</A>&nbsp;|&nbsp;
 
 %             if ( defined($opt{xml_elements}) ) {
 %               $cgi->param('_type', 'xml'); 
-                as <A HREF="<% "$self_url?". $cgi->query_string %>">XML file</A><BR>
+                <A HREF="<% "$self_url?". $cgi->query_string %>">XML</A>&nbsp;|&nbsp;
 %             }
 
 %               $cgi->param('_type', 'html-print'); 
-                as <A HREF="<% "$self_url?". $cgi->query_string %>">printable copy</A>
+                <A HREF="<% "$self_url?". $cgi->query_string %>">webpage</A>
 
+%# "save search" -- for now, obey disable_download and the 'Download
+%# report data' ACL, because saving a search allows the user to receive
+%# copies of the data.
+                <BR>
+%# XXX should do a check here on whether the user already has this
+%# search saved...
+                <& /elements/popup_link.html,
+                  'action'        => $fsurl.'/edit/saved_search.html?title='.
+                                       uri_escape($opt{title}),
+                  'label'         => 'Save this search',
+                  'actionlabel'   => 'Save this search',
+                  'width'         => 650,
+                  'height'        => 500,
+                &>
               </TD>
 %             $cgi->param('_type', "html" ); 
 %           } 
@@ -349,6 +363,7 @@ $rows => []
 % }
 
 % my $i = 0; # for row striping # XXX CSS - nth-child
+% my $id = 0;
 % foreach my $row ( @$rows ) {
 %
 %   my $rowstyle = '';
@@ -377,9 +392,16 @@ $rows => []
 %     my $sizes    = $opt{'size'}  ? [ @{$opt{'size'}}  ] : [];
 %     my $styles   = $opt{'style'} ? [ @{$opt{'style'}} ] : [];
 %     my $cstyles  = $opt{'cell_style'} ? [ @{$opt{'cell_style'}} ] : [];
+%     my $formats  = $opt{'format'} ? [ @{$opt{'format'}} ] : [];
 %
 %     foreach my $field (
 %
+%       # if the value of the field is an arrayref, then construct a table in
+%       # the cell.
+%       # if it's a (non-empty) scalar, and a format has been specified, then
+%       # format the scalar with that.
+%       # otherwise, just output the value.
+%       # XXX we should also do date formats like this
 %       map {
 %             if ( ref($_) eq 'ARRAY' ) {
 %
@@ -443,10 +465,17 @@ $rows => []
 %               '</table>';
 %
 %             } else {
+%               if ( length($_) > 0 and my $format = shift @$formats ) {
+%                 $_ = sprintf($format, $_);
+%               }
 %               $_;
 %             }
 %           }
 %
+%       # get the value of the field spec:
+%       # - if the spec is a coderef, evaluate the coderef
+%       # - if the spec is a string, call that string as a method
+%       # - if the spec is an integer, get the field in that position
 %       map {
 %             if ( ref($_) eq 'CODE' ) {
 %               &{$_}($row);
@@ -490,11 +519,11 @@ $rows => []
 %
 %           $tooltip = &{$tooltip}($row)
 %             if ref($tooltip) eq 'CODE';
-%           $tooltip = qq! title="<% $tooltip |h %>"!;
-%#             qq! onmouseover="return overlib(!.
-%#             $m->interp->apply_escapes($tooltip, 'h', 'js_string').
-%#             qq!, FGCLASS, 'tooltip', REF, 'a$id', !.
-%#             qq!REFC, 'LL', REFP, 'UL')"! if $tooltip;
+%           $tooltip = qq! id="a$id" !.
+%             qq! onmouseover="return overlib(!.
+%             $m->interp->apply_escapes($tooltip, 'h', 'js_string').
+%             qq!, FGCLASS, 'tooltip', REF, 'a$id', !.
+%             qq!REFC, 'LL', REFP, 'UL')"! if $tooltip;
 %
 %           if ( $link ) {
 %             my( $url, $method ) = @{$link};
@@ -511,6 +540,7 @@ $rows => []
 %           elsif ( $tooltip ) {
 %             $a = qq(<A $tooltip>);
 %           }
+%           $id++;
 
 %         }
 %