1 #=====================================================================
2 # SQL-Ledger Accounting
5 # Author: Dieter Simader
6 # Email: dsimader@sql-ledger.org
7 # Web: http://www.sql-ledger.org
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #=====================================================================
25 # routines for menu items
27 #=====================================================================
33 my ($type, $menufile, $level) = @_;
36 my $self = Inifile->new($menufile, $level);
38 bless $self, $type if $self;
44 my ($self, $myconfig, $form, $item, $level) = @_;
46 my $module = $form->{script};
47 my $action = "section_menu";
50 if ($self->{$item}{module}) {
51 $module = $self->{$item}{module};
53 if ($self->{$item}{action}) {
54 $action = $self->{$item}{action};
56 if ($self->{$item}{target}) {
57 $target = $self->{$item}{target};
60 $level = $form->escape($item);
61 my $str = qq|<a href=$module?path=$form->{path}&action=$action&level=$level&login=$form->{login}&timeout=$form->{timeout}&sessionid=$form->{sessionid}|;
63 my @vars = qw(module action target href);
65 if ($self->{$item}{href}) {
66 $str = qq|<a href=$self->{$item}{href}|;
67 @vars = qw(module target href);
70 map { delete $self->{$item}{$_} } @vars;
72 delete $self->{$item}{submenu};
75 foreach my $key (keys %{ $self->{$item} }) {
76 $str .= "&".$form->escape($key)."=";
77 ($value, $conf) = split /=/, $self->{$item}{$key}, 2;
78 $value = $myconfig->{$value}."/$conf" if ($conf);
79 $str .= $form->escape($value);
82 $str .= qq|#id$form->{tag}| if $target eq 'acc_menu';
85 $str .= qq| target=$target|;
94 my ($self, $myconfig, $menulevel) = @_;
98 if ($menulevel eq "") {
99 @menu = grep { !/--/ } @{ $self->{ORDER} };
101 @menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} };
104 my @a = split /;/, $myconfig->{acs};
107 # remove --AR, --AP from array
108 grep { ($a, $b) = split /--/; s/--$a$//; } @a;
110 map { $excl{$_} = 1 } @a;
113 map { push @a, $_ unless $excl{$_} } (@menu);