[freeside-commits] branch FREESIDE_4_BRANCH updated. 4408ac2321d14809b49f94877717602a90a3ada9

Ivan ivan at 420.am
Fri Nov 11 13:13:19 PST 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  4408ac2321d14809b49f94877717602a90a3ada9 (commit)
      from  5fc06d3c683c6d9a51508e2a50fa7e487af9294d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4408ac2321d14809b49f94877717602a90a3ada9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Nov 11 13:13:18 2016 -0800

    UX: acknowledge bill now instead of silently redirecting

diff --git a/httemplate/elements/bill.html b/httemplate/elements/bill.html
index 420a748..6ba8b7e 100644
--- a/httemplate/elements/bill.html
+++ b/httemplate/elements/bill.html
@@ -28,7 +28,7 @@ Example:
           $formname,
           [ 'custnum', @opt_keys ],
           $p.'misc/bill.cgi',
-          $url ? { url => $url } : { message => $message },
+          \%args,
           $formname, # use it as 'key'
 ) %>
 <A HREF="javascript:void(0);" onclick="javascript:<%$formname%>process();"><%$label%></A>
@@ -46,10 +46,11 @@ my $label     = $opt{'label'};
 # need one and it needs to be unique
 my $formname  = $opt{'formname'} ||
                 'bill'.sprintf('%04d',random_id(4)).$custnum;
-my $url       = $opt{'url'} || '';
-my $message   = $opt{'message'} || 'Finished!';
 my $bill_opts = $opt{'bill_opts'} || {};
 my @opt_keys  = keys(%$bill_opts);
 my @opt_vals  = values(%$bill_opts);
 
+my %args = ( 'message' => $opt{'message'} || mt('Customer billed') );
+$args{url} = $opt{url} if $opt{url};
+
 </%init>
diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html
index 0c2b816..789825c 100644
--- a/httemplate/elements/progress-init.html
+++ b/httemplate/elements/progress-init.html
@@ -13,8 +13,7 @@ In misc/something.html:
          #or { message => 'Finished!' },
          #or { url => $p.'where_to_go.html',
                message => 'Finished' },
-         # which displays the message, then waits for confirmation before 
-         # redirecting to the URL.
+         # which recirects to the URL and displays the message as a status
          #or { popup_url => $p.'popup_contents.html' }
          # which loads that URL into the popup after completion
          #or { url => $p.'where_to_go.html',
@@ -96,7 +95,7 @@ function <%$key%>process () {
     document.<%$formname%>.submit.disabled=true;
   }
 
-  overlib( 'Submitting job to server...', WIDTH, 444, HEIGHT, 168, CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );
+  overlib( 'Submitting job to server...', WIDTH, 444, HEIGHT, 168, CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0, TEXTPADDING, 0, BASE, 0, BGCOLOR, '#333399', CGCOLOR, '#333399', FGCOLOR, '#f8f8f8' );
 
   // jQuery .serializeArray() maybe?
   var copy_fields = <% encode_json(\%copy_fields) %>;
@@ -140,7 +139,7 @@ function <%$key%>myCallback( jobnum ) {
 
   var url = <% $progress_url->as_string |js_string %>;
   url = url.replace('_JOBNUM_', jobnum);
-  overlib( OLiframeContent(url, 444, 168, '<% $popup_name %>'), CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );
+  overlib( OLiframeContent(url, 444, 168, '<% $popup_name %>', 0), CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0, TEXTPADDING, 0, BASE, 0, BGCOLOR, '#333399', CGCOLOR, '#333399', FGCOLOR, '#f8f8f8' );
 
 }
 
diff --git a/httemplate/misc/progress-popup.html b/httemplate/misc/progress-popup.html
index 8e2d676..9964bcc 100644
--- a/httemplate/misc/progress-popup.html
+++ b/httemplate/misc/progress-popup.html
@@ -1,26 +1,16 @@
-%
-%  my $jobnum = $cgi->param('jobnum');
-%  my $url = $cgi->param('url');
-%  my $message = $cgi->param('message');
-%  my $popup_url = $cgi->param('popup_url');
-%  my $formname = scalar($cgi->param('formname'));
-%  my $error_url = $cgi->param('error_url');
-%
-
-<HTML>
-  <HEAD>
-    <TITLE></TITLE>
-  </HEAD>
-  <BODY BGCOLOR="#ccccff" onLoad="refreshStatus()">
-
-<% include('/elements/xmlhttp.html',
-              'url'  => $p.'misc/jsrsServer.html',
-              'subs' => [ 'job_status' ],
-           )
-%>
+<& /elements/header-popup.html, {
+     'etc' => 'onLoad="refreshStatus()"',
+   }
+&>
+
+<& /elements/xmlhttp.html,
+     'url'  => $p.'misc/jsrsServer.html',
+     'subs' => [ 'job_status' ],
+&>
 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/control.js"></SCRIPT>
 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/imagelist.js"></SCRIPT>
 <SCRIPT TYPE="text/javascript" src="<%$fsurl%>elements/qlib/progress.js"></SCRIPT>
+<script src="<% $fsurl %>elements/js.cookie.js"></script>
 <SCRIPT TYPE="text/javascript">
 function refreshStatus () {
   //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
@@ -45,25 +35,22 @@ function updateStatus( status_statustext ) {
     //jsrsExecute( '<%$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<% $jobnum %>' );
     job_status( '<% $jobnum %>', updateStatus );
   } else if ( status.indexOf('complete') > -1 ) {
-% if ( $message ) {
-%
-%   my $onClick = $url
-%                   ? "window.top.location.href = \\'$url\\';"
-%                   : 'parent.nd(1);';
+% if ( $message && !$url ) {
 
     document.getElementById("progress_message").innerHTML = "<% $message %>";
     document.getElementById("progress_bar").innerHTML = '';
     document.getElementById("progress_percent").innerHTML =
-      '<INPUT TYPE="button" VALUE="OK" onClick="<% $onClick %>">';
+      '<INPUT TYPE="button" VALUE="OK" onClick="parent.nd(1)">';
     document.getElementById("progress_jobnum").innerHTML = '';
 
-%   unless ( $url ) {
-        if ( parent.document.<%$formname%>.submit.disabled == true ) {
-          parent.document.<%$formname%>.submit.disabled=false;
-        }
-%   }
+    if ( parent.document.<%$formname%>.submit.disabled == true ) {
+      parent.document.<%$formname%>.submit.disabled=false;
+    }
 
 % } elsif ( $url ) {
+    Cookies.set('freeside_status', <% $message |js_string %>, {
+                  expires: 0.0035
+    });
     parent.nd(1);
     window.top.location.href = '<% $url %>';
 % } elsif ( $popup_url ) {
@@ -130,6 +117,14 @@ function updateStatus( status_statustext ) {
       </TR>
     </TABLE>
 
-  </BODY>
-</HTML>
+<& /elements/footer-popup.html &>
+<%init>
+
+my $jobnum = $cgi->param('jobnum');
+my $url = $cgi->param('url');
+my $message = $cgi->param('message');
+my $popup_url = $cgi->param('popup_url');
+my $formname = scalar($cgi->param('formname'));
+my $error_url = $cgi->param('error_url');
 
+</%init>

-----------------------------------------------------------------------

Summary of changes:
 httemplate/elements/bill.html          |    7 ++--
 httemplate/elements/progress-init.html |    7 ++--
 httemplate/misc/progress-popup.html    |   61 +++++++++++++++-----------------
 3 files changed, 35 insertions(+), 40 deletions(-)




More information about the freeside-commits mailing list