From d26fa8c1e0886c813de5364ee6570c860c6ce12c Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Thu, 31 Mar 2011 19:05:23 +0000 Subject: hopfully repaired this after backup loss --- local/menu.pm | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'local/menu.pm') diff --git a/local/menu.pm b/local/menu.pm index d5078ff..714e06d 100644 --- a/local/menu.pm +++ b/local/menu.pm @@ -8,11 +8,11 @@ use config; my %menus = ( - '/cgi-bin/nzbget/groups.pl'=> [10 , 'Aktive Downloads'], - '/cgi-bin/nzbget/mydl.pl?only_me=1'=>[20 , 'Meine Downloads'], - '/cgi-bin/nzbget/mydl.pl'=> [30,'Alle Downloads'], - '/cgi-bin/nzbget/log.pl'=> [50,'Protokoll'], - '/cgi-bin/nzbget/search.pl'=> [5, 'Suche'], + 'download'=> [10 , 'Downloads','aktive','fertige','meine'], +# 'list?only_me=1'=>[20 , 'Meine Downloads'], +# 'list'=> [30,'Alle Downloads'], + 'log'=> [50,'Protokoll'], + 'search'=> [5, 'Suche', 'nzbindex.nl','NZB Datei hochladen'], ); @@ -30,6 +30,11 @@ sub start_html my $self=shift; my ($title)=@_; my $active = $self->{REQUEST_URI}; + $active =~ s'.*/''; + $active =~ s'\?.*''; + my $active_sub; + ($active,$active_sub)= split /_/,$active; + $active_sub+=2; my $html= CGI::start_html(-style=>{'src'=>'/style.css'},-title=>$title); my $user = new local::user(%ENV); $html.= table({class=>'nohigh'},Tr({class=>'nohigh'},td({style=>'font-weight: bold'},[$config::config{page_name} ]),td({class=>'login',align=>'right'},[''.b('Angemeldet als: ').$user->get_name.'']))); @@ -37,6 +42,7 @@ sub start_html my @elements; foreach my $url (sort {$menus{$a}->[0] <=> $menus{$b}->[0] } keys %menus) { + next if not $menus{$url}->[1]; if ($url eq $active) { push @elements,th({class=>'active'},[$menus{$url}->[1]]); @@ -48,6 +54,28 @@ sub start_html Tr({class=>'menu'},join '',@elements ), ); + my @submens; + if ($#{$menus{$active}}>1) + { + foreach my $i (2..$#{$menus{$active}}) + { + if ($i == $active_sub) + { + push @submens,th({class=>'active'},[$menus{$active}->[$i]]); + } else { + if ($i > 2) + { + push @submens,th([a({href=>"${active}_".($i-2)},$menus{$active}->[$i])]); + } else { + push @submens,th([a({href=>"${active}"},$menus{$active}->[$i])]); + } + } + } + } + $html.= table({class=>'submenu'}, + Tr({class=>'submenu'},join '',@submens + ), + ); return $html; } -- cgit v1.2.3