diff options
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/browse/queue.cgi | 5 | ||||
-rw-r--r-- | httemplate/index.html | 5 | ||||
-rw-r--r-- | httemplate/misc/queue.cgi | 2 | ||||
-rw-r--r-- | httemplate/search/queue.html | 124 |
4 files changed, 129 insertions, 7 deletions
diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi deleted file mode 100755 index b865b1c30..000000000 --- a/httemplate/browse/queue.cgi +++ /dev/null @@ -1,5 +0,0 @@ -<!-- mason kludge --> -<%= include("/elements/header.html","Job Queue", menubar( 'Main Menu' => $p, )) %> -<%= joblisting({}) %> -</BODY> -</HTML> diff --git a/httemplate/index.html b/httemplate/index.html index 89fe7fcae..a1c3caf39 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -170,7 +170,7 @@ <A HREF="browse/nas.cgi">session server</A> <!-- or <A HREF="browse/nas-sqlradius.cgi">RADIUS</A> <BR> --> - <A HREF="browse/queue.cgi">View pending job queue</A> + <A HREF="search/queue.html">View pending job queue</A> <BR><A HREF="misc/cust_main-import.cgi">Batch import customers from CSV file</A> <BR><A HREF="misc/cust_main-import_charges.cgi">Batch import charges from CSV file</A> <BR><A HREF="misc/dump.cgi">Download database dump</A> @@ -186,6 +186,9 @@ - One or more services are grouped together into a package and given pricing information. Customers purchase packages, not services. + <LI><A HREF="browse/pkg_class.cgi">View/Edit package classes</A> + - Package classes define groups of packages, for reporting and + convenience purposes. </ul> <A NAME="admin_agent">Resellers</a> <ul> diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index ce9c8fbd3..d8e910fb7 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -42,6 +42,6 @@ if ( $action eq 'new' ) { } } -print $cgi->redirect(popurl(2). "browse/queue.cgi"); +print $cgi->redirect(popurl(2). "search/queue.html"); %> diff --git a/httemplate/search/queue.html b/httemplate/search/queue.html new file mode 100644 index 000000000..132c05129 --- /dev/null +++ b/httemplate/search/queue.html @@ -0,0 +1,124 @@ +<% + +my $hashref = {}; + +my $conf = new FS::Conf; +my $dangerous = $conf->exists('queue_dangerous_controls'); + +my $noactions = 0; + +my $count_query = 'SELECT COUNT(*) FROM queue'; # + $hashref + +my $areboxes = 0; + +%><%= include( 'elements/search.html', + 'title' => 'Job Queue', + 'menubar' => [ 'Main menu' => $p, ], + 'name' => 'jobs', + 'query' => { 'table' => 'queue', + 'hashref' => $hashref, + 'extra_sql' => 'ORDER BY jobnum', + }, + 'count_query' => $count_query, + 'header' => [ '#', + 'Job', + 'Args', + 'Date', + 'Status', + 'Account', # unless $hashref->{'svcnum'} + '', # checkbox column + ], + 'fields' => [ + 'jobnum', + 'job', + sub { + my $queue = shift; + if ( $dangerous + || $queue->job !~ /^FS::part_export::/ + || !$noactions + ) + { + encode_entities( join(' ', $queue->args) ); + } else { + ''; + } + }, + sub { + time2str( "%a %b %e %T %Y", shift->_date ); + }, + sub { + my $queue = shift; + my $jobnum = $queue->jobnum; + my $status = $queue->status; + $status .= ': '. $queue->statustext + if $queue->statustext; + my @queue_depend = $queue->queue_depend; + $status .= ' (waiting for '. + join(', ', map { $_->depend_jobnum } + @queue_depend + ). + ')' + if @queue_depend; + my $changable = $dangerous + || ( ! $noactions + && $status =~ /^failed/ + || $status =~ /^locked/ + ); + if ( $changable ) { + $status .= + qq! ( <A HREF="$p/misc/queue.cgi?jobnum=$jobnum&action=new">retry</A> |!. + qq! <A HREF="$p/misc/queue.cgi?jobnum=$jobnum&action=del">remove</A> )!; + } + $status; + }, + sub { + my $queue = shift; + # return '' if $hashref->{'svcnum'} + my $cust_svc = $queue->cust_svc; + my $account; + if ( $cust_svc ) { + my $table = $cust_svc->part_svc->svcdb; + my $label = ( $cust_svc->label )[1]; + qq!<A HREF="../view/$table.cgi?!. $queue->svcnum. + qq!">$label</A>!; + } else { + ''; + } + }, + sub { + my $queue = shift; + my $jobnum = $queue->jobnum; + my $status = $queue->status; + my $changable = $dangerous + || ( ! $noactions + && $status eq 'failed' + || $status eq 'locked' + ); + if ( $changable ) { + $areboxes = 1; + qq!<INPUT NAME="jobnum$jobnum" TYPE="checkbox" VALUE="1">!; + } else { + ''; + } + }, + ], + #'links' => [ + # '', + # '', + # '', + # '', + # '', + # '', #$acct_link, + # '', + # ], + 'html_foot' => sub { + if ( $areboxes ) { + '<BR><INPUT TYPE="submit" NAME="action" VALUE="retry selected">'. + '<INPUT TYPE="submit" NAME="action" VALUE="remove selected"><BR>'; + } else { + ''; + } + }, + ) + +%> |