2 # Show the left-side menu of Virtualmin domains, plus modules
4 BEGIN { push(@INC, ".."); };
8 %text = &load_language($current_theme);
9 %gaccess = &get_module_acl(undef, "");
11 # Work out what modules and categories we have
12 @cats = &get_visible_modules_categories();
13 @modules = map { @{$_->{'modules'}} } @cats;
17 <link rel="stylesheet" type="text/css" href="left.css" />
19 function toggleview (id1,id2) {
20 var obj1 = document.getElementById(id1);
21 var obj2 = document.getElementById(id2);
22 (obj1.className=="itemshown") ? obj1.className="itemhidden" : obj1.className="itemshown";
23 (obj1.className=="itemshown") ? obj2.innerHTML="<img border='0' src='images/open.gif' alt='[–]'>" : obj2.innerHTML="<img border='0' src='images/closed.gif' alt='[+]'>";
26 // Show the logs for the current module in the right
27 function show_logs() {
28 var url = ''+window.parent.frames[1].location;
29 var sl1 = url.indexOf('//');
32 var sl2 = url.indexOf('/', sl1+2);
34 var sl3 = url.indexOf('/', sl2+1);
36 mod = url.substring(sl2+1, sl3);
38 mod = url.substring(sl2+1);
42 if (mod && mod.indexOf('.cgi') <= 0) {
43 // Show one module's logs
44 window.parent.frames[1].location = 'webminlog/search.cgi?tall=4&uall=1&fall=1&mall=0&module='+mod;
48 window.parent.frames[1].location = 'webminlog/search.cgi?tall=4&uall=1&fall=1&mall=0&mall=1'
57 print &text('left_login', $remote_user),"<br>\n";
59 if ($gconfig{"notabs_${base_remote_user}"} == 2 ||
60 $gconfig{"notabs_${base_remote_user}"} == 0 && $gconfig{'notabs'} ||
62 # Show all modules in one list
63 foreach $minfo (@modules) {
64 $target = $minfo->{'noframe'} ? "_top" : "right";
65 print "<a target=$target href=$minfo->{'dir'}/>$minfo->{'desc'}</a><br>\n";
69 # Show all modules under categories
71 # Show category opener, plus modules under it
72 &print_category_opener(
74 $in{$c->{'code'}} ? 1 : 0,
76 "<font color=#888888>$c->{'desc'}</font>" :
78 $cls = $in{$c->{'code'}} ? "itemshown" : "itemhidden";
79 print "<div class='$cls' id='$c->{'code'}'>";
80 foreach my $minfo (@{$c->{'modules'}}) {
81 &print_category_link("$minfo->{'dir'}/",
85 $minfo->{'noframe'} ? "_top" : "",
92 # Show module/help search form
93 if (-r "$root_directory/webmin_search.cgi" &&
94 $gaccess{'webminsearch'}) {
95 print "<form action=webmin_search.cgi target=right>\n";
96 print $text{'left_search'}," ";
97 print &ui_textbox("search", undef, 15);
100 print "<div class='leftlink'><hr></div>\n";
102 # Show current module's log search, if logging
103 if ($gconfig{'log'} && &foreign_available("webminlog")) {
104 print "<div class='linkwithicon'><img src=images/logs.gif>\n";
105 print "<div class='aftericon'><a target=right href='webminlog/' onClick='show_logs(); return false;'>$text{'left_logs'}</a></div></div>\n";
109 print "<div class='linkwithicon'><img src=images/gohome.gif>\n";
110 print "<div class='aftericon'><a target=right href='right.cgi?open=system&open=status'>$text{'left_home'}</a></div></div>\n";
112 # Show feedback link, but only if a custom email is set
113 %gaccess = &get_module_acl(undef, "");
114 if (&get_product_name() eq 'webmin' && # For Webmin
115 !$ENV{'ANONYMOUS_USER'} &&
116 $gconfig{'nofeedbackcc'} != 2 &&
117 $gaccess{'feedback'} &&
118 $gconfig{'feedback_to'} ||
119 &get_product_name() eq 'usermin' && # For Usermin
120 !$ENV{'ANONYMOUS_USER'} &&
123 print "<div class='linkwithicon'><img src=images/mail-small.gif>\n";
124 print "<div class='aftericon'><a target=right href='feedback_form.cgi'>$text{'left_feedback'}</a></div></div>\n";
127 # Show refesh modules link, for master admin
128 if (&foreign_available("webmin")) {
129 print "<div class='linkwithicon'><img src=images/refresh-small.gif>\n";
130 print "<div class='aftericon'><a target=right href='webmin/refresh_modules.cgi'>$text{'main_refreshmods'}</a></div></div>\n";
134 &get_miniserv_config(\%miniserv);
135 if ($miniserv{'logout'} && !$ENV{'SSL_USER'} && !$ENV{'LOCAL_USER'} &&
136 $ENV{'HTTP_USER_AGENT'} !~ /webmin/i) {
137 print "<div class='linkwithicon'><img src=images/stock_quit.gif>\n";
138 if ($main::session_id) {
139 print "<div class='aftericon'><a target=_top href='session_login.cgi?logout=1'>$text{'main_logout'}</a></div>";
142 print "<div class='aftericon'><a target=_top href='switch_user.cgi'>$text{'main_switch'}</a></div>";
147 # Show link back to original Webmin server
148 if ($ENV{'HTTP_WEBMIN_SERVERS'}) {
149 print "<div class='linkwithicon'><img src=images/webmin-small.gif>\n";
150 print "<div class='aftericon'><a target=_top href='$ENV{'HTTP_WEBMIN_SERVERS'}'>$text{'header_servers'}</a></div>";
155 # print_category_opener(name, &allcats, label)
156 # Prints out an open/close twistie for some category
157 sub print_category_opener
159 local ($c, $status, $label) = @_;
160 $label = $c eq "others" ? $text{'left_others'} : $label;
161 local $img = $status ? "open.gif" : "closed.gif";
163 # Show link to close or open catgory
164 print "<div class='linkwithicon'>";
165 print "<a href=\"javascript:toggleview('$c','toggle$c')\" id='toggle$c'><img border='0' src='images/$img' alt='[+]'></a>\n";
166 print "<div class='aftericon'><a href=\"javascript:toggleview('$c','toggle$c')\" id='toggle$c'><font color=#000000>$label</font></a></div></div>\n";
170 sub print_category_link
172 local ($link, $label, $image, $noimage, $target) = @_;
174 print "<div class='linkindented'><a target=$target href=$link>$label</a></div>\n";