]> ruin.nu Git - ndwebbie.git/commitdiff
minor things
authorMichael Andreen <harv@ruin.nu>
Tue, 19 Dec 2006 13:13:24 +0000 (13:13 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 19 Dec 2006 13:13:24 +0000 (13:13 +0000)
15 files changed:
alliances.pl
calls.pl
covop.pl
include.pl
index.pl
intel.pl
memberIntel.pl
nd.css
points.pl
raid.js
resources.pl
templates/skel.tmpl
templates/targetlist.tmpl
top100.pl
users.pl

index 62aae64f71ad2b7a98c5e8e5e81df5012773a30b..66ecfd68789dac710c85596b6b507692691cbc34 100644 (file)
@@ -84,9 +84,9 @@ ORDER BY $order});
        $members->execute($alliance->{id});
        my $i = 0;
        while (my $member = $members->fetchrow_hashref){
+               $i++;
                $member->{ODD} = $i % 2;
                push @members,$member;
-               $i++;
        }
        $BODY->param(Members => \@members);
 
@@ -105,9 +105,9 @@ ORDER BY $order});
                }else{
                        $intel->{missionclass} = $intel->{mission};
                }
+               $i++;
                $intel->{ODD} = $i % 2;
                push @intel,$intel;
-               $i++;
        }
        $BODY->param(Intel => \@intel);
 }else{
@@ -131,10 +131,10 @@ ORDER BY $order
        my @alliances;
        my $i = 0;
        while (my $alliance = $query->fetchrow_hashref){
+               $i++;
                next if ($alliance->{score} < 1 && $alliance->{kscore} < 1);
                $alliance->{ODD} = $i % 2;
                push @alliances, $alliance;
-               $i++;
        }
        $BODY->param(Alliances => \@alliances);
 }
index ad7e13c449c20ed2cc8506a9e0b5831d33691c28..e6153a1741fd1df2060bc28b8690104cad987706 100644 (file)
--- a/calls.pl
+++ b/calls.pl
@@ -190,10 +190,10 @@ ORDER BY c.landing_tick DESC
        my @calls;
        my $i = 0;
        while (my $call = $query->fetchrow_hashref){
+               $i++;
                $call->{ODD} = $i % 2;
                $call->{shiptype} = escapeHTML($call->{shiptype});
                push @calls, $call;
-               $i++;
        }
        $BODY->param(Calls => \@calls);
 }
index 9c8284d33ddeba4ec3f11b654268045e8d885bec..0614da0d4e5ca22d9ee64acbf092cd009c10300d 100644 (file)
--- a/covop.pl
+++ b/covop.pl
@@ -59,10 +59,10 @@ $query->execute($ND::PLANET);
 my @targets;
 my $i = 0;
 while (my ($id,$coords,$metal,$crystal,$eonium,$seccents,$dists,$lastcovop,$user,$max) = $query->fetchrow){
+       $i++;
        push @targets,{Username => $user, Target => $id, Coords => $coords
                , Metal => $metal, Crystal => $crystal, Eonium => $eonium, SecCents => $seccents
                , Dists => $dists, MaxResHack => $max, LastCovOp => $lastcovop, List => $list, ODD => $i % 2};
-       $i++;
 }
 $BODY->param(Targets => \@targets);
 
index c5a5acf39417f6d525837f284a0c837eea5a62f2..0bf16a8c3510283014b5f2f0346f9087f7e77f3d 100644 (file)
@@ -67,7 +67,7 @@ sub max {
 }
 
 sub listTargets {
-       my $query = $ND::DBH->prepare(qq{SELECT t.id, r.id AS raid, r.tick+c.wave-1 AS landingtick, released_coords, coords(x,y,z),c.launched,c.wave
+       my $query = $ND::DBH->prepare(qq{SELECT t.id, r.id AS raid, r.tick+c.wave-1 AS landingtick, released_coords, coords(x,y,z),c.launched,c.wave,c.joinable
 FROM raid_claims c
        JOIN raid_targets t ON c.target = t.id
        JOIN raids r ON t.raid = r.id
@@ -80,7 +80,9 @@ ORDER BY r.tick+c.wave,x,y,z});
                my $coords = "Target $target->{id}";
                $coords = $target->{coords} if $target->{released_coords};
                push @targets,{Coords => $coords, Launched => $target->{launched}, Raid => $target->{raid}
-                       , Target => $target->{id}, Tick => $target->{landingtick}, Wave => $target->{wave}, AJAX => $ND::AJAX};
+                       , Target => $target->{id}, Tick => $target->{landingtick}, Wave => $target->{wave}
+                       , AJAX => $ND::AJAX, JoinName => $target->{joinable} ? 'N' : 'J'
+                       , Joinable => $target->{joinable} ? 'FALSE' : 'TRUE'};
        }
        my $template = HTML::Template->new(filename => "templates/targetlist.tmpl");
        $template->param(Targets => \@targets);
index 3d324604456016bccdcc95d625e41f59b03482e3..ecb27a21cb7d38cdcbd384c4677d8a75156de78b 100755 (executable)
--- a/index.pl
+++ b/index.pl
@@ -120,7 +120,7 @@ $USER = undef;
 $PLANET = undef;
 $TEMPLATE = undef;
 $TICK = undef;
-%GROUPS = undef;
+undef %GROUPS;
 $ND::BODY = undef;
 
 exit;
index c1beff473da2c6281a714af4d1fe9e2d4d9ed25d..90498c29dd5307b56cfe8af6e2779956f59f3153 100644 (file)
--- a/intel.pl
+++ b/intel.pl
@@ -143,9 +143,9 @@ if ($planet){
                }else{
                        $intel->{missionclass} = $intel->{mission};
                }
+               $i++;
                $intel->{ODD} = $i % 2;
                push @intel,$intel;
-               $i++;
        }
        push @intellists,{Message => 'Incoming fleets', Intel => \@intel, Origin => 1};
 
