Update httemplate/elements/selectlayers.html
[freeside.git] / httemplate / search / elements / search-html.html
index d1f4b2f..5c8001f 100644 (file)
 
             </TD>
 
-%           unless ( $opt{'disable_download'} || $type eq 'html-print' ) { 
+%           if ( $curuser->access_right('Download report data')
+%                 and !$opt{'disable_download'}
+%                 and $type ne 'html-print' ) { 
 
-              <TD ALIGN="right">
+              <TD ALIGN="right" CLASS="noprint">
 
-                Download full results<BR>
+                <% $opt{'download_label'} || 'Download full results' %><BR>
 
 %               $cgi->param('_type', "$xlsname.xls" ); 
                 as <A HREF="<% "$self_url?". $cgi->query_string %>">Excel spreadsheet</A><BR>
 %                                       ? '<A HREF="'. $e->{'link'}. '">'
 %                                       : ''
 %                                   ).
+%                                   ( $e->{'onclick'} # don't use with 'link'
+%                                       ? '<A HREF="#" onclick="' .
+%                                         $e->{'onclick'}.'">'
+%                                       : ''
+%                                   ).
 %                                   ( $e->{'size'}
 %                                      ? '<FONT SIZE="'.uc($e->{'size'}).'">'
 %                                      : ''
 %                                       : ''
 %                                   ).
 %                                   ( $e->{'size'} ? '</FONT>' : '' ).
-%                                   ( $e->{'link'} ? '</A>'    : '' ).
+%                                   ( $e->{'link'} || $e->{'onclick'} 
+%                                       ? '</A>'
+%                                       : '' ).
 %                                   '</td>';
 %
 %                                 } @$rowref ).
 %                       map {
 %                             if ( ref($_) eq 'CODE' ) {
 %                               &{$_}($row);
+%                             } elsif ( ref($row) eq 'ARRAY' and 
+%                                       $_ =~ /^\d+$/ ) {
+%                             # for the 'straight SQL' case: specify fields
+%                             # by position
+%                               encode_entities($row->[$_]);
 %                             } else {
-%                               $row->$_();
+%                               encode_entities($row->$_());
 %                             }
 %                           }
 %                       @{$opt{'fields'}}
 %
 %                     ) {
 %
-%                       my $class = ( $field =~ /^<TABLE/i ) ? 'inv' : 'grid';
+%#                       my $class = ( $field =~ /^<TABLE/i ) ? 'inv' : 'grid';
+%                       my $class = 'grid';
 %
 %                       my $align = $aligns ? shift @$aligns : '';
 %                       $align = " ALIGN=$align" if $align;
 %   } 
 <%init>
 
+my $curuser = $FS::CurrentUser::CurrentUser;
+
 my %args = @_;
 my $type           = $args{'type'};
 my $header         = $args{'header'};