diff --git a/bind8/bind8-lib.pl b/bind8/bind8-lib.pl index 0061d5c8f..e6b479f93 100755 --- a/bind8/bind8-lib.pl +++ b/bind8/bind8-lib.pl @@ -1188,11 +1188,9 @@ $rv .= &ui_columns_start([ "", $text{'index_zone'}, $text{'index_type'} ], for($i=0; $i<@{$_[0]}; $i++) { local @cols; if (&have_dnssec_tools_support()) { - @cols = ( "[$i]\">$_[1]->[$i]", - $_[2]->[$i], $_[4]->[$i]); + @cols = ( &ui_link($_[0]->[$i], $_[1]->[$i]), $_[2]->[$i], $_[4]->[$i] ); } else { - @cols = ( "[$i]\">$_[1]->[$i]", - $_[2]->[$i]); + @cols = ( &ui_link($_[0]->[$i], $_[1]->[$i]), $_[2]->[$i] ); } if (defined($_[3]->[$i])) { $rv .= &ui_checked_columns_row(\@cols, \@tds, "d", $_[3]->[$i]); @@ -2930,26 +2928,23 @@ if (!$access{'ro'} && $access{'apply'}) { if (&is_bind_running()) { if ($zone && ($access{'apply'} == 1 || $access{'apply'} == 2)) { # Apply this zone - push(@rv, "{'name'}'>". - "$text{'links_apply'}"); + my $link = "restart_zone.cgi?return=$r&". + "view=$zone->{'viewindex'}&". + "zone=$zone->{'name'}"; + push(@rv, &ui_link($link, $text{'links_apply'}) ); } # Apply whole config if ($access{'apply'} == 1 || $access{'apply'} == 3) { - push(@rv, "". - "$text{'links_restart'}"); + push(@rv, &ui_link("restart.cgi?return=$r", $text{'links_restart'}) ); } if ($access{'apply'} == 1) { # Stop BIND - push(@rv, "". - "$text{'links_stop'}"); + push(@rv, &ui_link("stop.cgi?return=$r", $text{'links_stop'}) ); } } elsif ($access{'apply'} == 1) { # Start BIND - push(@rv, "". - "$text{'links_start'}"); + push(@rv, &ui_link("start.cgi?return=$r", $text{'links_start'})); } } return join('
', @rv); diff --git a/bind8/edit_master.cgi b/bind8/edit_master.cgi index 8c5563ca5..c245b8eb5 100755 --- a/bind8/edit_master.cgi +++ b/bind8/edit_master.cgi @@ -191,9 +191,7 @@ if ($_[0]) { %rnum ? ( $text{'master_records'} ) : ( ) ], 100); for(my $i=0; $_[$i]; $i++) { - local @cols = ( "". - ($text{"recs_$_[$i]"} || $_[$i])."" ); + local @cols = ( &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$_[$i]", ($text{"recs_$_[$i]"} || $_[$i]) ) ); if (%rnum) { push(@cols, $rnum{$_[$i]}); } diff --git a/bind8/edit_recs.cgi b/bind8/edit_recs.cgi index 2cc2b0cb1..2ea407df6 100755 --- a/bind8/edit_recs.cgi +++ b/bind8/edit_recs.cgi @@ -136,18 +136,18 @@ if (!$access{'ro'} && $type eq 'master') { push(@hcols, ""); push(@tds, "width=5"); } -push(@hcols, "".($in{'type'} eq "PTR" ? $text{'recs_addr'} : $text{'recs_name'}).""); -push(@hcols, "$text{'recs_type'}") if ($in{'type'} eq "ALL"); +push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=1", ($in{'type'} eq "PTR" ? $text{'recs_addr'} : $text{'recs_name'}) ) ); +push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=5", $text{'recs_type'}) ) if ($in{'type'} eq "ALL"); push(@hcols, $text{'recs_ttl'}); @hmap = @{$hmap{$in{'type'}}}; foreach $h (@hmap) { - push(@hcols, "$h"); + push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=2",$h) ); } if ($in{'type'} eq "ALL" || $is_extra{$in{'type'}}) { push(@hcols, $text{'recs_vals'}); } if ($config{'allow_comments'} && $in{'type'} ne "WKS") { - push(@hcols, "$text{'recs_comment'}"); + push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=4", $text{'recs_comment'}) ); } $rv .= &ui_columns_start(\@hcols, 100); @@ -169,11 +169,7 @@ for($i=0; $i<@_; $i++) { $name = &html_escape($name); $id = &record_id($r); if (!$access{'ro'} && $type eq 'master') { - push(@cols, - "{'num'}&". - "type=$in{'type'}&sort=$in{'sort'}&view=$in{'view'}\">". - "$name"); + push(@cols, &ui_link("edit_record.cgi?zone=$in{'zone'}&id=".&urlize($id)."&num=$r->{'num'}&type=$in{'type'}&sort=$in{'sort'}&view=$in{'view'}", $name) ); } else { push(@cols, $name); diff --git a/bind8/edit_slave.cgi b/bind8/edit_slave.cgi index 4979f08f6..228e07f2b 100755 --- a/bind8/edit_slave.cgi +++ b/bind8/edit_slave.cgi @@ -123,9 +123,7 @@ if ($_[0]) { $text{'master_records'}, ], 100); for(my $i=0; $_[$i]; $i++) { - local @cols = ( "". - ($text{"recs_$_[$i]"} || $_[$i])."", + local @cols = ( &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$_[$i]",($text{"recs_$_[$i]"} || $_[$i]) ), $rnum{$_[$i]} ); $rv .= &ui_columns_row(\@cols); } diff --git a/bind8/find_free.cgi b/bind8/find_free.cgi index f545edf12..a005fc614 100755 --- a/bind8/find_free.cgi +++ b/bind8/find_free.cgi @@ -147,8 +147,7 @@ print &ui_form_end([ [ undef, $text{'findfree_search'} ] ]); sub frecs_table { print &ui_grid_table( - [ map { "{'ip'}'>$_->{'ip'}" } @_ ], + [ map { &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=A&newvalue=$_->{'ip'}", $_->{'ip'}) } @_ ], 4, 100, [ "width=25%", "width=25%", "width=25%", "width=25%" ]); } diff --git a/bind8/free_chooser.cgi b/bind8/free_chooser.cgi index cd642ffcd..cc69b3b0f 100755 --- a/bind8/free_chooser.cgi +++ b/bind8/free_chooser.cgi @@ -68,7 +68,7 @@ foreach $net (@nets) { for($d=$start; $d<=$end; $d++) { $ip = "$netip[0].$netip[1].$netip[2].$d"; if (!$taken{$ip}) { - print &ui_columns_row([ "$ip" ]); + print &ui_columns_row([ &ui_link("", $ip, undef, "onClick='return select(\"$ip\");'") ]); } } } diff --git a/bind8/index.cgi b/bind8/index.cgi index e458b4d03..8f60393da 100755 --- a/bind8/index.cgi +++ b/bind8/index.cgi @@ -128,31 +128,24 @@ if ($access{'defaults'}) { # Work out what creation links we have @crlinks = ( ); if ($access{'master'} && !$access{'ro'}) { - push(@crlinks, - "$text{'index_addmaster'}"); + push(@crlinks, &ui_link("master_form.cgi", $text{'index_addmaster'}) ); } if ($access{'slave'} && !$access{'ro'}) { - push(@crlinks, - "$text{'index_addslave'}"); - push(@crlinks, - "$text{'index_addstub'}"); + push(@crlinks, &ui_link("slave_form.cgi", $text{'index_addslave'}) ); + push(@crlinks, &ui_link("stub_form.cgi", $text{'index_addstub'}) ); } if ($access{'forward'} && !$access{'ro'}) { - push(@crlinks, - "$text{'index_addfwd'}"); + push(@crlinks, &ui_link("forward_form.cgi", $text{'index_addfwd'}) ); } if ($access{'delegation'} && !$access{'ro'} && &version_atleast(9, 2, 1)) { - push(@crlinks, - "$text{'index_adddele'}"); + push(@crlinks, &ui_link("delegation_form.cgi", $text{'index_adddele'}) ); } if ($access{'master'} && !$access{'ro'} && scalar(@hashint) < (@views ? scalar(@views) : 1)) { - push(@crlinks, - "$text{'index_addhint'}"); + push(@crlinks, &ui_link("hint_form.cgi", $text{'index_addhint'}) ); } if (@crlinks) { - push(@crlinks, - "$text{'index_addmass'}"); + push(@crlinks, &ui_link("mass_form.cgi", $text{'index_addmass'}) ); } if (@zones > $config{'max_zones'}) { @@ -463,8 +456,7 @@ if ($access{'views'} && $bind_version >= 9) { push(@vicons, "images/view.gif"); } @links = ( ); - push(@links, "$text{'index_addview'}") - if (!$access{'ro'} && $access{'views'} != 2); + push(@links, &ui_link("view_form.cgi", $text{'index_addview'}) ) if (!$access{'ro'} && $access{'views'} != 2); if (@views) { print &ui_links_row(\@links); &icons_table(\@vlinks, \@vtitles, \@vicons, 5); @@ -518,13 +510,13 @@ if ($_[0] ne "") { $name =~ /^([^\.]+)/; if (!$ztree{$name}) { # Has no children - print "  $1\n", + print "  $1\n", } else { # Has children local $act = $heiropen{$name} ? "close" : "open"; - print ""; - print "  $1\n", + print &ui_link("$act.cgi?what=".&urlize($name), ""); + print "  $1\n", } } else { @@ -535,9 +527,9 @@ if ($zhash{$name}) { local $cb = $zdelhash{$name} ? &ui_checkbox("d", $zdelhash{$name}, "", 0)." " : ""; if (&have_dnssec_tools_support()) { - print "$cb$ztitlehash{$name} ($ztypeshash{$name}) ($zstatushash{$name}) \n"; + print "$cb".&ui_link($zlinkhash{$name}, "$ztitlehash{$name} ($ztypeshash{$name}) ($zstatushash{$name})")."\n"; } else { - print "$cb$ztitlehash{$name} ($ztypeshash{$name}) \n"; + print "$cb".&ui_link($zlinkhash{$name}, "$ztitlehash{$name} ($ztypeshash{$name})")."\n"; } } else { diff --git a/dhcpd/edit_group.cgi b/dhcpd/edit_group.cgi index b1d5ab862..115fcf0b6 100755 --- a/dhcpd/edit_group.cgi +++ b/dhcpd/edit_group.cgi @@ -80,19 +80,19 @@ foreach $s (@shar) { } } -print "
\n"; -print "\n"; -print "\n"; -print "\n"; -print "
$text{'egroup_tblhdr'}
\n"; +print &ui_form_start("save_group.cgi", "post"); +print &ui_hidden("ret",$in{'ret'}); +print &ui_table_start($text{'egroup_tblhdr'}, "width=100%", 4); -print "\n"; -printf "\n", - &html_escape($group->{'comment'}); +print "\n"; +print ""; +print ""; -$rws = "rowspan=2" if (defined($in{'ret'})); -print "\n"; -print "$text{'egroup_hosts'}\n"; +print ""; foreach $h (&find("host", $mems)) { push(@host, $h); # if &can('r', \%access, $h); @@ -105,20 +105,19 @@ foreach $g (&find("group", $mems)) { } } @host = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } @host; +my @hosts_sel; foreach $h (@host) { next if !&can('r', \%access, $h); - printf "\n", - $h->{'index'}, $ingroup{$h}, - (!$in{'new'}) && $ingroup{$h} eq $group->{'index'} ? "selected" : "", - $h->{'values'}->[0]; + push(@hosts_sel, ["$h->{'index'},$ingroup{$h}", $h->{'values'}->[0], ((!$in{'new'}) && $ingroup{$h} eq $group->{'index'} ? "selected" : "") ] ); } -print "\n"; +print &ui_select("hosts", undef, \@hosts_sel, 5, 1); +print "\n"; if (!$in{'new'}) { # inaccessible hosts in this group foreach $h (@host) { if (!&can('r', \%access, $h) && $ingroup{$h} eq $group->{'index'}) { - print "{'index'},$group->{'index'}\" type=hidden>\n"; + print &ui_hidden("hosts","$h->{'index'},$group->{'index'}"); } } } @@ -126,7 +125,7 @@ if (!$in{'new'}) { $assign = $in{'uidx'} ne "" ? "2" : $in{'sidx'} ne "" ? "1" : "0"; if (!defined($in{'ret'})) { - local @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'}, + my @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'}, $text{'ehost_insubnet'} ); print "\n"; - print "\n"; + print "\n"; } else { - print "\n", - print "\n"; + print &ui_hidden("assign",$assign); + print &ui_hidden("parent",$currpar); } print &choice_input($text{'egroup_nchoice'}, "use-host-decl-names", @@ -184,30 +179,26 @@ print &choice_input($text{'egroup_nchoice'}, "use-host-decl-names", print "\n" if (defined($in{'ret'})); &display_params($gconf, "group"); -print "
$text{'egroup_desc'}
$text{'egroup_desc'}"; +print &ui_textbox("desc", &html_escape($group->{'comment'}), 60); +print "
$text{'egroup_hosts'}
"; print "\n" if ($in{'assign'}); @@ -134,48 +133,44 @@ if (!defined($in{'ret'})) { if ($in{'assign'}) { $assign = $in{'assign'}; print "$labels[$assign]\n"; - print "\n"; - print "\n"; + print &ui_hidden("assign",$assign); + print &ui_hidden("jsquirk",1); } else { - print "\n"; + print &ui_select("assign", undef, \@assign_sel, 1, undef, undef, undef, "onChange='setparent(0)'" ); + print ""; } - print "\n"; + print &ui_select("parent", undef, \@parent_sel, 5, undef, undef, undef, "width=120"); + print "\n"; print "
$text{'ehost_nojavascr'}
"; + my @parent_sel; if ($assign == 2) { $iu = 0; foreach $u (@subn) { - printf "\n", - defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'}, - $iu == $sel_parent ? "selected" : "", - $subn_desc[$iu] - if &can('rw', \%access, $u); - $iu ++; + my $val1 = defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'}; + my $txt1 = $subn_desc[$iu] if &can('rw', \%access, $u); + push(@parent_sel, [$val1, $txt1, ($iu == $sel_parent ? "selected" : "") ] ); + $iu++; } } elsif ($assign == 1) { $is = 0; foreach $s (@shar) { - printf "\n", - $s->{'index'}, - $is == $sel_parent ? "selected" : "", - $shar_desc[$is] - if &can('rw', \%access, $s); - $is ++; + my $txt2 = $shar_desc[$is] if &can('rw', \%access, $s); + push(@parent_sel, [$s->{'index'}, $txt1, ($is == $sel_parent ? "selected" : "") ] ); + $is++; } } - print "
\n"; -print "\n"; -print "\n"; +print ""; +print &ui_table_end(); + +print &ui_hidden("sidx",$in{'sidx'}); +print &ui_hidden("uidx",$in{'uidx'}); + if (!$in{'new'}) { - print "\n"; + print &ui_hidden("idx",$in{'idx'}); print "\n"; - print "\n" - if &can('rw', \%access, $group); - print "\n"; - print "\n" - if &can('rw', \%access, $group, 1); + print "" if &can('rw', \%access, $group); + print ""; + print "" if &can('rw', \%access, $group, 1); print "
".&ui_submit($text{'save'})."".&ui_submit(( &can('rw', \%access, $group) ? $text{'butt_eco'} : $text{'butt_vco'} ),"options")."".&ui_submit($text{'delete'},"delete")."
\n"; - print "" - .$text{'index_addhst'}."

\n" if &can('rw', \%access, $group); + print &ui_link("edit_host.cgi?new=1&sidx=".$in{'sidx'}."&uidx=".$in{'uidx'}."&gidx=".$in{'idx'}."&ret=group",$text{'index_addhst'}) if &can('rw', \%access, $group); } else { - print "\n"; - print "\n"; + print &ui_hidden("new",1); + print &ui_submit($text{'create'}); } -print "

\n"; +print &ui_form_end(); print &script_fn() if (!defined($in{'ret'})); if ($in{'ret'} eq "subnet") { &ui_print_footer("edit_subnet.cgi?sidx=$in{'sidx'}&idx=$in{'uidx'}", diff --git a/dhcpd/edit_host.cgi b/dhcpd/edit_host.cgi index 2a68bb8f9..a0355b5d7 100755 --- a/dhcpd/edit_host.cgi +++ b/dhcpd/edit_host.cgi @@ -23,7 +23,7 @@ else { # display if ($in{'uidx'} ne '') { - local $s = $in{'sidx'} eq '' ? $conf->[$in{'uidx'}] : + my $s = $in{'sidx'} eq '' ? $conf->[$in{'uidx'}] : $conf->[$in{'sidx'}]->{'members'}->[$in{'uidx'}]; $desc = &text('ehost_subnet', $s->{'values'}->[0], $s->{'values'}->[2]); } @@ -153,132 +153,122 @@ foreach $s (@shar) { } $is ++; } +print &ui_form_start("save_host.cgi", "post"); +print &ui_hidden("ret",$in{'ret'}); +print &ui_table_start($text{'ehost_tabhdr'}, "width=100%", 4); -print "
\n"; -print "\n"; -print "\n"; -print "\n"; -print "
$text{'ehost_tabhdr'}
\n"; +print "\n"; +print ""; +print ""; -print "\n"; -printf "\n", - &html_escape($host->{'comment'}); +print "\n"; +print "\n"; -print "\n"; -printf "\n", - $host ? $host->{'values'}->[0] : ""; $assign = $in{'gidx'} ne "" ? "3" : $in{'uidx'} ne "" ? "2" : $in{'sidx'} ne "" ? "1" : "0"; if (!defined($in{'ret'})) { - local @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'}, + my @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'}, $text{'ehost_insubnet'}, $text{'ehost_ingroup'} ); - print "
$text{'ehost_desc'}"; +print &ui_textbox("desc", &html_escape($host->{'comment'}), 60); +print "
$text{'ehost_desc'}
$text{'ehost_hname'}"; +print &ui_textbox("name", ( $host ? $host->{'values'}->[0] : "" ), 20); +print "
$text{'ehost_hname'}"; + print "\n"; - - print "\n"; + print "\n"; } else { - print "\n"; - print "\n"; + print &ui_hidden("assign",$assign); + print &ui_hidden("parent",$currpar); } $hard = $hconf ? &find("hardware", $hconf) : undef; -print "\n"; -print "\n", - $hard ? $hard->{'values'}->[1] : ""; +print "\n"; +print "\n"; $fixed = $host ? &find("fixed-address", $hconf) : ""; -print "\n", - $fixed ? join(" ", grep { $_ ne "," } @{$fixed->{'values'}}) : ""; +print "\n"; &display_params($hconf, "host"); -print "
"; print "\n" if ($in{'assign'}); print "\n"; - print "\n"; - print "\n"; + print &ui_hidden("assign",$assign); + print &ui_hidden("jsquirk",1); } else { - print "\n"; + print &ui_select("assign", undef, \@assign_sel, 1, undef, undef, undef, "onChange='setparent(0)'" ); + print "\n"; } - print "\n"; + print &ui_select("parent", undef, \@parent_sel, 5, undef, undef, undef, "width=120"); + print "\n"; print "
$text{'ehost_nojavascr'}
$text{'ehost_assign'}
\n"; if ($in{'assign'}) { $assign = $in{'assign'}; print "$labels[$assign]
"; + my @parent_sel; if ($assign == 3) { $ig = 0; foreach $g (@group) { - printf "\n", - (defined($shared{$g}) ? "$shared{$g}," : ""). - (defined($subnet{$g}) ? "$subnet{$g}," : ""). - $g->{'index'}, - $ig == $sel_parent ? "selected" : "", - $group_desc[$ig] - if &can('rw', \%access, $g); - $ig ++; + my $val = (defined($shared{$g}) ? "$shared{$g}," : "").(defined($subnet{$g}) ? "$subnet{$g}," : "").$g->{'index'}; + my $txt = $group_desc[$ig] if &can('rw', \%access, $g); + push(@parent_sel, [$val, $txt, ($ig == $sel_parent ? "selected" : "") ] ); + $ig++; } } elsif ($assign == 2) { $iu = 0; foreach $u (@subn) { - printf "\n", - defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'}, - $iu == $sel_parent ? "selected" : "", - $subn_desc[$iu] - if &can('rw', \%access, $u); - $iu ++; + my $val1 = defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'}; + my $txt1 = $subn_desc[$iu] if &can('rw', \%access, $u); + push(@parent_sel, [$val1, $txt1, ($iu == $sel_parent ? "selected" : "") ] ); + $iu++; } } elsif ($assign == 1) { $is = 0; foreach $s (@shar) { - printf "\n", - $s->{'index'}, - $is == $sel_parent ? "selected" : "", - $shar_desc[$is] - if &can('rw', \%access, $s); - $is ++; + my $txt2 = $shar_desc[$is] if &can('rw', \%access, $s); + push(@parent_sel, [$s->{'index'}, $txt1, ($is == $sel_parent ? "selected" : "") ] ); + $is++; } } - print "
$text{'ehost_hwaddr'}"; -printf "
$text{'ehost_hwaddr'}"; +my @hardware_type_sel; +my @hardware = ("ethernet","token-ring","fddi"); +foreach my $hv (@hardware) { + push(@hardware_type_sel, [$hv,$hv, ($hard && $hard->{'values'}->[0] eq $hv ? "selected" : "")] ); +} +print &ui_select("hardware_type", undef, \@hardware_type_sel, 1); +print &ui_textbox("hardware", ( $hard ? $hard->{'values'}->[1] : "" ), 18); +print "
$text{'ehost_fixedip'} \n"; -printf "
$text{'ehost_fixedip'}\n"; +print &ui_textbox("fixed-address", ( $fixed ? join(" ", grep { $_ ne "," } @{$fixed->{'values'}}) : "" ), 20); +print "
\n"; -print "\n"; -print "\n"; -print "\n"; +print &ui_table_end(); + +print &ui_hidden("gidx",$in{'gidx'}); +print &ui_hidden("uidx",$in{'uidx'}); +print &ui_hidden("sidx",$in{'sidx'}); + if (!$in{'new'}) { - print "\n"; + print &ui_hidden("idx",$in{'idx'}); print "\n"; - print "\n" - if &can('rw', \%access, $host); - print "\n"; - print "\n" - if &can('rw', \%access, $host, 1); + print "" if &can('rw', \%access, $host); + print ""; + print "" if &can('rw', \%access, $host, 1); print "
".&ui_submit($text{'save'})."".&ui_submit(( &can('rw', \%access, $host) ? $text{'butt_eco'} : $text{'butt_vco'} ),"options")."".&ui_submit($text{'delete'},"delete")."
\n"; } else { - print "\n"; - print "\n"; + print &ui_hidden("new",1); + print &ui_submit($text{'butt_create'}); } -print "\n"; + +print &ui_form_end(); + print &script_fn() if (!defined($in{'ret'})); if ($in{'ret'} eq "group") { &ui_print_footer("edit_group.cgi?sidx=$in{'sidx'}&uidx=$in{'uidx'}&idx=$in{'gidx'}", @@ -298,7 +288,7 @@ else { sub script_fn { return < +