From: Michael Andreen Date: Thu, 18 Jan 2007 11:56:27 +0000 (+0000) Subject: oo points X-Git-Url: https://ruin.nu/git/?a=commitdiff_plain;ds=sidebyside;h=5e8e40894860b7bab39783a43c32d98d080801c9;p=ndwebbie.git oo points --- diff --git a/ND/Web/Pages/Points.pm b/ND/Web/Pages/Points.pm index 30512fb..b17e4b1 100644 --- a/ND/Web/Pages/Points.pm +++ b/ND/Web/Pages/Points.pm @@ -23,20 +23,18 @@ use warnings FATAL => 'all'; use CGI qw/:standard/; use ND::Web::Include; -$ND::PAGES{points} = {parse => \&parse, process => \&process, render=> \&render}; +our @ISA = qw/ND::Web::XMLPage/; -sub parse { -} - -sub process { +$ND::Web::Page::PAGES{points} = 'ND::Web::Pages::Points'; -} -sub render { - my ($DBH,$BODY) = @_; - $ND::TEMPLATE->param(TITLE => 'Top Members'); +sub render_body { + my $self = shift; + my ($BODY) = @_; + $self->{TITLE} = 'Top Members'; + my $DBH = $self->{DBH}; - return $ND::NOACCESS unless isMember(); + return $self->noAccess unless $self->isMember; my $type = "total"; if (defined param('type') && param('type') =~ /^(defense|attack|total|humor|scan|rank)$/){ @@ -48,7 +46,7 @@ sub render { $order = 'ASC' if ($type eq 'rank'); my $limit = 'LIMIT 10'; - $limit = '' if isHC(); + $limit = '' if $self->isHC; my $query = $DBH->prepare("SELECT username,defense_points,attack_points,scan_points,humor_points, (attack_points+defense_points+scan_points/20) as total_points, rank FROM users WHERE uid IN (SELECT uid FROM groupmembers WHERE gid = 2) ORDER BY $type $order $limit"); $query->execute; diff --git a/ND/Web/XMLPage.pm b/ND/Web/XMLPage.pm index 4a0e189..8381a1f 100644 --- a/ND/Web/XMLPage.pm +++ b/ND/Web/XMLPage.pm @@ -29,7 +29,7 @@ use ND::Web::Include; our @ISA = qw/ND::Web::Page/; -sub noAccess { +sub noAccess () { HTML::Template->new(filename => 'templates/NoAccess.tmpl', global_vars => 1, cache => 1); }; diff --git a/startup.pl b/startup.pl index 6c4ebdb..250b419 100644 --- a/startup.pl +++ b/startup.pl @@ -29,7 +29,7 @@ use ND::Web::XMLPage; use ND::Web::Pages::Main; use ND::Web::Pages::AddIntel; -#use ND::Web::Pages::Points; +use ND::Web::Pages::Points; #use ND::Web::Pages::LaunchConfirmation; #use ND::Web::Pages::CovOp; #use ND::Web::Pages::Top100;