From e55892bdf6dc95710a19876087690a9664421215 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 14 Feb 2013 14:31:13 -0800 Subject: include elements/search.html the right way to avoid problems with XLS download, #21421 --- httemplate/search/477partIA_detail.html | 6 +++--- httemplate/search/477partIA_summary.html | 6 +++--- httemplate/search/477partIIA.html | 6 +++--- httemplate/search/477partV.html | 6 +++--- httemplate/search/477partVI_census.html | 6 +++--- httemplate/search/agent_inventory.html | 5 ++--- httemplate/search/bill_batch.cgi | 6 ++---- httemplate/search/cdr.html | 6 +++--- httemplate/search/cust_bill_event.cgi | 6 +++--- httemplate/search/cust_bill_pay.html | 6 +++--- httemplate/search/cust_bill_pkg_discount.html | 6 +++--- httemplate/search/cust_credit_bill.html | 6 +++--- httemplate/search/cust_credit_bill_pkg.html | 6 +++--- httemplate/search/cust_credit_refund.html | 6 +++--- httemplate/search/cust_event.html | 5 ++--- httemplate/search/cust_main-zip.html | 5 ++--- httemplate/search/cust_pay_batch.cgi | 5 ++--- httemplate/search/cust_pkg_discount.html | 6 +++--- httemplate/search/cust_pkg_svc.html | 6 +++--- httemplate/search/cust_tax_adjustment.html | 7 +++---- httemplate/search/cust_tax_exempt.cgi | 6 +++--- httemplate/search/cust_tax_exempt_pkg.cgi | 5 ++--- httemplate/search/inventory_item.html | 6 +++--- httemplate/search/mailinglistmember.html | 5 ++--- httemplate/search/part_pkg.html | 6 +++--- httemplate/search/pay_batch.cgi | 5 ++--- httemplate/search/phone_avail.html | 6 +++--- httemplate/search/phone_inventory_provisioned.html | 6 +++--- httemplate/search/prepay_credit.html | 6 +++--- httemplate/search/prospect_main.html | 5 ++--- httemplate/search/qual.cgi | 6 +++--- httemplate/search/queue.html | 7 +++---- httemplate/search/reg_code.html | 6 +++--- httemplate/search/rt_ticket.html | 5 ++--- httemplate/search/rt_transaction.html | 5 ++--- httemplate/search/sql.html | 6 +++--- httemplate/search/svc_broadband.cgi | 6 +++--- httemplate/search/svc_dish.cgi | 6 +++--- httemplate/search/svc_domain.cgi | 6 +++--- httemplate/search/svc_external.cgi | 7 +++---- httemplate/search/svc_forward.cgi | 6 +++--- httemplate/search/svc_hardware.cgi | 5 ++--- httemplate/search/svc_phone.cgi | 6 +++--- httemplate/search/svc_www.cgi | 6 +++--- httemplate/search/timeworked.html | 7 +++---- httemplate/search/unprovisioned_services.html | 6 +++--- 46 files changed, 126 insertions(+), 143 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/477partIA_detail.html b/httemplate/search/477partIA_detail.html index 66f3a8651..666032d0c 100755 --- a/httemplate/search/477partIA_detail.html +++ b/httemplate/search/477partIA_detail.html @@ -1,4 +1,4 @@ -<% include( 'elements/search.html', +<& elements/search.html, 'html_init' => $html_init, 'name' => 'lines', 'query' => $query, @@ -11,8 +11,8 @@ 'xml_elements' => [ @xml_elements ], 'xml_omit_empty' => 1, 'fields' => [ @fields ], - ) -%> + +&> <%init> my $curuser = $FS::CurrentUser::CurrentUser; diff --git a/httemplate/search/477partIA_summary.html b/httemplate/search/477partIA_summary.html index f5c2bc251..ebf081c71 100755 --- a/httemplate/search/477partIA_summary.html +++ b/httemplate/search/477partIA_summary.html @@ -1,4 +1,4 @@ -<% include( 'elements/search.html', +<& elements/search.html, 'html_init' => $html_init, 'name' => 'lines', 'query' => 'SELECT 1', @@ -28,8 +28,8 @@ sub { $total_percentage }, sub { $above_200_percentage }, ], - ) -%> + +&> <%init> my $curuser = $FS::CurrentUser::CurrentUser; diff --git a/httemplate/search/477partIIA.html b/httemplate/search/477partIIA.html index d2cc8c3e9..6a532299b 100755 --- a/httemplate/search/477partIIA.html +++ b/httemplate/search/477partIIA.html @@ -1,4 +1,4 @@ -<% include( 'elements/search.html', +<& elements/search.html, 'html_init' => $html_init, 'name' => 'lines', 'query' => $query, @@ -10,8 +10,8 @@ 'header' => [ @headers ], 'xml_elements' => [ @xml_elements ], 'fields' => [ @fields ], - ) -%> + +&> <%init> my $curuser = $FS::CurrentUser::CurrentUser; diff --git a/httemplate/search/477partV.html b/httemplate/search/477partV.html index 2fd5119d1..f83a7a0cb 100755 --- a/httemplate/search/477partV.html +++ b/httemplate/search/477partV.html @@ -1,4 +1,4 @@ -<% include( 'elements/search.html', +<& elements/search.html, 'html_init' => $html_init, 'name' => 'zip code', 'query' => $sql_query, @@ -12,8 +12,8 @@ 'url' => $opt{url} || '', 'really_disable_download' => 1, - ) -%> + +&> <%init> my $curuser = $FS::CurrentUser::CurrentUser; diff --git a/httemplate/search/477partVI_census.html b/httemplate/search/477partVI_census.html index 8425c4b48..59a6fb50d 100755 --- a/httemplate/search/477partVI_census.html +++ b/httemplate/search/477partVI_census.html @@ -1,4 +1,4 @@ -<% include( 'elements/search.html', +<& elements/search.html, 'html_init' => '

