diff options
author | ivan <ivan> | 2002-02-20 01:03:10 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-02-20 01:03:10 +0000 |
commit | 8f42b751aebda2e7dce2c363bed6f1e15b411b1d (patch) | |
tree | 942c30415b1e1683dec03dd62dcc24d575f7de46 /httemplate | |
parent | 47bc56487b4aebf3e415767a053dc049fe4a28d4 (diff) |
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
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/browse/queue.cgi | 44 | ||||
-rw-r--r-- | httemplate/index.html | 4 | ||||
-rw-r--r-- | httemplate/misc/queue.cgi | 25 | ||||
-rwxr-xr-x | httemplate/view/svc_acct.cgi | 4 | ||||
-rwxr-xr-x | httemplate/view/svc_domain.cgi | 6 | ||||
-rwxr-xr-x | httemplate/view/svc_forward.cgi | 9 | ||||
-rw-r--r-- | httemplate/view/svc_www.cgi | 9 |
7 files changed, 45 insertions, 56 deletions
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 @@ <!-- mason kludge --> <% -print header("Job Queue", menubar( - 'Main Menu' => $p, -# 'Add new referral' => "../edit/part_referral.cgi", -)), &table(), <<END; - <TR> - <TH COLSPAN=2>Job</TH> - <TH>Args</TH> - <TH>Date</TH> - <TH>Status</TH> - </TR> -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! ( <A HREF="$p/edit/queue.cgi?jobnum=$jobnum&action=new">retry</A> |!. - qq! <A HREF="$p/edit/queue.cgi?jobnum$jobnum&action=del">remove </A> )!; - } - print <<END; - <TR> - <TD>$jobnum</TD> - <TD>$hashref->{job}</TD> - <TD>$args</TD> - <TD>$date</TD> - <TD>$status</TD> - </TR> -END - -} - -print <<END; - </TABLE> - </BODY> -</HTML> -END +print header("Job Queue", menubar( 'Main Menu' => $p, )). + joblisting({}). '</BODY></HTML>'; %> 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 @@ <LI>120 day open invoices (<A HREF="search/cust_bill.cgi?OPEN120_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN120_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN120_custnum">by customer number</A>) <LI>all invoices (<A HREF="search/cust_bill.cgi?invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?date">by date</A>) (<A HREF="search/cust_bill.cgi?custnum">by customer number</A>) </UL> - <BR><CENTER><HR WIDTH="87%" NOSHADE></CENTER><BR> + <BR><CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR> <A NAME="admin">Administration</a> <ul> <LI><A HREF="browse/part_pkg.cgi">View/Edit package definitions</A> @@ -133,7 +133,7 @@ <BR> <A HREF="browse/nas.cgi">View active NAS ports</A> <BR><A HREF="browse/queue.cgi">View pending job queue</A> - <BR><BR><CENTER><HR WIDTH="87%" NOSHADE></CENTER><BR> + <BR><BR><CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR> <A NAME="config" HREF="config/config-view.cgi">Configuration</a><!-- - <font size="+2" color="#ff0000">start here</font> --> <BR><BR><A NAME="admin">Administration</a> <ul> 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 "<TR><TH COLSPAN=2>(No SLIP/PPP account)</TH></TR>"; } -print "</TABLE></TD></TR></TABLE></BODY></HTML>"; +print "</TABLE></TD></TR></TABLE>". + '<BR>'. joblisting({'svcnum'=>$svcnum}, 1). + "</BODY></HTML>"; %> 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 } ) ) { '<td>'. $domain_record->recaf. ' '. $domain_record->rectype. '</td>'. '<td>'. $domain_record->recdata. '</td></tr>'; } -print '</table>'; - -print '</BODY></HTML>'; +print '</table>'. + '<BR>'. joblisting({'svcnum'=>$svcnum}, 1). + '</BODY></HTML>'; %> 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!<A HREF="${p}edit/svc_forward.cgi?$svcnum">Edit this information</A>!, - "<BR>Service #$svcnum", - "<BR>Service: <B>$svc</B>", - qq!<BR>Mail to <B>$source</B> forwards to <B>$destination</B> mailbox.!, +print qq!<A HREF="${p}edit/svc_forward.cgi?$svcnum">Edit this information</A>!. + "<BR>Service #$svcnum". + "<BR>Service: <B>$svc</B>". + qq!<BR>Mail to <B>$source</B> forwards to <B>$destination</B> mailbox.!. + '<BR>'. joblisting({'svcnum'=>$svcnum}, 1). '</BODY></HTML>' ; 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!<BR>Website name: <B><A HREF="http://$www">$www</A></B>!, - '</BODY></HTML>', +)). + "Service #$svcnum". + qq!<BR>Website name: <B><A HREF="http://$www">$www</A></B>!. + '<BR>'. joblisting({'svcnum'=>$svcnum}, 1). + '</BODY></HTML>' ; %> |