]> ruin.nu Git - ndwebbie.git/commitdiff
member intel, shows all incoming and outgoing fleets for member planets
authorMichael Andreen <harv@ruin.nu>
Fri, 15 Dec 2006 12:24:07 +0000 (12:24 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 15 Dec 2006 12:24:07 +0000 (12:24 +0000)
include.pl
index.pl
memberIntel.pl [new file with mode: 0644]
templates/memberIntel.tmpl [new file with mode: 0644]
templates/skel.tmpl

index 07bb9857984e1563d3a47f24c13dfee6f0715cf1..a78acc9be229a5d335d6f0866efae0ebd91aeafe 100644 (file)
@@ -107,7 +107,7 @@ FROM (intel i NATURAL JOIN users u)
        JOIN current_planet_stats t ON i.target = t.id
        JOIN current_planet_stats o ON i.sender = o.id
 WHERE $where 
-GROUP BY i.tick,i.mission,t.x,t.y,t.z,o.x,o.y,o.z,i.amount,i.ingal,u.username,t.alliance,o.alliance 
+GROUP BY i.tick,i.mission,t.x,t.y,t.z,o.x,o.y,o.z,i.amount,i.ingal,u.username,t.alliance,o.alliance,t.nick,o.nick
 ORDER BY i.tick DESC, i.mission};
 }
 
index e557be179b6bc51e6c3e03f71008c86e4dacf9ac..fe1572b68330d920d1e89d4fd2256bc5c513aa33 100755 (executable)
--- a/index.pl
+++ b/index.pl
@@ -64,7 +64,7 @@ while (my ($name,$attack,$gid) = $query->fetchrow()){
 our $LOG = $DBH->prepare('INSERT INTO log (uid,text) VALUES(?,?)');
 
 my $page = 'main';
-if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|addintel|defrequest|raids|editRaid|calls|intel|users|alliances)$/){
+if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|addintel|defrequest|raids|editRaid|calls|intel|users|alliances|memberIntel)$/){
        $page = $1;
 }
 
