From 8f42b751aebda2e7dce2c363bed6f1e15b411b1d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Feb 2002 01:03:10 +0000 Subject: use Net::SSH::ssh_cmd for all job queueing rather than local duplicated ssh subs queue daemon updates: retry & remove links work, bubble up error message to webinterface, link to svcnum & have job listings on view/svc_* pages, closes: Bug#280 s/option/optionname/ schema change, dumb mysql, closes: Bug#334 --- httemplate/browse/queue.cgi | 44 ++--------------------------------------- httemplate/index.html | 4 ++-- httemplate/misc/queue.cgi | 25 +++++++++++++++++++++++ httemplate/view/svc_acct.cgi | 4 +++- httemplate/view/svc_domain.cgi | 6 +++--- httemplate/view/svc_forward.cgi | 9 +++++---- httemplate/view/svc_www.cgi | 9 +++++---- 7 files changed, 45 insertions(+), 56 deletions(-) create mode 100644 httemplate/misc/queue.cgi (limited to 'httemplate') diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi index 7fce1f5df..b53c1402d 100755 --- a/httemplate/browse/queue.cgi +++ b/httemplate/browse/queue.cgi @@ -1,47 +1,7 @@ <% -print header("Job Queue", menubar( - 'Main Menu' => $p, -# 'Add new referral' => "../edit/part_referral.cgi", -)), &table(), < - Job - Args - Date - Status - -END - -foreach my $queue ( sort { - $a->getfield('jobnum') <=> $b->getfield('jobnum') -} qsearch('queue',{}) ) { - my($hashref)=$queue->hashref; - my $jobnum = $hashref->{jobnum}; - my $args = join(' ', $queue->args); - my $date = time2str( "%a %b %e %T %Y", $queue->_date ); - my $status = $hashref->{status}; - if ( $status eq 'failed' || $status eq 'locked' ) { - $status .= - qq! ( retry |!. - qq! remove )!; - } - print < - $jobnum - $hashref->{job} - $args - $date - $status - -END - -} - -print < - - -END +print header("Job Queue", menubar( 'Main Menu' => $p, )). + joblisting({}). ''; %> diff --git a/httemplate/index.html b/httemplate/index.html index dd08c4fa7..f4bb6581c 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -66,7 +66,7 @@
  • 120 day open invoices (by invoice number) (by date) (by customer number)
  • all invoices (by invoice number) (by date) (by customer number) -


    +


    Administration
    • View/Edit package definitions @@ -133,7 +133,7 @@
      View active NAS ports
      View pending job queue -



      +



      Configuration

      Administration
        diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi new file mode 100644 index 000000000..7e962d498 --- /dev/null +++ b/httemplate/misc/queue.cgi @@ -0,0 +1,25 @@ +<% + +$cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; +my $jobnum = $1; +my $job = qsearchs('queue', { 'jobnum' => $1 }) + or die "unknown jobnum $jobnum"; + +$cgi->param('action') =~ /^(new|del)$/ or die "Illegal action"; +my $action = $1; + +if ( $action eq 'new' ) { + my %hash = $job->hash; + $hash{'status'} = 'new'; + $hash{'statustext'} = ''; + my $new = new FS::queue \%hash; + my $error = $new->replace($job); + die $error if $error; +} elsif ( $action eq 'del' ) { + my $error = $job->delete; + die $error if $error; +} + +print $cgi->redirect(popurl(2). "browse/queue.cgi"); + +%> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 90ca1a240..d1c61576d 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -129,6 +129,8 @@ if ($svc_acct->slipip) { print "(No SLIP/PPP account)"; } -print ""; +print "". + '
        '. joblisting({'svcnum'=>$svcnum}, 1). + ""; %> diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index f086cda1a..61194a26d 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -55,8 +55,8 @@ foreach my $domain_record ( qsearch('domain_record', { svcnum => $svcnum } ) ) { ''. $domain_record->recaf. ' '. $domain_record->rectype. ''. ''. $domain_record->recdata. ''; } -print ''; - -print ''; +print ''. + '
        '. joblisting({'svcnum'=>$svcnum}, 1). + ''; %> diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index cafb9e5b8..8d2afc823 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -52,10 +52,11 @@ if ($dstsvc) { $destination = $dst; } -print qq!Edit this information!, - "
        Service #$svcnum", - "
        Service: $svc", - qq!
        Mail to $source forwards to $destination mailbox.!, +print qq!Edit this information!. + "
        Service #$svcnum". + "
        Service: $svc". + qq!
        Mail to $source forwards to $destination mailbox.!. + '
        '. joblisting({'svcnum'=>$svcnum}, 1). '' ; diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index a82921f1b..70a7a1be4 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -38,9 +38,10 @@ print header('Website View', menubar( "${p}misc/cancel-unaudited.cgi?$svcnum" ) ), "Main menu" => $p, -)), - "Service #$svcnum", - qq!
        Website name: $www!, - '', +)). + "Service #$svcnum". + qq!
        Website name: $www!. + '
        '. joblisting({'svcnum'=>$svcnum}, 1). + '' ; %> -- cgit v1.2.1