3 # Display details of a module or theme
5 require './cluster-usermin-lib.pl';
7 $type = $in{'tedit'} || !$in{'mod'} ? 'theme' : 'mod';
9 &ui_print_header(undef, $text{"edit_title_$type"}, "");
11 # Find all hosts with the module or theme
12 @hosts = &list_usermin_hosts();
13 @servers = &list_servers();
15 local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers;
16 foreach $m ($type eq 'theme' ? @{$h->{'themes'}}
17 : @{$h->{'modules'}}) {
18 if ($m->{'dir'} eq $name) {
23 if (!$checkon && ($s->{'id'} == $in{'host'} ||
24 !$s->{'id'} && !defined($in{'host'}))) {
32 # Get the details from this host, or the first in the list
37 #&remote_foreign_require($checkon->{'host'}, "software", "software-lib.pl");
38 #@pinfo = &remote_foreign_call($checkon->{'host'}, "software", "package_info",
41 # Show module/theme details
42 print "<table border width=100%>\n";
43 print "<tr $tb> <td><b>",&text("edit_header_$type", &server_name($checkon)),
45 print "<tr $cb> <td><table width=100%>\n";
47 print "<tr> <td><b>$text{'edit_desc'}</b></td>\n";
48 print "<td>",$mod->{'desc'},"</td>\n";
50 print "<td><b>$text{'edit_ver'}</b></td>\n";
51 print "<td>",$mod->{'version'} ? $mod->{'version'}
52 : $text{'edit_nover'},"</td> </tr>\n";
55 # Show details of module
56 foreach $m (@{$checkonh->{'modules'}}) {
57 $modmap{$m->{'dir'}} = $m;
58 foreach $d (split(/\s+/, $m->{'depends'})) {
59 push(@{$ondeps{$d}}, $m);
63 &read_file("$usermin::config{'usermin_dir'}/webmin.catnames",
65 %utext = &get_usermin_text();
66 print "<tr> <td><b>$text{'edit_cat'}</b></td>\n";
67 $c = $mod->{'category'};
68 print "<td>",$catname{$c} ? $catname{$c} :
69 $utext{"category_$c"} ? $utext{"category_$c"} :
70 $utext{"category_"},"</td>\n";
72 print "<td><b>$text{'edit_dir'}</b></td>\n";
73 print "<td><tt>$mod->{'dir'}</tt></td> </tr>\n";
75 # Show operating systems
76 print "<tr> <td valign=top><b>$text{'edit_os'}</b></td>\n";
77 print "<td colspan=3>\n";
78 $oss = $mod->{'os_support'};
80 print $text{'edit_osall'};
83 open(OSLIST, "$root_directory/os_list.txt");
86 if (/^([^\t]+)\t+([^\t]+)\t+(\S+)\t+(\S+)\t*(.*)$/) {
87 $osname{$3} = $1 if (!$osname{$3});
91 $osname{"*-linux"} = "Linux";
93 local ($os, $ver, $codes);
94 if ($oss =~ /^([^\/\s]+)\/([^\{\s]+)\{([^\}]*)\}\s*(.*)$/) {
95 $os = $1; $ver = $2; $codes = $3; $oss = $4;
97 elsif ($oss =~ /^([^\/\s]+)\/([^\/\s]+)\s*(.*)$/) {
98 $os = $1; $ver = $2; $oss = $3;
100 elsif ($oss =~ /^([^\{\s]+)\{([^\}]*)\}\s*(.*)$/) {
101 $os = $1; $codes = $2; $oss = $3;
103 elsif ($oss =~ /^\{([^\}]*)\}\s*(.*)$/) {
104 $codes = $1; $oss = $2;
106 elsif ($oss =~ /^(\S+)\s*(.*)$/) {
110 print " , \n" if ($doneone++);
111 $osn = $osname{$os} ? $osname{$os} : $os;
112 $osn =~ s/\s/ /g;
114 print "$osn $ver";
120 $codes =~ s/\s/ /g;
122 print " (",&text('edit_codes',
123 "<tt>$codes</tt>"),")";
126 print &text('edit_codes',
132 print "</td> </tr>\n";
134 # Show which modules this module depends upon
135 local @deps = grep { !/^[0-9\.]+$/ } split(/\s+/, $mod->{'depends'});
136 local @pdeps = split(/\s+/, $mod->{'perldepends'});
137 print "<tr> <td valign=top><b>$text{'edit_deps'}</b></td>\n";
138 print "<td valign=top>\n";
139 if (@deps || @pdeps) {
141 local $mm = $modmap{$d};
142 print $mm->{'desc'}," (<tt>$mm->{'dir'}</tt>)<br>\n";
144 foreach $d (@pdeps) {
145 print &text('edit_pdep', "<tt>$d</tt>"),"<br>\n";
149 print "$text{'edit_nodeps'}\n";
153 # Show which other modules depend on this one
154 print "<td valign=top><b>$text{'edit_ondeps'}</b></td>\n";
155 print "<td valign=top>\n";
156 if ($ondeps{$mod->{'dir'}}) {
157 foreach $d (@{$ondeps{$mod->{'dir'}}}) {
158 print $d->{'desc'}," (<tt>$d->{'dir'}</tt>)<br>\n";
162 print "$text{'edit_nodeps'}\n";
164 print "</td> </tr>\n";
167 # Show details of theme
170 print "</table></td></tr></table><p>\n";
172 print "<table width=100%><tr>\n";
173 print "<form action=delete_mod.cgi>\n";
174 print "<input type=hidden name=type value=\"$type\">\n";
175 print "<input type=hidden name=mod value=\"$name\">\n";
176 print "<td><input type=submit value='",$text{"edit_uninst_$type"},"'>\n";
177 print "<select name=server>\n";
178 print "<option value=-1>$text{'edit_all'}\n";
180 print "<option value='$s->{'id'}'>",&server_name($s),"\n";
182 print "</select></td></form>\n";
184 print "</tr></table>\n";
186 # Show hosts with the module or theme
188 print &ui_subheading($text{'edit_hosts'});
189 @icons = map { "/servers/images/$_->{'type'}.gif" } @got;
190 @links = map { "edit_host.cgi?id=$_->{'id'}" } @got;
191 @titles = map { &server_name($_).
192 ($_->{'module'}->{'version'} ? " ($text{'host_version2'} $_->{'module'}->{'version'})" : "") } @got;
193 &icons_table(\@links, \@titles, \@icons);
196 &ui_print_footer("", $text{'index_return'});