3 #theme_prebody - called just before the main body of every page, so it can print any HTML it likes.
4 #theme_postbody - called just after the main body of every page.
5 #theme_header - called instead of the normal header function, with the same parameters. You could use this to re-write the header function in your own style with help and index links whereever you want them.
6 #theme_footer - called instead of the footer function with the same parameters.
7 #theme_error - called instead of the error function, with the same parameters.
12 local @available = ("webmin", "system", "servers", "cluster", "hardware", "", "net", "kororaweb");
15 print "<!doctype html public \"-//W3C//DTD HTML 3.2 Final//EN\">\n";
18 print "<meta http-equiv=\"Content-Type\" ",
19 "content=\"text/html; Charset=$charset\">\n";
21 local $os_type = $gconfig{'real_os_type'} ? $gconfig{'real_os_type'}
22 : $gconfig{'os_type'};
23 local $os_version = $gconfig{'real_os_version'} ? $gconfig{'real_os_version'}
24 : $gconfig{'os_version'};
27 if ($gconfig{'sysinfo'} == 1) {
28 printf "<title>%s : %s on %s (%s %s)</title>\n",
29 $_[0], $remote_user, &get_display_hostname(),
30 $os_type, $os_version;
32 elsif ($gconfig{'sysinfo'} == 4) {
33 printf "<title>%s on %s (%s %s)</title>\n",
34 $remote_user, &get_display_hostname(),
35 $os_type, $os_version;
38 print "<title>$_[0]</title>\n";
40 print $_[7] if ($_[7]);
41 if ($gconfig{'sysinfo'} == 0 && $remote_user) {
42 print "<SCRIPT LANGUAGE=\"JavaScript\">\n";
44 "defaultStatus=\"%s%s logged into Webmin %s on %s (%s %s)\";\n",
46 $ENV{'SSL_USER'} ? " (SSL certified)" :
47 $ENV{'LOCAL_USER'} ? " (Local user)" : "",
48 &get_webmin_version(), &get_display_hostname(),
49 $os_type, $os_version;
54 @msc_modules = &get_visible_module_infos()
55 if (!scalar(@msc_modules));
57 print '<body bgcolor=#424242 link=#000000 vlink=#000000 text=#000000 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" '.$_[8].'>';
59 if ($remote_user && @_ > 1) {
60 # Show basic header with webmin.com link and logout button
61 local $logout = $main::session_id ? "/session_login.cgi?logout=1"
63 print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/top_bar.jpg">
65 <td width="100%" nowrap><a href="http://www.webmin.com"><img src="/images/webmin_top.jpg" border="0" alt="Webmin home page"></a></td>
66 <td nowrap><a href='$logout'><img src="/images/logout.jpg" border="0" alt="$text{'main_logout'}"></a></td>
71 local $one = @msc_modules == 1 && $gconfig{'gotoone'};
72 if (@_ > 1 && !$one && $remote_user) {
73 # Display module categories
74 print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0">
76 <td background="/images/shadow.jpg" nowrap><img src="/images/shadow.jpg"></td>
80 &read_file("$config_directory/webmin.catnames", \%catnames);
81 foreach $m (@msc_modules) {
82 $c = $m->{'category'};
84 if (defined($catnames{$c})) {
85 $cats{$c} = $catnames{$c};
87 elsif ($text{"category_$c"}) {
88 $cats{$c} = $text{"category_$c"};
91 # try to get category name from module ..
92 local %mtext = &load_language($m->{'dir'});
93 if ($mtext{"category_$c"}) {
94 $cats{$c} = $mtext{"category_$c"};
97 $c = $m->{'category'} = "";
98 $cats{$c} = $text{"category_$c"};
102 @cats = sort { $b cmp $a } keys %cats;
104 $per = $cats ? 100.0 / $cats : 100;
106 if (!defined($in{'cat'})) {
108 # Use default category
109 if (defined($gconfig{'deftab'}) &&
110 &indexof($gconfig{'deftab'}, @cats) >= 0) {
111 $in{'cat'} = $gconfig{'deftab'};
114 $in{'cat'} = $cats[0];
117 elsif (!$cats{$in{'cat'}}) {
121 #####Navigation Bar START#####
122 print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#848484">
128 foreach $testet (@available) {
133 if ($in{'cat'} eq $c) {
134 if ($inlist eq "true") {
137 print qq~<img src="/images/cats_over/others.jpg">~;
139 } elsif ($c eq "webmin") {
141 print qq~<a href=/?cat=$c><img src="/images/cats_over/$c.jpg" border=0></a>~;
143 print qq~<img src="/images/cats_over/$c.jpg" border=0>~;
146 print qq~<img src="/images/cats_over/$c.jpg">~;
152 print qq~<img src="/images/cats_over/unknown.jpg">~;
158 if ($inlist eq "true") {
160 print qq~<a href=/?cat=$c><img src="/images/cats/others.jpg" border=0 alt=$c></a>~;
164 print qq~<a href=/?cat=$c><img src="/images/cats/$c.jpg" border=0 alt=$c></a>~;
169 print qq~<a href=/?cat=$c><img src="/images/cats/unknown.jpg" border=0 alt=$c></a>~;
181 print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/shadow2.jpg" height="4">
183 <td width="100%"><img src="/images/shadow2.jpg"></td>
190 if (@_ > 1 && (!$_[5] || $ENV{'HTTP_WEBMIN_SERVERS'})) {
191 # Show tabs under module categories
192 print '<table width=100% border="0" cellspacing="0" cellpadding="0" background="/images/tabs/bgimage.jpg"><tr><td>';
194 if ($ENV{'HTTP_WEBMIN_SERVERS'}) {
196 print "<a href='$ENV{'HTTP_WEBMIN_SERVERS'}'>",
197 "$text{'header_servers'}</a><br>\n";
200 if (!$_[4]) { &tab_start; print "<a href=\"/$module_name/\">",
201 "$text{'header_module'}</a>"; &tab_end;}
202 if (ref($_[2]) eq "ARRAY") {
203 &tab_start; print &hlink($text{'header_help'}, $_[2]->[0], $_[2]->[1]); &tab_end;
205 elsif (defined($_[2])) {
207 print &hlink($text{'header_help'}, $_[2]);
211 local %access = &get_module_acl();
212 if (!$access{'noconfig'}) {
213 &tab_start; print "<a href=\"/config.cgi?$module_name\">",
214 $text{'header_config'},"</a>"; &tab_end;
218 foreach $t (split(/<br>/, $_[6])) {
220 &tab_start; print $t; &tab_end;
224 print "</td></tr></table>";
227 # Show page title in tab
228 local $title = $_[0];
229 $title =~ s/ä/ä/g;
230 $title =~ s/ö/ö/g;
231 $title =~ s/ü/ü/g;
232 $title =~ s/ / /g;
234 # print "<p><table border=0 cellpadding=0 cellspacing=0 width=95% align=center><tr><td><table border=0 cellpadding=0 cellspacing=0 height=20><tr>\n";
235 $usercol = defined($gconfig{'cs_header'}) ||
236 defined($gconfig{'cs_table'}) ||
237 defined($gconfig{'cs_page'});
238 # print "<td bgcolor=#bae3ff>",
239 # "<img src=/images/tabs/blue_left.jpg alt=\"\">","</td>\n";
240 # print "<td bgcolor=#bae3ff> <b>$title</b> </td>\n";
241 # print "<td bgcolor=#bae3ff>",
242 # "<img src=/images/tabs/blue_right.jpg alt=\"\">","</td>\n";
243 # print "</tr></table></td></tr></table>";
245 print "<center><font color=#FFFFFF><b>$title</b></font></center>";
250 @header_arguments = @_;
255 print "<table border=0 width=100% align=center cellspacing=0 cellpadding=0><tr><td background=/images/msctile.jpg>\n";
260 print "</table>\n" if (@header_arguments > 1 && !$header_arguments[5]);
266 print "</table></table><br>\n"
267 if (@header_arguments > 1 && !$header_arguments[5]);
269 print "<table border=0 width=100% align=center cellspacing=0 cellpadding=0><tr><td>\n";
271 for($i=0; $i+1<@_; $i+=2) {
274 $url = "/?cat=$module_info{'category'}";
276 elsif ($url eq '' && $module_name) {
277 $url = "/$module_name/";
279 elsif ($url =~ /^\?/ && $module_name) {
280 $url = "/$module_name/$url";
283 print " <a href=\"$url\"><img alt=\"<-\" align=middle border=0 src=/images/arrow.jpg></a>\n";
288 print " <a href=\"$url\"><font color=#FFFFFF>",&text('main_return', $_[$i+1]),"</font></a>\n";
290 print "</td></tr></table>\n";
294 local $postbody = $tconfig{'postbody'};
296 local $hostname = &get_display_hostname();
297 local $version = &get_webmin_version();
298 local $os_type = $gconfig{'real_os_type'} ?
299 $gconfig{'real_os_type'} : $gconfig{'os_type'};
300 local $os_version = $gconfig{'real_os_version'} ?
301 $gconfig{'real_os_version'} : $gconfig{'os_version'};
302 $postbody =~ s/%HOSTNAME%/$hostname/g;
303 $postbody =~ s/%VERSION%/$version/g;
304 $postbody =~ s/%USER%/$remote_user/g;
305 $postbody =~ s/%OS%/$os_type $os_version/g;
308 if ($tconfig{'postbodyinclude'}) {
309 open(INC, $module_name ?
310 "../$gconfig{'theme'}/$tconfig{'postbodyinclude'}" :
311 "$gconfig{'theme'}/$tconfig{'postbodyinclude'}");
317 if (defined(&theme_postbody)) {
320 print "</body></html>\n";
334 if (!$lang->{'titles'} || $gconfig{'texttitles'}) {
337 foreach $l (split(//, $t)) {
339 if ($ll > 127 && $lang->{'charset'}) {
340 print "<img src=/images/letters2/$ll.$lang->{'charset'}.gif alt=\"$l\" align=bottom border=0>";
343 print "<img src=/images/letters2/$ll.gif alt=\"\ \" align=bottom border=0>";
346 print "<img src=/images/letters2/$ll.gif alt=\"$l\" align=bottom border=0>";
353 print qq~ <td nowrap>
354 <table border="0" cellspacing="0" cellpadding="0">
356 <td background="/images/tabs/bg.jpg"><img src="/images/tabs/left.jpg" nowrap></td>
357 <td background="/images/tabs/bg.jpg" nowrap>
364 <td background="/images/tabs/bg.jpg" nowrap><img src="/images/tabs/right.jpg"></td>
376 <table cellpadding="0" cellspacing="0" border="0" width="100%" background="/images/cat_sep.jpg">
378 <td valign="Top" width="100%"><img src="/images/left_cat_sep.jpg" alt=" ">
380 <td valign="Top"><img src="/images/right_cat_sep.jpg" alt=" "></td>