&ReadParse();
print "Refresh: $config{'queue_refresh'}\r\n"
if ($config{'queue_refresh'});
-&ui_print_header(undef, $text{'jobs_title'}, "");
+&ui_print_header(&text('jobs_on', "<tt>$in{'name'}</tt>"),
+ $text{'jobs_title'}, "");
@jobs = &get_jobs($in{'name'});
if (@jobs) {
- print &ui_subheading(&text('jobs_header', "<tt>$in{'name'}</tt>"));
- print "<table border width=100%>\n";
- print "<tr $tb> <td><b>$text{'jobs_id'}</b></td>\n";
- print "<td><b>$text{'jobs_size'}</b></td>\n";
- print "<td><b>$text{'jobs_by'}</b></td>\n";
- if ($jobs[0]->{'when'}) {
- print "<td><b>$text{'jobs_when'}</b></td>\n";
- }
- if ($jobs[0]->{'file'}) {
- print "<td><b>$text{'jobs_file'}</b></td>\n";
+ if ($access{'cancel'}) {
+ # Start of cancel form
+ print &ui_form_start("cancel_all.cgi", "post");
+ print &ui_hidden("name", $in{'name'});
+ @tds = ( "width=5" );
+ @links = ( &select_all_link("d"), &select_invert_link("d") );
+ print &ui_links_row(\@links);
}
+ print &ui_columns_start([
+ $access{'cancel'} ? ( "" ) : ( ),
+ $text{'jobs_id'},
+ $text{'jobs_size'},
+ $text{'jobs_by'},
+ $jobs[0]->{'when'} ? ( $text{'jobs_when'} ) : ( ),
+ $jobs[0]->{'file'} ? ( $text{'jobs_file'} ) : ( ),
+ ], 100, 0, \@tds);
foreach $j (@jobs) {
local $ju = $j->{'user'};
$ju =~ s/\!.*$//;
- print "<tr $cb>\n";
- if (&can_edit_jobs($in{'name'}, $ju)) {
- print "<td><a href=\"cancel_job.cgi?name=$in{'name'}&",
- "id=$j->{'id'}\">",&html_escape($j->{'id'}),
- "</a></td>\n";
- }
- else {
- print "<td>",&html_escape($j->{'id'}),"</td>\n";
- }
+ local @cols;
+ push(@cols, &html_escape($j->{'id'}));
if ($j->{'printfile'} && &can_edit_jobs($in{'name'}, $ju)) {
- print "<td><a href='view_job.cgi?name=$in{'name'}",
- "&id=$j->{'id'}'>",&html_escape($j->{'size'}),
- " $text{'jobs_bytes'}</a></td>\n";
+ push(@cols,
+ "<a href='view_job.cgi?name=$in{'name'}".
+ "&id=$j->{'id'}'>".&nice_size($j->{'size'})."</a>");
$printfile++;
}
else {
- print "<td>",&html_escape($j->{'size'}),
- " $text{'jobs_bytes'}</td>\n";
+ push(@cols, &nice_size($j->{'size'}));
}
if ($j->{'user'} =~ /^(\S+)\!(\S+)$/) {
- print "<td>",&html_escape("$2\@$1"),"</td>\n";
+ push(@cols, &html_escape("$2\@$1"));
+ }
+ else {
+ push(@cols, &html_escape($j->{'user'}));
+ }
+ if ($j->{'when'}) {
+ push(@cols, $j->{'when'});
+ }
+ if ($j->{'file'}) {
+ push(@cols, $j->{'file'});
+ }
+ if (&can_edit_jobs($in{'name'}, $ju) &&
+ $access{'cancel'}) {
+ # Can cancel this job
+ print &ui_checked_columns_row(\@cols, \@tds,
+ "d", $j->{'id'});
+ }
+ elsif ($access{'cancel'}) {
+ # Can cancel, but not this job
+ print &ui_columns_row([ "", @cols ], \@tds);
+ }
+ else {
+ # Cannot cancel at all
+ print &ui_columns_row(\@cols, \@tds);
}
- else { print "<td>",&html_escape($j->{'user'}),"</td>\n"; }
- if ($j->{'when'}) { print "<td>$j->{'when'}</td>\n"; }
- if ($j->{'file'}) { print "<td>$j->{'file'}</td>\n"; }
- print "</tr>\n";
}
- print "</table>\n";
+ print &ui_columns_end();
if ($access{'cancel'}) {
- print "<table width=100%><tr><td>\n";
- print $printfile ? $text{'jobs_cancelview'}
- : $text{'jobs_cancel'},"<br>\n";
- print "</td> <td align=right>",
- "<a href='cancel_all.cgi?name=$in{'name'}'>",
- "$text{'jobs_all'}</a></td> </tr></table>\n";
+ print &ui_links_row(\@links);
+ print &ui_form_end([ [ undef, $text{'jobs_cancelsel'} ] ]);
}
}
else {
print "<b>",&text('jobs_none', "<tt>$in{'name'}</tt>"),"</b><p>\n";
}
-print "<form action=test_form.cgi>\n";
-print "<input type=hidden name=name value='$in{'name'}'>\n";
-print "<input type=submit value='$text{'jobs_test'}'></form><p>\n";
+# Test print button
+print &ui_form_start("test_form.cgi");
+print &ui_hidden("name", $in{'name'});
+print &ui_form_end([ [ undef, $text{'jobs_test'} ] ]);
&ui_print_footer("", $text{'index_return'});