mirror of
https://github.com/webmin/webmin.git
synced 2026-06-30 23:50:41 +01:00
ui_link conversion + cleanup
This commit is contained in:
@@ -864,7 +864,7 @@ foreach $e (@{$_[0]}) {
|
||||
foreach $ed (split(/\s+/, $e->{'name'})) {
|
||||
# nodo50 v0.1 - Change 000004 - Open new window for Help in Apache module and mod_apachessl Help from http://www.apache-ssl.org and
|
||||
# nodo50 v0.1 - Change 000004 - Abre nueva ventana para Ayuda del módulo Apache y para mod_apachessl busca la Ayuda en http://www.apache-ssl.org and
|
||||
$names .= "<tt><a href='".($e->{'module'} eq 'mod_apachessl' ? 'http://www.apache-ssl.org/docs.html#'.$ed : $apache_docbase."/".$e->{'module'}.".html#".lc($ed))."'>".$ed."</a></tt> ";
|
||||
$names .= "<tt>".&ui_link( ($e->{'module'} eq 'mod_apachessl' ? 'http://www.apache-ssl.org/docs.html#'.$ed : $apache_docbase."/".$e->{'module'}.".html#".lc($ed)), $ed )."</tt> ";
|
||||
#$names .= "<tt><a href='".$apache_docbase."/".$e->{'module'}.".html#".lc($ed)."'>".$ed."</a></tt> ";
|
||||
# nodo50 v0.1 - Change 000004 - End
|
||||
}
|
||||
@@ -938,7 +938,7 @@ return ( [ $v =~ /\s/ && !$_[3] ? "\"$v\"" : $v ] );
|
||||
# Each choice is a display,value pair
|
||||
sub choice_input
|
||||
{
|
||||
local($i, $rv);
|
||||
my($i, $rv);
|
||||
for($i=3; $i<@_; $i++) {
|
||||
$_[$i] =~ /^([^,]*),(.*)$/;
|
||||
$rv .= &ui_oneradio($_[1], $2, $1, lc($2) eq lc($_[0]) ||
|
||||
@@ -951,12 +951,11 @@ return $rv;
|
||||
# Each choice is a display,value pair
|
||||
sub choice_input_vert
|
||||
{
|
||||
local($i, $rv);
|
||||
my($i, $rv);
|
||||
for($i=3; $i<@_; $i++) {
|
||||
$_[$i] =~ /^([^,]*),(.*)$/;
|
||||
$rv .= sprintf "<input type=radio name=$_[1] value=\"$2\" %s> $1<br>\n",
|
||||
lc($2) eq lc($_[0]) || !defined($_[0]) &&
|
||||
lc($2) eq lc($_[2]) ? "checked" : "";
|
||||
$rv .= &ui_oneradio($_[1], $2, $1, lc($2) eq lc($_[0]) ||
|
||||
!defined($_[0]) && lc($2) eq lc($_[2]))."<br>\n";
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
@@ -971,15 +970,12 @@ else { return ( [ $in{$_[0]} ] ); }
|
||||
# select_input(value, name, default, [choice]+)
|
||||
sub select_input
|
||||
{
|
||||
local($i, $rv);
|
||||
$rv = "<select name=\"$_[1]\">\n";
|
||||
my($i, @sel);
|
||||
for($i=3; $i<@_; $i++) {
|
||||
$_[$i] =~ /^([^,]*),(.*)$/;
|
||||
$rv .= sprintf "<option value=\"$2\" %s>$1</option>\n",
|
||||
lc($2) eq lc($_[0]) || !defined($_[0]) && lc($2) eq lc($_[2]) ? "selected" : "";
|
||||
push(@sel, [$2, $1, (lc($2) eq lc($_[0]) || !defined($_[0]) && lc($2) eq lc($_[2]) ? "selected" : "") ]);
|
||||
}
|
||||
$rv .= "</select>\n";
|
||||
return $rv;
|
||||
return &ui_select($_[1], undef, \@sel, 1);
|
||||
}
|
||||
|
||||
# parse_choice(name, default)
|
||||
@@ -991,8 +987,8 @@ return &parse_choice(@_);
|
||||
# handler_input(value, name)
|
||||
sub handler_input
|
||||
{
|
||||
local($m, $func, @hl, $rv, $h);
|
||||
local $conf = &get_config();
|
||||
my($m, $func, @hl, @sel, $h);
|
||||
my $conf = &get_config();
|
||||
push(@hl, "");
|
||||
foreach $m (keys %httpd_modules) {
|
||||
$func = $m."_handlers";
|
||||
@@ -1001,15 +997,11 @@ foreach $m (keys %httpd_modules) {
|
||||
}
|
||||
}
|
||||
if (&indexof($_[0], @hl) < 0) { push(@hl, $_[0]); }
|
||||
$rv = "<select name=$_[1]>\n";
|
||||
foreach $h (&unique(@hl)) {
|
||||
$rv .= sprintf "<option value=\"$h\" %s>$h</option>\n",
|
||||
$h eq $_[0] ? "selected" : "";
|
||||
push(@sel, [$h, $h, ($h eq $_[0] ? "selected" : "")] );
|
||||
}
|
||||
$rv .= sprintf "<option value=\"None\" %s><$text{'core_none'}></option>\n",
|
||||
$_[0] eq "None" ? "selected" : "";
|
||||
$rv .= "</select>\n";
|
||||
return $rv;
|
||||
push(@sel, ["None", "<".$text{'core_none'}.">", ($_[0] eq "None" ? "selected" : "")] );
|
||||
return &ui_select($_[1], undef, \@sel, 1);
|
||||
}
|
||||
|
||||
# parse_handler(name)
|
||||
@@ -1034,8 +1026,7 @@ foreach $f (@{$_[0]}) {
|
||||
push(@fl, $f) if (&indexof($f, @fl) < 0);
|
||||
}
|
||||
foreach $f (&unique(@fl)) {
|
||||
$rv .= sprintf "<input type=checkbox name=$_[1] value='%s' %s> %s\n",
|
||||
$f, &indexof($f, @{$_[0]}) < 0 ? "" : "checked", $f;
|
||||
$rv .= &ui_checkbox($_[1], $f, $f, (&indexof($f, @{$_[0]}) < 0 ? 0 : 1 ) );
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
@@ -1147,14 +1138,14 @@ $args = "redir=".&urlize(&this_url());
|
||||
local @rv;
|
||||
if (&is_apache_running()) {
|
||||
if ($access{'apply'}) {
|
||||
push(@rv, "<a href=\"restart.cgi?$args\">$text{'apache_apply'}</a>\n");
|
||||
push(@rv, &ui_link("restart.cgi?$args", $text{'apache_apply'}) );
|
||||
}
|
||||
if ($access{'stop'}) {
|
||||
push(@rv, "<a href=\"stop.cgi?$args\">$text{'apache_stop'}</a>\n");
|
||||
push(@rv, &ui_link("stop.cgi?$args", $text{'apache_stop'}) );
|
||||
}
|
||||
}
|
||||
elsif ($access{'stop'}) {
|
||||
push(@rv, "<a href=\"start.cgi?$args\">$text{'apache_start'}</a>\n");
|
||||
push(@rv, &ui_link("start.cgi?$args", $text{'apache_start'}) );
|
||||
}
|
||||
return join("<br>\n", @rv);
|
||||
}
|
||||
@@ -1259,7 +1250,7 @@ local $txtlen = length($txt);
|
||||
$txt = &html_escape($txt);
|
||||
print " " x $_[2];
|
||||
if ($_[3]) {
|
||||
print "<a href=\"$_[3]\">",$txt,"</a>";
|
||||
print &ui_link($_[3], $txt);
|
||||
}
|
||||
else { print $txt; }
|
||||
print " " x (90 - $txtlen - $_[2] - length($lstr));
|
||||
|
||||
@@ -28,8 +28,8 @@ if ($in{'type'} == 6) {
|
||||
print &ui_hr();
|
||||
print &ui_subheading($text{'global_mime'});
|
||||
print "$text{'global_mimedesc'}<p>\n";
|
||||
@links = ( "<a href=\"edit_gmime_type.cgi?file=$mfile\">".
|
||||
"$text{'global_add'}</a>" );
|
||||
@links = ( &ui_link("edit_gmime_type.cgi?file=$mfile",
|
||||
$text{'global_add'}) );
|
||||
print &ui_links_row(\@links);
|
||||
print &ui_columns_start([ $text{'global_type'},
|
||||
$text{'global_ext'} ]);
|
||||
@@ -40,8 +40,8 @@ if ($in{'type'} == 6) {
|
||||
s/#.*$//;
|
||||
if (/^\s*(\S+)\s*(.*)$/) {
|
||||
print &ui_columns_row([
|
||||
"<a href=\"edit_gmime_type.cgi?line=$line".
|
||||
"&file=$mfile\">$1</a>", $2 ]);
|
||||
&ui_link("edit_gmime_type.cgi?line=$line".
|
||||
"&file=$mfile", $1), $2 ]);
|
||||
}
|
||||
$line++;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ if (@htaccess_files) {
|
||||
$i = 0;
|
||||
foreach $f (@htaccess_files) {
|
||||
print &ui_columns_row([
|
||||
"<a href=\"htaccess_index.cgi?file=".&urlize($htaccess_files[$i])."\">".$htaccess_files[$i]."</a>"
|
||||
&ui_link("htaccess_index.cgi?file=".&urlize($htaccess_files[$i]), $htaccess_files[$i])
|
||||
]);
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ $access{'global'} || &error($text{'htaccess_ecannot'});
|
||||
$conf = &get_htaccess_config($in{'file'});
|
||||
$desc = &html_escape($in{'file'});
|
||||
&ui_print_header($desc, $text{'htindex_title'}, "",
|
||||
undef, undef, undef, undef, "<a href=\"delete_htaccess.cgi?file=".
|
||||
&urlize($in{'file'})."\">$text{'htindex_delete'}</a>");
|
||||
undef, undef, undef, undef, &ui_link("delete_htaccess.cgi?file=".
|
||||
&urlize($in{'file'}), $text{'htindex_delete'}) );
|
||||
|
||||
$sw_icon = { "icon" => "images/show.gif",
|
||||
"name" => $text{'htindex_show'},
|
||||
@@ -45,7 +45,7 @@ if (@file && $httpd_modules{'core'} >= 1.2) {
|
||||
$text{'virt_type'} ]);
|
||||
for($i=0; $i<@links; $i++) {
|
||||
print &ui_columns_row([
|
||||
"<a href='$links[$i]'>$titles[$i]</a>",
|
||||
&ui_link($links[$i], $titles[$i]),
|
||||
$text{'virt_'.$types[$i]} ]);
|
||||
}
|
||||
print &ui_columns_end();
|
||||
|
||||
@@ -335,13 +335,13 @@ elsif ($config{'show_list'} && scalar(@vname)) {
|
||||
$text{'index_url'} ], 100);
|
||||
for($i=0; $i<@vname; $i++) {
|
||||
local @cols;
|
||||
push(@cols, "<a href=\"$vlink[$i]\">$vname[$i]</a>");
|
||||
push(@cols, &ui_link($vlink[$i], $vname[$i]) );
|
||||
push(@cols, &html_escape($vaddr[$i]));
|
||||
push(@cols, &html_escape($vport[$i]));
|
||||
push(@cols, $vserv[$i] || $text{'index_auto'});
|
||||
push(@cols, &html_escape($vproxy[$i]) ||
|
||||
&html_escape($vroot[$i]));
|
||||
push(@cols, "<a href=$vurl[$i]>$text{'index_view'}</a>");
|
||||
push(@cols, &ui_link($vurl[$i], $text{'index_view'}) );
|
||||
if ($showdel && $vidx[$i]) {
|
||||
print &ui_checked_columns_row(\@cols, undef,
|
||||
"d", $vidx[$i]);
|
||||
|
||||
@@ -25,10 +25,11 @@ if (@groups) {
|
||||
$g = $groups[$i]->{'group'};
|
||||
@m = @{$groups[$i]->{'members'}};
|
||||
if (@m > 15) { @m = @m[0..14]; }
|
||||
printf "<tr> <td><a href=\"edit_authgroup.cgi?group=$g&".
|
||||
"file=%s&url=%s\">$g</a></td>\n",
|
||||
&urlize($f), &urlize(&this_url());
|
||||
printf "<td>%s</td> </tr>\n",
|
||||
print "<tr><td>";
|
||||
print &ui_link("edit_authgroup.cgi?group=$g&".
|
||||
"file=".&urlize($f)."&url=".&urlize(&this_url()), $g);
|
||||
print "</td>";
|
||||
printf "<td>%s</td></tr>\n",
|
||||
@m ? join(" , ", @m) : "<i>None</i>";
|
||||
}
|
||||
print "</table></td></tr></table>\n";
|
||||
@@ -36,8 +37,9 @@ if (@groups) {
|
||||
else {
|
||||
print "<b>",&text('authg_none', "<tt>$f</tt>"),"</b><p>\n";
|
||||
}
|
||||
printf "<a href=\"edit_authgroup.cgi?file=%s&url=%s\">%s</a><p>\n",
|
||||
&urlize($f), &urlize(&this_url()), $text{'authg_add'};
|
||||
print &ui_link("edit_authgroup.cgi?file=".
|
||||
&urlize($f)."&url=".&urlize(&this_url()), $text{'authg_add'});
|
||||
print "<p>\n";
|
||||
|
||||
&ui_print_footer($in{'url'}, $text{'auth_return'});
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ if (@users) {
|
||||
for($i=0; $i<@users; $i++) {
|
||||
$u = $users[$i];
|
||||
if ($i%4 == 0) { print "<tr>\n"; }
|
||||
printf "<td width=25%%><a href=\"edit_authuser.cgi?user=$u&".
|
||||
"file=%s&url=%s\">$u</a></td>\n",
|
||||
&urlize($f), &urlize(&this_url());
|
||||
print "<td width='25%'>";
|
||||
print &ui_link("edit_authuser.cgi?user=$u&file=".&urlize($f)."&url=".&urlize(&this_url()), $u);
|
||||
print "</td>";
|
||||
if ($i%4 == 3) { print "</tr>\n"; }
|
||||
}
|
||||
while($i++%4) { print "<td width=25%></td>\n"; }
|
||||
@@ -33,8 +33,8 @@ if (@users) {
|
||||
else {
|
||||
print "<b>",&text('authu_none', "<tt>$f</tt>"),"</b><p>\n";
|
||||
}
|
||||
printf "<a href=\"edit_authuser.cgi?file=%s&url=%s\">%s</a><p>\n",
|
||||
&urlize($f), &urlize(&this_url()), $text{'authu_add'};
|
||||
print &ui_link("edit_authuser.cgi?file=".&urlize($f)."&url=".&urlize(&this_url()), $text{'authu_add'});
|
||||
print "<p>\n";
|
||||
|
||||
print &ui_hr();
|
||||
$s = $config{"sync_$f"};
|
||||
|
||||
@@ -18,14 +18,14 @@ $rv = "<table border><tr><td><table>\n";
|
||||
$rv .= "<tr> <td><b>$text{'mod_auth_ufile'}</b></td> <td>".
|
||||
&opt_input($_[0]->{'value'}, "AuthUserFile", $text{'default'}, 45).
|
||||
&file_chooser_button("AuthUserFile", 0).
|
||||
($uf ? " <a href=\"list_authusers.cgi?file=".$_[0]->{'value'}.
|
||||
"&url=".&urlize(&this_url())."\">$text{'mod_auth_uedit'}</a>" : "")."</td></tr>\n";
|
||||
($uf ? " ".&ui_link("list_authusers.cgi?file=".$_[0]->{'value'}.
|
||||
"&url=".&urlize(&this_url()), $text{'mod_auth_uedit'}) : "")."</td></tr>\n";
|
||||
|
||||
$rv .= "<tr> <td><b>$text{'mod_auth_gfile'}</b></td> <td>".
|
||||
&opt_input($_[1]->{'value'}, "AuthGroupFile", $text{'default'}, 45).
|
||||
&file_chooser_button("AuthGroupFile", 0).
|
||||
($gf ? " <a href=\"list_authgroups.cgi?file=".$_[1]->{'value'}.
|
||||
"&url=".&urlize(&this_url())."\">$text{'mod_auth_gedit'}</a>" : "")."</td></tr>\n";
|
||||
($gf ? " ".&ui_link("list_authgroups.cgi?file=".$_[1]->{'value'}.
|
||||
"&url=".&urlize(&this_url()), $text{'mod_auth_gedit'}) : "")."</td></tr>\n";
|
||||
|
||||
$rv .= "<tr> <td><b>$text{'mod_auth_pass'}</b></td> <td>".
|
||||
&choice_input($_[2]->{'value'}, "AuthAuthoritative", "",
|
||||
|
||||
@@ -14,8 +14,8 @@ local $uf = $_[0] && -r "list_authusers.cgi" ? 1 : 0;
|
||||
return (2, $text{'mod_auth_ufile'},
|
||||
&opt_input($_[0]->{'value'}, "AuthUserFile", $text{'default'}, 45).
|
||||
&file_chooser_button("AuthUserFile", 0).
|
||||
($uf ? " <a href=\"list_authusers.cgi?file=".$_[0]->{'value'}.
|
||||
"&url=".&urlize(&this_url())."\">$text{'mod_auth_uedit'}</a>" : ""));
|
||||
($uf ? " ".&ui_link("list_authusers.cgi?file=".$_[0]->{'value'}.
|
||||
"&url=".&urlize(&this_url()), $text{'mod_auth_uedit'}) : ""));
|
||||
}
|
||||
sub save_AuthUserFile
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ local $uf = $_[0] && -r "list_authgroups.cgi" ? 1 : 0;
|
||||
return (2, $text{'mod_auth_gfile'},
|
||||
&opt_input($_[0]->{'value'}, "AuthGroupFile", $text{'default'}, 45).
|
||||
&file_chooser_button("AuthGroupFile", 0).
|
||||
($uf ? " <a href=\"list_authgroups.cgi?file=".$_[0]->{'value'}.
|
||||
"&url=".&urlize(&this_url())."\">$text{'mod_auth_gedit'}</a>" : ""));
|
||||
($uf ? " ".&ui_link("list_authgroups.cgi?file=".$_[0]->{'value'}.
|
||||
"&url=".&urlize(&this_url()), $text{'mod_auth_gedit'}) : ""));
|
||||
}
|
||||
sub save_AuthGroupFile
|
||||
{
|
||||
|
||||
@@ -111,14 +111,14 @@ else {
|
||||
}
|
||||
else {
|
||||
print "<table width=100% border=1>\n";
|
||||
print "<tr $tb> <td><b>$text{'index_type'}</b></td> ",
|
||||
print "<tr $tb><td><b>$text{'index_type'}</b></td> ",
|
||||
"<td><b>$text{'index_addr'}</b></td> ",
|
||||
"<td><b>$text{'index_port'}</b></td> ",
|
||||
"<td><b>$text{'index_name'}</b></td> ",
|
||||
"<td><b>$text{'index_root'}</b></td> </tr>\n";
|
||||
foreach $i (@match) {
|
||||
print "<tr $cb>\n";
|
||||
print "<td><a href='$vlink[$i]'>$vname[$i]</a></td>\n";
|
||||
print "<td>".&ui_link($vlink[$i], $vname[$i])."</td>\n";
|
||||
print "<td>$vaddr[$i]</td>\n";
|
||||
print "<td>$vport[$i]</td>\n";
|
||||
print "<td>$vserv[$i]</td>\n";
|
||||
|
||||
@@ -104,16 +104,15 @@ for($idx=0; $idx<@$list; $idx++) {
|
||||
$t = $edit{lc($d->{'name'})};
|
||||
if ($d->{'type'}) {
|
||||
# Recurse into section
|
||||
local ($ed1, $ed2);
|
||||
my $ed = "";
|
||||
print " " x $ind;
|
||||
if ($d->{'name'} eq "VirtualHost") { next; }
|
||||
elsif ($d->{'name'} =~ /Location|Files|Directory/) {
|
||||
$ed1 = "<a href=\"$dir?$args&".
|
||||
"idx=$idx\">";
|
||||
$ed2 = "</a>";
|
||||
$ed = "$dir?$args&idx=$idx";
|
||||
}
|
||||
print $ed1,"<",$d->{'name'}," ",$d->{'value'},
|
||||
">",$ed2,"\n";
|
||||
my $et = "<".$d->{'name'}." ".$d->{'value'}.">";
|
||||
print ( $ed ne "" ? &ui_link($ed, $et) : $et);
|
||||
print "\n";
|
||||
&show_directives($d->{'members'}, $ind+1);
|
||||
print " " x $ind;
|
||||
print "</",$d->{'name'},">\n";
|
||||
|
||||
@@ -47,7 +47,7 @@ if (@dir) {
|
||||
$text{'virt_type'} ]);
|
||||
for($i=0; $i<@links; $i++) {
|
||||
print &ui_columns_row([
|
||||
"<a href='$links[$i]'>$titles[$i]</a>",
|
||||
&ui_link($links[$i], $titles[$i]),
|
||||
$text{'virt_'.$types[$i]} ]);
|
||||
}
|
||||
print &ui_columns_end();
|
||||
|
||||
Reference in New Issue
Block a user