From 342e2bfbe6aad470ab9dee40640f8ac7d9653003 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 22 Jul 2010 00:11:56 +0000 Subject: cdr rating by day and time, part 2, RT#4763 --- httemplate/elements/auto-table.html | 77 ++++++++++++++++++++++--------------- httemplate/elements/menu.html | 1 + 2 files changed, 47 insertions(+), 31 deletions(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/auto-table.html b/httemplate/elements/auto-table.html index 89d6eacb9..9c7dfd09a 100644 --- a/httemplate/elements/auto-table.html +++ b/httemplate/elements/auto-table.html @@ -28,6 +28,12 @@ Example: 'records' => [ qsearch('item', { } ) ], # or any other array of FS::Record objects + 'select' => [ '', + [ 1 => 'option 1', + 2 => 'option 2', ... + ], # options for second field + '' ], + 'prefix' => 'mytable_', ) %> @@ -47,6 +53,17 @@ Values will be passed through as "mytable_id1", etc. % for ( $col = 0; $col < scalar @fields; $col++ ) { % my $id = $prefix . $fields[$col] . $row; +% my @o = @{ $select[$col] }; +% if( @o ) { + +% } +% else { STYLE = "text-align:<% $align[$col] %>" VALUE = "<% $data[$row][$col] %>" - onchange = "possiblyAddRow();" +% if( $opt{'autoadd'} ) { + onchange = "possiblyAddRow(this);" +% } > +% } % } " ALT = "X" - onclick = "deleteThisRow(this);" + onclick = "deleteRow(this);" > % } +% if( !$opt{'autoadd'} ) { +
+% } <%init> @@ -137,10 +148,14 @@ elsif($opt{'records'}) { } } # else @data = (); +push @data, [ map {''} @fields ]; # make a blank row my $prefix = $opt{'prefix'}; my @size = $opt{'size'} ? @{ $opt{'size'} } : (map {16} @fields); my @maxl = $opt{'maxl'} ? @{ $opt{'maxl'} } : @size; my @align = $opt{'align'} ? @{ $opt{'align'} } : (map {'right'} @fields); - +my @select = @{ $opt{'select'} || [] }; +foreach (0..scalar(@fields)-1) { + $select[$_] ||= []; +} diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 1eaefe231..da2dcaa4c 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -421,6 +421,7 @@ tie my %config_billing_rates, 'Tie::IxHash', 'Rate plans' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans' ], 'Regions and prefixes' => [ $fsurl.'browse/rate_region.html', 'Manage regions and prefixes' ], 'Usage classes' => [ $fsurl.'browse/usage_class.html', 'Usage classes define groups of usage for taxation.' ], + 'Time periods' => [ $fsurl.'browse/rate_time.html', 'Time periods define days and hours for rate plans' ], 'Edit rates with Excel' => [ $fsurl.'misc/rate_edit_excel.html', 'Download and edit rates with Excel, then upload changes.' ], #"Edit with Excel" ? ; -- cgit v1.2.1