freeside/httemplate/edit rate.cgi,1.3,1.4
ivan
ivan at pouncequick.420.am
Thu Jan 27 02:21:26 PST 2005
- Previous message: freeside/httemplate/elements/qlib box.js,NONE,1.1 boxctrl.js,NONE,1.1 boxres.js,NONE,1.1 button.js,NONE,1.1 buttonres.js,NONE,1.1 control.js,NONE,1.1 counter.js,NONE,1.1 imagelist.js,NONE,1.1 label.js,NONE,1.1 messagebox.js,NONE,1.1 progress.js,NONE,1.1 sound.js,NONE,1.1 sprite.js,NONE,1.1 window.js,NONE,1.1 wndctrl.js,NONE,1.1
- Next message: freeside/FS/FS cust_pkg.pm,1.53,1.54
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory pouncequick:/tmp/cvs-serv11805/httemplate/edit
Modified Files:
rate.cgi
Log Message:
DHTML progress bar for glacial rate adding and editing, closes: Bug#1100
Index: rate.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/rate.cgi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rate.cgi 7 Jan 2005 22:16:50 -0000 1.3
+++ rate.cgi 27 Jan 2005 10:21:18 -0000 1.4
@@ -1,52 +1,7 @@
<%
-my($rate, $error);
-
-if ( $cgi->param('magic') eq 'process' ) {
-
- my $ratenum = $cgi->param('ratenum');
-
- my $old = qsearchs('rate', { 'ratenum' => $ratenum } ) if $ratenum;
-
- my @rate_detail = map {
- my $regionnum = $_->regionnum;
- if ( $cgi->param("sec_granularity$regionnum") ) {
- new FS::rate_detail {
- 'dest_regionnum' => $regionnum,
- map { $_ => scalar($cgi->param("$_$regionnum")) }
- qw( min_included min_charge sec_granularity )
- };
- } else {
- new FS::rate_detail {
- 'dest_regionnum' => $regionnum,
- 'min_included' => 0,
- 'min_charge' => 0,
- 'sec_granularity' => '60'
- };
- }
- } qsearch('rate_region', {} );
-
- $rate = new FS::rate ( {
- map {
- $_, scalar($cgi->param($_));
- } fields('rate')
- } );
-
- if ( $ratenum ) {
- warn "$rate replacing $old ($ratenum)\n";
- $error = $rate->replace($old, 'rate_detail' => \@rate_detail );
- } else {
- warn "inserting $rate\n";
- $error = $rate->insert( 'rate_detail' => \@rate_detail );
- $ratenum = $rate->getfield('ratenum');
- }
-
- unless ( $error ) {
- print $cgi->redirect("${p}browse/rate.cgi");
- myexit;
- }
-
-} elsif ( $cgi->keywords ) {
+my $rate;
+if ( $cgi->keywords ) {
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
$rate = qsearchs( 'rate', { 'ratenum' => $1 } );
@@ -77,12 +32,41 @@
))
%>
-<% if ( $error ) { %>
-<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT><BR>
-<% } %>
+<!-- <FORM ACTION="<%=$p1%>rate.cgi" NAME="OneTrueForm" METHOD=POST onSubmit="document.OneTrueForm.submit.disabled=true"> -->
-<FORM ACTION="<%=$p1%>rate.cgi" NAME="OneTrueForm" METHOD=POST onSubmit="document.OneTrueForm.submit.disabled=true">
-<INPUT TYPE="hidden" NAME="magic" VALUE="process">
+<SCRIPT TYPE="text/javascript" SRC="../elements/jsrsClient.js"></SCRIPT>
+<SCRIPT TYPE="text/javascript">
+function process () {
+ document.OneTrueForm.submit.disabled=true;
+
+ var Hash = new Array();
+ var x = 0;
+ var fieldName;
+ for (var i = 0; i<document.OneTrueForm.elements.length; i++) {
+ fieldName = document.OneTrueForm.elements[i].name;
+ if ( (fieldName.indexOf('rate') > -1)
+ || (fieldName.indexOf('min_') > -1)
+ || (fieldName.indexOf('sec_') > -1)
+ )
+ {
+ Hash[x++] = fieldName;
+ Hash[x++] = document.OneTrueForm.elements[i].value;
+ }
+ }
+
+ jsrsPOST = true;
+ jsrsExecute( 'process/rate.cgi', myCallback, 'process_rate', Hash );
+
+ function myCallback( jobnum ) {
+ var progressWindow = window.open('../../misc/progress.html?jobnum=' + jobnum + ';url=<%=$p%>browse/rate.cgi', 'progressWindow', 'toolbar=no,location=no,directories=no,scrollbars=no,menubar=no,status=no,width=420,height=128');
+ progressWindow.opener = self;
+ //progressWindow.opener = document;
+ }
+
+}
+</SCRIPT>
+
+<FORM NAME="OneTrueForm">
<INPUT TYPE="hidden" NAME="ratenum" VALUE="<%= $rate->ratenum %>">
Rate plan
@@ -135,11 +119,12 @@
</TABLE>
-<BR><INPUT NAME="submit" TYPE="submit" VALUE="<%=
+<BR><INPUT NAME="submit" TYPE="button" VALUE="<%=
$rate->ratenum ? "Apply changes" : "Add rate plan"
-%>">
-Please be patient, <%= $rate->ratenum ? 'editing' : 'adding' %>
-a rate plan can take a few minutes...
+%>" onClick="document.OneTrueForm.submit.disabled=true; process();">
+Please make sure to allow popups from this site in order to view the progress window.
+<!-- Please be patient, <%= $rate->ratenum ? 'editing' : 'adding' %>
+a rate plan can take a few minutes... -->
</FORM>
</BODY>
- Previous message: freeside/httemplate/elements/qlib box.js,NONE,1.1 boxctrl.js,NONE,1.1 boxres.js,NONE,1.1 button.js,NONE,1.1 buttonres.js,NONE,1.1 control.js,NONE,1.1 counter.js,NONE,1.1 imagelist.js,NONE,1.1 label.js,NONE,1.1 messagebox.js,NONE,1.1 progress.js,NONE,1.1 sound.js,NONE,1.1 sprite.js,NONE,1.1 window.js,NONE,1.1 wndctrl.js,NONE,1.1
- Next message: freeside/FS/FS cust_pkg.pm,1.53,1.54
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list