X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fsearch.html;h=566ea8391a97ad364bf496c7b678fff2972614d2;hp=e739afb1d1d6cb4906b5234ed0e79748665a3f0a;hb=19ca51b6b215fc76757812b5b4d2bea6dd6e4cf7;hpb=0f5028bc5a7789429a41bca886e5a38ed0fa099f diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index e739afb1d..566ea8391 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -2,6 +2,16 @@ my(%opt) = @_; + my %align = ( + 'l' => 'left', + 'r' => 'right', + 'c' => 'center', + ' ' => '', + '.' => '', + ); + $opt{align} = [ map $align{$_}, split(//, $opt{align}) ], + unless !$opt{align} || ref($opt{align}); + if ( ref($opt{'query'}) ) { } @@ -67,55 +77,63 @@ 'maxrecords' => $maxrecords, ); %> -<%= $total %> total <%= $opt{'name'} %>
-<% if ( $opt{'count_addl'} ) { %> - <% my $n=0; foreach my $count ( @{$opt{'count_addl'}} ) { %> - <%= sprintf( $count, $count_arrayref->[++$n] ) %>
- <% } %> -<% } %> -
<%= $pager %> -<%= include( '/elements/table.html' ) %> - - <% foreach my $header ( @$header ) { %> - <%= $header %> +<% unless ( $total ) { %> + No matching <%= $opt{'name'} %> found.
+<% } else { %> + <%= $total %> total <%= $opt{'name'} %>
+ <% if ( $opt{'count_addl'} ) { %> + <% my $n=0; foreach my $count ( @{$opt{'count_addl'}} ) { %> + <%= sprintf( $count, $count_arrayref->[++$n] ) %>
+ <% } %> <% } %> - - <% foreach my $row ( @$rows ) { %> - - <% if ( $opt{'fields'} ) { %> - <% my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : ''; %> - <% foreach my $field ( @{$opt{'fields'}} ) { %> - <% my $a = ''; %> - <% if ( $links ) { - my $link = shift @$links; - $link = &{$link}($row) if ref($link) eq 'CODE'; - if ( $link ) { - my( $url, $method ) = @{$link}; - if ( ref($method) eq 'CODE' ) { - $a = $url. &{$method}($row); - } else { - $a = $url. $row->$method(); +
<%= $pager %> + <%= include( '/elements/table.html' ) %> + + <% foreach my $header ( @$header ) { %> + <%= $header %> + <% } %> + + <% foreach my $row ( @$rows ) { %> + + <% if ( $opt{'fields'} ) { + my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : ''; + my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : ''; + foreach my $field ( @{$opt{'fields'}} ) { + my $align = $aligns ? shift @$aligns : ''; + $align = " ALIGN=$align" if $align; + my $a = ''; + if ( $links ) { + my $link = shift @$links; + $link = &{$link}($row) if ref($link) eq 'CODE'; + if ( $link ) { + my( $url, $method ) = @{$link}; + if ( ref($method) eq 'CODE' ) { + $a = $url. &{$method}($row); + } else { + $a = $url. $row->$method(); + } + $a = qq(); } - $a = qq(); } - } - %> - <% if ( ref($field) eq 'CODE' ) { %> - <%= $a %><%= &{$field}($row) %><%= $a ? '' : '' %> - <% } else { %> - <%= $a %><%= $row->$field() %><%= $a ? '' : '' %> + %> + <% if ( ref($field) eq 'CODE' ) { %> + ><%= $a %><%= &{$field}($row) %><%= $a ? '' : '' %> + <% } else { %> + ><%= $a %><%= $row->$field() %><%= $a ? '' : '' %> + <% } %> + <% } %> + <% } else { %> + <% foreach ( @$row ) { %> + <%= $_ %> <% } %> <% } %> - <% } else { %> - <% foreach ( @$row ) { %> - <%= $_ %> - <% } %> - <% } %> - - <% } %> - - -<%= $pager %> + + <% } %> + + + <%= $pager %> +<% } %> <% } %> +