mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Add cgi args script, ui-libification
This commit is contained in:
15
lpadmin/cgi_args.pl
Normal file
15
lpadmin/cgi_args.pl
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
do 'lpadmin-lib.pl';
|
||||
|
||||
sub cgi_args
|
||||
{
|
||||
my ($cgi) = @_;
|
||||
if ($cgi eq 'edit_printer.cgi') {
|
||||
return 'new=1';
|
||||
}
|
||||
elsif ($cgi eq 'list_jobs.cgi') {
|
||||
my @plist = grep { &can_edit_jobs($_) } &list_printers();
|
||||
return @plist ? 'name='.&urlize($plist[0]->{'name'}) : 'none';
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
@@ -38,37 +38,36 @@ if (@plist) {
|
||||
if ($config{'display_mode'}) {
|
||||
# Just show printer names
|
||||
print &ui_links_row(\@links);
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'index_header'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
@grid = ( );
|
||||
$i = 0;
|
||||
foreach $p (@plist) {
|
||||
local $ed = &can_edit_printer($p);
|
||||
local $jb = &can_edit_jobs($p);
|
||||
next if (!$ed && !$jb && !$access{'view'});
|
||||
print "<tr>\n" if ($i%4 == 0);
|
||||
print "<td width=25%>";
|
||||
local $l;
|
||||
if ($ed) {
|
||||
print "<a href='edit_printer.cgi?name=$p'>",
|
||||
"$p</a>\n";
|
||||
$l = "<a href='edit_printer.cgi?name=$p'>".
|
||||
"$p</a>\n";
|
||||
}
|
||||
else {
|
||||
print "$p\n";
|
||||
$l = $p."\n";
|
||||
}
|
||||
if ($config{'show_jobs'}) {
|
||||
local @jobs = &get_jobs($p->{'name'});
|
||||
print " <a href='list_jobs.cgi?name=$p'>",
|
||||
"(",&text('index_jcount', scalar(@jobs)),
|
||||
")</a></td>\n";
|
||||
$l .= " <a href='list_jobs.cgi?name=$p'>".
|
||||
"(".&text('index_jcount', scalar(@jobs)).
|
||||
")</a>";
|
||||
}
|
||||
else {
|
||||
print " <a href='list_jobs.cgi?name=$p'>",
|
||||
"($text{'index_jlist'})</a></td>\n";
|
||||
$l .= " <a href='list_jobs.cgi?name=$p'>".
|
||||
"($text{'index_jlist'})</a>";
|
||||
}
|
||||
print "</tr>\n" if ($i%4 == 3);
|
||||
$i++;
|
||||
push(@grid, $l);
|
||||
}
|
||||
print "</table></td></tr></table>\n";
|
||||
print &ui_grid_table(\@grid, 4, 100,
|
||||
[ "width=25%", "width=25%", "width=25%", "width=25%" ],
|
||||
undef,
|
||||
$text{'index_header'});
|
||||
print &ui_links_row(\@links);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -8,8 +8,8 @@ index_enabled=Enabled?
|
||||
index_accepting=Accepting?
|
||||
index_jobs=Jobs
|
||||
index_none=No printers installed on this system.
|
||||
index_list=list..
|
||||
index_jlist=jobs..
|
||||
index_list=List..
|
||||
index_jlist=Jobs..
|
||||
index_jcount=$1 jobs..
|
||||
index_add=Add a new printer.
|
||||
index_stop=Stop Scheduler
|
||||
|
||||
@@ -6,8 +6,7 @@ require './lpadmin-lib.pl';
|
||||
&ReadParse();
|
||||
print "Refresh: $config{'queue_refresh'}\r\n"
|
||||
if ($config{'queue_refresh'});
|
||||
&ui_print_header(&text('jobs_on', "<tt>$in{'name'}</tt>"),
|
||||
$text{'jobs_title'}, "");
|
||||
&ui_print_header(&text('jobs_on', "<tt>$in{'name'}</tt>"), $text{'jobs_title'}, "");
|
||||
|
||||
@jobs = &get_jobs($in{'name'});
|
||||
if (@jobs) {
|
||||
|
||||
Reference in New Issue
Block a user