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);
44 my ($self, $myconfig, $form, $item) = @_;
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 my $level = $form->escape($item);
61 my $str = qq|<a href=$module?path=$form->{path}&action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
62 my @vars = qw(module action target href);
64 if ($self->{$item}{href}) {
65 $str = qq|<a href=$self->{$item}{href}|;
66 @vars = qw(module target href);
69 map { delete $self->{$item}{$_} } @vars;
73 foreach my $key (keys %{ $self->{$item} }) {
74 $str .= "&".$form->escape($key,1)."=";
75 ($value, $conf) = split /=/, $self->{$item}{$key}, 2;
76 $value = $myconfig->{$value}."/$conf" if ($conf);
77 $str .= $form->escape($value, 1);
81 $str .= qq| target=$target|;
90 my ($self, $myconfig, $menulevel) = @_;
94 if ($menulevel eq "") {
95 @menu = grep { !/--/ } @{ $self->{ORDER} };
97 @menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} };
100 my @a = split /;/, $myconfig->{acs};
103 # remove --AR, --AP from array
104 grep { ($a, $b) = split /--/; s/--$a$//; } @a;
106 map { $excl{$_} = 1 } @a;
109 map { push @a, $_ unless $excl{$_} } (@menu);