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 # thre frame layout with refractured menu
34 # DS. 2002-03-25 Created
35 # 2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de>
36 #######################################################################
44 my $menufile = "menu.ini";
50 $main::lxdebug->enter_sub();
52 my $form = $main::form;
54 my $callback = $form->unescape($form->{callback});
55 $callback = URI->new($callback)->rel($callback) if $callback;
56 $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
57 my $framesize = _calc_framesize();
62 <frameset rows="28px,*" cols="*" framespacing="0" frameborder="0">
63 <frame src="kopf.pl" name="kopf" scrolling="NO">
64 <frameset cols="$framesize,*" framespacing="0" frameborder="0" border="0" >
65 <frame src="$form->{script}?action=acc_menu" name="acc_menu" scrolling="auto" noresize marginwidth="0">
66 <frame src="$callback" name="main_window" scrolling="auto">
69 You need a browser that can read frames to see this page.
75 $main::lxdebug->leave_sub();
79 $main::lxdebug->enter_sub();
81 my $form = $main::form;
82 my $locale = $main::locale;
83 my $framesize = _calc_framesize();
85 $mainlevel = $form->{level};
86 $mainlevel =~ s/\Q$mainlevel\E--//g;
87 my $menu = Menu->new($::menufile);
89 $form->{title} = $locale->text('Accounting Menu');
97 print qq|<div align="left">\n<table width="|
101 §ion_menu($menu);
103 print qq|</table></div>|;
109 $main::lxdebug->leave_sub();
113 $main::lxdebug->enter_sub();
114 my ($menu, $level) = @_;
116 my $form = $main::form;
117 my %myconfig = %main::myconfig;
118 my $locale = $main::locale;
123 my @menuorder = $menu->access_control(\%myconfig, $level);
125 my $item = shift @menuorder;
128 $label =~ s/\Q$level\E--//g;
130 if ($ml eq $mainlevel) { $zeige = 1; }
132 my $spacer = " " x (($item =~ s/--/--/g) * 1);
134 my $label_icon = $label . ".gif";
136 $label = $locale->text($label);
138 # multi line hack, sschoeling jul06
139 # if a label is too long, try to split it at whitespaces, then join it to chunks of less
140 # than 20 chars and store it in an array.
141 # use this array later instead of the -ed label
143 my ($i,$l) = (-1, 20);
145 if (($l += length $_) < 20) {
146 $chunks[$i] .= " $_";
153 map { s/ / / } @chunks;
156 $label =~ s/ / /g;
157 $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
159 if ($menu->{$item}{submenu}) {
160 $menu->{$item}{$item} = !$form->{$item};
161 if ($form->{level} && $item =~ /^\Q$form->{level}\E/) {
166 qq|<tr><td style='vertical-align:bottom'><b>$spacer<img src="image/unterpunkt.png">$label</b></td></tr>\n|;
169 # remove same level items
170 map { shift @menuorder } grep /^$item/, @menuorder;
171 §ion_menu($menu, $item);
175 . $menu->menuitem(\%myconfig, \%$form, $item, $level)
176 . qq|$label ...</a></td></tr>\n|;
179 # remove same level items
180 map { shift @menuorder } grep /^$item/, @menuorder;
183 if ($menu->{$item}{module}) {
184 if ($form->{$item} && $form->{level} eq $item) {
185 $menu->{$item}{$item} = !$form->{$item};
188 qq|<tr><td valign=bottom>$spacer<img src="image/unterpunkt.png">|
189 . $menu->menuitem(\%myconfig, \%$form, $item, $level)
190 . qq|$label</a></td></tr>\n|;
193 # remove same level items
194 map { shift @menuorder } grep /^$item/, @menuorder;
195 §ion_menu($menu, $item);
198 if (scalar @chunks <= 1) {
200 qq|<tr><td class="hover" height="13" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">|
201 . $menu->menuitem(\%myconfig, \%$form, $item, $level)
202 . qq|$label</a></td></tr>\n|;
204 my $tmpitem = $menu->menuitem(\%myconfig, \%$form, $item, $level);
206 qq|<tr><td class="hover" height="13" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">|
208 . qq|$chunks[0]</a></td></tr>\n|;
211 qq|<tr style="vertical-align:top""><td class="hover">$spacer<img src="image/unterpunkt.png" style="visibility:hidden; width:23; height=2;">|
213 . qq|$chunks[$_]</a></td></tr>\n|;
219 my $ml_ = $form->escape($ml);
221 qq|<tr><td class="bg" height="22" align="left" valign="middle" ><img src="image/$item.png" style="vertical-align:middle"> <a href="menu.pl?action=acc_menu&level=$ml_" class="nohover">$label</a> </td></tr>\n|;
222 §ion_menu($menu, $item);
228 $main::lxdebug->leave_sub();
231 sub _calc_framesize {
232 my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
233 my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
234 my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
236 return $is_mobile_browser && $is_mobile_style ? 130
237 : $is_lynx_browser ? 240