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 # three frame layout with refractured menu
34 # DS. 2002-03-25 Created
35 # 2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de>
36 # 2007-10-14 - XMLified - Holger Will <holger@treebuilder.de>
37 #######################################################################
39 my $menufile = "menu.ini";
42 use CGI::Carp qw(fatalsToBrowser);
53 my $form = $main::form;
54 my %myconfig = %main::myconfig;
56 my $charset = $main::dbcharset || 'ISO-8859-1';
57 my $callback = $form->unescape($form->{callback});
58 $callback = URI->new($callback)->rel($callback) if $callback;
59 $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
61 my $text = $form->create_http_response('content_type' => 'text/xml',
62 'charset' => $charset)
63 . qq|<?xml version="1.0" encoding="${charset}"?>
64 <?xml-stylesheet href="xslt/xulmenu.xsl" type="text/xsl"?>
66 <!ENTITY szlig "| . $::locale->{iconv_iso8859}->convert('ß') . qq|">
67 <!ENTITY auml "| . $::locale->{iconv_iso8859}->convert('ä') . qq|">
68 <!ENTITY ouml "| . $::locale->{iconv_iso8859}->convert('ö') . qq|">
69 <!ENTITY uuml "| . $::locale->{iconv_iso8859}->convert('ü') . qq|">
73 <name>$myconfig{name}</name>
74 <version>$form->{version}</version>
75 <callback>$callback</callback>
76 <db>$myconfig{dbname}</db>
80 my $fav = $myconfig{favorites};
81 my @favorites = split m/;/, $fav;
82 foreach (@favorites) {
83 $text .= qq|<link name="$_"/>|;
86 $text .= qq|</favorites>\n|
97 my $form = $main::form;
99 my $mainlevel = $form->{level};
100 $mainlevel =~ s/$mainlevel--//g;
101 my $menu = new Menu "$menufile";
105 return print_menu($menu);
109 my ($menu, $parent, $depth) = @_;
112 my $form = $main::form;
113 my %myconfig = %main::myconfig;
115 die if ($depth * 1 > 5);
119 @menuorder = $menu->access_control(\%myconfig, $parent);
121 $parent .= "--" if ($parent);
123 foreach my $item (@menuorder) {
124 my $menu_item_id = $item;
125 substr($item, 0, length($parent)) = "";
126 next if (($item eq "") || ($item =~ /--/));
128 my $menu_item = $menu->{"${parent}${item}"};
129 my $menu_title = $::locale->text($item);
130 my $menu_text = $menu_title;
132 my $target = "main_window";
133 $target = $menu_item->{"target"} if ($menu_item->{"target"});
135 if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) ||
136 ($menu_item->{"module"} eq "menu.pl")) {
138 my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1)."\n";
140 $html .= qq|<item name='${menu_text}' id='${menu_item_id}'>${h}</item>\n|;
142 $html .= qq|<item name='${menu_text}' id='${menu_item_id}'>${h}</item>\n|;
146 $html .= $menu->menuitem_XML(\%myconfig, $form, "${parent}$item",
147 { "title" => $menu_title,
148 "target" => $target });
149 $html .= qq| name="${menu_text}" id='${menu_item_id}'/>\n|;