X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FMenu.pm;h=89a6ffd15e06cb1b16b94388e40ccb40186c5bfb;hb=7783c24d2a5f3f7413dc18d5b96b8a98995ac7da;hp=5da42e64a06443e3932c839a1aaa02bb2d04875f;hpb=54e4131e091831e00a861fe2c4f53e344b87ddca;p=kivitendo-erp.git
diff --git a/SL/Menu.pm b/SL/Menu.pm
index 5da42e64a..89a6ffd15 100644
--- a/SL/Menu.pm
+++ b/SL/Menu.pm
@@ -34,13 +34,17 @@
package Menu;
+use SL::Inifile;
+
sub new {
$main::lxdebug->enter_sub();
- my ($type, $menufile, $level) = @_;
+ my ($type, $menufile) = @_;
+
+ my $self = {};
+ my $inifile = Inifile->new($menufile);
- use SL::Inifile;
- my $self = Inifile->new($menufile, $level);
+ map { $self->{$_} = $inifile->{$_} } keys %{ $inifile };
$main::lxdebug->leave_sub();
@@ -69,7 +73,7 @@ sub menuitem {
my $level = $form->escape($item);
my $str =
- qq|{path}&action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
+ qq|{login}&password=$form->{password}|;
my @vars = qw(module action target href);
@@ -83,7 +87,7 @@ sub menuitem {
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
- ($value, $conf) = split /=/, $self->{$item}{$key}, 2;
+ ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
@@ -99,6 +103,67 @@ sub menuitem {
return $str;
}
+sub menuitem_v3 {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $item, $other) = @_;
+
+ my $module = $form->{script};
+ my $action = "section_menu";
+ my $target = "";
+
+ if ($self->{$item}{module}) {
+ $module = $self->{$item}{module};
+ }
+ if ($self->{$item}{action}) {
+ $action = $self->{$item}{action};
+ }
+ if ($self->{$item}{target}) {
+ $target = $self->{$item}{target};
+ }
+
+ my $level = $form->escape($item);
+
+ my $str = qq|escape($form->{$_}); } qw(login password));
+
+ my @vars = qw(module action target href);
+
+ if ($self->{$item}{href}) {
+ $str = qq|{$item}{href}|;
+ @vars = qw(module target href);
+ }
+
+ map { delete $self->{$item}{$_} } @vars;
+
+ # add other params
+ foreach my $key (keys %{ $self->{$item} }) {
+ $str .= "&" . $form->escape($key, 1) . "=";
+ ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
+ $value = $myconfig->{$value} . "/$conf" if ($conf);
+ $str .= $form->escape($value, 1);
+ }
+
+ $str .= '"';
+
+ if ($target) {
+ $str .= qq| target="| . $form->quote($target) . qq|"|;
+ }
+
+ if ($other) {
+ foreach my $key (keys(%{$other})) {
+ $str .= qq| ${key}="| . $form->quote($other->{$key}) . qq|"|;
+ }
+ }
+
+ $str .= ">";
+
+ $main::lxdebug->leave_sub();
+
+ return $str;
+}
+
sub menuitemNew {
my ($self, $myconfig, $form, $item) = @_;
@@ -115,7 +180,7 @@ sub menuitemNew {
my $level = $form->escape($item);
my $str =
- qq|$module?path=$form->{path}&action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
+ qq|$module?action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
my @vars = qw(module action target href);
if ($self->{$item}{href}) {
@@ -128,7 +193,7 @@ sub menuitemNew {
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
- ($value, $conf) = split /=/, $self->{$item}{$key}, 2;
+ ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
@@ -150,11 +215,11 @@ sub access_control {
@menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} };
}
- my @a = split /;/, $myconfig->{acs};
+ my @a = split(/;/, $myconfig->{acs});
my $excl = ();
# remove --AR, --AP from array
- grep { ($a, $b) = split /--/; s/--$a$//; } @a;
+ grep { ($a, $b) = split(/--/); s/--$a$//; } @a;
map { $excl{$_} = 1 } @a;