X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fsearch-html.html;h=10cc955396ae53dc5b5ae0428ed9b56150063b26;hb=7a7a0c736e3cfbd10b06151a93bf499d185d37d3;hp=37178dcc2fe9dd84e3cc8c329c81b2befbc98249;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html index 37178dcc2..10cc95539 100644 --- a/httemplate/search/elements/search-html.html +++ b/httemplate/search/elements/search-html.html @@ -1,4 +1,3 @@ -% % if ( exists($opt{'redirect'}) && $opt{'redirect'} % && scalar(@$rows) == 1 && $total == 1 % && $type ne 'html-print' @@ -30,34 +29,36 @@ % } % } % -% if ( $type eq 'html-print' ) { - - <% include( '/elements/header-popup.html', $opt{'title'} ) %> - -% } elsif ( $type eq 'select' ) { - - <% 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' ) { - <% include( '/elements/header.html', $opt{'title'}, - include( '/elements/menubar.html', @menubar ) - ) - %> +% if ( $opt{'add_link'} ) { #or after html_init? + Add a <% $opt{'name_singular'} %>

+% } <% defined($opt{'html_init'}) ? ( ref($opt{'html_init'}) @@ -71,7 +72,7 @@ % unless ( $total ) { % unless ( $opt{'disable_nonefound'} ) { - No matching <% $opt{'name'} %> found.
+

No matching <% $opt{'name'} %> found.
% } % } % @@ -95,7 +96,7 @@ % $cgi->delete('maxrecords'); % $cgi->param('_dummy', 1); - ( show query_string %>;maxrecords=' + this.options[this.selectedIndex].value;"> % foreach my $max ( map { $_ * $confmax } qw( 1 5 10 25 ) ) { @@ -129,20 +130,27 @@ -% unless ( $opt{'disable_download'} || $type eq 'html-print' ) { +% if ( $curuser->access_right('Download report data') +% and !$opt{'disable_download'} +% and $type ne 'html-print' ) { - + - Download full results
+ <% $opt{'download_label'} || 'Download full results' %>
% $cgi->param('_type', "$xlsname.xls" ); - as Excel spreadsheet
+ as query_string %>">Excel spreadsheet
% $cgi->param('_type', 'csv'); - as CSV file
+ as query_string %>">CSV file
+ +% if ( defined($opt{xml_elements}) ) { +% $cgi->param('_type', 'xml'); + as query_string %>">XML file
+% } % $cgi->param('_type', 'html-print'); - as printable copy + as query_string %>">printable copy % $cgi->param('_type', "html" ); @@ -178,11 +186,26 @@ % 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($label); +% } +% % $colspan = ref($header) ? $header->{colspan} : 0; % my $rowspan = 1; % my $style = ''; @@ -230,12 +253,29 @@ % $bgcolor = $bgcolor1; % } - +% my $rowstyle = ''; +% if ( $row eq $opt{'footer_data'} ) { +% $rowstyle = ' STYLE="border-top: dashed 1px black; font-style: italic"'; +% $bgcolor = '#dddddd'; +% } + +% my $trid = ''; +% if ( $opt{'link_field' } ) { +% my $link_field = $opt{'link_field'}; +% if ( ref($link_field) eq 'CODE' ) { +% $trid = &{$link_field}($row); +% } else { +% $trid = $row->$link_field(); +% } +% } + > + % if ( $opt{'fields'} ) { % % 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'}} ] : []; @@ -275,6 +315,11 @@ % ? '' % : '' % ). +% ( $e->{'onclick'} # don't use with 'link' +% ? '' +% : '' +% ). % ( $e->{'size'} % ? '' % : '' @@ -289,7 +334,9 @@ % : '' % ). % ( $e->{'size'} ? '' : '' ). -% ( $e->{'link'} ? '' : '' ). +% ( $e->{'link'} || $e->{'onclick'} +% ? '' +% : '' ). % ''; % % } @$rowref ). @@ -307,15 +354,21 @@ % 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 =~ /^agentnum ) @@ -338,6 +392,14 @@ % 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' ) { @@ -345,11 +407,16 @@ % } else { % $a = $url. $row->$method(); % } -% $a = qq(); +% $a = qq(); % } % elsif ( $onclick ) { % $a = qq(); % } +% elsif ( $tooltip ) { +% $a = qq(); +% } +% $id++; + % } % % } @@ -379,7 +446,7 @@ % $cstyle = qq(STYLE="$cstyle") % if $cstyle; - + % } % @@ -417,9 +484,11 @@ % } % if ( $type eq 'html-print' ) { +% unless ( $opt{nohtmlheader} ) { +% } % } else { <% defined($opt{'html_foot'}) @@ -430,13 +499,18 @@ : '' %> - <% include( '/elements/footer.html' ) %> + <% $opt{nohtmlheader} + ? '' + : include( '/elements/footer.html' ) + %> % } % } <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + my %args = @_; my $type = $args{'type'}; my $header = $args{'header'}; @@ -447,6 +521,7 @@ my $confmax = $args{'confmax'}; my $maxrecords = $args{'maxrecords'}; my $offset = $args{'offset'}; my %opt = %{ $args{'opt'} }; +my $self_url = $opt{'url'} || $cgi->url('-path_info' => 1, '-full' =>1); my $count_sth = dbh->prepare($opt{'count_query'}) or die "Error preparing $opt{'count_query'}: ". dbh->errstr; @@ -455,4 +530,5 @@ $count_sth->execute my $count_arrayref = $count_sth->fetchrow_arrayref; my $total = $count_arrayref->[0]; +my $id = 0;
<% $cstyle %>><% $font %><% $a %><% $s %><% $field %><% $es %><% $a ? '' : '' %><% $font ? '' : '' %> <% $cstyle %>><% $a %><% $font %><% $s %><% $field %><% $es %><% $font ? '' : '' %><% $a ? '' : '' %>