X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fprogress-popup.html;h=a37cf24ebecc857b054f35bd97a65bf0858a4321;hb=aeb90ade381fc3d5477db0334048c2af623fccfe;hp=0bd71ff4a07e5e17239be71acc4b3fa2182cb37b;hpb=5da73ac30a52234cc126ead03cddaf5a4e131019;p=freeside.git
diff --git a/httemplate/elements/progress-popup.html b/httemplate/elements/progress-popup.html
index 0bd71ff4a..a37cf24eb 100644
--- a/httemplate/elements/progress-popup.html
+++ b/httemplate/elements/progress-popup.html
@@ -2,7 +2,9 @@
% 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');
%
@@ -31,10 +33,12 @@ function updateStatus( status_statustext ) {
var statusArray = eval('(' + status_statustext + ')');
var status = statusArray[0];
var statustext = statusArray[1];
+ var actiontext = statusArray[2];
//if ( status == 'progress' ) {
//IE workaround, no i have no idea why
if ( status.indexOf('progress') > -1 ) {
+ document.getElementById("progress_message").innerHTML = actiontext + '...';
document.getElementById("progress_percent").innerHTML = statustext + '%';
bar1.set(statustext);
bar1.update;
@@ -59,18 +63,35 @@ function updateStatus( status_statustext ) {
}
% }
-% } elsif ( $url ) {
-
+% } elsif ( $url ) {
+ parent.nd(1);
window.top.location.href = '<% $url %>';
+% } elsif ( $popup_url ) {
+ document.location.replace('<% $popup_url %>');
% } else {
+
alert('job done but no url or message specified');
% }
+ } else if ( status.indexOf('done') > -1 ) {
+
+ document.getElementById("progress_message").innerHTML = "Loading report";
+ document.getElementById("progress_bar").innerHTML = '';
+ document.getElementById("progress_percent").innerHTML = '';
+ document.getElementById("progress_jobnum").innerHTML = '';
+ window.top.location.href = statustext.substr(8, statustext.length-18);
} else if ( status.indexOf('error') > -1 ) {
+%
+% # default behavior: just close the popup
+% my $onClick = 'parent.nd(1);';
+% if ( $error_url ) { # then on clicking to confirm, redirect somewhere
+% $onClick = "window.top.location.href = \\'$error_url\\';";
+% }
+
document.getElementById("progress_message").innerHTML = 'Error: ' + statustext + '';
document.getElementById("progress_bar").innerHTML = '';
- document.getElementById("progress_percent").innerHTML = '';
+ document.getElementById("progress_percent").innerHTML = '';
document.getElementById("progress_jobnum").innerHTML = '';
if ( parent.document.<%$formname%>.submit.disabled == true ) {
parent.document.<%$formname%>.submit.disabled=false;