From 69a17ed7c31d23670f715ad639ab16b12392dcc1 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 27 Apr 2011 00:48:10 +0000 Subject: [PATCH] fix submission bug w/chrome, RT#12638 --- httemplate/elements/form-file_upload.html | 4 +++- httemplate/misc/cdr-import.html | 22 ++++++++++---------- httemplate/misc/cust_main-import.cgi | 22 ++++++++++---------- httemplate/misc/cust_pkg-import.html | 22 ++++++++++---------- httemplate/misc/inventory_item-import.html | 32 +++++++++++++++--------------- httemplate/misc/part_device-import.html | 22 ++++++++++---------- httemplate/misc/phone_avail-import.html | 23 +++++++++++---------- httemplate/misc/rate-import.html | 22 ++++++++++---------- httemplate/misc/rate_edit_excel.html | 22 ++++++++++---------- httemplate/misc/tax-import.cgi | 23 +++++++++++---------- 10 files changed, 109 insertions(+), 105 deletions(-) diff --git a/httemplate/elements/form-file_upload.html b/httemplate/elements/form-file_upload.html index 4ab70ad9c..45b6c97f2 100644 --- a/httemplate/elements/form-file_upload.html +++ b/httemplate/elements/form-file_upload.html @@ -72,7 +72,7 @@ Example: ACTION = "<% $fsurl %>misc/file-upload.html" METHOD = "POST" ENCTYPE = "multipart/form-data" - onSubmit = "return doUpload(this, <% $opt{key} %>gotUploaded)" + onSubmit = "<% $opt{onsubmit} %>return doUpload(this, <% $opt{key} %>gotUploaded)" > <%init> @@ -90,4 +90,6 @@ my $msg_or_url = $opt{message} } : $opt{url}; +$opt{onsubmit} .= ';' if $opt{onsubmit} && $opt{onsubmit} !~ /;\s*$/; + diff --git a/httemplate/misc/cdr-import.html b/httemplate/misc/cdr-import.html index 7af6c521f..05d0bbc3c 100644 --- a/httemplate/misc/cdr-import.html +++ b/httemplate/misc/cdr-import.html @@ -1,14 +1,14 @@ <% include("/elements/header.html",'Call Detail Record Import') %> -<% include( '/elements/form-file_upload.html', - 'name' => 'CDRImportForm', - 'action' => 'process/cdr-import.html', - 'num_files' => 1, - 'fields' => [ 'format', 'cdrbatch', ], - 'message' => 'CDR import successful', - 'url' => $p."search/cdr.html?cdrbatch=$cdrbatch", - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'CDRImportForm', + 'action' => 'process/cdr-import.html', + 'num_files' => 1, + 'fields' => [ 'format', 'cdrbatch', ], + 'message' => 'CDR import successful', + 'url' => $p."search/cdr.html?cdrbatch=$cdrbatch", + 'onsubmit' => "document.CDRImportForm.submitButton.disabled=true;", +&> Import a file containing Call Detail Records (CDRs).

@@ -36,9 +36,9 @@ Import a file containing Call Detail Records (CDRs).

diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 028876c3a..664651069 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -3,15 +3,15 @@ Import a file containing customer records.

