changeset 1676:8d1c971ba148

Add simple location list PHP and CSS.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Apr 2017 17:29:42 +0300
parents 006a1a577146
children 9d51b4138e7d
files www/simple.css www/simple.php
diffstat 2 files changed, 189 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/simple.css	Tue Apr 25 17:29:42 2017 +0300
@@ -0,0 +1,58 @@
+body {
+	margin: 1em;
+	font-family: Verdana, Arial, helvetica, sans-serif;
+	font-size: 10pt;
+	color: black;
+}
+
+table.loc {
+	width: 100%;
+}
+
+table.loc a, table.loc a:visited, table.loc a:active  {
+	text-decoration: none;
+	color: black;
+}
+
+table.loc a:hover {
+	text-decoration: underline;
+}
+
+table.loc td {
+	background: #eee;
+	border: 1px solid black;
+	padding: 0.2em;
+}
+
+table.loc td.name {
+	width: 15%;
+}
+
+table.loc td.continent {
+	width: 5%;
+}
+
+
+table.loc td.coords {
+	width: 5%;
+	min-width: 6em;
+}
+
+table.loc td.altnames {
+	width: 15%;
+}
+
+table.loc td.desc {
+	width: 40%;
+}
+
+.laenor { background: #955 !important; }
+.rothikgen { background: #595 !important; }
+.lucentium { background: #559 !important; }
+.desolathya { background: #599 !important; }
+.furnachia { background: #959 !important; }
+.renardy { background: #c70 !important; }
+.tormentas { background: #7a0 !important; }
+.hcbat { background: #444 !important; }
+.special { background: #a06 !important; }
+.all { background: #0af !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/simple.php	Tue Apr 25 17:29:42 2017 +0300
@@ -0,0 +1,131 @@
+<?php
+require "config.inc.php";
+require "world.inc.php";
+require "common.inc.php";
+
+$locTable = apc_fetch("loc_locTable");
+if (empty($locTable))
+{
+  $locTable = mpReadLocationFiles(FALSE, "F");
+  apc_store("loc_locTable", $locTable, 3600);
+}
+
+
+// Make alphabetically sorted table of locations
+$alphaTable = [];
+foreach ($locTable as $id => $data)
+if (isset($data["name"]))
+{
+  $idx = $data["name"][0];
+  $alphaTable[$idx][] = $data;
+}
+
+ksort($alphaTable, SORT_STRING);
+
+
+//
+// Start of the page
+//
+$pageCSS = "simple.css";
+cmPrintPageHeader($pageTitle." - Simple locations list",
+  "  <meta name=\"robots\" content=\"nofollow\" />\n", FALSE);
+
+//
+// Print list of locations
+//
+if (count($alphaTable) > 0)
+{
+  $locationTips = [];
+  $totalLoc = 0;
+  $maxRow = 6;
+  foreach ($alphaTable as $alpha => $alphaLocs)
+  {
+    if (count($alphaLocs) <= 0) continue;
+    $letter = strtoupper($alpha);
+
+    asort($alphaLocs);
+    
+    echo
+      "<h3 class=\"alpha\"><a id=\"ch".$letter."\"></a>".$letter."</h3>\n".
+      "<table class=\"loc\">\n";
+ 
+    $n = 0;
+    foreach ($alphaLocs as $ik => $iv)
+    {
+      $totalLoc++;
+
+      // Print location entry
+      echo
+        " <tr>\n".
+        "  <td class=\"name\">".mpGetMapLink($iv, $continentList[$iv["continent"]][4], FALSE)."</td>\n".
+        "  <td class=\"continent ".$iv["continent"]."\">".$iv["continent"]."</td>\n".
+        "  <td class=\"coords\">".$iv["x"].", ".$iv["y"]."</td>\n";
+
+      // Alternative names
+      $alt = "";
+      if (($nnames = count($iv["names"])) > 1)
+      {
+        $fs = [];
+        for ($nname = 1; $nname < $nnames; $nname++)
+        {
+          $norig = $iv["names"][$nname]["flags"] & NAME_ORIG;
+          $fs[] =
+            ($norig ? "<b>" : "").
+            chentities($iv["names"][$nname]["name"]).
+            ($norig ? "</b>" : "");
+        }
+        $alt = implode(" | ", $fs);
+      }
+      echo "  <td class=\"altnames\">".$alt."</td>\n";
+        
+      // If either freeform desc or URL field are set, we add those
+      $desc = "";
+      if (isset($iv["freeform"]))
+      {
+        // Free form description
+        $desc = isset($iv["freeform"]) ? chentities($iv["freeform"]) : "";
+      }
+      echo "  <td class=\"desc\">".$desc."</td>\n";
+
+      // Coder / society names
+      $coders = "";
+      if (count($iv["coders"]) > 0)
+      {
+        $fs = [];
+        foreach ($iv["coders"] as $name)
+        {
+          // Tags/flags of this coder in relation to the area
+          switch ($name["flags"])
+          {
+            case NAME_ORIG:       $qs = "title=\"Original creator\" class=\"wizorig\""; break;
+            case NAME_RECODER:    $qs = "title=\"Converter, recoder\" class=\"wizrecoder\""; break;
+            case NAME_MAINTAINER: $qs = "title=\"Maintainer\" class=\"wizmaintainer\""; break;
+            case NAME_EXPANDER:   $qs = "title=\"Implemented new content, expansion(s)\" class=\"wizexpander\""; break;
+            default: $qs = "";
+          }
+          $fs[] = $name["name"];
+        }
+        $coders = implode(", ", $fs);
+      }
+        
+      echo
+        "  <td class=\"coders\">".$coders."</td>\n".
+        " </tr>\n";
+    }
+
+    echo "</table>\n";
+  }
+  
+  echo
+    "<p><b>".$totalLoc."</b> locations.</p>\n";
+}
+else
+{
+  echo
+    "<p><b>No locations known!</b></p>\n";
+
+  stError("No locations known!");
+}
+
+cmPrintPageFooter(FALSE);
+?>
\ No newline at end of file