[freeside-commits] freeside/httemplate/search/elements search.html, 1.28.2.2, 1.28.2.3
Ivan,,,
ivan at wavetail.420.am
Thu Jan 3 18:42:30 PST 2008
Update of /home/cvs/cvsroot/freeside/httemplate/search/elements
In directory wavetail:/tmp/cvs-serv10611/httemplate/search/elements
Modified Files:
Tag: FREESIDE_1_7_BRANCH
search.html
Log Message:
new tax rate editor
Index: search.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/elements/search.html,v
retrieving revision 1.28.2.2
retrieving revision 1.28.2.3
diff -u -d -r1.28.2.2 -r1.28.2.3
--- search.html 5 Dec 2007 00:52:16 -0000 1.28.2.2
+++ search.html 4 Jan 2008 02:42:28 -0000 1.28.2.3
@@ -51,7 +51,20 @@
#listref of column labels, <TH>
#required unless 'query' is an SQL query string
# (if not specified the database column names will be used)
- 'header' => [ '#', 'Item' ],
+ 'header' => [ '#',
+ 'Item',
+ { 'label' => 'Another Item',
+
+ },
+ ],
+
+ #second (smaller) header line, currently only for HTML
+ 'header2 => [ '#',
+ 'Item',
+ { 'label' => 'Another Item',
+
+ },
+ ],
'disable_download' => '', # set true to hide the CSV/Excel download links
'disable_nonefound' => '', # set true to disable the "No matching Xs found"
@@ -80,19 +93,27 @@
#listref of column footers
'footer' => [],
- #listref - each item is the empty string, or a listref of ...
- 'links' =>
-
-
- 'align' => 'lrc.', #one letter for each column, left/right/center/none
- # can also pass a listref with full values:
- # [ 'left', 'right', 'center', '' ]
+ #listref - each item is the empty string,
+ # or a listref of link and method name to append,
+ # or a listref of link and coderef to run and append
+ # or a coderef that returns such a listref
+ 'links' => [],`
+
+ #listref - each item is the empty string,
+ # or a string onClick handler for the corresponding link
+ # or a coderef that returns string onClick handler
+ 'link_onclicks' => [],
+
+ #one letter for each column, left/right/center/none
+ # or pass a listref with full values: [ 'left', 'right', 'center', '' ]
+ 'align' => 'lrc.',
- #listrefs...
+ #listrefs of ( scalars or coderefs )
#currently only HTML, maybe eventually Excel too
'color' => [],
'size' => [],
- 'style' => [],
+ 'style' => [], #<B> or <I>, etc.
+ 'cell_style' => [], #STYLE= attribute of TR, very HTML-specific...
#redirect if there's only one item...
# listref of URL base and column name (or method)
@@ -375,11 +396,42 @@
<% include('/elements/table-grid.html') %>
<TR>
-% foreach my $header ( @$header ) {
- <TH CLASS="grid" BGCOLOR="#cccccc"><% $header %></TH>
+% my $h2 = 0;
+% foreach my $header ( @{ $opt{header} } ) {
+% my $label = ref($header) ? $header->{label} : $header;
+% my $rowspan = 1;
+% my $style = '';
+% if ( $opt{header2} ) {
+% if ( !length($opt{header2}->[$h2]) ) {
+% $rowspan = 2;
+% splice @{ $opt{header2} }, $h2, 1;
+% } else {
+% $h2++;
+% $style = 'STYLE="border-bottom: none"'
+% }
+% }
+ <TH CLASS = "grid"
+ BGCOLOR = "#cccccc"
+ ROWSPAN = "<% $rowspan %>"
+ <% $style %>
+
+ >
+ <% $label %>
+ </TH>
% }
</TR>
+% if ( $opt{header2} ) {
+ <TR>
+% foreach my $header ( @{ $opt{header2} } ) {
+% my $label = ref($header) ? $header->{label} : $header;
+ <TH CLASS="grid" BGCOLOR="#cccccc">
+ <FONT SIZE="-1"><% $label %></FONT>
+ </TH>
+% }
+ </TR>
+% }
+
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
% my $bgcolor;
@@ -396,11 +448,13 @@
% if ( $opt{'fields'} ) {
%
-% my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : '';
-% my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : '';
-% my $colors = $opt{'color'} ? [ @{$opt{'color'}} ] : [];
-% my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
-% my $styles = $opt{'style'} ? [ @{$opt{'style'}} ] : [];
+% my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : '';
+% my $onclicks = $opt{'link_onclicks'} ? [ @{$opt{'link_onclicks'}} ] : [];
+% my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : '';
+% my $colors = $opt{'color'} ? [ @{$opt{'color'}} ] : [];
+% my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
+% my $styles = $opt{'style'} ? [ @{$opt{'style'}} ] : [];
+% my $cstyles = $opt{'cell_style'} ? [ @{$opt{'cell_style'}} ] : [];
%
% foreach my $field (
%
@@ -483,7 +537,14 @@
% my $a = '';
% if ( $links ) {
% my $link = shift @$links;
-% $link = &{$link}($row) if ref($link) eq 'CODE';
+% $link = &{$link}($row)
+% if ref($link) eq 'CODE';
+%
+% my $onclick = shift @$onclicks;
+% $onclick = &{$onclick}($row)
+% if ref($onclick) eq 'CODE';
+% $onclick = qq( onClick="$onclick") if $onclick;
+%
% if ( $link ) {
% my( $url, $method ) = @{$link};
% if ( ref($method) eq 'CODE' ) {
@@ -491,7 +552,7 @@
% } else {
% $a = $url. $row->$method();
% }
-% $a = qq(<A HREF="$a">);
+% $a = qq(<A HREF="$a"$onclick>);
% }
% }
%
@@ -514,8 +575,13 @@
% $s = join( '', map "<$_>", split('', $style) );
% $es = join( '', map "</$_>", split('', $style) );
% }
+%
+% my $cstyle = shift @$cstyles;
+% $cstyle = &{$cstyle}($row) if ref($cstyle) eq 'CODE';
+% $cstyle = qq(STYLE="$cstyle")
+% if $cstyle;
- <TD CLASS="<% $class %>" BGCOLOR="<% $bgcolor %>"<% $align %>><% $font %><% $a %><% $s %><% $field %><% $es %><% $a ? '</A>' : '' %><% $font ? '</FONT>' : '' %></TD>
+ <TD CLASS="<% $class %>" BGCOLOR="<% $bgcolor %>" <% $align %> <% $cstyle %>><% $font %><% $a %><% $s %><% $field %><% $es %><% $a ? '</A>' : '' %><% $font ? '</FONT>' : '' %></TD>
% }
%
@@ -620,6 +686,8 @@
splice @{ $opt{'color'} }, $pos, 0, '';
splice @{ $opt{'links'} }, $pos, 0, '' #[ 'agent link?', 'agentnum' ]
if $opt{'links'};
+ splice @{ $opt{'link_onclicks'} }, $pos, 0, ''
+ if $opt{'link_onclicks'};
}
@@ -655,6 +723,8 @@
sub { shift->disabled ? 'FF0000' : '00CC00'; };
splice @{ $opt{'links'} }, $pos, 0, ''
if $opt{'links'};
+ splice @{ $opt{'link_onlicks'} }, $pos, 0, ''
+ if $opt{'link_onlicks'};
}
#add show/hide disabled links
@@ -722,7 +792,7 @@
# run the query
-my $header = $opt{header};
+my $header = [ map { ref($_) ? $_->{'label'} : $_ } @{$opt{header}} ];
my $rows;
if ( ref($opt{query}) ) {
More information about the freeside-commits
mailing list