diff options
-rwxr-xr-x | api_openlayers.js | 16 | ||||
-rwxr-xr-x | auth.php | 5 | ||||
-rwxr-xr-x | config.php | 4 | ||||
-rwxr-xr-x | index.php | 33 | ||||
-rwxr-xr-x | lang.php | 12 | ||||
-rwxr-xr-x | main.css | 2 | ||||
-rwxr-xr-x | main.js | 27 |
7 files changed, 91 insertions, 8 deletions
diff --git a/api_openlayers.js b/api_openlayers.js index 3df53bd..228eff5 100755 --- a/api_openlayers.js +++ b/api_openlayers.js @@ -66,12 +66,20 @@ function init() { 'http://c.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png']); map.addLayer(osmapa); } + if (layer_ump==1) { + // UMP + var ump = new OpenLayers.Layer.OSM('UMP', + ['http://1.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png', + 'http://2.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png', + 'http://3.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png']); + map.addLayer(ump); + } var position = new OpenLayers.LonLat(21.01,52.23).transform(wgs84, mercator); var zoom = 8; map.setCenter(position, zoom); // init layers - layerTrack = new OpenLayers.Layer.Vector( 'Track' ); - layerMarkers = new OpenLayers.Layer.Markers( 'Markers' ); + layerTrack = new OpenLayers.Layer.Vector('Track'); + layerMarkers = new OpenLayers.Layer.Markers('Markers'); } function displayTrack(xml,update) { altitudes.length = 0; @@ -167,8 +175,8 @@ function setMarker(p,i,posLen) { return function() { // remove popups if (map.popups.length>0) { - for (var i = map.popups.length-1; i>=0; i-- ) { - map.removePopup(map.popups[i]) + for (var j = map.popups.length-1; j>=0; j-- ) { + map.removePopup(map.popups[j]) }; } // show popup @@ -18,6 +18,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ require_once("config.php"); +// if is set cookie overwrite config value +if (isset($_COOKIE["phpTrackme_api"])) { $mapapi = $_COOKIE["phpTrackme_api"]; } +if (isset($_COOKIE["phpTrackme_lang"])) { $lang = $_COOKIE["phpTrackme_lang"]; } +if (isset($_COOKIE["phpTrackme_units"])) { $units = $_COOKIE["phpTrackme_units"]; } +if (isset($_COOKIE["phpTrackme_interval"])) { $interval = $_COOKIE["phpTrackme_interval"]; } require_once("lang.php"); $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if ($mysqli->connect_errno) { @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -$version = "2.1"; +$version = "2.2"; // default map drawing framework // (gmaps = google maps, openlayers = openlayers/osm) @@ -31,6 +31,8 @@ $layer_ocm = 1; $layer_mq = 1; // osmapa.pl (0 = no, 1 = yes) $layer_osmapa = 1; +// UMP (0 = no, 1 = yes) +$layer_ump = 1; // you may set your google maps api key // this is not obligatory by now @@ -71,13 +71,35 @@ $track_form .= ' $api_form = ' <u>'.$lang_api.'</u><br /> <form> -<select name="track" onchange="loadMapAPI(this.options[this.selectedIndex].value);"> +<select name="api" onchange="loadMapAPI(this.options[this.selectedIndex].value);"> <option value="gmaps"'.(($mapapi=="gmaps")?' selected':'').'>Google Maps</option> <option value="openlayers"'.(($mapapi=="openlayers")?' selected':'').'>OpenLayers</option> </select> </form> '; +// language select form +$lang_form = ' +<u>'.$lang_language.'</u><br /> +<form> +<select name="units" onchange="setLang(this.options[this.selectedIndex].value);"> +<option value="en"'.(($lang=="en")?' selected':'').'>English</option> +<option value="pl"'.(($lang=="pl")?' selected':'').'>Polski</option> +<option value="de"'.(($lang=="de")?' selected':'').'>Deutsch</option> +</select> +</form> +'; +// units select form +$units_form = ' +<u>'.$lang_units.'</u><br /> +<form> +<select name="units" onchange="setUnits(this.options[this.selectedIndex].value);"> +<option value="metric"'.(($units=="metric")?' selected':'').'>'.$lang_metric.'</option> +<option value="imperial"'.(($units=="imperial")?' selected':'').'>'.$lang_imperial.'</option> +</select> +</form> +'; + print '<!DOCTYPE html> <html> @@ -109,6 +131,7 @@ print var layer_ocm = "'.$layer_ocm.'"; var layer_mq = "'.$layer_mq.'"; var layer_osmapa = "'.$layer_osmapa.'"; + var layer_ump = "'.$layer_ump.'"; </script> <script type="text/javascript" src="main.js"></script> '; @@ -149,8 +172,14 @@ print ' <div id="api"> '.$api_form.' </div> + <div id="lang"> + '.$lang_form.' + </div> + <div id="units"> + '.$units_form.' + </div> <div id="export"> - <u>'.$lang_download.'</u><br /> + <u>'.$lang_download.'</u><br /> <a href="javascript:void(0);" onclick="load(\'kml\',userid,trackid)">kml</a><br /> <a href="javascript:void(0);" onclick="load(\'gpx\',userid,trackid)">gpx</a><br /> </div> @@ -48,6 +48,10 @@ switch($lang) { $lang_language = "Language"; $lang_newinterval = "Enter new interval value (seconds)"; $lang_api = "Map API"; + $lang_language = "Language"; + $lang_units = "Units"; + $lang_metric = "Metric"; + $lang_imperial = "Imperial/US"; break; case "pl": @@ -79,6 +83,10 @@ switch($lang) { $lang_language = "Język"; $lang_newinterval = "Podaj częstotliwość odświeżania (w sekundach)"; $lang_api = "Map API"; + $lang_language = "Język"; + $lang_units = "Jednostki"; + $lang_metric = "Metryczne"; + $lang_imperial = "Anglosaskie"; break; case "de": @@ -110,6 +118,10 @@ switch($lang) { $lang_language = "Sprache"; $lang_newinterval = "Neuen Intervall-Wert eingeben (in Sekunden)"; $lang_api = "Karten API"; + $lang_language = "Sprache"; + $lang_units = "Maßsystem"; + $lang_metric = "Metrisches"; + $lang_imperial = "Angloamerikanisches"; break; } ?> @@ -81,7 +81,7 @@ select { background-color: #666; color: lightgray; } -#user, #trip, #summary, #export, #other, #api { +#user, #trip, #summary, #export, #other, #units { padding-bottom: 10px; } #login { @@ -278,6 +278,8 @@ function setTime() { clearInterval(auto); autoReload(); } + // save current state as default + setCookie('interval',interval,30); } } @@ -326,6 +328,8 @@ function waitAndInit(api) { loadTime = 0; zoomToBounds(savedBounds); loadTrack(userid,trackid,0); + // save current api as default + setCookie('api',api,30); } function addScript(url) { @@ -346,3 +350,26 @@ function isScriptLoaded(url) { } return false; } + +function setCookie(name,value,days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = '; expires='+date.toGMTString(); + } + else { + var expires = ''; + } + document.cookie = 'phpTrackme_'+name+'='+value+expires+'; path=/'; +} + +function setLang(lang) { + setCookie('lang',lang,30); + location.reload(); +} + +function setUnits(unit) { + units = unit; + setCookie('units',unit,30); + location.reload(); +} |