sub new {
$main::lxdebug->enter_sub();
- my ($type, $menufile) = @_;
+ my ($type, @menufiles) = @_;
+ my $self = bless {}, $type;
- my $self = {};
- my $inifile = Inifile->new($menufile);
+ my @order;
- map { $self->{$_} = $inifile->{$_} } keys %{ $inifile };
+ foreach my $menufile (grep { -f } @menufiles) {
+ my $inifile = Inifile->new($menufile);
- bless $self, $type;
+ push @order, @{ delete($inifile->{ORDER}) || [] };
+ $self->{$_} = $inifile->{$_} for keys %{ $inifile };
+ }
+
+ $self->{ORDER} = \@order;
$self->set_access();
}
sub menuitem_new {
- $main::lxdebug->enter_sub();
+ $main::lxdebug->enter_sub(LXDebug::DEBUG2());
my ($self, $name, $item) = @_;
$item->{href} .= "&" . $form->escape($key) . "=" . $form->escape($value);
}
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub(LXDebug::DEBUG2());
}
sub access_control {
my @menu = ();
- if ($menulevel eq "") {
+ if (!$menulevel) {
@menu = grep { !/--/ } @{ $self->{ORDER} };
} else {
@menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} };
return SL::Auth::evaluate_rights_ary($stack[0]);
}
+sub parse_instance_conf_string {
+ my ($self, $setting) = @_;
+ return $::instance_conf->data->{$setting};
+}
+
sub set_access {
my $self = shift;
my $entry = $self->{$key};
$entry->{GRANTED} = $entry->{ACCESS} ? $self->parse_access_string($key, $entry->{ACCESS}) : 1;
+ $entry->{GRANTED} &&= $self->parse_instance_conf_string($entry->{INSTANCE_CONF}) if $entry->{INSTANCE_CONF};
$entry->{IS_MENU} = $entry->{submenu} || ($key !~ m/--/);
$entry->{NUM_VISIBLE_CHILDREN} = 0;