@@ -159,9 +159,9 @@ if ($planet){
                }else{
                        $intel->{missionclass} = $intel->{mission};
                }
+               $i++;
                $intel->{ODD} = $i % 2;
                push @intel,$intel;
-               $i++;
        }
        push @intellists,{Message => 'Outgoing Fleets', Intel => \@intel, Target => 1};
 
@@ -184,9 +184,9 @@ if ($planet){
                }else{
                        $intel->{missionclass} = $intel->{mission};
                }
+               $i++;
                $intel->{ODD} = $i % 2;
                push @intel,$intel;
-               $i++;
        }
        push @intellists,{Message => q{Intel where alliances doesn't match}, Intel => \@intel, Origin => 1, Target => 1};
        $BODY->param(IntelLIsts => \@intellists);
index 98d6738f0532122d7a291c489aae6ece6667ee62..db7c939f66f25f6071ac12ae33102ca4e4a62c24 100644 (file)
@@ -47,9 +47,9 @@ while (my $intel = $query->fetchrow_hashref){
        }else{
                $intel->{missionclass} = $intel->{mission};
        }
+       $i++;
        $intel->{ODD} = $i % 2;
        push @intel,$intel;
-       $i++;
 }
 push @intellists,{Message => 'Incoming fleets', Intel => \@intel, Origin => 1};
 
@@ -63,9 +63,9 @@ while (my $intel = $query->fetchrow_hashref){
        }else{
                $intel->{missionclass} = $intel->{mission};
        }
+       $i++;
        $intel->{ODD} = $i % 2;
        push @intel,$intel;
-       $i++;
 }
 push @intellists,{Message => 'Outgoing Fleets', Intel => \@intel, Target => 1};
 
