*Replace more links with &ui_link call

This commit is contained in:
Derrick Hammer
2014-06-08 19:19:22 -04:00
parent 0f2d5e907d
commit 1a5d783f7e
37 changed files with 49 additions and 98 deletions
+1 -2
View File
@@ -47,8 +47,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
scalar(@{$h->{'packages'}}),
$type->[1],
+1 -2
View File
@@ -44,8 +44,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
scalar(@{$h->{'users'}}),
scalar(@{$h->{'groups'}}),
+1 -2
View File
@@ -41,8 +41,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
$h->{'version'},
$type->[1],
+1 -2
View File
@@ -43,8 +43,7 @@ if (@links) {
local ($type) = grep { $_->[0] eq $s->{'type'} }
@servers::server_types;
print &ui_columns_row([
"<a href='edit_host.cgi?id=$h->{'id'}'>".
($s->{'host'} || &get_system_hostname())."</a>",
&ui_link("edit_host.cgi?id=$h->{'id'}",($s->{'host'} || &get_system_hostname())),
$s->{'desc'},
$h->{'version'},
$type->[1],
+1 -2
View File
@@ -112,8 +112,7 @@ else {
print &ui_columns_row([
"<a name=$name><a href='cpan.cgi?$pars'>".
"<img src=images/cat.gif border=0></a>",
"<a href='cpan.cgi?$pars'>".
&html_escape($name)."</a>",
&ui_link("cpan.cgi?$pars",&html_escape($name)),
""
]);
}
+10 -20
View File
@@ -115,38 +115,28 @@ else {
}
if ($c->{'edit'} && !@{$c->{'args'}}) {
# Open file editor directly, as file is known
push(@cols, "<a href='view.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='view.cgi?id=$c->{'id'}'>".
$text{'index_acted'}."</a>");
push(@cols, &ui_link("view.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("view.cgi?id=$c->{'id'}",$text{'index_acted'}));
}
elsif ($c->{'sql'} && !@{$c->{'args'}}) {
# Execute SQL directorly, as no args
push(@cols, "<a href='sql.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='sql.cgi?id=$c->{'id'}'>".
$text{'index_actrun'}."</a>");
push(@cols, &ui_link("sql.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("sql.cgi?id=$c->{'id'}",$text{'index_actrun'}));
}
elsif ($c->{'sql'}) {
# Link to SQL query form
push(@cols, "<a href='sqlform.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='sqlform.cgi?id=$c->{'id'}'>".
$text{'index_actsql'}."</a>");
push(@cols, &ui_link("sqlform.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("sqlform.cgi?id=$c->{'id'}",$text{'index_actsql'}));
}
elsif (!@{$c->{'args'}}) {
# Link direct to execute page
push(@cols, "<a href='run.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='run.cgi?id=$c->{'id'}'>".
$text{'index_actrun'}."</a>");
push(@cols, &ui_link("run.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("run.cgi?id=$c->{'id'}",$text{'index_actrun'}));
}
else {
# Link to parameters form
push(@cols, "<a href='form.cgi?id=$c->{'id'}'>".
&html_escape($c->{'desc'})."</a>");
push(@links, "<a href='form.cgi?id=$c->{'id'}'>".
$text{'index_actform'}."</a>");
push(@cols, &ui_link("form.cgi?id=$c->{'id'}",&html_escape($c->{'desc'})));
push(@links, &ui_link("form.cgi?id=$c->{'id'}",$text{'index_actform'}));
}
push(@cols, $c->{'html'});
push(@cols, &ui_links_row(\@links));
+1 -2
View File
@@ -44,8 +44,7 @@ if (@exps) {
$ccount = 0;
foreach $c (@cl) {
$dirs .= "&nbsp;|&nbsp; " if ($ccount++);
$dirs .= "<a href='edit_export.cgi?idx=$c->{'index'}'>".
&describe_host($c->{'host'})."</a>\n";
$dirs .= &ui_link("edit_export.cgi?idx=$c->{'index'}",&describe_host($c->{'host'}))\n";
if (!$c->{'active'}) {
$dirs .= "<font color=#ff0000>(".
$text{'index_inactive'}.")</font>\n"
+1 -2
View File
@@ -69,8 +69,7 @@ if (@disks) {
"disk=$d->{'index'}'>$text{'index_blink'}</a>");
}
print &ui_columns_row([
$ed ? "<a href='edit_disk.cgi?device=$d->{'device'}'>".
$d->{'desc'}."</a>"
$ed ? &ui_link("edit_disk.cgi?device=$d->{'device'}",$d->{'desc'})
: $d->{'desc'},
$d->{'size'} ? &nice_size($d->{'size'}) : "",
$d->{'model'},
+2 -4
View File
@@ -101,8 +101,7 @@ elsif (@$rules && !$in{'reset'}) {
"before=$r->{'index'}'>".
"<img src=images/before.gif border=0></a>";
local $ls = "<a href='edit_rule.cgi?idx=$r->{'index'}'>";
local $le = "</a>";
local $ls = &ui_link("edit_rule.cgi?idx=$r->{'index'}","local $le =");
local $act = $amap{int($r->{'num'})};
print &ui_checked_columns_row(
[ $ls.($r->{'active'} ? $text{'yes'} :
@@ -170,8 +169,7 @@ elsif (@$rules && !$in{'reset'}) {
"border=0></a>";
}
local $ls = "<a href='edit_nat.cgi?idx=$r->{'index'}'>";
local $le = "</a>";
local $ls = &ui_link("edit_nat.cgi?idx=$r->{'index'}","local $le =");
print &ui_columns_row(
[ &ui_checkbox("d", $r->{'index'}, "", 0),
$ls.($r->{'active'} ? $text{'yes'} :
+1 -2
View File
@@ -111,8 +111,7 @@ elsif (@$rules && !$in{'reset'}) {
local ($ls, $le);
if ($r->{'index'} <= $lastidx) {
$ls = "<a href='edit_rule.cgi?idx=$r->{'index'}'>";
$le = "</a>";
$ls = &ui_link("edit_rule.cgi?idx=$r->{'index'}","$le =");
}
local $act = $amap{int($r->{'num'})};
print &ui_checked_columns_row(
+1 -2
View File
@@ -20,8 +20,7 @@ if (@secs) {
$desc = &text('secrets_mod', "<tt>".substr($1, 0, 20)."..</tt>");
}
print &ui_columns_row([
"<a href='edit_secret.cgi?idx=$s->{'idx'}'>".
($s->{'name'} || $text{'secrets_any'})."</a>",
&ui_link("edit_secret.cgi?idx=$s->{'idx'}","($s->{'name'} || $text{'secrets_any'})"),
$text{'secrets_'.lc($s->{'type'})} || uc($s->{'type'}),
$desc,
]);
+1 -2
View File
@@ -24,8 +24,7 @@ if (@$conns) {
100, 0, \@tds);
foreach my $c (@$conns) {
print &ui_checked_columns_row([
"<a href='view_conn.cgi?num=$c->{'num'}'>".
$c->{'ip'}."</a>",
&ui_link("view_conn.cgi?num=$c->{'num'}",$c->{'ip'}),
$c->{'port'},
$c->{'iface'},
$c->{'name'},
+1 -2
View File
@@ -23,8 +23,7 @@ if (@devices) {
my %omap = map { $_->{'type'}.$_->{'num'}, $_ } @$conf;
foreach my $e (@devices) {
print &ui_checked_columns_row([
"<a href='edit_device.cgi?num=$e->{'num'}'>".
$e->{'type'}.$e->{'num'}."</a>",
&ui_link("edit_device.cgi?num=$e->{'num'}","$e->{'type'}.$e->{'num'}"),
$text{'devices_mode_'.$e->{'mode'}} ||
uc($e->{'mode'}),
join("&nbsp;|&nbsp;",
+1 -2
View File
@@ -23,8 +23,7 @@ if (@extents) {
$text{'extents_size'} ], 100, 0, \@tds);
foreach my $e (@extents) {
print &ui_checked_columns_row([
"<a href='edit_extent.cgi?num=$e->{'num'}'>".
$e->{'type'}.$e->{'num'}."</a>",
&ui_link("edit_extent.cgi?num=$e->{'num'}","$e->{'type'}.$e->{'num'}"),
&mount::device_name($e->{'device'}),
&nice_size($e->{'start'}),
&nice_size($e->{'size'}),
+1 -2
View File
@@ -24,8 +24,7 @@ if (@targets) {
my %omap = map { $_->{'type'}.$_->{'num'}, $_ } @$conf;
foreach my $e (@targets) {
print &ui_checked_columns_row([
"<a href='edit_target.cgi?num=$e->{'num'}'>".
$e->{'type'}.$e->{'num'}."</a>",
&ui_link("edit_target.cgi?num=$e->{'num'}","$e->{'type'}.$e->{'num'}"),
$text{'targets_flags_'.$e->{'flags'}} ||
uc($e->{'flags'}),
&describe_object($omap{$e->{'export'}}),
+1 -2
View File
@@ -20,8 +20,7 @@ if (@users) {
$text{'users_mode'} ], 50, 0, \@tds);
foreach my $e (@users) {
print &ui_checked_columns_row([
"<a href='edit_user.cgi?user=$e->{'user'}'>".
&html_escape($e->{'user'})."</a>",
&ui_link("edit_user.cgi?user=$e->{'user'}",&html_escape($e->{'user'})),
uc($e->{'mode'}),
], \@tds, "d", $e->{'user'});
}
+1 -2
View File
@@ -10,8 +10,7 @@ my $allow = &get_allow_config($in{'mode'});
&ui_print_header(undef, $text{$in{'mode'}.'_title'}, "");
my @links = ( "<a href='edit_allow.cgi?new=1&mode=$in{'mode'}'>".
$text{'allow_add'}."</a>" );
my @links = ( &ui_link("edit_allow.cgi?new=1&mode=$in{'mode'}",$text{'allow_add'}) );
if (@$allow) {
unshift(@links, &select_all_link("d"), &select_invert_link("d"));
print &ui_form_start("delete_allows.cgi", "post");
+1 -2
View File
@@ -314,8 +314,7 @@ local $g;
local @rv;
foreach $g (split(/\s+/, $_[0])) {
if ($g =~ /^\@(.*)$/ || $g =~ /^\!\@(.*)$/) {
push(@rv, "<a href='edit_group.cgi?name=$1&from=$_[1]'>".
&group_name($g, $_[2])."</a>");
push(@rv, &ui_link("edit_group.cgi?name=$1&from=$_[1]",&group_name($g, $_[2])));
}
else {
push(@rv, &group_name($g, $_[2]));
+1 -2
View File
@@ -25,8 +25,7 @@ if (@{$d->{'data'}}) {
$i++;
next if ($access{'perms'} == 2 && !&can_edit_db($u->[1]));
local @cols;
push(@cols, "<a href='edit_cpriv.cgi?idx=$i'>".
&html_escape($u->[4])."</a>");
push(@cols, &ui_link("edit_cpriv.cgi?idx=$i",&html_escape($u->[4])));
push(@cols, &html_escape($u->[3]));
push(@cols, &html_escape($u->[1]));
push(@cols, $u->[0] eq '' || $u->[0] eq '%' ?
+1 -2
View File
@@ -25,8 +25,7 @@ if (@{$d->{'data'}}) {
$i++;
next if ($access{'perms'} == 2 && !&can_edit_db($u->[1]));
local @cols;
push(@cols, "<a href='edit_tpriv.cgi?idx=$i'>".
&html_escape($u->[3])."</a>");
push(@cols, &ui_link("edit_tpriv.cgi?idx=$i",&html_escape($u->[3])));
push(@cols, &html_escape($u->[1]));
push(@cols, $u->[0] eq '' || $u->[0] eq '%' ?
$text{'tprivs_all'} : &html_escape($u->[0]));
+1 -2
View File
@@ -859,8 +859,7 @@ sub generate_map_edit
my $nt = $_[3] || $text{'mapping_name'};
my $vt = $_[4] || $text{'mapping_value'};
local @links = ( "<a href='edit_mapping.cgi?map_name=$_[0]'>".
$text{'new_mapping'}."</a>",);
local @links = ( &ui_link("edit_mapping.cgi?map_name=$_[0]",$text{'new_mapping'}),);
if ($#{$mappings} ne -1)
{
+1 -2
View File
@@ -25,8 +25,7 @@ if (@{$s->{'data'}}) {
$text{'group_mems'} ], 100, 0, \@tds);
foreach $g (@{$s->{'data'}}) {
local @cols;
push(@cols, "<a href='edit_group.cgi?gid=$g->[1]'>".
&html_escape($g->[0])."</a>");
push(@cols, &ui_link("edit_group.cgi?gid=$g->[1]",&html_escape($g->[0])));
push(@cols, $g->[1]);
push(@cols, join("&nbsp;|&nbsp;",
map { &html_escape($uid{$_}) } &split_array($g->[2])));
+1 -2
View File
@@ -19,8 +19,7 @@ print &ui_columns_start([ "", $text{'user_name'},
$text{'user_until'} ], 100);
foreach $u (sort { $a->[0] cmp $b->[0] } @{$s->{'data'}}) {
local @cols;
push(@cols, "<a href='edit_user.cgi?user=$u->[0]'>".
&html_escape($u->[0])."</a>");
push(@cols, &ui_link("edit_user.cgi?user=$u->[0]",&html_escape($u->[0])));
push(@cols, $u->[5] ? $text{'yes'} : $text{'no'});
push(@cols, $u->[2] =~ /t|1/ ? $text{'yes'} : $text{'no'});
push(@cols, $u->[4] =~ /t|1/ ? $text{'yes'} : $text{'no'});
+1 -2
View File
@@ -46,8 +46,7 @@ if (@$conf) {
}
my @errors = grep { $_ ne "U" } @{$c->{'errors'}};
print &ui_columns_row([
"<a href='view_raid.cgi?idx=$c->{'index'}'>".
&html_escape($c->{'value'})."</a>",
&ui_link("view_raid.cgi?idx=$c->{'index'}",&html_escape($c->{'value'})),
!$c->{'active'} ?
"<font color=#ff0000>$text{'no'}</font>" :
@errors ?
+1 -2
View File
@@ -20,8 +20,7 @@ if (@ulist) {
@grid = ( );
for($i=0; $i<@ulist; $i++) {
$u = $ulist[$i];
push(@grid, "<a href='edit_euser.cgi?idx=$u->{'index'}'>".
&html_escape($u->{'name'})."</a>");
push(@grid, &ui_link("edit_euser.cgi?idx=$u->{'index'}",&html_escape($u->{'name'})));
}
print &ui_grid_table(\@grid, 4, 100,
[ "width=25%", "width=25%", "width=25%", "width=25%" ],
+1 -2
View File
@@ -21,8 +21,7 @@ if (@groups) {
$text{'groups_sid'} ]);
foreach $g (@groups) {
print &ui_columns_row([
"<a href='edit_group.cgi?idx=$g->{'index'}'>".
&html_escape($g->{'name'})."</a>",
&ui_link("edit_group.cgi?idx=$g->{'index'}",&html_escape($g->{'name'})),
$g->{'unix'} == -1 ? $text{'groups_nounix'} :
"<tt>".&html_escape($g->{'unix'})."</tt>",
$text{'groups_type_'.$g->{'type'}} ||
+1 -2
View File
@@ -35,8 +35,7 @@ else {
}
@locks = &list_locks();
@rightlinks = ( "<a href='view_users.cgi?$in'>".
$text{'viewu_refresh'}."</a>" );
@rightlinks = ( &ui_link("view_users.cgi?$in",$text{'viewu_refresh'}) );
if (@cons) {
print &ui_form_start("kill_users.cgi");
print &ui_hidden("share", $in{'share'});
+1 -2
View File
@@ -74,8 +74,7 @@ if (@accs) {
print &ui_links_row(\@links);
print &ui_form_end([ [ "delete", $text{'access_delete'} ] ]);
}
print "<a href='edit_file.cgi?mode=access'>",
&text('file_edit', "<tt>$afile</tt>"),"</a><p>\n"
print &ui_link("edit_file.cgi?mode=access",&text('file_edit', "<tt>$afile</tt>"))<p>\n"
if ($access{'manual'});
print $text{'access_desc1'},"<p>\n";
+1 -2
View File
@@ -53,8 +53,7 @@ if (@doms) {
print &ui_links_row(\@links);
print &ui_form_end([ [ "delete", $text{'domains_delete'} ] ]);
}
print "<a href='edit_file.cgi?mode=domains'>",
&text('file_edit', "<tt>$dfile</tt>"),"</a><p>\n"
print &ui_link("edit_file.cgi?mode=domains",&text('file_edit', "<tt>$dfile</tt>"))<p>\n"
if ($access{'manual'});
print $text{'domains_desc'},"<p>\n";
+1 -2
View File
@@ -75,8 +75,7 @@ if (@gens) {
print &ui_form_end([ [ "delete", $text{'generics_delete'} ] ]);
}
if ($access{'omode'} == 1 && $access{'manual'}) {
print "<a href='edit_file.cgi?mode=generics'>",
&text('file_edit', "<tt>$gfile</tt>"),"</a><p>\n";
print &ui_link("edit_file.cgi?mode=generics",&text('file_edit', "<tt>$gfile</tt>"))<p>\n";
}
print $text{'generics_desc1'},"<p>\n";
+1 -2
View File
@@ -54,8 +54,7 @@ if (@mailers) {
print &ui_links_row(\@links);
print &ui_form_end([ [ "delete", $text{'mailers_delete'} ] ]);
}
print "<a href='edit_file.cgi?mode=mailers'>",
&text('file_edit', "<tt>$mfile</tt>"),"</a><p>\n"
print &ui_link("edit_file.cgi?mode=mailers",&text('file_edit', "<tt>$mfile</tt>"))<p>\n"
if ($access{'manual'});
print $text{'mailers_desc1'},"<p>\n";
print &text('mailers_desc2', 'list_cws.cgi')," ",
+1 -2
View File
@@ -81,8 +81,7 @@ if (@virts) {
}
if ($access{'vmode'} == 1 && $access{'vedit_0'} && $access{'vedit_1'} &&
$access{'vedit_2'} && $access{'vmax'} == 0 && $access{'manual'}) {
print "<a href='edit_file.cgi?mode=virtusers'>",
&text('file_edit', "<tt>$vfile</tt>"),"</a><p>\n";
print &ui_link("edit_file.cgi?mode=virtusers",&text('file_edit', "<tt>$vfile</tt>"))<p>\n";
}
print &text('virtusers_desc1', 'list_aliases.cgi'),"<p>\n"
+2 -4
View File
@@ -31,11 +31,9 @@ else {
# Work out select/create links
@links = ( &select_all_link("d"),
&select_invert_link("d"),
"<a href='edit.cgi?table=$in{'table'}&new=1'>".
$text{$in{'tableclean'}."_add"}."</a>" );
&ui_link("edit.cgi?table=$in{'table'}&new=1","$text{$in{'tableclean'}."_add"}") );
if (&version_atleast(3, 3, 3) && &indexof($in{'table'}, @comment_tables) >= 0) {
push(@links, "<a href='editcmt.cgi?table=$in{'table'}&new=1'>".
$text{"comment_add"}."</a>");
push(@links, &ui_link("editcmt.cgi?table=$in{'table'}&new=1","$text{"comment_add"}"));
}
# Show the table
+2 -4
View File
@@ -31,11 +31,9 @@ else {
# Work out select/create links
@links = ( &select_all_link("d"),
&select_invert_link("d"),
"<a href='edit.cgi?table=$in{'table'}&new=1'>".
$text{$in{'tableclean'}."_add"}."</a>" );
&ui_link("edit.cgi?table=$in{'table'}&new=1","$text{$in{'tableclean'}."_add"}") );
if (&version_atleast(3, 3, 3) && &indexof($in{'table'}, @comment_tables) >= 0) {
push(@links, "<a href='editcmt.cgi?table=$in{'table'}&new=1'>".
$text{"comment_add"}."</a>");
push(@links, &ui_link("editcmt.cgi?table=$in{'table'}&new=1","$text{"comment_add"}"));
}
# Show the table
+1 -2
View File
@@ -63,8 +63,7 @@ if (@tunnels) {
}
else {
push(@cols,
"<a href='edit_stunnel.cgi?idx=$t->{'index'}'>".
&html_escape($t->{'name'})."</a>");
&ui_link("edit_stunnel.cgi?idx=$t->{'index'}",&html_escape($t->{'name'})));
}
push(@cols, &html_escape($t->{'port'}));
push(@cols, $t->{'active'} ? $text{'yes'} :
+1 -2
View File
@@ -99,8 +99,7 @@ if (@ipkeys) {
$text{'ssl_cert'} ]);
foreach $k (@ipkeys) {
print &ui_columns_row([
"<a href='edit_ipkey.cgi?idx=$k->{'index'}'>".
join(", ", @{$k->{'ips'}})."</a>",
&ui_link("edit_ipkey.cgi?idx=$k->{'index'}","join(", ", @{$k->{'ips'}})"),
"<tt>$k->{'key'}</tt>",
$k->{'cert'} ? "<tt>$k->{'cert'}</tt>"
: $text{'ssl_cert_def'},
+1 -2
View File
@@ -85,8 +85,7 @@ if (@svcs) {
}
}
local @cols;
push(@cols, "<a href='edit_serv.cgi?idx=$x->{'index'}'>".
&html_escape($x->{'value'})."</a>");
push(@cols, &ui_link("edit_serv.cgi?idx=$x->{'index'}",&html_escape($x->{'value'})));
push(@cols, &indexof('RPC', @{$q->{'type'}}) < 0 ?
$text{'index_inet'} : $text{'index_rpc'});
if (@s) {