[freeside-commits] freeside/httemplate/elements progress-init.html,
1.4, 1.5 xmlhttp.html, 1.1, 1.2 progress-popup.html, 1.3,
1.4 jsrsServer.html, 1.1, 1.2
Ivan,,,
ivan at wavetail.420.am
Sun Sep 25 01:13:37 PDT 2005
Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail:/tmp/cvs-serv32619/httemplate/elements
Modified Files:
progress-init.html xmlhttp.html progress-popup.html
jsrsServer.html
Log Message:
get rid of JSRS iframe foo for progress bar, use XMLHTTPRequest instead. really should have done that in the first place. JSON will wait until another day...
Index: progress-popup.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/progress-popup.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- progress-popup.html 2 Jun 2005 09:29:55 -0000 1.3
+++ progress-popup.html 25 Sep 2005 08:13:35 -0000 1.4
@@ -10,25 +10,35 @@
</HEAD>
<BODY BGCOLOR="#ccccff" onLoad="refreshStatus()">
-<SCRIPT TYPE="text/javascript" SRC="../elements/jsrsClient.js"></SCRIPT>
+<%= include('/elements/xmlhttp.html',
+ 'url' => $p.'elements/jsrsServer.html',
+ 'subs' => [ 'job_status' ],
+ )
+%>
<SCRIPT TYPE="text/javascript" src="../elements/qlib/control.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" src="../elements/qlib/imagelist.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" src="../elements/qlib/progress.js"></SCRIPT>
<SCRIPT TYPE="text/javascript">
function refreshStatus () {
- jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' );
+ //jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' );
+
+ job_status( '<%= $jobnum %>', updateStatus );
}
function updateStatus( status_statustext ) {
- var Array = status_statustext.split("\n");
- var status = Array[0];
- var statustext = Array[1];
+
+ //var Array = status_statustext.split("\n");
+ var statusArray = eval('(' + status_statustext + ')');
+ var status = statusArray[0];
+ var statustext = statusArray[1];
+
//if ( status == 'progress' ) {
//IE workaround, no i have no idea why
if ( status.indexOf('progress') > -1 ) {
document.getElementById("progress_percent").innerHTML = statustext + '%';
bar1.set(statustext);
bar1.update;
- jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' );
+ //jsrsExecute( '<%=$p%>elements/jsrsServer.html', updateStatus, 'job_status', '<%= $jobnum %>' );
+ job_status( '<%= $jobnum %>', updateStatus );
} else if ( status.indexOf('complete') > -1 ) {
<% if ( $message ) { %>
document.getElementById("progress_message").innerHTML = "<%= $message %>";
Index: xmlhttp.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/xmlhttp.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xmlhttp.html 10 Sep 2005 14:50:57 -0000 1.1
+++ xmlhttp.html 25 Sep 2005 08:13:35 -0000 1.2
@@ -1,5 +1,9 @@
<%
- my ( $url, @subs ) = @_;
+ my ( %opt ) = @_;
+
+ my $url = $opt{'url'};
+ #my $action = exists $opt{'action'} ? $opt{'action'} : 'GET';
+ #my @subs = @{ $opt{'subs'};
$url .= ( ($url =~ /\?/) ? '&' : '?' ).
'sub=';
@@ -27,7 +31,7 @@
}
- <% foreach my $func (@subs) {
+ <% foreach my $func ( @{$opt{'subs'}} ) {
my $furl = $url . uri_escape($func);
$furl =~ s/\"/\\\\\"/; #javascript escape
@@ -38,11 +42,21 @@
// count args; build URL
var url = "<%=$furl%>";
var a = <%=$func%>.arguments;
- for (var i = 0; i < a.length-1; i++)
- url = url + "&arg=" + escape(a[i]);
+ var args;
+ var len;
+ if ( a && typeof a == 'object' && a[0].constructor == Array ) {
+ args = a[0];
+ len = args.length
+ } else {
+ args = a;
+ len = args.length - 1;
+ }
+ for (var i = 0; i < len; i++)
+ url = url + "&arg=" + escape(args[i]);
url = url.replace( /[+]/g, '%2B'); // fix the unescaped plus signs
var xmlhttp = rs_init_object();
xmlhttp.open("GET", url, true);
+ xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState != 4)
return;
Index: jsrsServer.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/jsrsServer.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- jsrsServer.html 20 Feb 2005 08:44:40 -0000 1.1
+++ jsrsServer.html 25 Sep 2005 08:13:35 -0000 1.2
@@ -1,4 +1,3 @@
<%
-my $server = new FS::UI::Web::JSRPC;
-$server->process;
-%>
+ my $server = new FS::UI::Web::JSRPC '', $cgi;
+%><%= $server->process %>
Index: progress-init.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/progress-init.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- progress-init.html 24 Aug 2005 13:22:27 -0000 1.4
+++ progress-init.html 25 Sep 2005 08:13:35 -0000 1.5
@@ -11,7 +11,11 @@
}
%>
-<SCRIPT TYPE="text/javascript" SRC="../elements/jsrsClient.js"></SCRIPT>
+<%= include('/elements/xmlhttp.html',
+ 'url' => $action,
+ 'subs' => [ 'start_job' ],
+ )
+%>
<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
<SCRIPT TYPE="text/javascript">
@@ -54,8 +58,10 @@
}
}
- jsrsPOST = true;
- jsrsExecute( '<%= $action %>', <%=$key%>myCallback, 'start_job', Hash );
+ // jsrsPOST = true;
+ // jsrsExecute( '<%= $action %>', <%=$key%>myCallback, 'start_job', Hash );
+
+ start_job( Hash, <%=$key%>myCallback );
}
More information about the freeside-commits
mailing list