diff --git a/memberIntel.pl b/memberIntel.pl
new file mode 100644 (file)
index 0000000..98d6738
--- /dev/null
@@ -0,0 +1,75 @@
+#**************************************************************************
+#   Copyright (C) 2006 by Michael Andreen <harvATruinDOTnu>               *
+#                                                                         *
+#   This program is free software; you can redistribute it and/or modify  *
+#   it under the terms of the GNU General Public License as published by  *
+#   the Free Software Foundation; either version 2 of the License, or     *
+#   (at your option) any later version.                                   *
+#                                                                         *
+#   This program is distributed in the hope that it will be useful,       *
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+#   GNU General Public License for more details.                          *
+#                                                                         *
+#   You should have received a copy of the GNU General Public License     *
+#   along with this program; if not, write to the                         *
+#   Free Software Foundation, Inc.,                                       *
+#   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
+#**************************************************************************/
+
+use strict;
+use POSIX;
+our $BODY;
+our $DBH;
+our $LOG;
+my $error;
+
+$ND::TEMPLATE->param(TITLE => 'Member Intel');
+
+die "You don't have access" unless isHC();
+
+my $showticks = 'AND i.tick > tick()';
+if (param('show') eq 'all'){
+       $showticks = '';
+}elsif (param('show') =~ /^(\d+)$/){
+       $showticks = "AND (i.tick - i.eta) > (tick() - $1)";
+}
+
+
+my $query = $DBH->prepare(intelquery('o.alliance AS oalliance,coords(o.x,o.y,o.z) AS origin, coords(t.x,t.y,t.z) AS target, t.nick',"t.alliance_id = 1 $showticks"));
+$query->execute() or $error .= $DBH->errstr;
+my @intellists;
+my @intel;
+my $i = 0;
+while (my $intel = $query->fetchrow_hashref){
+       if ($intel->{ingal}){
+               $intel->{missionclass} = 'ingal';
+       }else{
+               $intel->{missionclass} = $intel->{mission};
+       }
+       $intel->{ODD} = $i % 2;
+       push @intel,$intel;
+       $i++;
+}
+push @intellists,{Message => 'Incoming fleets', Intel => \@intel, Origin => 1};
+
+my $query = $DBH->prepare(intelquery('o.nick,coords(o.x,o.y,o.z) AS origin,t.alliance AS talliance,coords(t.x,t.y,t.z) AS target',"o.alliance_id = 1 $showticks"));
+$query->execute() or $error .= $DBH->errstr;
+my @intel;
+my $i = 0;
+while (my $intel = $query->fetchrow_hashref){
+       if ($intel->{ingal}){
+               $intel->{missionclass} = 'ingal';
+       }else{
+               $intel->{missionclass} = $intel->{mission};
+       }
+       $intel->{ODD} = $i % 2;
+       push @intel,$intel;
+       $i++;
+}
+push @intellists,{Message => 'Outgoing Fleets', Intel => \@intel, Target => 1};
+
+$BODY->param(IntelLIsts => \@intellists);
+
+$BODY->param(Error => $error);
+1;
diff --git a/templates/memberIntel.tmpl b/templates/memberIntel.tmpl
new file mode 100644 (file)
index 0000000..b6a3c57
--- /dev/null
@@ -0,0 +1,35 @@
+<TMPL_VAR NAME=Error>
+<p><a href="index.pl?page=memberIntel&amp;show=all">Show all ticks</a></p>
+<TMPL_LOOP IntelLists>
+<TMPL_IF Message><p><TMPL_VAR NAME=Message></p></TMPL_IF>
+<table>
+       <tr>
+               <TMPL_IF Origin><th>Alliance</th><TMPL_ELSE><th>Nick</th></TMPL_IF><th>Sender</th>
+               <th>Mission</th><th>Landing tick</th><th>ETA</th><th>Amount</th>
+               <th>Target</th><TMPL_IF Target><th>Alliance</th><TMPL_ELSE><th>Nick</th></TMPL_IF>
+               <th>Ingal</th><th>Reported by</th>
+       </tr>
+       <TMPL_LOOP Intel>
+       <tr class="<TMPL_IF ODD>odd<TMPL_ELSE>even</TMPL_IF>">
+       <td><a href="index.pl?page=intel&amp;coords=<TMPL_VAR NAME=Origin>"><TMPL_VAR NAME=Origin></a></td>
+       <TMPL_IF OAlliance>
+       <td><TMPL_VAR NAME=OAlliance></td>
+       <TMPL_ELSE>
+       <td><TMPL_VAR NAME=Nick></td>
+       </TMPL_IF>
+       <td class="<TMPL_VAR NAME=MissionClass>"><TMPL_VAR NAME=Mission></td>
+       <td align="center"><TMPL_VAR NAME=landingtick></td>
+       <td align="center"><TMPL_VAR NAME=ETA></td>
+       <td><TMPL_VAR NAME=Amount></td>
+       <td><a href="index.pl?page=intel&amp;coords=<TMPL_VAR NAME=Target>"><TMPL_VAR NAME=Target></a></td>
+       <TMPL_IF TAlliance>
+       <td><TMPL_VAR NAME=TAlliance></td>
+       <TMPL_ELSE>
+       <td><TMPL_VAR NAME=Nick></td>
+       </TMPL_IF>
+       <td><TMPL_VAR NAME=Ingal></td>
+       <td><TMPL_VAR NAME=Username></td>
+       </tr>
+       </TMPL_LOOP>
+</table>
+</TMPL_LOOP>
index 9c4685c7c09225cf0be12d71fa39fede6a508951..681038b674b9d12bc99fd3d4c5aea79e3587efec 100644 (file)
@@ -58,7 +58,7 @@
                        <li><a href="index.pl?page=users">List users</a></li>
                        <li><a href="index.pl?page=intel">Intel</a></li>
                        <li><a href="index.pl?page=alliances">Alliances</a></li>
-                       <li><a href="index.pl?page=allianceStatus">Alliance status</a></li>
+                       <li><a href="index.pl?page=memberIntel">Member Intel</a></li>
                        <li><a href="index.pl?page=allianceRes">Alliance resources</a></li>
                </ul>
                </TMPL_IF>