From be29d9d86f95d4355d9536fa65717bb359e5beae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 17 Oct 2012 15:51:58 +0200 Subject: [PATCH] MenuItems wieder entfernt --- SL/Menu.pm | 12 ------ SL/MenuItem.pm | 100 ------------------------------------------------- 2 files changed, 112 deletions(-) delete mode 100644 SL/MenuItem.pm diff --git a/SL/Menu.pm b/SL/Menu.pm index 63a4f868e..3b994f2fb 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -58,18 +58,6 @@ sub new { return $self; } -sub menuitems { - my ($self) = @_; - - map { - SL::MenuItem->new( - name => $_, - menu => $self, - item => $self->{$_} - ); - } $self->access_control; -} - sub menuitem_js { my ($self, $myconfig, $form, $item) = @_; diff --git a/SL/MenuItem.pm b/SL/MenuItem.pm deleted file mode 100644 index dbdaf800b..000000000 --- a/SL/MenuItem.pm +++ /dev/null @@ -1,100 +0,0 @@ -package SL::MenuItem; - -use strict; - -sub new { - my ($class, %params) = @_; - - my $obj = bless {}, $class; - $obj->{fullname} = $params{name}; - my $values = $params{item}; - - $obj->{ACCESS} = delete $values->{ACCESS}; - $obj->{module} = delete $values->{module} || die 'menuitem - need module'; - $obj->{action} = delete $values->{action} || die 'menuitem - need action'; - - $obj->{params} = $values; -} - -sub ACCESS { $_[0]{ACCESS} } -sub action { $_[0]{action} } -sub module { $_[0]{module} } -sub params { $_[0]{params} } - -sub name { $_[0]{name} ||= $_[0]->_init_name } -sub _init_name { my $name = $_[0]{fullname}; $name =~ s/.*--//; $name } -sub path { @{ $_[0]{path} ||= [ $_[0]->_init_path ] } } -sub _init_path { my $name = $_[0]{fullname}; split /--/, $name } - -sub children { } -sub siblings {} -sub parent {} - - -###### internal stuff ####### - - - -1; - -__END__ - -=encoding utf-8 - -=head1 NAME - -SL::MenuItem - wrapper class for menu items - -=head1 SYNOPSIS - - use SL::Menu; - - for my item (Menu->new->menuitems) { - next unless $item->access; - - make_your_own_menuentry_from( - module => $item->module, - action => $iten->action, - params => $item->params, - name => $item->name, - path => $item->path, - children => $item->children, - parent => $item->parent, - ); - } - -=head1 DESCRIPTION - -This provides some wrapper methods around the raw entries in menu.ini. It sorts through expected information like module and action, wraps access calls for you and gives you tree access to siblings, children and parent elements in the menu structure. - -=head1 METHODS - -=over 4 - -=item new - -=item access - -=item module - -=item params - -=item name - -=item path - -=item children - -=item parent - -=item siblings - -=back - -=head1 BUGS - -=head1 AUTHOR - -Sven Schoeling Es.schoeling@linet-services.deE - -=cut -- 2.20.1