diff options
author | Othmar Gsenger <otti@wirdorange.org> | 2011-01-15 02:59:12 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@wirdorange.org> | 2011-01-15 02:59:12 +0000 |
commit | 3bbb1b248f51e8eb01926a6ca383c48063303ea2 (patch) | |
tree | 055e037979473ce7959b9a28cc9319cf791dc68d /local/menu.pm | |
parent | added remove (diff) |
christian schon fast zufriednen
Diffstat (limited to 'local/menu.pm')
-rw-r--r-- | local/menu.pm | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/local/menu.pm b/local/menu.pm index 3d8d73c..918e9f5 100644 --- a/local/menu.pm +++ b/local/menu.pm @@ -3,14 +3,15 @@ require Exporter; use CGI qw(:standard); use strict; use base "Exporter"; +use local::user; my %menus = ( - '/cgi-bin/nzbget/groups.pl'=>'Aktive Downloads', - '/cgi-bin/nzbget/mydl.pl?only_me=1'=>'My Downloads', - '/cgi-bin/nzbget/mydl.pl'=>'All Downloads', - '/cgi-bin/nzbget/log.pl'=>'Log', - '/cgi-bin/nzbget/search.pl'=>'Suche', + '/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'], ); @@ -27,29 +28,32 @@ sub start_html { my $self=shift; my ($title)=@_; - my $active = $self->{SCRIPT_NAME}; + my $active = $self->{REQUEST_URI}; my $html= CGI::start_html(-style=>{'src'=>'/style.css'},-title=>$title); + my $user = new local::user($ENV{REMOTE_USER}); + $html.= table({class=>'nohigh',style=>'padding-bottom:0.5em;'},Tr({class=>'nohigh'},td({style=>'font-weight: bold'},[qw/ share.ffgraz.net /]),td({align=>'right'},[b('Angemeldet als: ').$user->get_name]))); + $html.= CGI::start_div({class=>'bodydiv'}); my @elements; - foreach my $url (keys %menus) + foreach my $url (sort {$menus{$a}->[0] <=> $menus{$b}->[0] } keys %menus) { if ($url eq $active) { - push @elements,td([$menus{$url}]); + push @elements,th({class=>'active'},[$menus{$url}->[1]]); } else { - push @elements,th([a({href=>$url},$menus{$url})]); + push @elements,th([a({href=>$url},$menus{$url}->[1])]); } } - $html.= table( - Tr(join '',@elements + $html.= table({class=>'menu'}, + Tr({class=>'menu'},join '',@elements ), ); - return $html; } sub end_html { my $self=shift; - my $html= CGI::end_html; + my $html= CGI::end_div(); + $html.= CGI::end_html; return $html; } |