1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 ######################################################################
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
15 # Contributors: Christopher Browne
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2 of the License, or
20 # (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #######################################################################
31 # the frame layout with refractured menu
34 # DS. 2002-03-25 Created
35 # 2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de>
36 # 2010-08-19 - Icons for sub entries and one click
37 # JS switchable HTML-menu - Sven Donath <lxo@dexo.de>
38 #######################################################################
46 my $menufile = "menu.ini";
52 $main::lxdebug->enter_sub();
54 my $form = $main::form;
56 my $callback = $form->unescape($form->{callback});
57 $callback = URI->new($callback)->rel($callback) if $callback;
58 $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
59 my $framesize = _calc_framesize();
64 <frameset rows="28px,*" cols="*" framespacing="0" frameborder="0">
65 <frame src="kopf.pl" name="kopf" scrolling="NO">
66 <frameset cols="$framesize,*" framespacing="0" frameborder="0" border="0" id="menuframe" name="menuframe">
67 <frame src="$form->{script}?action=acc_menu" name="acc_menu" scrolling="auto" noresize marginwidth="0">
68 <frame src="$callback" name="main_window" scrolling="auto">
71 You need a browser that can read frames to see this page.
77 $main::lxdebug->leave_sub();
81 $main::lxdebug->enter_sub();
83 my $form = $main::form;
84 my $locale = $main::locale;
85 my $framesize = _calc_framesize(); # how to get it into kopf.pl or vice versa?
87 $mainlevel = $form->{level};
88 $mainlevel =~ s/\Q$mainlevel\E--//g;
89 my $menu = Menu->new($::menufile);
91 $form->{title} = $locale->text('Lx-Office');
99 print qq|<div align="left">\n<table width="|
101 . qq|" border="0">\n|;
103 §ion_menu($menu);
105 print qq|</table></div>|;
111 $main::lxdebug->leave_sub();
115 $main::lxdebug->enter_sub();
116 my ($menu, $level) = @_;
118 my $form = $main::form;
119 my %myconfig = %main::myconfig;
120 my $locale = $main::locale;
125 my @menuorder = $menu->access_control(\%myconfig, $level);
127 my $item = shift @menuorder;
130 $label =~ s/\Q$level\E--//g;
132 if ($ml eq $mainlevel) { $zeige = 1; }
134 my $spacer = " " x (($item =~ s/--/--/g) * 2);
136 my $label_icon = $level . "--" . $label . ".png";
138 $label = $locale->text($label);
140 # multi line hack, sschoeling jul06
141 # if a label is too long, try to split it at whitespaces, then join it to chunks of less
142 # than 20 chars and store it in an array.
143 # use this array later instead of the -ed label
145 my ($i,$l) = (-1, 20);
147 if (($l += length $_) < 20) {
148 $chunks[$i] .= " $_";
155 map { s/ / / } @chunks;
158 $label =~ s/ / /g;
159 $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
161 if ($menu->{$item}{submenu}) {
162 $menu->{$item}{$item} = !$form->{$item};
163 if ($form->{level} && $item =~ /^\Q$form->{level}\E/) {
168 qq|<tr><td style='vertical-align:bottom'><b>$spacer<img src="image/unterpunkt.png">$label</b></td></tr>\n|;
171 # remove same level items
172 map { shift @menuorder } grep /^$item/, @menuorder;
173 §ion_menu($menu, $item);
177 . $menu->menuitem(\%myconfig, \%$form, $item, $level)
178 . qq|$label ...</a></td></tr>\n|;
181 # remove same level items
182 map { shift @menuorder } grep /^$item/, @menuorder;
185 if ($menu->{$item}{module}) {
186 if ($form->{$item} && $form->{level} eq $item) {
187 $menu->{$item}{$item} = !$form->{$item};
190 qq|<tr><td valign=bottom>$spacer<img src="image/unterpunkt.png">|
191 . $menu->menuitem(\%myconfig, \%$form, $item, $level)
192 . qq|$label</a></td></tr>\n|;
195 # remove same level items
196 map { shift @menuorder } grep /^$item/, @menuorder;
197 §ion_menu($menu, $item);
200 if (scalar @chunks <= 1) {
202 qq|<tr><td class="hover" height="16" >$spacer|
203 . $menu->menuitem(\%myconfig, \%$form, $item, $level) ;
205 if (-f "image/icons/16x16/$label_icon")
207 qq|<img src="image/icons/16x16/$label_icon" border="0" style="vertical-align:text-top" title="|
208 . $locale->text($item)
209 . qq|"> | }
211 print qq|<img src="image/unterpunkt.png" border="0" style="vertical-align:text-top">|;
215 qq|$label</a></td></tr>\n|;
217 my $tmpitem = $menu->menuitem(\%myconfig, \%$form, $item, $level);
219 qq|<tr><td class="hover" height="16" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">|
221 . qq|$chunks[0]</a></td></tr>\n|;
224 qq|<tr style="vertical-align:top""><td class="hover">$spacer<img src="image/unterpunkt.png" style="visibility:hidden; width:24; height=2;">|
226 . qq|$chunks[$_]</a></td></tr>\n|;
232 my $ml_ = $form->escape($ml);
234 qq|<tr><td class="bg" height="24" align="left" valign="middle"><a href="menu.pl?action=acc_menu&level=$ml_" class="nohover""><img src="image/icons/24x24/$item.png" border="0" style="vertical-align:middle" title="| . $locale->text("Help Menu $item") . qq|"> $label</a> </td></tr>\n|;
235 §ion_menu($menu, $item);
241 $main::lxdebug->leave_sub();
244 sub _calc_framesize {
245 my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
246 my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
247 my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
249 return $is_mobile_browser && $is_mobile_style ? 130
250 : $is_lynx_browser ? 240