2 # Override functions for the OSX theme
3 # XXX always starts with 'other' category?
5 # header(title, image, [help], [config], [nomodule], [nowebmin], [rightside],
6 # [header], [body], [below])
9 print "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n";
12 print "<title>$_[0]</title>\n";
13 print "<link rel='stylesheet' href='/unauthenticated/style.css' type='text/css'>\n";
15 print "<meta http-equiv=\"Content-Type\" ",
16 "content=\"text/html; Charset=$charset\">\n";
19 print "<body $_[8]>\n";
21 # Get all modules visible to this user
22 @osx_modules = &get_available_module_infos()
23 if (!scalar(@osx_modules));
25 # Show table of categories
26 local $one = @osx_modules == 1 && $gconfig{'gotoone'};
27 local $notabs = $gconfig{"notabs_${base_remote_user}"} == 2 ||
28 $gconfig{"notabs_${base_remote_user}"} == 0 && $gconfig{'notabs'};
29 if (@_ > 1 && !$one && $remote_user && !$notabs) {
31 if (!$ENV{'ANONYMOUS_USER'} && !$ENV{'SSL_USER'} &&
32 !$ENV{'LOCAL_USER'} && !$ENV{'HTTP_WEBMIN_SERVERS'}) {
33 if ($main::session_id) {
34 $logout = "<a href='/session_login.cgi?logout=1'>$text{'main_logout'}</a>";
37 $logout = "<a href='/switch_user.cgi'>$text{'main_switch'}</a>";
40 &start_osx_table("Module Categories", $logout);
42 &read_file("$config_directory/webmin.catnames", \%catnames);
43 foreach $m (@osx_modules) {
44 local $c = $m->{'category'};
46 if (defined($catnames{$c})) {
47 $cats{$c} = $catnames{$c};
49 elsif ($text{"category_$c"}) {
50 $cats{$c} = $text{"category_$c"};
53 # try to get category name from module ..
54 local %mtext = &load_language($m->{'dir'});
55 if ($mtext{"category_$c"}) {
56 $cats{$c} = $mtext{"category_$c"};
59 $c = $m->{'category'} = "";
60 $cats{$c} = $text{"category_$c"};
64 @cats = sort { $b cmp $a } keys %cats;
66 $per = $cats ? 100.0 / $cats : 100;
68 # Actually show category icons
70 local (@icons, @titles, @links);
74 push(@icons, -r "$root_directory/$current_theme/cats/$c.gif" ?
75 "/$current_theme/cats/$c.gif" :
76 "/$current_theme/cats/unknown.gif");
77 push(@links, "/?cat=$c");
79 &icons_table(\@links, \@titles, \@icons,
80 @links > 7 ? scalar(@links) : 7);
86 # Open table for main page
88 if ($ENV{'HTTP_WEBMIN_SERVERS'}) {
89 push(@right, "<a href='$ENV{'HTTP_WEBMIN_SERVERS'}'>".
90 "$text{'header_servers'}</a>");
94 local $idx = $module_info{'index_link'};
95 local $mi = $module_index_link || "/$module_name/$idx";
96 push(@right, "<a href=\"$gconfig{'webprefix'}$mi\">".
97 "$text{'header_module'}</a>");
99 if (ref($_[2]) eq "ARRAY" && !$ENV{'ANONYMOUS_USER'}) {
101 push(@right, &hlink($text{'header_help'},
102 $_[2]->[0], $_[2]->[1]));
104 elsif (defined($_[2]) && !$ENV{'ANONYMOUS_USER'}) {
106 push(@right, &hlink($text{'header_help'}, $_[2]));
109 local %access = &get_module_acl();
110 if (!$access{'noconfig'} && !$config{'noprefs'}) {
111 local $cprog = $user_module_config_directory ?
112 "uconfig.cgi" : "config.cgi";
113 push(@right, "<a href=\"$gconfig{'webprefix'}/$cprog?$module_name\">$text{'header_config'}</a>");
116 push(@right, split(/<br>/, $_[6]));
117 &start_osx_table($_[0], join(" | ", @right));
119 print "<table width=100%><tr><td align=center>",
120 "$_[9]</td></tr></table>\n";
122 $started_osx_table++;
128 if ($started_osx_table) {
129 # Close table for main page
139 # start_osx_table(title, rightstuff, width)
142 local ($title, $right, $width) = @_;
145 <table align="center" width="$width%" cellspacing="0" cellpadding="0" class="maintablea">
148 <table width="100%" cellspacing="0" cellpadding="0" class="tableh1a">
150 <td class="tableh1a"><img src="/unauthenticated/left.gif"></td>
151 <td class="tableh1a" background="/unauthenticated/middle.gif" width="100%"><font class="optionx" color="#ffffff">  $title</font></td>
152 <td class="tableh1a" background="/unauthenticated/middle.gif" align=right nowrap><font class="optionx" color="#ffffff">$right</font></td>
153 <td class="tableh1a"><img src="/unauthenticated/right.gif"></td>
160 <table align="center" width="$width%" cellspacing="0" cellpadding="0">
162 <td background="/unauthenticated/c1b.gif" valign="top"><img name="main_table_r1_c1" src="/unauthenticated/c1.gif" border="0" id="main_table_r1_c1" alt="" /></td>
163 <td width="100%"><table width="100%" cellspacing="0" cellpadding="5" class="maintableb" border="1" bordercolor="7F7F7F">
176 <td background="/unauthenticated/c3b.gif" valign="top"><img name="main_table_r1_c3" src="/unauthenticated/c3.gif" border="0" id="main_table_r1_c3" alt="" /></td>
179 <td><img name="main_table_r2_c1" src="/unauthenticated/2c1.gif" width="10" height="4" border="0" id="main_table_r2_c1" alt="" /></td>
180 <td background="/unauthenticated/c2b.gif"><img name="main_table_r2_c2" src="/unauthenticated/c2.gif" border="0" id="main_table_r2_c2" alt="" /></td>
181 <td><img name="main_table_r2_c3" src="/unauthenticated/c3.gif" width="10" height="4" border="0" id="main_table_r2_c3" alt="" /></td>
187 sub theme_ui_post_header
191 if (defined($text)) {
192 $rv .= "<center><font size=+1>$text</font></center><br>\n";
197 sub theme_ui_pre_footer
202 # Hack to prevent the display of <hr> lines
206 #if ($_[1] !~ /^<hr>(<p>|<br>)?\s*$/) {
209 # &write_to_sock(@_);