diff options
author | ivan <ivan> | 2005-09-25 08:13:36 +0000 |
---|---|---|
committer | ivan <ivan> | 2005-09-25 08:13:36 +0000 |
commit | 76161f1a2ae0f96470bed4089b00eff5abb16cff (patch) | |
tree | 1d727c8829d651347f3bcd79971e519674290f23 /httemplate | |
parent | 672f360a644d12d7eab223fd00cd3426b00756cd (diff) |
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...
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/docs/install.html | 1 | ||||
-rw-r--r-- | httemplate/docs/upgrade10.html | 3 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-country.html | 6 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-county.html | 6 | ||||
-rwxr-xr-x | httemplate/edit/process/part_svc.cgi | 5 | ||||
-rwxr-xr-x | httemplate/edit/process/rate.cgi | 5 | ||||
-rw-r--r-- | httemplate/elements/jsrsServer.html | 5 | ||||
-rw-r--r-- | httemplate/elements/progress-init.html | 12 | ||||
-rw-r--r-- | httemplate/elements/progress-popup.html | 22 | ||||
-rw-r--r-- | httemplate/elements/xmlhttp.html | 22 |
10 files changed, 60 insertions, 27 deletions
diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 72b1214ec..d89ea3f04 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -61,7 +61,6 @@ Before installing, you need: <li><a href="http://search.cpan.org/dist/Chart">Chart</a> <li><a href="http://search.cpan.org/dist/Crypt-PasswdMD5">Crypt::PasswdMD5</a> <li><a href="http://search.cpan.org/dist/Locale-SubCountry">Locale::SubCountry</a> - <li><a href="http://search.cpan.org/dist/JavaScript-RPC">JavaScript::RPC (JavaScript::RPC::Server::CGI)</a> <li><a href="http://search.cpan.org/dist/Frontier-RPC">Frontier::RPC</a> <li><a href="http://search.cpan.org/dist/Text-CSV_XS">Text::CSV_XS</a> <li><a href="http://search.cpan.org/dist/Spreadsheet-WriteExcel">Spreadsheet::WriteExcel</a> diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 98a457ae6..fb51bfb8e 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -18,8 +18,7 @@ install HTML::Widgets::SelectLayers 0.05 - In httpd.conf, change <Files ~ \.cgi> to <Files ~ (\.cgi|\.html)> - In httpd.conf, change <b>AddHandler perl-script .cgi</b> or <b>SetHandler perl-script</b> to <b>AddHandler perl-script .cgi .html</b> -install NetAddr::IP, Chart::Base, Locale::SubCountry, -JavaScript::RPC (JavaScript::RPC::Server::CGI), Text::CSV_XS, +install NetAddr::IP, Chart::Base, Locale::SubCountry, Text::CSV_XS, Spreadsheet::WriteExcel, IO-stringy (IO::Scalar), Frontier::RPC (Frontier::RPC2), MIME::Entity (MIME-tools) and IPC::Run3 <!-- and Crypt::YAPassGen--> diff --git a/httemplate/edit/cust_main/select-country.html b/httemplate/edit/cust_main/select-country.html index 44f4f0a55..014effd66 100644 --- a/httemplate/edit/cust_main/select-country.html +++ b/httemplate/edit/cust_main/select-country.html @@ -10,7 +10,11 @@ %> -<%= include('/elements/xmlhttp.html', $p.'misc/states.cgi', $opt{'prefix'}. 'get_states') %> +<%= include('/elements/xmlhttp.html', + 'url' => $p.'misc/states.cgi', + 'subs' => [ $opt{'prefix'}. 'get_states' ], + ) +%> <SCRIPT TYPE="text/javascript"> diff --git a/httemplate/edit/cust_main/select-county.html b/httemplate/edit/cust_main/select-county.html index 70a8f9477..3de380b31 100644 --- a/httemplate/edit/cust_main/select-county.html +++ b/httemplate/edit/cust_main/select-county.html @@ -15,7 +15,11 @@ <% if ( $countyflag ) { %> - <%= include('/elements/xmlhttp.html', $p.'misc/counties.cgi', $opt{'prefix'}. 'get_counties' ) %> + <%= include('/elements/xmlhttp.html', + 'url' => $p.'misc/counties.cgi', + 'subs' => [ $opt{'prefix'}. 'get_counties' ], + ) +%> <SCRIPT TYPE="text/javascript"> diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi index 664e5212a..b92b62739 100755 --- a/httemplate/edit/process/part_svc.cgi +++ b/httemplate/edit/process/part_svc.cgi @@ -1,4 +1,3 @@ <% -my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process'; -$server->process; -%> + my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process', $cgi; +%><%= $server->process %> diff --git a/httemplate/edit/process/rate.cgi b/httemplate/edit/process/rate.cgi index 005caf90a..0030b5754 100755 --- a/httemplate/edit/process/rate.cgi +++ b/httemplate/edit/process/rate.cgi @@ -1,4 +1,3 @@ <% -my $server = new FS::UI::Web::JSRPC 'FS::rate::process'; -$server->process; -%> + my $server = new FS::UI::Web::JSRPC 'FS::rate::process'; +%><%= $server->process %> diff --git a/httemplate/elements/jsrsServer.html b/httemplate/elements/jsrsServer.html index d6d537070..fd6dc5465 100644 --- a/httemplate/elements/jsrsServer.html +++ b/httemplate/elements/jsrsServer.html @@ -1,4 +1,3 @@ <% -my $server = new FS::UI::Web::JSRPC; -$server->process; -%> + my $server = new FS::UI::Web::JSRPC '', $cgi; +%><%= $server->process %> diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html index 472a1725f..fb408400a 100644 --- a/httemplate/elements/progress-init.html +++ b/httemplate/elements/progress-init.html @@ -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 @@ function <%=$key%>process () { } } - jsrsPOST = true; - jsrsExecute( '<%= $action %>', <%=$key%>myCallback, 'start_job', Hash ); + // jsrsPOST = true; + // jsrsExecute( '<%= $action %>', <%=$key%>myCallback, 'start_job', Hash ); + + start_job( Hash, <%=$key%>myCallback ); } diff --git a/httemplate/elements/progress-popup.html b/httemplate/elements/progress-popup.html index 20bb5fc5a..200f97d9b 100644 --- a/httemplate/elements/progress-popup.html +++ b/httemplate/elements/progress-popup.html @@ -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 %>"; diff --git a/httemplate/elements/xmlhttp.html b/httemplate/elements/xmlhttp.html index 425e28e3d..41965ace2 100644 --- a/httemplate/elements/xmlhttp.html +++ b/httemplate/elements/xmlhttp.html @@ -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; |