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
 
  33 #######################################################################
 
  35 use English qw(-no_match_vars);
 
  36 use List::Util qw(max);
 
  47 #   $form->{force_ul_width} = $ENV{HTTP_USER_AGENT} =~ m/MSIE\s+6\./;
 
  48 #   $form->{force_ul_width} = $ENV{HTTP_USER_AGENT} !~ m/Opera/;
 
  49   $form->{force_ul_width} = 1;
 
  50   $form->{date}           = clock_line();
 
  51   $form->{menu_items}     = acc_menu();
 
  53   print $form->parse_html_template("menu/menunew");
 
  57   my ($Sekunden, $Minuten,   $Stunden,   $Monatstag, $Monat,
 
  58       $Jahr,     $Wochentag, $Jahrestag, $Sommerzeit)
 
  62   $Monat     = $Monat < 10     ? $Monat     = "0" . $Monat     : $Monat;
 
  63   $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
 
  65   my @Wochentage = ("Sonntag",    "Montag",  "Dienstag", "Mittwoch",
 
  66                     "Donnerstag", "Freitag", "Samstag");
 
  67   my @Monatsnamen = ("",       "Januar",    "Februar", "März",
 
  68                      "April",  "Mai",       "Juni",    "Juli",
 
  69                      "August", "September", "Oktober", "November",
 
  72       $Wochentage[$Wochentag] . ", der "
 
  79   $locale = Locale->new($language, "menu");
 
  81   my $mainlevel =  $form->{level};
 
  82   $mainlevel    =~ s/\Q$mainlevel\E--//g;
 
  83   my $menu      = Menu->new('menu.ini');
 
  88   create_menu($menu, $all_items);
 
  90   my $item = { 'subitems' => $all_items };
 
  91   calculate_width($item);
 
  99   $item->{max_width} = max map { length $_->{title} } @{ $item->{subitems} };
 
 101   foreach my $subitem (@{ $item->{subitems} }) {
 
 102     calculate_width($subitem) if ($subitem->{subitems});
 
 107   my ($menu, $all_items, $parent, $depth) = @_;
 
 110   die if ($depth * 1 > 5);
 
 112   my @menuorder  = $menu->access_control(\%myconfig, $parent);
 
 113   $parent       .= "--" if ($parent);
 
 115   foreach my $name (@menuorder) {
 
 116     substr($name, 0, length($parent), "");
 
 117     next if (($name eq "") || ($name =~ /--/));
 
 119     my $menu_item = $menu->{"${parent}${name}"};
 
 120     my $item      = { 'title' => $locale->text($name) };
 
 121     push @{ $all_items }, $item;
 
 123     if ($menu_item->{submenu} || !defined($menu_item->{module}) || ($menu_item->{module} eq "menu.pl")) {
 
 124       $item->{subitems} = [];
 
 125       create_menu($menu, $item->{subitems}, "${parent}${name}", $depth * 1 + 1);
 
 128       $menu->menuitem_new("${parent}${name}", $item);