X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/79d30e2e5cceb8b1136e1e3a340a88322ed7b461..f559ec45ea2fc09c361ef7e4a40a59b1f2133737:/bin/mozilla/menuXML.pl diff --git a/bin/mozilla/menuXML.pl b/bin/mozilla/menuXML.pl new file mode 100644 index 000000000..84fabbb05 --- /dev/null +++ b/bin/mozilla/menuXML.pl @@ -0,0 +1,140 @@ +#===================================================================== +# 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. +####################################################################### +# +# three frame layout with refractured menu +# +# CHANGE LOG: +# DS. 2002-03-25 Created +# 2004-12-14 - New Optik - Marco Welter +# 2007-10-14 - XMLified - Holger Will +####################################################################### + +$menufile = "menu.ini"; +use SL::Menu; + +use CGI::Carp qw(fatalsToBrowser); +use Encode; +1; + +# end of main + +sub display { + print "Content-type: text/xml; charset=iso-8859-1\n\n"; + print qq|\n|; + print qq|\n|; + print qq| +]>|; + print qq||; + print qq||; + print $form->{login}; + print qq||; + print qq||; + print $form->{password}; + print qq||; + print qq||; + print %myconfig->{name}; + print qq||; + print qq||; + print %myconfig->{dbname}; + print qq||; + print qq||; + my $fav=%myconfig->{favorites}; + my @favorites = split(/;/, $fav); + foreach (@favorites) { + print qq||; + } + print qq||; + print qq||; +my $isoencodedmenu=&acc_menu($menu); + print encode("iso-8859-1",$isoencodedmenu ); + + print qq||; + print qq||; + +} + + +sub acc_menu { + $locale = Locale->new($language, "menu"); + + $mainlevel = $form->{level}; + $mainlevel =~ s/$mainlevel--//g; + my $menu = new Menu "$menufile"; + + $| = 1; + + return print_menu($menu); +} + +sub print_menu { + my ($menu, $parent, $depth) = @_; + my $html; + + die if ($depth * 1 > 5); + + my @menuorder; + + @menuorder = $menu->access_control(\%myconfig, $parent); + + $parent .= "--" if ($parent); + + foreach my $item (@menuorder) { + my $menu_item_id = $item; + substr($item, 0, length($parent)) = ""; + next if (($item eq "") || ($item =~ /--/)); + + my $menu_item = $menu->{"${parent}${item}"}; + my $menu_title = $locale->text($item); + my $menu_text = $menu_title; + + my $target = "main_window"; + $target = $menu_item->{"target"} if ($menu_item->{"target"}); + + if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) || + ($menu_item->{"module"} eq "menu.pl")) { + + my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1)."\n"; + if (!$parent) { + $html .= qq|${h}\n|; + } else { + $html .= qq|${h}\n|; + } + } else { + $html .= qq|menuitem_XML(\%myconfig, $form, "${parent}$item", + { "title" => $menu_title, + "target" => $target }); + $html .= qq| name="${menu_text}" id='${menu_item_id}'/>\n|; + } + } + + return $html; +}