summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-02-17 16:43:25 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-02-17 16:43:25 -0800
commitd51b87d9a31f5914fe8509e6ac47eace1872d0ba (patch)
tree5221e63d08af6e7b6ec3cd278d691ea65cab259c
parente12ea632b28d9a0cba7c002fe37edc42bf291777 (diff)
downloadpathery-d51b87d9a31f5914fe8509e6ac47eace1872d0ba.tar.xz
Active maps now have a different color in the scoreboard.
-rw-r--r--ajax/maps.ajax.php17
-rw-r--r--css/stats.css6
-rw-r--r--pages/scores.php16
3 files changed, 26 insertions, 13 deletions
diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php
index 31c041c..bd060fe 100644
--- a/ajax/maps.ajax.php
+++ b/ajax/maps.ajax.php
@@ -9,11 +9,11 @@ $tmp = explode(".", $_GET['mapid']);
$mapID = $tmp[0] * 1;
if (!is_int($mapID)) exit;
-//$map = new map(getMapCode($mapID), $mapID);
$map = getMapObjectByID($mapID);
-//62 days
-$expires = 62*24*60*60;
+$expires = 365*24*60*60;
+//TODO: Remove this line once we're confident in data in the mapObject.
+$expires = 1*24*60*60;
header("Cache-Control: public, maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
header("Content-type: text/javascript");
@@ -22,21 +22,20 @@ echo json_encode($map);
function getMapObjectByID($mapID) {
include_once('../includes/sqlEmbedded.php');
include_once('../includes/maps.php');
- $sql = "SELECT `code`, `name`
+ $sql = "SELECT `code`, `name`, `mapExpireTime`
FROM `maps`
- WHERE `ID` = '$mapID'
+ INNER JOIN `mapOfTheDay` ON mapID = maps.ID
+ WHERE maps.ID = '$mapID'
";
$result = mysql_query($sql);
if (mysql_num_rows($result) > 0) {
- list($code, $name) = mysql_fetch_row($result);
+ list($code, $name, $mapExpireTime) = mysql_fetch_row($result);
$map = new map($code, $mapID);
$map->name = $name;
- //$map->name = "bobs";
+ $map->dateExpires = $mapExpireTime;
return $map;
}
}
-
-
?> \ No newline at end of file
diff --git a/css/stats.css b/css/stats.css
index c214726..18f3708 100644
--- a/css/stats.css
+++ b/css/stats.css
@@ -84,6 +84,12 @@
background-color:#445;
}
+.mapThumbnail.current {
+ background-color:#557;
+}
+.mapThumbnail.current:hover {
+ background-color:#668;
+}
table {
diff --git a/pages/scores.php b/pages/scores.php
index cf33b49..f995e62 100644
--- a/pages/scores.php
+++ b/pages/scores.php
@@ -200,10 +200,6 @@ var Tile = {"Wall" : "w",
"SinglePath" : "o"};
function mapThumbnailHTML(map, targetWidth) {
- var r = '';
- r += "<div class='mapThumbnail' onclick='displayMapScores("+map.ID+")'>";
- r += map.name;
-
if (!targetWidth) targetWidth = 100;
var scale = map.width / targetWidth;
@@ -215,6 +211,18 @@ function mapThumbnailHTML(map, targetWidth) {
var mapgrid = '';
+ var mapClass = '';
+ var toolTip = 'Inactive map';
+ var mapDate = new Date(map.dateExpires + " PST");
+ if (mapDate.getTime() > serverTime.getTime()) {
+ mapClass = ' current';
+ toolTip = 'Active map';
+ }
+
+ var r = '';
+ r += "<div class='mapThumbnail"+mapClass+"' title='"+toolTip+"'; onclick='displayMapScores("+map.ID+")'>";
+ r += map.name;
+
mapgrid += '<div class="map" style="width:'+width+'px; height:'+height+'px">';
for (var y in map.tiles) {
for (var x in map.tiles[y]) {