From 3bbb1b248f51e8eb01926a6ca383c48063303ea2 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Sat, 15 Jan 2011 02:59:12 +0000 Subject: christian schon fast zufriednen --- groups.pl | 19 +++++++++---------- local/menu.pm | 30 +++++++++++++++++------------- log.pl | 6 ++++-- mydl.pl | 6 ++++-- search.pl | 3 ++- 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/groups.pl b/groups.pl index 5b992fd..15291d2 100755 --- a/groups.pl +++ b/groups.pl @@ -19,7 +19,7 @@ print $pjx->build_html( $cgi, \&Show_HTML); sub get_download_speed { my $cli = new local::nzbget; - my $status = $cli->send_request('status') or die "Can't connect to nubget"; + my $status = $cli->send_request('status') or die "Can't connect to nzbget"; return int($status->{DownloadRate}->value/(1024*1024)).'MB/s'; } @@ -27,7 +27,7 @@ sub get_download_table { my $html; my $cli = new local::nzbget; - my $row = $cli->send_request('listgroups') or die "Can't connect to nubget"; + my $row = $cli->send_request('listgroups') or die "Can't connect to nzbget"; $html.= CGI::start_table(); foreach my $value ( @$row) { @@ -35,8 +35,11 @@ sub get_download_table my $remaining=$value->{RemainingSizeMB}->value; my $total=$value->{FileSizeMB}->value; my $percent = int(100-100*$remaining/$total); - $download->size($total); - $download->update(); + if (not $download->size) + { + $download->size($total); + $download->update(); + } my $cancel; $cancel=a({href=>'/cgi-bin/nzbget/cancel.pl?id='.$value->{NZBNicename}->value},'Abbrechen') if ($download->owner->owner_id() eq $user->get_id()); $html.= Tr(td([$download->category->name,$download->name,$download->owner->name,$percent.'%',$cancel])); @@ -61,12 +64,8 @@ sub Show_HTML //--> LALALA ; - $html.= hr(); - $html.= CGI::start_table(); - $html.= Tr(td['download speed', div({id=>'speed'},get_download_speed())]); - $html.= CGI::end_table(); - $html.= hr(); - + $html.= table({class=>'nohigh'},Tr(td['download speed', div({id=>'speed'},get_download_speed())]),Tr(td([' ']))); + $html.= table(Tr(th([qw/Kategorie Name Besitzer Fortschritt Abbrechen/]))); $html.= div({id=>'dls'},get_download_table()); $html.= $menu->end_html(); 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; } diff --git a/log.pl b/log.pl index 84ccbd1..6cdaf40 100755 --- a/log.pl +++ b/log.pl @@ -6,7 +6,9 @@ use CGI::Carp 'fatalsToBrowser'; use URI::Escape; print header; -print start_html('nzbget status'); +use local::menu; +my $menu=new local::menu(%ENV); +print $menu->start_html('log'); my $cli = new local::nzbget; print CGI::start_table(); @@ -25,4 +27,4 @@ foreach my $row (@{ $resp->value}) # } } print CGI::end_table(); -print end_html; +print $menu->end_html; diff --git a/mydl.pl b/mydl.pl index 0ceb08d..d5ef969 100755 --- a/mydl.pl +++ b/mydl.pl @@ -2,6 +2,7 @@ use strict; use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; +use utf8; use local::nzbget; use local::db; use local::user; @@ -10,10 +11,11 @@ my $user = new local::user($ENV{REMOTE_USER}); print header; use local::menu; -my $menu=new local::menu; +my $menu=new local::menu(%ENV); print $menu->start_html('my downloads'); print CGI::start_table(); +print Tr(th([qw/Kategorie Name Größe Löschen /])); my @downloads; if (param('only_me')) { @@ -24,7 +26,7 @@ if (param('only_me')) foreach my $dl ( @downloads) { my $dl_remove; - $dl_remove = a({href=>'/cgi-bin/nzbget/remove.pl?id='.$dl->download_id},"loeschen") if $dl->owner->owner_id == $user->get_id; + $dl_remove = a({href=>'/cgi-bin/nzbget/remove.pl?id='.$dl->download_id},"löschen") if $dl->owner->owner_id == $user->get_id; print Tr(td([ $dl->category->name,a({title=>$dl->description,href=>'/'.$dl->category->name.'/'.$dl->download_id},$dl->name),$dl->size.'MB',$dl_remove diff --git a/search.pl b/search.pl index 24831f7..aefec96 100755 --- a/search.pl +++ b/search.pl @@ -15,7 +15,7 @@ print CGI::start_table(); print CGI::start_form(-action=>'/cgi-bin/nzbget/search.pl'); print - table( + table({class=>'nohigh'}, Tr(td(['Search',textfield('q'),])), Tr(td(['min Size',textfield('minsize')])), Tr(td(['max Size',textfield('maxsize').hidden('more',1)])), @@ -26,6 +26,7 @@ print -labels => {25=>'25',100=>'100',500=>500} ) ])), Tr(td(['',submit()])), + Tr(td([' '])), ); print CGI::end_form; my $param_obj=new local::params; -- cgit v1.2.3