X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fsearch.html;h=5649c85790437d7095a010629310649ea531449c;hb=948b8acdd4b9b3864342062d0c397a11f57c5700;hp=cbf0887a6a910fecc4b914d769d5ac11c4aef125;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e;p=freeside.git diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index cbf0887a6..5649c8579 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -1,535 +1,755 @@ +<%doc> + +Example: + + include( 'elements/search.html', + + # basic options, required + 'title' => 'Page title', + + 'name_singular' => 'item', #singular name for the records returned + #OR# # (preferred, will be pluralized automatically) + 'name' => 'items', #plural name for the records returned + # (deprecated, will be singularlized + # simplisticly) + + # some HTML callbacks... + 'menubar' => '', #menubar arrayref + 'html_init' => '', #after the header/menubar and before the pager + 'html_form' => '', #after the pager, right before the results + # (only shown if there are results) + # (use this for any form-opening tag rather than + # html_init, to avoid a nested form) + 'html_foot' => '', #at the bottom + 'html_posttotal' => '', #at the bottom + # (these three can be strings or coderefs) + + + #literal SQL query string (deprecated?) or qsearch hashref, required + 'query' => { + 'table' => 'tablename', + #everything else is optional... + 'hashref' => { 'field' => 'value', + 'field' => { 'op' => '<', + 'value' => '54', + }, + }, + 'select' => '*', + 'addl_from' => '', #'LEFT JOIN othertable USING ( key )', + 'extra_sql' => '', #'AND otherstuff', #'WHERE onlystuff', + 'order_by' => 'ORDER BY something', + + }, + # "select * from tablename"; + + #required unless 'query' is an SQL query string (shouldn't be...) + 'count_query' => 'SELECT COUNT(*) FROM tablename', + + 'count_addl' => [], #additional count fields listref of sprintf strings or coderefs + # [ $money_char.'%.2f total paid', ], + + #listref of column labels,
- <% $total %> total <% $opt{'name'} %>
- <% defined($opt{'html_posttotal'})
- ? ( ref($opt{'html_posttotal'})
- ? &{$opt{'html_posttotal'}}()
- : $opt{'html_posttotal'}
+ <% include( '/elements/header-popup.html', $opt{'title'} ) %>
+
+% } else {
+%
+% my @menubar = ();
+% if ( $opt{'menubar'} ) {
+% @menubar = @{ $opt{'menubar'} };
+% #} else {
+% # @menubar = ( 'Main menu' => $p );
+% }
+
+ <% include( '/elements/header.html', $opt{'title'},
+ include( '/elements/menubar.html', @menubar )
)
- : ''
- %>
- -% if ( $opt{'count_addl'} ) { -% my $n=0; foreach my $count ( @{$opt{'count_addl'}} ) { + %> - <% sprintf( $count, $count_arrayref->[++$n] ) %> -% } -% } + <% defined($opt{'html_init'}) + ? ( ref($opt{'html_init'}) + ? &{$opt{'html_init'}}() + : $opt{'html_init'} + ) + : '' + %> - |
-% unless ( $opt{'disable_download'} ) {
+% }
-
-% $cgi->param('_type', "$xlsname.xls" );
+% unless ( $total ) {
+% unless ( $opt{'disable_nonefound'} ) {
+ No matching <% $opt{'name'} %> found. +% } +% } else { - Download full results - as Excel spreadsheet -% $cgi->param('_type', 'csv'); +
|
+