freeside/FS/FS/UI Web.pm,1.2,1.3
ivan
ivan at pouncequick.420.am
Sun Feb 20 00:44:43 PST 2005
- Previous message: freeside/httemplate/edit rate.cgi,1.5,1.6
- Next message: freeside/httemplate/elements jsrsServer.html,NONE,1.1 progress-popup.html,NONE,1.1 progress-init.html,NONE,1.1 overlibmws.js,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/UI
In directory pouncequick:/tmp/cvs-serv9463/FS/FS/UI
Modified Files:
Web.pm
Log Message:
use a javascript layer instead of a browser popup (popup blockers), really generalize the progressbar code to make it easy to use as a component
Index: Web.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/UI/Web.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Web.pm 17 Feb 2005 00:11:29 -0000 1.2
+++ Web.pm 20 Feb 2005 08:44:39 -0000 1.3
@@ -9,14 +9,17 @@
package FS::UI::Web::JSRPC;
+use strict;
use vars qw(@ISA $DEBUG);
use Storable qw(nfreeze);
use MIME::Base64;
use JavaScript::RPC::Server::CGI;
use FS::UID;
+use FS::Record qw(qsearchs);
+use FS::queue;
@ISA = qw( JavaScript::RPC::Server::CGI );
-$DEBUG = 1;
+$DEBUG = 0;
sub new {
my $class = shift;
@@ -57,6 +60,32 @@
$job->jobnum;
}
+}
+
+sub job_status {
+ my( $self, $jobnum ) = @_; #$url ???
+
+ sleep 5; #could use something better...
+
+ my $job;
+ if ( $jobnum =~ /^(\d+)$/ ) {
+ $job = qsearchs('queue', { 'jobnum' => $jobnum } );
+ } else {
+ die "FS::UI::Web::job_status: illegal jobnum $jobnum\n";
+ }
+
+ my @return;
+ if ( $job && $job->status ne 'failed' ) {
+ @return = ( 'progress', $job->statustext );
+ } elsif ( !$job ) { #handle job gone case : job sucessful
+ # so close popup, redirect parent window...
+ @return = ( 'complete' );
+ } else {
+ @return = ( 'error', $job ? $job->statustext : $jobnum );
+ }
+
+ join("\n", at return);
+
}
sub get_new_query {
- Previous message: freeside/httemplate/edit rate.cgi,1.5,1.6
- Next message: freeside/httemplate/elements jsrsServer.html,NONE,1.1 progress-popup.html,NONE,1.1 progress-init.html,NONE,1.1 overlibmws.js,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list