[freeside-commits] freeside/FS/FS/UI Web.pm,1.10,1.11
Ivan,,,
ivan at wavetail.420.am
Sun Sep 25 01:13:37 PDT 2005
- Previous message: [freeside-commits] freeside/FS/FS cust_main.pm,1.195,1.196
- Next message: [freeside-commits] freeside CREDITS, 1.40, 1.41 JSRS-LICENSE, 1.1,
NONE README.1.5.7, 1.15, 1.16 Changes.1.5.8, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/UI
In directory wavetail:/tmp/cvs-serv32619/FS/FS/UI
Modified Files:
Web.pm
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: Web.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/UI/Web.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Web.pm 15 Aug 2005 01:55:43 -0000 1.10
+++ Web.pm 25 Sep 2005 08:13:35 -0000 1.11
@@ -133,12 +133,12 @@
use vars qw(@ISA $DEBUG);
use Storable qw(nfreeze);
use MIME::Base64;
-use JavaScript::RPC::Server::CGI;
+#use JavaScript::RPC::Server::CGI;
use FS::UID;
use FS::Record qw(qsearchs);
use FS::queue;
- at ISA = qw( JavaScript::RPC::Server::CGI );
+#@ISA = qw( JavaScript::RPC::Server::CGI );
$DEBUG = 0;
sub new {
@@ -146,6 +146,7 @@
my $self = {
env => {},
job => shift,
+ cgi => shift,
};
bless $self, $class;
@@ -153,6 +154,35 @@
return $self;
}
+sub process {
+
+ my $self = shift;
+
+ my $cgi = $self->{'cgi'};
+
+ # XXX this should parse JSON foo and build a proper data structure
+ my @args = $cgi->param('arg');
+
+ my $sub = $cgi->param('sub'); #????
+
+ warn "FS::UI::Web::JSRPC::process:\n".
+ " cgi=$cgi\n".
+ " sub=$sub\n".
+ " args=".join(', ', at args)."\n"
+ if $DEBUG;
+
+ if ( $sub eq 'start_job' ) {
+
+ $self->start_job(@args);
+
+ } elsif ( $sub eq 'job_status' ) {
+
+ $self->job_status(@args);
+
+ }
+
+}
+
sub start_job {
my $self = shift;
@@ -193,7 +223,10 @@
my $error = $job->insert( '_JOB', encode_base64(nfreeze(\%param)) );
if ( $error ) {
- $error;
+ $error; #this doesn't seem to be handled well,
+ # will trigger "illegal jobnum" below?
+ # (should never be an error inserting the job, though, only thing
+ # would be Pg f%*kage)
} else {
$job->jobnum;
}
@@ -203,7 +236,7 @@
sub job_status {
my( $self, $jobnum ) = @_; #$url ???
- sleep 5; #could use something better...
+ sleep 1; # XXX could use something better...
my $job;
if ( $jobnum =~ /^(\d+)$/ ) {
@@ -222,13 +255,23 @@
@return = ( 'error', $job ? $job->statustext : $jobnum );
}
- join("\n", at return);
+ #join("\n", at return);
-}
+ #XXX should use JSON!
+ @return = map {
+ s/\\/\\\\/g;
+ s/\n/\\n/g;
+ s/"/\"/g;
+ $_
+ } @return;
+
+ '[ '. join(', ', map { qq("$_") } @return). " ]\n";
-sub get_new_query {
- FS::UID::cgi();
}
+#sub get_new_query {
+# FS::UID::cgi();
+#}
+
1;
- Previous message: [freeside-commits] freeside/FS/FS cust_main.pm,1.195,1.196
- Next message: [freeside-commits] freeside CREDITS, 1.40, 1.41 JSRS-LICENSE, 1.1,
NONE README.1.5.7, 1.15, 1.16 Changes.1.5.8, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list