]> ruin.nu Git - ndwebbie.git/commitdiff
color for defense priority
authorMichael Andreen <harv@ruin.nu>
Tue, 19 Dec 2006 20:49:12 +0000 (20:49 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 19 Dec 2006 20:49:12 +0000 (20:49 +0000)
calls.pl
nd.css
templates/calls.tmpl

index e6153a1741fd1df2060bc28b8690104cad987706..0b843dfdb09dd910ad4e3481cced2294f39a4914 100644 (file)
--- a/calls.pl
+++ b/calls.pl
@@ -170,6 +170,10 @@ ORDER BY p.x,p.y,p.z});
        }elsif (param('show') eq 'uncovered'){
                $where = 'not covered';
        }
+       my $pointlimits = $DBH->prepare(q{SELECT value :: int FROM misc WHERE id = ?});
+       my ($minpoints) = $DBH->selectrow_array($pointlimits,undef,'DEFMIN');
+       my ($maxpoints) = $DBH->selectrow_array($pointlimits,undef,'DEFMAX');
+
        my $query = $DBH->prepare(qq{
 SELECT c.id, coords(p.x,p.y,p.z), u.defense_points, c.landing_tick, 
        TRIM('/' FROM concat(p2.race||' /')) AS race, TRIM('/' FROM concat(i.amount||' /')) AS amount,
@@ -190,6 +194,13 @@ ORDER BY c.landing_tick DESC
        my @calls;
        my $i = 0;
        while (my $call = $query->fetchrow_hashref){
+               if ($call->{defense_points} < $minpoints){
+                       $call->{DefPrio} = 'LowestPrio';
+               }elsif ($call->{defense_points} < $maxpoints){
+                       $call->{DefPrio} = 'MediumPrio';
+               }else{
+                       $call->{DefPrio} = 'HighestPrio';
+               }
                $i++;
                $call->{ODD} = $i % 2;
                $call->{shiptype} = escapeHTML($call->{shiptype});
diff --git a/nd.css b/nd.css
index 869c7baa0e957c330030f16118d2ab6ff3facdd6..dde4cf75dae0a01dbad7e6e64701a34d87a25c91 100644 (file)
--- a/nd.css
+++ b/nd.css
@@ -132,3 +132,16 @@ div.clear {
        line-height: 0.0;
        font-size: 1px;
 }
+
+td.LowestPrio{
+       background: red;
+       color: black;
+}
+td.MediumPrio{
+       background: yellow;
+       color: black;
+}
+td.HighestPrio{
+       background: green;
+       color: black;
+}
index da9420cd3b2bd32840a38cd1a24826446e09c3d8..b1f4f0d5b7de097e1f94d63376fb91d400e94b6a 100644 (file)
@@ -73,7 +73,7 @@
 <TMPL_LOOP Calls>
        <tr align="center" class="<TMPL_IF ODD>odd<TMPL_ELSE>even</TMPL_IF>">
                <td><a href="index.pl?page=calls&amp;call=<TMPL_VAR NAME=Id>"><TMPL_VAR NAME=Id></a></td>
-               <td><TMPL_VAR NAME=Coords> (<TMPL_VAR NAME=Defense_points>)</td>
+               <td class='<TMPL_VAR NAME=DefPrio>'><TMPL_VAR NAME=Coords> (<TMPL_VAR NAME=Defense_points>)</td>
                <td><TMPL_VAR NAME=Landing_tick></td>
                <td><TMPL_VAR NAME=Race></td>
                <td><TMPL_VAR NAME=Amount></td>