From 28e7336097f7146bdba93871fb54737c32e2b0c5 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Sun, 11 May 2008 12:55:20 +0000 Subject: [PATCH] LEMONLDAP::NG : Status is in HTML now --- .../lib/Lemonldap/NG/Handler/Simple.pm | 4 +-- .../lib/Lemonldap/NG/Handler/Status.pm | 34 ++++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm index 32d68de84..e331e4d52 100644 --- a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm +++ b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm @@ -722,7 +722,7 @@ sub status($$) { $r->push_handlers( 'PerlResponseHandler' => sub { my $r = shift; - $r->content_type('text/plain'); + $r->content_type('text/html; charset=UTF-8'); $r->print($buf); OK; } @@ -732,7 +732,7 @@ sub status($$) { $r->push_handlers( 'PerlHandler' => sub { my $r = shift; - $r->content_type('text/plain'); + $r->content_type('text/html; charset=UTF-8'); $r->send_http_header; $r->print($buf); OK; diff --git a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm index 21cce7546..d55c2f21e 100644 --- a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm +++ b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm @@ -51,7 +51,7 @@ sub run { my $args = $1; my ( $c, $a, $u ); while ( my ( $user, $v ) = each( %{ $status->{user} } ) ) { - $u++; + $u++ unless( $user =~ /^\d+\.\d+\.\d+\.\d+$/ ); # Total requests foreach ( keys %$v ) { $c->{$_} += $v->{$_}; @@ -70,15 +70,39 @@ sub run { #print Dumper( $c, $a, $status ); my @t = $refLocalStorage->get_keys( $localStorageOptions->{namespace} ); - print "TOTAL\n"; + &head; + print "

Total

\n";
             print sprintf("%-10s : %d\n", $_, $c->{$_}) foreach(sort keys %$c);
-            print "\nAVERAGE\n";
+            print "\n

Average

\n";
             print sprintf("%-10s : %s\n", $_, $a->{$_}) foreach(sort keys %$a);
-            print "\nUsers : $u\n\nLocal Cache : " . @t . " objects\n";
-            print "END\n";
+            print "\n

\nTotal users : $u\n

\nLocal Cache : " . @t . " objects\n

"; + &end; + print "\nEND\n"; } } } + +sub head { + print <<"EOF"; + + + +Lemonldap::NG Status + + + +

Lemonldap::NG Status informations

+EOF +} + +sub end { + print <<"EOF"; + + +EOF +} 1; __END__