From 16e1ecfecf8e28f603ee560b648375d158f8f142 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Thu, 18 Jan 2007 21:08:42 +0000 Subject: [PATCH] calls class --- ND/Web/Pages/Calls.pm | 29 +++++++++++------------------ startup.pl | 2 +- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/ND/Web/Pages/Calls.pm b/ND/Web/Pages/Calls.pm index 208b1a9..191a50e 100644 --- a/ND/Web/Pages/Calls.pm +++ b/ND/Web/Pages/Calls.pm @@ -23,27 +23,20 @@ use ND::Include; use CGI qw/:standard/; use ND::Web::Include; -$ND::PAGES{calls} = {parse => \&parse, process => \&process, render=> \&render}; +our @ISA = qw/ND::Web::XMLPage/; -sub parse { - my ($uri) = @_; - #if ($uri =~ m{^/.*/(\w+)$}){ - # param('list',$1); - #} -} +$ND::Web::Page::PAGES{calls} = __PACKAGE__; -sub process { +sub render_body { + my $self = shift; + my ($BODY) = @_; + $self->{TITLE} = 'Defense Calls'; + my $DBH = $self->{DBH}; -} + return $self->noAccess unless $self->isDC; -sub render { - my ($DBH,$BODY) = @_; my $error; - $ND::TEMPLATE->param(TITLE => 'Defense Calls'); - - return $ND::NOACCESS unless isDC(); - my $call; if (defined param('call') && param('call') =~ /^(\d+)$/){ my $query = $DBH->prepare(q{ @@ -93,7 +86,7 @@ sub render { ,undef,$ND::UID,$call->{id})){ $call->{covered} = (param('cmd') eq 'Cover call'); $call->{open} = (param('cmd') =~ /^(Uncover|Open) call$/); - $call->{DC} = $ND::USER; + $call->{DC} = $self->{USER}; }else{ $error .= "

Something went wrong: ".$DBH->errstr."

"; } @@ -132,7 +125,7 @@ sub render { $BODY->param(Coords => $call->{coords}); $BODY->param(DefensePoints => $call->{defense_points}); $BODY->param(LandingTick => $call->{landing_tick}); - $BODY->param(ETA => $call->{landing_tick}-$ND::TICK); + $BODY->param(ETA => $call->{landing_tick}-$self->{TICK}); $BODY->param(Info => $call->{info}); $BODY->param(DC => $call->{dc}); if ($call->{covered}){ @@ -217,7 +210,7 @@ sub render { $query->execute or $error .= $DBH->errstr; my @calls; my $i = 0; - my $tick = $ND::TICK; + my $tick = $self->{TICK}; while (my $call = $query->fetchrow_hashref){ if ($call->{defense_points} < $minpoints){ $call->{DefPrio} = 'LowestPrio'; diff --git a/startup.pl b/startup.pl index 97247ba..db9e321 100644 --- a/startup.pl +++ b/startup.pl @@ -37,7 +37,7 @@ use ND::Web::Pages::DefRequest; use ND::Web::Pages::Check; use ND::Web::Pages::Raids; use ND::Web::Pages::EditRaid; -#use ND::Web::Pages::Calls; +use ND::Web::Pages::Calls; #use ND::Web::Pages::Users; #use ND::Web::Pages::Intel; #use ND::Web::Pages::Alliances; -- 2.39.2