% }
% }
%
-% 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>
<TR>
% my $h2 = 0;
% my $colspan = 0;
-% my @fields = @{ $opt{'sort_fields'} || $opt{'fields'}};
+% my @fields = @{ $opt{'sort_fields'} || $opt{'fields'} || [] };
% my $order_by = $cgi->param('order_by');
% foreach my $header ( @{ $opt{header} } ) {
%
%
% my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : '';
% my $onclicks = $opt{'link_onclicks'} ? [ @{$opt{'link_onclicks'}} ] : [];
+% my $tooltips = $opt{'tooltips'} ? [ @{$opt{'tooltips'}} ] : [];
% my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : '';
% my $colors = $opt{'color'} ? [ @{$opt{'color'}} ] : [];
% my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
% ? '<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 ).
% if ( ref($_) eq 'CODE' ) {
% &{$_}($row);
% } else {
-% $row->$_();
+% encode_entities($row->$_());
% }
% }
% @{$opt{'fields'}}
% if ( $links ) {
% my $link = shift @$links;
% my $onclick = shift @$onclicks;
+% my $tooltip = shift @$tooltips;
%
% if ( ! $opt{'agent_virt'}
% || ( $null_link && ! $row->agentnum )
% if ref($onclick) eq 'CODE';
% $onclick = qq( onClick="$onclick") if $onclick;
%
+% $tooltip = &{$tooltip}($row)
+% if ref($tooltip) eq 'CODE';
+% $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};
% if ( ref($method) eq 'CODE' ) {
% } else {
% $a = $url. $row->$method();
% }
-% $a = qq(<A HREF="$a"$onclick>);
+% $a = qq(<A HREF="$a"$onclick$tooltip>);
% }
% elsif ( $onclick ) {
% $a = qq(<A HREF="javascript:void(0);"$onclick>);
% }
+% elsif ( $tooltip ) {
+% $a = qq(<A $tooltip>);
+% }
+% $id++;
+
% }
%
% }
% }
<%init>
+my $curuser = $FS::CurrentUser::CurrentUser;
+
my %args = @_;
my $type = $args{'type'};
my $header = $args{'header'};
my $count_arrayref = $count_sth->fetchrow_arrayref;
my $total = $count_arrayref->[0];
+my $id = 0;
</%init>