diff options
author | Othmar Gsenger <otti@wirdorange.org> | 2011-01-14 22:19:17 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@wirdorange.org> | 2011-01-14 22:19:17 +0000 |
commit | ca8cddbd2d5d89ed4c1bdf9498bb4eb68f2fac13 (patch) | |
tree | 3cd2bedb18f8d54f2200744d5c034b956d9fd48f /local/menu.pm | |
parent | wathever (diff) |
added ajax & navigation
Diffstat (limited to 'local/menu.pm')
-rw-r--r-- | local/menu.pm | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/local/menu.pm b/local/menu.pm new file mode 100644 index 0000000..6019acb --- /dev/null +++ b/local/menu.pm @@ -0,0 +1,55 @@ +package local::menu; +require Exporter; +use CGI qw(:standard); +use strict; +use base "Exporter"; + +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', + +); + +sub new +{ + my $invocant = shift; + my $class = ref($invocant) || $invocant; + # my $self = $class->SUPER::new(@_); + my $self=bless {@_}, $class; + return $self; +} + +sub start_html +{ + my $self=shift; + + my $active = $self->{SCRIPT_NAME}; + my $html= CGI::start_html(-style=>{'src'=>'/style.css'},@_); + my @elements; + foreach my $url (keys %menus) + { + if ($url eq $active) + { + push @elements,td([$menus{$url}]); + } else { + push @elements,th([a({href=>$url},$menus{$url})]); + } + } + $html.= table( + Tr(join '',@elements + ), + ); + + return $html; +} + +sub end_html +{ + my $self=shift; + my $html= CGI::end_html; + return $html; +} |