2 # Shows the details of one zone, with links to make changes
4 require './zones-lib.pl';
7 $zinfo = &get_zone($in{'zone'});
8 $zinfo || &error($text{'edit_egone'});
10 $p = new Webmin::Page(&zone_title($in{'zone'}), $text{'edit_title'}, "edit");
12 # Show general information
13 $gform = &get_zone_form(\%in, $zinfo);
16 # Show network interfaces
18 $nform = new Webmin::Form();
20 $nform->set_input(\%in);
21 $ntable = new Webmin::Table([ $text{'edit_netaddress'},
22 $text{'edit_netname'},
23 $text{'edit_netmask'},
24 $text{'edit_netbroad'} ], "100%", "ntable");
25 $nform->add_section($ntable);
26 $ntable->set_heading($text{'edit_net'});
27 foreach $net (@{$zinfo->{'net'}}) {
28 $active = &get_active_interface($zinfo, $net);
29 ($address, $netmask) = &get_address_netmask($net, $active);
31 "<a href='edit_net.cgi?zone=$in{'zone'}&old=$net->{'address'}'>$address</a>",
32 $active->{'fullname'} || $text{'edit_netdown'},
34 $active->{'broadcast'} ]);
36 $ntable->set_emptymsg($text{'edit_netnone'});
37 $ntable->add_link("edit_net.cgi?zone=$in{'zone'}&new=1", $text{'edit_netadd'});
39 # Show package directories
41 $pform = new Webmin::Form();
43 $pform->set_input(\%in);
44 $ptable = new Webmin::Table([ $text{'edit_pkgdir'} ], "100%", "ptable");
45 $pform->add_section($ptable);
46 $ptable->set_heading($text{'edit_pkg'});
47 foreach $pkg (@{$zinfo->{'inherit-pkg-dir'}}) {
48 if ($zinfo->{'status'} eq 'configured') {
49 $ptable->add_row([ "<a href='edit_pkg.cgi?zone=$in{'zone'}&old=$pkg->{'dir'}'>$pkg->{'dir'}</a>" ]);
52 $ptable->add_row([ "<tt>$pkg->{'dir'}</tt>" ]);
55 $ptable->set_emptymsg($text{'edit_pkgnone'});
56 if ($zinfo->{'status'} eq 'configured') {
57 $ptable->add_link("edit_pkg.cgi?zone=$in{'zone'}&new=1",
58 $text{'edit_pkgadd'});
61 $p->add_message($text{'edit_pkgcannot'});
64 # Show other filesystems
66 $fform = new Webmin::Form("edit_fs.cgi");
68 $fform->set_input(\%in);
69 $ftable = new Webmin::Table([ $text{'edit_fsdir'},
70 $text{'edit_fsspecial'},
72 $text{'edit_fsmounted'} ], "100%", "ftable");
73 $fform->add_section($ftable);
74 $ftable->set_heading($text{'edit_fs'});
75 foreach $fs (@{$zinfo->{'fs'}}) {
77 "<a href='edit_fs.cgi?zone=$in{'zone'}&old=$fs->{'dir'}'>$fs->{'dir'}</a>",
78 &mount::device_name($fs->{'special'}),
79 &mount::fstype_name($fs->{'type'}),
80 &get_active_mount($zinfo, $fs) ?
81 $text{'yes'} : $text{'no'},
84 $ftable->set_emptymsg($text{'edit_fsnone'});
85 $ftable->add_input(new Webmin::Submit($text{'edit_fsadd'}));
86 $ftable->add_input(new Webmin::Select("type", "ufs",
87 [ map { [ $_, &mount::fstype_name($_) ] } &list_filesystems() ]));
88 $fform->add_hidden("new", 1);
89 $fform->add_hidden("zone", $in{'zone'});
91 # Show resource controls
93 $rform = new Webmin::Form();
95 $rform->set_input(\%in);
96 $rtable = new Webmin::Table([ $text{'edit_rctlname'},
97 $text{'edit_rctlpriv'},
98 $text{'edit_rctllimit'},
99 $text{'edit_rctlaction'}, ], "100%", "rtable");
100 $rform->add_section($rtable);
101 $rtable->set_heading($text{'edit_rctl'});
102 foreach $rctl (@{$zinfo->{'rctl'}}) {
103 @values = split(/\0/, $rctl->{'value'});
104 local (@privs, @limits, @actions);
105 foreach $v (@values) {
106 ($priv, $limit, $action) = &get_rctl_value($v);
107 push(@privs, $text{'rctl_'.$priv});
108 push(@limits, $limit);
109 push(@actions, $text{'rctl_'.$action});
112 "<a href='edit_rctl.cgi?zone=$in{'zone'}&old=$rctl->{'name'}'>$rctl->{'name'}</a>",
113 join("<br>", @privs),
114 join("<br>", @limits),
115 join("<br>", @actions),
118 $rtable->set_emptymsg($text{'edit_rctlnone'});
119 $rtable->add_link("edit_rctl.cgi?zone=$in{'zone'}&new=1",
120 $text{'edit_rctladd'});
122 # Show generic attributes
124 $gform = new Webmin::Form();
125 $p->add_form($gform);
126 $gform->set_input(\%in);
127 $gtable = new Webmin::Table([ $text{'edit_attrname'},
128 $text{'edit_attrtype'},
129 $text{'edit_attrvalue'}, ], "100%", "gtable");
130 $gform->add_section($gtable);
131 $gtable->set_heading($text{'edit_attr'});
132 foreach $attr (@{$zinfo->{'attr'}}) {
134 "<a href='edit_attr.cgi?zone=$in{'zone'}&old=$attr->{'name'}'>$attr->{'name'}</a>",
135 $text{'attr_'.$attr->{'type'}},
139 $gtable->set_emptymsg($text{'edit_attrnone'});
140 $gtable->add_link("edit_attr.cgi?zone=$in{'zone'}&new=1",
141 $text{'edit_attradd'});
143 $p->add_footer("index.cgi", $text{'index_return'});