kivitendo/bin/mozilla/menu.pl @ 4012cbd7
d319704a | Moritz Bunkus | #=====================================================================
|
||
# LX-Office ERP
|
||||
# Copyright (C) 2004
|
||||
# Based on SQL-Ledger Version 2.1.9
|
||||
# Web http://www.lx-office.org
|
||||
#
|
||||
######################################################################
|
||||
# SQL-Ledger Accounting
|
||||
# Copyright (c) 1998-2002
|
||||
#
|
||||
# Author: Dieter Simader
|
||||
# Email: dsimader@sql-ledger.org
|
||||
# Web: http://www.sql-ledger.org
|
||||
#
|
||||
# Contributors: Christopher Browne
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#######################################################################
|
||||
#
|
||||
# thre frame layout with refractured menu
|
||||
#
|
||||
# CHANGE LOG:
|
||||
# DS. 2002-03-25 Created
|
||||
# 2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de>
|
||||
#######################################################################
|
||||
9f4b866c | Sven Schöling | my $menufile = "menu.ini";
|
||
d319704a | Moritz Bunkus | use SL::Menu;
|
||
54e4131e | Moritz Bunkus | use Data::Dumper;
|
||
f2078516 | Sven Schöling | use URI;
|
||
d319704a | Moritz Bunkus | |||
9f4b866c | Sven Schöling | use strict;
|
||
4012cbd7 | Holger Lindemann | my $framesize;
|
||
9f4b866c | Sven Schöling | my $mainlevel;
|
||
4012cbd7 | Holger Lindemann | #my $framesize = ($ENV{HTTP_USER_AGENT} =~ /mobile/i) ? "130" : "190";
|
||
if ($ENV{HTTP_USER_AGENT} =~ /mobile/i) {
|
||||
$framesize = "130";
|
||||
} elsif ($ENV{HTTP_USER_AGENT} =~ /links/i) {
|
||||
$framesize = "240";
|
||||
} else {
|
||||
$framesize = "190";
|
||||
}
|
||||
d319704a | Moritz Bunkus | 1;
|
||
# end of main
|
||||
sub display {
|
||||
9f4b866c | Sven Schöling | $main::lxdebug->enter_sub();
|
||
my $form = $main::form;
|
||||
d319704a | Moritz Bunkus | |||
f2078516 | Sven Schöling | my $callback = $form->unescape($form->{callback});
|
||
$callback = URI->new($callback)->rel($callback) if $callback;
|
||||
31b977d6 | Sven Schöling | $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
|
||
40255f36 | Sven Schöling | |||
d319704a | Moritz Bunkus | $form->header;
|
||
print qq|
|
||||
54e4131e | Moritz Bunkus | <frameset rows="28px,*" cols="*" framespacing="0" frameborder="0">
|
||
8c7e4493 | Moritz Bunkus | <frame src="kopf.pl" name="kopf" scrolling="NO">
|
||
d319704a | Moritz Bunkus | <frameset cols="$framesize,*" framespacing="0" frameborder="0" border="0" >
|
||
8c7e4493 | Moritz Bunkus | <frame src="$form->{script}?action=acc_menu" name="acc_menu" scrolling="auto" noresize marginwidth="0">
|
||
f2078516 | Sven Schöling | <frame src="$callback" name="main_window" scrolling="auto">
|
||
d319704a | Moritz Bunkus | </frameset>
|
||
<noframes>
|
||||
You need a browser that can read frames to see this page.
|
||||
</noframes>
|
||||
</frameset>
|
||||
</HTML>
|
||||
|;
|
||||
9f4b866c | Sven Schöling | $main::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
sub acc_menu {
|
||||
9f4b866c | Sven Schöling | $main::lxdebug->enter_sub();
|
||
my $form = $main::form;
|
||||
my $locale = $main::locale;
|
||||
d319704a | Moritz Bunkus | $mainlevel = $form->{level};
|
||
5cf977e5 | Moritz Bunkus | $mainlevel =~ s/\Q$mainlevel\E--//g;
|
||
d319704a | Moritz Bunkus | my $menu = new Menu "$menufile";
|
||
$form->{title} = $locale->text('Accounting Menu');
|
||||
$form->header;
|
||||
print qq|
|
||||
<body class="menu">
|
||||
|;
|
||||
print qq|<div align="left">\n<table width="|
|
||||
. $framesize
|
||||
. qq|" border=0>\n|;
|
||||
§ion_menu($menu);
|
||||
print qq|</table></div>|;
|
||||
print qq|
|
||||
</body>
|
||||
</html>
|
||||
|;
|
||||
9f4b866c | Sven Schöling | $main::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
sub section_menu {
|
||||
9f4b866c | Sven Schöling | $main::lxdebug->enter_sub();
|
||
d319704a | Moritz Bunkus | my ($menu, $level) = @_;
|
||
9f4b866c | Sven Schöling | my $form = $main::form;
|
||
my %myconfig = %main::myconfig;
|
||||
my $locale = $main::locale;
|
||||
my $zeige;
|
||||
d319704a | Moritz Bunkus | # build tiered menus
|
||
my @menuorder = $menu->access_control(\%myconfig, $level);
|
||||
while (@menuorder) {
|
||||
9f4b866c | Sven Schöling | my $item = shift @menuorder;
|
||
my $label = $item;
|
||||
my $ml = $item;
|
||||
5cf977e5 | Moritz Bunkus | $label =~ s/\Q$level\E--//g;
|
||
d319704a | Moritz Bunkus | $ml =~ s/--.*//;
|
||
if ($ml eq $mainlevel) { $zeige = 1; }
|
||||
else { $zeige = 0; }
|
||||
my $spacer = " " x (($item =~ s/--/--/g) * 1);
|
||||
$label =~ s/.*--//g;
|
||||
9f4b866c | Sven Schöling | my $label_icon = $label . ".gif";
|
||
my $mlab = $label;
|
||||
d319704a | Moritz Bunkus | $label = $locale->text($label);
|
||
40255f36 | Sven Schöling | |||
54e4131e | Moritz Bunkus | # multi line hack, sschoeling jul06
|
||
40255f36 | Sven Schöling | # if a label is too long, try to split it at whitespaces, then join it to chunks of less
|
||
54e4131e | Moritz Bunkus | # than 20 chars and store it in an array.
|
||
# use this array later instead of the -ed label
|
||||
9f4b866c | Sven Schöling | my @chunks = ();
|
||
d0810c42 | Sven Schöling | my ($i,$l) = (-1, 20);
|
||
54e4131e | Moritz Bunkus | map {
|
||
d0810c42 | Sven Schöling | if (($l += length $_) < 20) {
|
||
$chunks[$i] .= " $_";
|
||||
40255f36 | Sven Schöling | } else {
|
||
$l = length $_;
|
||||
$chunks[++$i] = $_;
|
||||
d0810c42 | Sven Schöling | }
|
||
54e4131e | Moritz Bunkus | } split / /, $label;
|
||
d0810c42 | Sven Schöling | map { s/ / / } @chunks;
|
||
54e4131e | Moritz Bunkus | # end multi line
|
||
d319704a | Moritz Bunkus | $label =~ s/ / /g;
|
||
$menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
|
||||
if ($menu->{$item}{submenu}) {
|
||||
$menu->{$item}{$item} = !$form->{$item};
|
||||
5cf977e5 | Moritz Bunkus | if ($form->{level} && $item =~ /^\Q$form->{level}\E/) {
|
||
d319704a | Moritz Bunkus | |||
# expand menu
|
||||
if ($zeige) {
|
||||
print
|
||||
20310b7f | Sven Schöling | qq|<tr><td style='vertical-align:bottom'><b>$spacer<img src="image/unterpunkt.png">$label</b></td></tr>\n|;
|
||
d319704a | Moritz Bunkus | }
|
||
# remove same level items
|
||||
map { shift @menuorder } grep /^$item/, @menuorder;
|
||||
§ion_menu($menu, $item);
|
||||
} else {
|
||||
if ($zeige) {
|
||||
print qq|<tr><td>|
|
||||
. $menu->menuitem(\%myconfig, \%$form, $item, $level)
|
||||
. qq|$label ...</a></td></tr>\n|;
|
||||
}
|
||||
# remove same level items
|
||||
map { shift @menuorder } grep /^$item/, @menuorder;
|
||||
}
|
||||
} else {
|
||||
if ($menu->{$item}{module}) {
|
||||
if ($form->{$item} && $form->{level} eq $item) {
|
||||
$menu->{$item}{$item} = !$form->{$item};
|
||||
if ($zeige) {
|
||||
print
|
||||
qq|<tr><td valign=bottom>$spacer<img src="image/unterpunkt.png">|
|
||||
. $menu->menuitem(\%myconfig, \%$form, $item, $level)
|
||||
. qq|$label</a></td></tr>\n|;
|
||||
}
|
||||
# remove same level items
|
||||
map { shift @menuorder } grep /^$item/, @menuorder;
|
||||
§ion_menu($menu, $item);
|
||||
} else {
|
||||
if ($zeige) {
|
||||
54e4131e | Moritz Bunkus | if (scalar @chunks <= 1) {
|
||
print
|
||||
qq|<tr><td class="hover" height="13" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">|
|
||||
. $menu->menuitem(\%myconfig, \%$form, $item, $level)
|
||||
. qq|$label</a></td></tr>\n|;
|
||||
} else {
|
||||
my $tmpitem = $menu->menuitem(\%myconfig, \%$form, $item, $level);
|
||||
print
|
||||
qq|<tr><td class="hover" height="13" >$spacer<img src="image/unterpunkt.png" style="vertical-align:text-top">|
|
||||
. $tmpitem
|
||||
. qq|$chunks[0]</a></td></tr>\n|;
|
||||
map {
|
||||
print
|
||||
qq|<tr style="vertical-align:top""><td class="hover">$spacer<img src="image/unterpunkt.png" style="visibility:hidden; width:23; height=2;">|
|
||||
. $tmpitem
|
||||
. qq|$chunks[$_]</a></td></tr>\n|;
|
||||
} 1..$#chunks;
|
||||
}
|
||||
d319704a | Moritz Bunkus | }
|
||
}
|
||||
} else {
|
||||
my $ml_ = $form->escape($ml);
|
||||
print
|
||||
8c7e4493 | Moritz Bunkus | 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|;
|
||
d319704a | Moritz Bunkus | §ion_menu($menu, $item);
|
||
#print qq|<br>\n|;
|
||||
}
|
||||
}
|
||||
}
|
||||
9f4b866c | Sven Schöling | $main::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|