diff --git a/nd.css b/nd.css
index 1d1d9ac188a8950c460f293c84b621e846973439..869c7baa0e957c330030f16118d2ab6ff3facdd6 100644 (file)
--- a/nd.css
+++ b/nd.css
@@ -1,5 +1,5 @@
 body {
-       padding-left: 12em;
+       padding-left: 14em;
        /*padding-right: 12em;*/
        font-family: sans-serif;
        color: black;
@@ -9,7 +9,7 @@ body {
        padding: 0;
        margin: 0;
        position: absolute;
-       width: 10em;
+       width: 14em;
        top: 1em;
 }
 #leftbar{
@@ -28,7 +28,7 @@ p.claimlinks{
 
 ul.linkbar {
        list-style-type: none;
-       width: 10em;
+       width: 13.5em;
        padding: 0;
        margin: 0;
 }
@@ -42,8 +42,11 @@ ul.linkbar li {
 ul.linkbar a {
        text-decoration: none;
 }
-input.coord {
-       width: 3.5em;
+input.coordsinput {
+       width: 4em;
+}
+input.small {
+       width: 1.7em;
 }
 tr.odd {
        background: white;
index 464ad18f79efe85872e0a941dc0f430a74a86491..6d33689f37d6fef5cd88b7e24f8211082ff696a5 100644 (file)
--- a/points.pl
+++ b/points.pl
@@ -45,9 +45,9 @@ $query->execute;
 my @members;
 my $i = 0;
 while (my ($username,$defense,$attack,$scan,$humor,$total,$rank) = $query->fetchrow){
+       $i++;
        push @members,{Username => $username, Defense => $defense, Attack => $attack
                , Scan => $scan, Humor => $humor, Total => $total, Rank => $rank, ODD => $i % 2};
-       $i++;
 }
 $BODY->param(Members => \@members);
 
diff --git a/raid.js b/raid.js
index 99204f4e62126ead6fba0cbdf9ba7f4620154467..ecebcbdb085813f7af37bc0eef802ae5410c2d96 100644 (file)
--- a/raid.js
+++ b/raid.js
@@ -65,7 +65,7 @@ function listTargets(dataSource){
                        var obj = document.getElementById("targets");
                        if (obj){
                                clearObject(obj);
-                               var re = new RegExp("targetlist>(.*)</targetlist", "m");
+                               var re = new RegExp("targetlist>((.|\\n)*)</targetlist");
                                if(re.test(http.responseText))
                                        obj.innerHTML = RegExp.$1;
                        }
index 5e63b7a5d3d6583c405101a982b668f39cf5ff97..486cc13eab8cb48d21606e9a7d5d1a11832b89da 100644 (file)
@@ -50,9 +50,9 @@ $query->execute;
 my @alliances;
 my $i = 0;
 while (my $alliance = $query->fetchrow_hashref){
+       $i++;
        $alliance->{ODD} = $i % 2;
        push @alliances,$alliance;
-       $i++
 }
 $BODY->param(Alliances => \@alliances);
 
index e4bb01977f4cf5bbad0e3a22604e0e244fbb8567..c554c28a72710cb0c4a5ff3d1a46e50d3804c205 100644 (file)
@@ -31,8 +31,8 @@
                <ul class="linkbar">
                        <li><form action="index.pl" method="post"><p>
                                <input type="hidden" name="page" value="check"/>
-                               <input class="coord" type="text" name="coords" value="<TMPL_VAR NAME=Coords>"/>
-                               <input class="coord" type="submit" value="Check"/>
+                               <input class="coordsinput" type="text" name="coords" value="<TMPL_VAR NAME=Coords>"/>
+                               <input class="coordsbutton" type="submit" value="Check"/>
                                </p></form></li>
                        <li><a href="index.pl?page=raids">Web raids</a></li>
                </ul>
index 0fd2a737ac925a02a6a653ee2b7c92a54ccc5660..a3584ff7e5579067944f4da5e43550896b930d44 100644 (file)
@@ -1,3 +1,6 @@
+<p><input type="button" value="Update target list"
+               onclick = "listTargets('index.pl?page=raids&amp;xml=1')"/>
+</p>
 <TMPL_IF Targets>
 <table>
        <tr><th>Target</th><th>Tick</th></tr>
@@ -8,8 +11,11 @@
                <td><a href="raids.php?raid=<TMPL_VAR NAME=Raid>#target<TMPL_VAR NAME=Target>">
                        <TMPL_VAR NAME=Tick></a></td>
                <td><TMPL_UNLESS AJAX><a href="index.pl?page=raids&amp;raid=<TMPL_VAR NAME=Raid>&amp;cmd=Unclaim&amp;target=<TMPL_VAR NAME=Target>&amp;wave=<TMPL_VAR NAME=Wave>" >U</a>
-                       <TMPL_ELSE><input type="button" value="U" onclick = 
+                       <TMPL_ELSE>
+                               <input type="button" value="U" class="small" onclick = 
                                "claim('index.pl?page=raids&amp;xml=1&amp;raid=<TMPL_VAR NAME=Raid>',<TMPL_VAR NAME=Target>,<TMPL_VAR NAME=Wave>,'Unclaim')"/>
+                               <input type="button" class="small" value="<TMPL_VAR NAME=JoinName>" onclick = 
+                               "claim('index.pl?page=raids&amp;xml=1&amp;raid=<TMPL_VAR NAME=Raid>',<TMPL_VAR NAME=Target>,<TMPL_VAR NAME=Wave>,'set&amp;joinable=<TMPL_VAR NAME=Joinable>')"/>
                        </TMPL_UNLESS>
                </td>
        </tr>
index 20b0bd1f8c8b582282f30444b997a53742320732..455312c810e70f92b2e375ebc05a34a42095b7c0 100644 (file)
--- a/top100.pl
+++ b/top100.pl
@@ -68,9 +68,9 @@ while (my ($id,$coords,$ruler,$planet,$race,$size,$score,$value,$xp,$sizerank,$s
                $planet{Relationship} = $relationship;
                $planet{isHC} = 1;
        }
+       $i++;
        $planet{ODD} = $i % 2;
        push @planets,\%planet;
-       $i++;
 }
 $BODY->param(Planets => \@planets);
 
index 3425c247dcdb1d713160c2ba585b8e0de363e6bc..6ed91d80bb3a32fdc5d1756bb749c3eeaa0fe892 100644 (file)
--- a/users.pl
+++ b/users.pl
@@ -115,9 +115,9 @@ $BODY->param(AddGroups => \@addgroups);
        my @users;
        my $i = 0;
        while (my $user = $query->fetchrow_hashref){
+               $i++;
                $user->{ODD} = $i % 2;
                push @users, $user;
-               $i++;
        }
        $BODY->param(Users => \@users);
 }