From d51b87d9a31f5914fe8509e6ac47eace1872d0ba Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Sun, 17 Feb 2013 16:43:25 -0800 Subject: Active maps now have a different color in the scoreboard. --- ajax/maps.ajax.php | 17 ++++++++--------- css/stats.css | 6 ++++++ pages/scores.php | 16 ++++++++++++---- 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 += "
"; - 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 += "
"; + r += map.name; + mapgrid += '
'; for (var y in map.tiles) { for (var x in map.tiles[y]) { -- cgit v1.2.3