X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/bf7f935de20f360843aa2a7b1e4563248766de8a..d679bb5b866e0336fb3df96a28cb58de349c9cb0:/SL/Menu.pm diff --git a/SL/Menu.pm b/SL/Menu.pm index 8cc9c7e06..ac8f7280b 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -21,7 +21,7 @@ sub new { my $path = File::Spec->catdir('menus', $domain); opendir my $dir, $path or die "can't open $path: $!"; - my @files = sort grep -f "$path/$_", readdir $dir; + my @files = sort grep -f "$path/$_", grep /\.yaml$/, readdir $dir; close $dir; my $nodes = []; @@ -220,6 +220,12 @@ sub parse_instance_conf_string { return $::instance_conf->data->{$setting}; } +sub parse_compare_string { + my ($self, $switch) = @_; + my ($setting, $mode) = split m/=/, $switch, 2; + return $::instance_conf->data->{$setting} eq $mode; +} + sub clear_access { my ($self) = @_; for my $node ($self->tree_walk("all")) { @@ -230,11 +236,14 @@ sub clear_access { sub set_access { my ($self) = @_; - # 1. evaluate access for all - # 2. if a menu has no visible children, its not visible either + # 1. evaluate appearence + # 2. evaluate access for all + # 3. if a menu has no visible children, its not visible either for my $node (reverse $self->tree_walk("all")) { - $node->{visible} = $node->{access} ? $self->parse_access_string($node) + $node->{visible} = $node->{inclusion} ? $self->parse_compare_string($node->{inclusion}) : 1 + && $node->{exclusion} ? !$self->parse_compare_string($node->{exclusion}) : 1 + && $node->{access} ? $self->parse_access_string($node) : !$node->{children} ? 1 : $node->{visible_children} ? 1 : 0;