Mercurial > hg > batmud > maputils
changeset 908:2e88bf27e360
Sync.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 15 Apr 2010 16:06:14 +0000 |
parents | 1aedae5acd82 |
children | 4f3959180974 |
files | www/index.php www/loc.php |
diffstat | 2 files changed, 64 insertions(+), 65 deletions(-) [+] |
line wrap: on
line diff
--- a/www/index.php Thu Apr 15 16:04:42 2010 +0000 +++ b/www/index.php Thu Apr 15 16:06:14 2010 +0000 @@ -144,8 +144,8 @@ </tr> <? $n = 0; -foreach ($continentList as $file => $map) - printLine($n++, $file, $map[0]); +foreach ($continentList as $continent => $data) + printLine($n++, $continent, $data[0]); ?> </table>
--- a/www/loc.php Thu Apr 15 16:04:42 2010 +0000 +++ b/www/loc.php Thu Apr 15 16:06:14 2010 +0000 @@ -153,11 +153,11 @@ echo " <td class=\"img\"><img src=\"".$s."\" alt=\"".$coderName."\" /></td>\n"; - echo " <td class=\"info\">\n"; - echo " <h2>".$coderName."</h2>\n"; + echo " <td class=\"info\">\n". + " <h2>".$coderName."</h2>\n"; $s = $wizTable[$coderName]["desc"]; - if (isset($s) > 0) { + if (isset($s)) { echo " <p>".$s."</p>\n"; } @@ -203,69 +203,69 @@ $locationTips = array(); $totalLoc = 0; $maxRow = 6; - foreach ($alphaTable as $key => $value) { - if (count($value) <= 0) continue; + foreach ($alphaTable as $alpha => $alphaLocs) { + if (count($alphaLocs) <= 0) continue; - asort($value); + asort($alphaLocs); - echo "<h3><a name=\"".strtolower($key)."\"></a>".$key."</h3>\n". + echo "<h3><a name=\"".strtolower($alpha)."\"></a>".$alpha."</h3>\n". "<table class=\"loc\" width=\"95%\">\n"; $n = 0; - foreach ($value as $ik => $iv) { + foreach ($alphaLocs as $ik => $iv) { if ($n == 0) echo " <tr>\n"; - $totalLoc++; + $totalLoc++; - // Print location entry - printf(" <td width=\"%d%%\" class=\"%s\">", - (100 / $maxRow), $iv["continent"]); + // Print location entry + printf(" <td width=\"%d%%\" class=\"%s\">", + (100 / $maxRow), $iv["continent"]); - if (isset($specialList[$iv["continent"]]) && !$specialList[$iv["continent"]][1]) { - echo "<b>".htmlentities($iv["name"])."</b>"; + if (isset($specialList[$iv["continent"]]) && !$specialList[$iv["continent"]][1]) { + echo "<b>".htmlentities($iv["name"])."</b>"; + } else { + printURL($iv["continent"].".html#loc".$iv["x"]."_".$iv["y"]); + echo htmlentities($iv["name"])."</a>"; + } + + // If either freeform desc or URL field are set, we add those + if (isset($iv["url"]) || isset($iv["freeform"])) { + // Free form description + $desc = isset($iv["freeform"]) ? htmlentities($iv["freeform"]) : ""; + + // Add URL information, chopped, if any + if (isset($iv["url"])) { + $urlEnt = $iv["url"]; + $urlBegin = "<a href=\"".htmlentities($urlEnt)."\" target=\"_blank\">"; + $urlEnd = "</a>"; + if (strlen($iv["url"]) > 40) + $urlEnt = substr($urlEnt, 0, 40)."..."; + $desc .= "<br /><br /><b>".htmlentities($urlEnt)."</b>"; } else { - printURL($iv["continent"].".html#loc".$iv["x"]."_".$iv["y"]); - echo htmlentities($iv["name"])."</a>"; + $urlBegin = $urlEnd = ""; } - - if (isset($iv["url"]) || isset($iv["freeform"])) { - if (isset($iv["freeform"])) - $desc = htmlentities($iv["freeform"]); - else - $desc = ""; - if (isset($iv["url"])) { - $urlEnt = $iv["url"]; - $urlBegin = "<a href=\"".htmlentities($urlEnt)."\" target=\"_blank\">"; - $urlEnd = "</a>"; - if (strlen($iv["url"]) > 40) - $urlEnt = substr($urlEnt, 0, 40)."..."; - $desc .= "<br /><br /><b>".htmlentities($urlEnt)."</b>"; - } else { - $urlBegin = $urlEnd = ""; - } - - echo " ".$urlBegin."<img class=\"noborder\" src=\"question.png\" onmouseover=\"stt(".$totalLoc. - ");\" onmouseout=\"htt();\" alt=\"(?)\" />".$urlEnd."\n"; + echo " ".$urlBegin."<img class=\"noborder\" src=\"question.png\" onmouseover=\"stt(".$totalLoc. + ");\" onmouseout=\"htt();\" alt=\"(?)\" />".$urlEnd."\n"; - $locationTips[$totalLoc] = array( - "title" => $iv["name"], - "desc" => $desc - ); - } + $locationTips[$totalLoc] = array( + "title" => $iv["name"], + "desc" => $desc + ); + } - // Alternative names - if (count($iv["names"]) > 0) { - echo "<br />".htmlentities(implode(" | ", $iv["names"])); - } + // Alternative names + if (count($iv["names"]) > 0) { + echo "<br />".htmlentities(implode(" | ", $iv["names"])); + } - // Coder / society names - if (count($iv["coders"]) > 0 && $showCoders) { - $isSG = preg_match("/[SG]/", $iv["flags"]); - if ((!isset($coderName) && !$isSG) || isset($coderName)) { + // Coder / society names + if (count($iv["coders"]) > 0 && $showCoders) { + $isSG = preg_match("/[SG]/", $iv["flags"]); + if ((!isset($coderName) && !$isSG) || isset($coderName)) { $fs = ""; - while (list($fKey, $fVal) = each($iv["coders"])) { + foreach ($iv["coders"] as $fKey => $fVal) { if ($fs != "") $fs .= ", "; if ($filter != "C" || !$applyFilter) $fs .= "<a href=\"".$_SERVER["PHP_SELF"]."?a=".$fVal."\">".$fVal."</a>"; @@ -273,24 +273,23 @@ $fs .= $fVal; } echo "<br />[".$fs."]"; - } } + } - echo "</td>\n"; + echo "</td>\n"; - $n++; - if ($n >= $maxRow) { - echo " </tr>\n"; - $n = 0; - } - } - if ($n > 0) { - while ($n++ < $maxRow) - echo " <td></td>\n"; - + if (++$n >= $maxRow) { echo " </tr>\n"; - } - echo "</table>\n"; + $n = 0; + } + } + + if ($n > 0) { + while ($n++ < $maxRow) + echo " <td></td>\n"; + echo " </tr>\n"; + } + echo "</table>\n"; } echo "<p><b>".$totalLoc."</b> locations.</p>\n";