-<% include( '/elements/form-file_upload.html', - 'name' => 'CustomerImportForm', - 'action' => 'process/cust_main-import.cgi', - 'num_files' => 1, - 'fields' => [ 'agentnum', 'custbatch', 'format' ], - 'message' => 'Customer import successful', - 'url' => $p."search/cust_main.html?custbatch=$custbatch", - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'CustomerImportForm', + 'action' => 'process/cust_main-import.cgi', + 'num_files' => 1, + 'fields' => [ 'agentnum', 'custbatch', 'format' ], + 'message' => 'Customer import successful', + 'url' => $p."search/cust_main.html?custbatch=$custbatch", + 'onsubmit' => "document.CustomerImportForm.submitButton.disabled=true;", +&> <% &ntable("#cccccc", 2) %> @@ -69,9 +69,9 @@ Import a file containing customer records. diff --git a/httemplate/misc/cust_pkg-import.html b/httemplate/misc/cust_pkg-import.html index b29884d66..f86d317b9 100644 --- a/httemplate/misc/cust_pkg-import.html +++ b/httemplate/misc/cust_pkg-import.html @@ -3,15 +3,15 @@ Import a file containing package records.

-<% include( '/elements/form-file_upload.html', - 'name' => 'PackageImportForm', - 'action' => 'process/cust_pkg-import.html', - 'num_files' => 1, - 'fields' => [ 'agentnum', 'pkgbatch', 'format' ], - 'message' => 'Package import successful', - 'url' => $p."search/cust_pkg.cgi?pkgbatch=$pkgbatch", - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'PackageImportForm', + 'action' => 'process/cust_pkg-import.html', + 'num_files' => 1, + 'fields' => [ 'agentnum', 'pkgbatch', 'format' ], + 'message' => 'Package import successful', + 'url' => $p."search/cust_pkg.cgi?pkgbatch=$pkgbatch", + 'onsubmit' => "document.PackageImportForm.submitButton.disabled=true;" +&> <% &ntable("#cccccc", 2) %> @@ -49,9 +49,9 @@ Import a file containing package records. diff --git a/httemplate/misc/inventory_item-import.html b/httemplate/misc/inventory_item-import.html index d264bafc5..37898739a 100644 --- a/httemplate/misc/inventory_item-import.html +++ b/httemplate/misc/inventory_item-import.html @@ -3,18 +3,18 @@ Import a file containing <% PL($inventory_class->classname) %>, one per line.

-<% include( '/elements/form-file_upload.html', - 'name' => 'InventoryItemImportForm', - 'action' => 'process/inventory_item-import.html', - 'num_files' => 1, - #'fields' => [ 'format', 'itembatch', 'classnum', 'agentnum' ], - 'fields' => [ 'format', 'classnum', 'agentnum', ], - 'message' => 'Inventory import successful', - #XXX redirect via $itembatch? or just back to class browse? - #'url' => $p."search/phone_avail.html?availbatch=$availbatch", - 'url' => $p."search/inventory_item.html?classnum=$classnum;avail=1", - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'InventoryImportForm', + 'action' => 'process/inventory_item-import.html', + 'num_files' => 1, + #'fields' => [ 'format', 'itembatch', 'classnum', 'agentnum' ], + 'fields' => [ 'format', 'classnum', 'agentnum', ], + 'message' => 'Inventory import successful', + #XXX redirect via $itembatch? or just back to class browse? + #'url' => $p."search/phone_avail.html?availbatch=$availbatch", + 'url' => $p."search/inventory_item.html?classnum=$classnum;avail=1", + 'onsubmit' => "document.InventoryImportForm.submitButton.disabled=true;", +&> <% &ntable("#cccccc", 2) %> @@ -37,10 +37,10 @@ Import a file containing <% PL($inventory_class->classname) %>, one per line. - diff --git a/httemplate/misc/part_device-import.html b/httemplate/misc/part_device-import.html index 7bd640459..7cf8167dc 100644 --- a/httemplate/misc/part_device-import.html +++ b/httemplate/misc/part_device-import.html @@ -3,15 +3,15 @@ Import a file containing phone device types, one per line.

-<% include( '/elements/form-file_upload.html', - 'name' => 'PartDeviceImportForm', - 'action' => 'process/part_device-import.html', - 'num_files' => 1, - 'fields' => [ 'format', ], - 'message' => 'Device type import successful', - 'url' => $p.'browse/part_device.html', - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'PartDeviceImportForm', + 'action' => 'process/part_device-import.html', + 'num_files' => 1, + 'fields' => [ 'format', ], + 'message' => 'Device type import successful', + 'url' => $p.'browse/part_device.html', + 'onsubmit' => "document.PartDeviceImportForm.submitButton.disabled=true;", +&> <% &ntable("#cccccc", 2) %> @@ -26,9 +26,9 @@ Import a file containing phone device types, one per line. diff --git a/httemplate/misc/phone_avail-import.html b/httemplate/misc/phone_avail-import.html index b6fea7ec2..0febfbcf5 100644 --- a/httemplate/misc/phone_avail-import.html +++ b/httemplate/misc/phone_avail-import.html @@ -3,15 +3,16 @@ Import a file containing phone numbers (DIDs).

-<% include( '/elements/form-file_upload.html', - 'name' => 'PhonenumImportForm', - 'action' => 'process/phone_avail-import.html', - 'num_files' => 1, - 'fields' => [ 'format', 'availbatch', 'exportnum', 'countrycode', 'ordernum', 'confirmed', 'vendor_order_id' ], - 'message' => 'DID import successful', - 'url' => $p."search/phone_avail.html?availbatch=$availbatch", - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'PhonenumImportForm', + 'action' => 'process/phone_avail-import.html', + 'num_files' => 1, + 'fields' => [ 'format', 'availbatch', 'exportnum', 'countrycode', + 'ordernum', 'confirmed', 'vendor_order_id' ], + 'message' => 'DID import successful', + 'url' => $p."search/phone_avail.html?availbatch=$availbatch", + 'onsubmit' => "document.PhonenumImportForm.submitButton.disabled=true;", +&> <% &ntable("#cccccc", 2) %> @@ -86,9 +87,9 @@ Import a file containing phone numbers (DIDs). diff --git a/httemplate/misc/rate-import.html b/httemplate/misc/rate-import.html index ae8ee695b..538418d13 100644 --- a/httemplate/misc/rate-import.html +++ b/httemplate/misc/rate-import.html @@ -1,14 +1,14 @@ <% include("/elements/header.html",'Import Rate Plan') %> -<% include( '/elements/form-file_upload.html', - 'name' => 'RateImportForm', - 'action ' => 'process/rate-import.html', - 'num_files' => 1, - 'fields' => [ 'ratename' ], - 'message' => 'Rate plan import successful', -# 'url' => $p."browse/rate_detail.cgi?ratenum=$ratenum", #XXX how? - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'RateImportForm', + 'action ' => 'process/rate-import.html', + 'num_files' => 1, + 'fields' => [ 'ratename' ], + 'message' => 'Rate plan import successful', + #'url' => $p."browse/rate_detail.cgi?ratenum=$ratenum", #XXX how? + 'onsubmit' => "document.RateImportForm.submitButton.disabled=true;", +&> <% &ntable("#cccccc", 2) %> @@ -28,9 +28,9 @@ diff --git a/httemplate/misc/rate_edit_excel.html b/httemplate/misc/rate_edit_excel.html index 442d83aca..e55c676a8 100644 --- a/httemplate/misc/rate_edit_excel.html +++ b/httemplate/misc/rate_edit_excel.html @@ -4,15 +4,15 @@ WARNING: This functionality does not yet preserve connection charges.

% } -<% include( '/elements/form-file_upload.html', - 'name' => 'RateImportForm', - 'action' => 'process/rate_edit_excel.html', - 'num_files' => 1, - 'fields' => [ 'format' ], - 'message' => 'Rate edit successful', - 'url' => $p."browse/rate_region.html", - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'RateImportForm', + 'action' => 'process/rate_edit_excel.html', + 'num_files' => 1, + 'fields' => [ 'format' ], + 'message' => 'Rate edit successful', + 'url' => $p."browse/rate_region.html", + 'onsubmit' => "document.RateImportForm.submitButton.disabled=true;" +&> <% &ntable("#cccccc", 2) %> @@ -46,9 +46,9 @@ diff --git a/httemplate/misc/tax-import.cgi b/httemplate/misc/tax-import.cgi index ceb74645c..25414b20d 100644 --- a/httemplate/misc/tax-import.cgi +++ b/httemplate/misc/tax-import.cgi @@ -3,14 +3,14 @@ Import a CSV file set containing tax rate records.

-<% include( '/elements/form-file_upload.html', - 'name' => 'TaxRateUpload', - 'action' => 'process/tax-import.cgi', - 'num_files' => 6, - 'fields' => [ 'format', 'reload' ], - 'message' => 'Tax rates imported', - ) -%> +<& /elements/form-file_upload.html, + 'name' => 'TaxRateUpload', + 'action' => 'process/tax-import.cgi', + 'num_files' => 6, + 'fields' => [ 'format', 'reload' ], + 'message' => 'Tax rates imported', + 'onsubmit' => "document.TaxRateUpload.submitButton.disabled=true;", +&> <% &ntable("#cccccc", 2) %> @@ -54,9 +54,10 @@ Import a CSV file set containing tax rate records. - -- 2.11.0