changeset 258:8a8bd1d4a51c gmap2

Some more work on setup process. Still missing some pieces.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 12 Apr 2014 09:07:34 +0300
parents 3729d8871b50
children 90e8d193cc90
files tools/makegmaps.php
diffstat 1 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tools/makegmaps.php	Sat Apr 12 08:20:05 2014 +0300
+++ b/tools/makegmaps.php	Sat Apr 12 09:07:34 2014 +0300
@@ -16,7 +16,7 @@
 
   "pathMapUtils" => array(2, "maputils/", "Path for maputils directory tree."),
   "pathImageCache" => array(2, "cache/", "Image cache directory."),
-  "pathMarkerData" => array(2, "../", "Path to marker data files."),
+  "pathGMap" => array(2, "../", "Path to map main directory and marker data files."),
   "pathTileData" => array(2, "../tiles/", "Path to map tiles directory structure."),
 
   "pathRawMaps" => array(3, FALSE, "Path to the raw ASCII maps."),
@@ -277,6 +277,15 @@
     echo "\n";
   }
 
+  $cfg["gmapsKey"] = stInputPrompt(
+    "Enter your Google Maps API key (or leave empty, and edit later)\n",
+    FALSE, FALSE);
+
+  echo
+    "\nNext up are some files and paths. All of them can be safely\n".
+    "left to their default values (e.g. just press <enter>) unless\n".
+    "you know you want something set differently.\n\n";
+  
   stQueryConfigItems(1);
   stQueryConfigItems(2);
 
@@ -287,16 +296,24 @@
   stQueryConfigItems(3);
 
 
-  stOutputToFile($gmapsConfig, "<?\n\$cfg = ".var_export($cfg, TRUE)."\n?>");
+  stOutputToFile($gmapsConfig, "<?php\n\$cfg = ".var_export($cfg, TRUE)."\n?>");
+
+  stOutputToFile($cfg["pathGMap"]."config.inc.php", 
+  "<?php\n".
+  "\$pageBaseURL = \"".$cfg["pageBaseURL"]."\";\n".
+  "\$gmapsKey = \"".$cfg["gmapsKey"]."\";\n".
+  "\$gmapsVersion = \"3\";\n".
+  "?>\n");
 }
 
 
 //
 // Set rest of the paths etc
 //
-$worldJS = $cfg["pathMarkerData"]."world.js";
-$tradelaneOut = $cfg["pathMarkerData"]."tradelane.json";
-$tradelaneOverlay = $cfg["pathMarkerData"]."trlines.json";
+$pathTileData = $cfg["pathGMap"]."tiles/";
+$worldJS = $cfg["pathGMap"]."world.js";
+$tradelaneOut = $cfg["pathGMap"]."tradelane.json";
+$tradelaneOverlay = $cfg["pathGMap"]."trlines.json";
 $binMkLoc = $cfg["pathMapUtils"]."mkloc";
 $rawSuffix = ".new";
 $rawAltSuffix = ".map";
@@ -402,7 +419,7 @@
 
 foreach ($modes as $mode => $mdata)
 {
-  $tmp = escapeshellcmd($binMkLoc)." -v -o ".escapeshellarg($cfg["pathMarkerData"].$mdata[0])." -G ".$mode." ";
+  $tmp = escapeshellcmd($binMkLoc)." -v -o ".escapeshellarg($cfg["pathGMap"].$mdata[0])." -G ".$mode." ";
 
   foreach ($continentList as $name => $data)
   {