projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kivitendo rebranding: title strings
[kivitendo-erp.git]
/
SL
/
Menu.pm
diff --git
a/SL/Menu.pm
b/SL/Menu.pm
index
26e3512
..
ab35fed
100644
(file)
--- a/
SL/Menu.pm
+++ b/
SL/Menu.pm
@@
-37,6
+37,8
@@
package Menu;
use SL::Auth;
use SL::Inifile;
use SL::Auth;
use SL::Inifile;
+use strict;
+
sub new {
$main::lxdebug->enter_sub();
sub new {
$main::lxdebug->enter_sub();
@@
-61,46
+63,35
@@
sub menuitem {
my ($self, $myconfig, $form, $item) = @_;
my ($self, $myconfig, $form, $item) = @_;
- my $module = $form->{script};
- my $action = "section_menu";
- my $target = "";
+ my $module = $
self->{$item}{module} || $
form->{script};
+ my $action =
$self->{$item}{action} ||
"section_menu";
+ my $target =
$self->{$item}{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 $level = $form->escape($item);
+ my $style = 'style="vertical-align:top"';
+ my $target_token = ($target)
+ ? "target='$target'" : '';
- my $str = qq|<a style="vertical-align:top" href=$module?action=$action&level=$level|;
+ my $href = ($self->{$item}{href})
+ ? $form->escape($self->{$item}{href})
+ : "$module?action=$action&level=$level";
- my @vars = qw(module action target href);
+ my @vars = ($self->{$item}{href})
+ ? qw(module target href)
+ : qw(module action target href);
- if ($self->{$item}{href}) {
- $str = qq|<a href=$self->{$item}{href}|;
- @vars = qw(module target href);
- }
-
- map { delete $self->{$item}{$_} } @vars;
+# map { delete $self->{$item}{$_} } @vars;
# add other params
foreach my $key (keys %{ $self->{$item} }) {
# add other params
foreach my $key (keys %{ $self->{$item} }) {
- $
str .= "&
" . $form->escape($key, 1) . "=";
- ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
+ $
href .= "&
" . $form->escape($key, 1) . "=";
+
my
($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
$value = $myconfig->{$value} . "/$conf" if ($conf);
$value = $myconfig->{$value} . "/$conf" if ($conf);
- $
str
.= $form->escape($value, 1);
+ $
href
.= $form->escape($value, 1);
}
}
- if ($target) {
- $str .= qq| target=$target|;
- }
-
- $str .= ">";
+ my $str = "<a href='$href' $target_token $style>";
$main::lxdebug->leave_sub();
$main::lxdebug->leave_sub();
@@
-135,7
+126,7
@@
sub menuitem_js {
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
- ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
+
my
($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
@@
-149,7
+140,8
@@
sub menuitem_new {
my ($self, $name, $item) = @_;
my ($self, $name, $item) = @_;
- my $form = $main::form;
+ my $form = $main::form;
+ my $myconfig = \%main::myconfig;
my $module = $self->{$name}->{module} || $form->{script};
my $action = $self->{$name}->{action};
my $module = $self->{$name}->{module} || $form->{script};
my $action = $self->{$name}->{action};
@@
-207,7
+199,7
@@
sub menuitem_v3 {
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
- ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
+
my
($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
@@
-267,7
+259,7
@@
sub menuitem_XML {
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
# add other params
foreach my $key (keys %{ $self->{$item} }) {
$str .= "&" . $form->escape($key, 1) . "=";
- ($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
+
my
($value, $conf) = split(/=/, $self->{$item}{$key}, 2);
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
$value = $myconfig->{$value} . "/$conf" if ($conf);
$str .= $form->escape($value, 1);
}
@@
-311,6
+303,10
@@
sub parse_access_string {
my $key = shift;
my $access = shift;
my $key = shift;
my $access = shift;
+ my $form = $main::form;
+ my $auth = $main::auth;
+ my $myconfig = \%main::myconfig;
+
my @stack;
my $cur_ary = [];
my @stack;
my $cur_ary = [];
@@
-331,7
+327,7
@@
sub parse_access_string {
} elsif ($token eq ")") {
pop @stack;
if (!@stack) {
} elsif ($token eq ")") {
pop @stack;
if (!@stack) {
- $
main::
form->error("Error in menu.ini for entry ${key}: missing '('");
+ $form->error("Error in menu.ini for entry ${key}: missing '('");
}
$cur_ary = $stack[-1];
}
$cur_ary = $stack[-1];
@@
-339,16
+335,16
@@
sub parse_access_string {
push @{$cur_ary}, $token;
} else {
push @{$cur_ary}, $token;
} else {
- push @{$cur_ary}, $
main::auth->check_right($main::
form->{login}, $token, 1);
+ push @{$cur_ary}, $
auth->check_right($
form->{login}, $token, 1);
}
}
if ($access) {
}
}
if ($access) {
- $
main::form->error("Error in menu.ini for entry ${name
}: unrecognized token at the start of '$access'\n");
+ $
form->error("Error in menu.ini for entry ${key
}: unrecognized token at the start of '$access'\n");
}
if (1 < scalar @stack) {
}
if (1 < scalar @stack) {
- $main::form->error("Error in menu.ini for entry ${
name
}: Missing ')'\n");
+ $main::form->error("Error in menu.ini for entry ${
key
}: Missing ')'\n");
}
return SL::Auth::evaluate_rights_ary($stack[0]);
}
return SL::Auth::evaluate_rights_ary($stack[0]);
@@
-393,7
+389,10
@@
sub set_access {
$self->{ORDER} = [ grep { $self->{$_}->{VISIBLE} } @{ $self->{ORDER} } ];
$self->{ORDER} = [ grep { $self->{$_}->{VISIBLE} } @{ $self->{ORDER} } ];
+ { no strict 'refs';
+ # ToDO: fix this. nuke and pave algorithm without type checking screams for problems.
map { delete @{$self->{$_}}{qw(GRANTED IS_MENU NUM_VISIBLE_CHILDREN VISIBLE ACCESS)} if ($_ ne 'ORDER') } keys %{ $self };
map { delete @{$self->{$_}}{qw(GRANTED IS_MENU NUM_VISIBLE_CHILDREN VISIBLE ACCESS)} if ($_ ne 'ORDER') } keys %{ $self };
+ }
}
sub dump_visible {
}
sub dump_visible {