summaryrefslogtreecommitdiff
path: root/scripts/menu.pl
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-27 15:19:55 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-27 15:19:55 +0000
commit50be11c3574706cae5e219ba910e8221e50da4e8 (patch)
treea2b6f050da940fdf1650a42bd5269469e6483467 /scripts/menu.pl
parent80d758a1abf3d2b696fd14521726806236a2c2b6 (diff)
Moving menu.pl to old-handler.pl and adjusting top level scripts accordingly.
Including also an unfinished and inactive version of the menu system running under the new architecture. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1334 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'scripts/menu.pl')
-rw-r--r--scripts/menu.pl39
1 files changed, 33 insertions, 6 deletions
diff --git a/scripts/menu.pl b/scripts/menu.pl
index 622c0cce..6836c1b4 100644
--- a/scripts/menu.pl
+++ b/scripts/menu.pl
@@ -44,15 +44,42 @@ sub expanding_menu {
template => 'menu_expand',
format => 'HTML',
);
- $request->{menu_items} = [];
- for (keys %$menu){
- push @{$request->{menu_items}}, $menu->{$_};
- }
+ $request->{subs} = [];
+ _attach_references({source => $menu, dest => $request->{subs}, path => ""});
$menu->debug({file => '/tmp/debug-menu'});
- $request->{menu_items} = {};
- $request->{menu_items}->{subs} = $menu;
$request->debug({file => '/tmp/debug'});
$template->render($request);
}
+sub _attach_references {
+ no strict qw(refs);
+ my ($args) = @_;
+ my ($source, $dest, $path)
+ = ($args->{source}, $args->{dest}, $args->{path});
+ my %hash;
+ if ($path and $source->{id}){
+ for (sort keys %$source){
+ next if $_ eq 'subs';
+ $hash{$_} = $source->{$_};
+ }
+ $hash{path} = $path;
+ push @{$dest}, \%hash;
+ foreach (sort keys %{$source->{subs}}) {
+ _attach_references({
+ source => $source->{subs}->{$_},
+ dest => $dest,
+ path => "$path--$_",
+ });
+ }
+ } else {
+ foreach (sort keys %$source){
+ _attach_references({
+ source => $source->{$_},
+ dest => $dest,
+ path => "$_",
+ });
+ }
+ }
+}
+
1;