% }
% }
%
-% 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'})
% unless ( $total ) {
% unless ( $opt{'disable_nonefound'} ) {
- No matching <% $opt{'name'} %> found.<BR>
+ <BR><BR>No matching <% $opt{'name'} %> found.<BR>
% }
% }
%
</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'};