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 $menufile = "menu.ini";
42 use CGI::Carp qw(fatalsToBrowser);
49 print $form->create_http_response('content_type' => 'text/xml',
50 'charset' => 'iso-8859-1');
51 print qq|<?xml version="1.0" encoding="iso-8859-1"?>\n|;
52 print qq|<?xml-stylesheet href="xslt/xulmenu.xsl" type="text/xsl"?>\n|;
53 print qq|<!DOCTYPE doc [
61 print %myconfig->{name};
64 print %myconfig->{dbname};
66 print qq|<favorites>|;
67 my $fav=%myconfig->{favorites};
68 my @favorites = split(/;/, $fav);
69 foreach (@favorites) {
70 print qq|<link name="$_"/>|;
72 print qq|</favorites>|;
74 my $isoencodedmenu=&acc_menu($menu);
75 print encode("iso-8859-1",$isoencodedmenu );
84 $locale = Locale->new($language, "menu");
86 $mainlevel = $form->{level};
87 $mainlevel =~ s/$mainlevel--//g;
88 my $menu = new Menu "$menufile";
92 return print_menu($menu);
96 my ($menu, $parent, $depth) = @_;
99 die if ($depth * 1 > 5);
103 @menuorder = $menu->access_control(\%myconfig, $parent);
105 $parent .= "--" if ($parent);
107 foreach my $item (@menuorder) {
108 my $menu_item_id = $item;
109 substr($item, 0, length($parent)) = "";
110 next if (($item eq "") || ($item =~ /--/));
112 my $menu_item = $menu->{"${parent}${item}"};
113 my $menu_title = $locale->text($item);
114 my $menu_text = $menu_title;
116 my $target = "main_window";
117 $target = $menu_item->{"target"} if ($menu_item->{"target"});
119 if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) ||
120 ($menu_item->{"module"} eq "menu.pl")) {
122 my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1)."\n";
124 $html .= qq|<item name='${menu_text}' id='${menu_item_id}'>${h}</item>\n|;
126 $html .= qq|<item name='${menu_text}' id='${menu_item_id}'>${h}</item>\n|;
130 $html .= $menu->menuitem_XML(\%myconfig, $form, "${parent}$item",
131 { "title" => $menu_title,
132 "target" => $target });
133 $html .= qq| name="${menu_text}" id='${menu_item_id}'/>\n|;