Part VI

', 'html_foot' => $html_foot, 'name' => 'regions', @@ -24,8 +24,8 @@ 'url' => $opt{url} || '', 'xml_row_element' => 'Datarow', 'really_disable_download' => 1, - ) -%> + +&> <%init> my $curuser = $FS::CurrentUser::CurrentUser; diff --git a/httemplate/search/agent_inventory.html b/httemplate/search/agent_inventory.html index ac65371ca..015aca46b 100644 --- a/httemplate/search/agent_inventory.html +++ b/httemplate/search/agent_inventory.html @@ -1,4 +1,4 @@ -<% include('elements/search.html', +<& elements/search.html, 'title' => 'Inventory summary per agent', 'name_singular' => 'agent', 'query' => { 'table' => 'agent', @@ -10,8 +10,7 @@ " AND $agentnums_sql", 'header' => \@header, 'fields' => \@fields, - ) -%> +&> <%init> die "access denied" diff --git a/httemplate/search/bill_batch.cgi b/httemplate/search/bill_batch.cgi index b6676f261..b740bdc68 100755 --- a/httemplate/search/bill_batch.cgi +++ b/httemplate/search/bill_batch.cgi @@ -26,7 +26,7 @@ function start() { % -expires => '-1d', % ); % $r->headers_out->add( 'Set-Cookie' => $cookie->as_string ); -<% include( 'elements/search.html', +<& elements/search.html, 'title' => 'Invoice Batches', 'name_singular' => 'batch', 'query' => { 'table' => 'bill_batch', @@ -67,9 +67,7 @@ function start() { 'agent_pos' => 1, 'html_foot' => include('.foot'), - ) - -%> +&> %} <%def .foot> +% } # end of $init + + +<%init> + +my %opt = @_; + +# might be useful but I'm not implementing it yet +#my $onchange = $opt{'onchange'} +# ? 'onChange="'. $opt{'onchange'}. '(this)"' +# : ''; + +$opt{'id'} ||= 'hidden_'.$opt{'field'}; +my $curr_value = $opt{curr_value}; +$curr_value = undef + unless $curr_value eq '0' or $curr_value eq '1'; + diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index 642c2da5b..1b4604bbb 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -9,26 +9,8 @@ 'fields' => \@fields, 'links' => \@links, 'html_form' => qq!
!, - #false laziness w/queue.html - 'html_foot' => sub { - if ( $areboxes ) { - '
'. - ''. - qq!
!. - qq!
!. - ''; - } else { - ''; - } - }, - + 'html_foot' => $html_foot, + ) &> <%init> @@ -44,8 +26,6 @@ my $totalminutes_sub = sub { my $conf = new FS::Conf; -my $areboxes = 0; - my $title = 'Call Detail Records'; my $hashref = {}; @@ -355,7 +335,6 @@ my %links = ( @fields = map { exists($fields{$_}) ? $fields{$_} : $_ } @fields; unshift @fields, sub { return '' unless $edit_data; - $areboxes = 1; my $cdr = shift; my $acctid = $cdr->acctid; qq!!; @@ -409,4 +388,14 @@ if ( $topmode ) { $nototalminutes = 1; } +my $html_foot = include('/search/elements/checkbox-foot.html', + actions => [ + { submit => "reprocess selected", + name => "action", + confirm => "Are you sure you want to reprocess the selected CDRs?" }, + { submit => "delete selected", + name => "action", + confirm => "Are you sure you want to delete the selected CDRs?" }, + ] +); diff --git a/httemplate/search/elements/checkbox-foot.html b/httemplate/search/elements/checkbox-foot.html new file mode 100644 index 000000000..be1caab91 --- /dev/null +++ b/httemplate/search/elements/checkbox-foot.html @@ -0,0 +1,86 @@ +<%doc> +<& /elements/search.html, + # options... + html_foot => include('elements/checkbox-foot.html', + actions => [ + { label => 'Edit selected packages', + action => 'popup_package_edit()', + }, + { submit => 'Delete selected packages', + confirm => 'Really delete these packages?' + }, + ], + filter => '.name = "pkgpart"', # see below + ), +&> + +This creates a footer for a search page containing a column of checkboxes. +Typically this is used to select several items from the search result and +apply some change to all of them at once. The footer always provides +"select all" and "unselect all" buttons. + +"actions" is an arrayref of action buttons to show. Each element of the +array is a hashref of either: + +- "submit" and, optionally, "confirm". Creates a submit button. The value +of "submit" becomes the "value" property of the button (and thus its label). +If "confirm" is specified, the button will have an onclick handler that +displays the value of "confirm" in a popup message box and asks the user to +confirm the choice. + +- "onclick" and "label". Creates a non-submit button that executes the +Javascript code in "onclick". "label" is used as the text of the button. + +If you want only a single action, you can forget the arrayref-of-hashrefs +business and just put "submit" and "confirm" (or "onclick" and "label") +elements in the argument list. + +"filter" is a javascript expression to limit which checkboxes are included in +the "select/unselect all" actions. By default, any input with type="checkbox" +will be included. If this option is given, it will be evaluated with the +HTML node in a variable named "obj". The expression should return true or +false. + + + + +<%init> +my %opt = @_; +my $actions = $opt{'actions'} || [ \%opt ]; +foreach (@$actions) { + $_->{confirm} &&= qq!onclick="return confirm('! . $_->{confirm} . qq!')"!; + $_->{name} &&= qq!NAME="! . $_->{name} . qq!"!; +} +my $filter = $opt{filter} || 'true'; + -- cgit v1.2.1 From 8b590098fbd78765f97d44f5500a967b4afdbbe1 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 15 Feb 2013 00:13:33 -0800 Subject: remember 477 report part 5 selection, #13057 --- httemplate/search/477.html | 5 +++++ httemplate/search/477partV.html | 4 ++-- httemplate/search/report_477.html | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/477.html b/httemplate/search/477.html index 6f5fcdf3b..04764c1da 100755 --- a/httemplate/search/477.html +++ b/httemplate/search/477.html @@ -97,6 +97,11 @@ for(my $i=0; $i < scalar(@part2b_row_option); $i++) { &FS::Report::FCC_477::save_fcc477map("part2b_row_option_$i",$part2b_row_option[$i]); } +my $part5_report_option = $cgi->param('part5_report_option'); +if ( $part5_report_option ) { + FS::Report::FCC_477::save_fcc477map('part5_report_option', $part5_report_option); +} + my $url_mangler = sub { my $part = shift; my $url = $cgi->url('-path_info' => 1, '-full' => 1); diff --git a/httemplate/search/477partV.html b/httemplate/search/477partV.html index f83a7a0cb..2106a44d6 100755 --- a/httemplate/search/477partV.html +++ b/httemplate/search/477partV.html @@ -32,8 +32,8 @@ for ( qw(agentnum magic state) ) { } $search_hash{'country'} = 'US'; $search_hash{'classnum'} = [ $cgi->param('classnum') ]; -$search_hash{report_option} = $cgi->param('partv_report_option') - if $cgi->param('partv_report_option'); +$search_hash{report_option} = $cgi->param('part5_report_option') + if $cgi->param('part5_report_option'); my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' => 1, diff --git a/httemplate/search/report_477.html b/httemplate/search/report_477.html index f593a94d8..b842b1f3f 100755 --- a/httemplate/search/report_477.html +++ b/httemplate/search/report_477.html @@ -231,7 +231,9 @@ 'table' => 'part_pkg_report_option', 'name_col' => 'name', 'hashref' => { 'disabled' => '' }, - 'element_name' => 'partv_report_option', + 'element_name' => 'part5_report_option', + 'curr_value' => + FS::Report::FCC_477::restore_fcc477map("part5_report_option"), ) %> -- cgit v1.2.1