summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xREADME3
-rwxr-xr-xapi_gmaps.js10
-rwxr-xr-xapi_openlayers.js40
-rwxr-xr-xconfig.php20
-rwxr-xr-xindex.php11
-rwxr-xr-xmain.css9
-rwxr-xr-xmain.js5
7 files changed, 67 insertions, 31 deletions
diff --git a/README b/README
index 397c2e9..4efa1f0 100755
--- a/README
+++ b/README
@@ -26,7 +26,8 @@ Features:
Todo
- install script
-- user level customization, storing settings in cookies?
+- user level customization, storing settings in cookies
+- custom icons
- write opensource client?
License
diff --git a/api_gmaps.js b/api_gmaps.js
index ce71491..968f9aa 100755
--- a/api_gmaps.js
+++ b/api_gmaps.js
@@ -26,7 +26,7 @@ var polyOptions;
var mapOptions;
var loadedAPI = 'gmaps';
function init() {
-google.maps.visualRefresh = true;
+ google.maps.visualRefresh = true;
polyOptions = {
strokeColor: '#FF0000',
strokeOpacity: 1.0,
@@ -95,7 +95,7 @@ function displayTrack(xml,update) {
}
}
-function clearMap(){
+function clearMap() {
if (polies){
for (var i=0; i<polies.length; i++){
polies[i].setMap(null);
@@ -161,12 +161,6 @@ function addChartEvent(chart) {
var id = selection.row;
var icon = markers[id].getIcon();
markers[id].setIcon('http://maps.google.com/mapfiles/marker_orange.png');
- //var contentString = '<div style="width:40px; height:20px;padding:10px">'+Math.round(altitudes[id]*factor_m)+' '+unit_m+'</div>';
- //popup = new google.maps.InfoWindow({
- // content: contentString
- //});
- //popup.open(map,markers[id]);
- //altTimeout = setTimeout(function() { if (popup) {popup.close();} },2000);
altTimeout = setTimeout(function() { markers[id].setIcon(icon); },2000);
}
});
diff --git a/api_openlayers.js b/api_openlayers.js
index 7c7c622..3df53bd 100755
--- a/api_openlayers.js
+++ b/api_openlayers.js
@@ -31,25 +31,52 @@ function init() {
var options = { controls: [
new OpenLayers.Control.ArgParser(), // default
new OpenLayers.Control.Attribution(), // default
- new OpenLayers.Control.LayerSwitcher({'ascending':false}),
+ new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(), // default
new OpenLayers.Control.PanZoomBar(),// do we need it?
new OpenLayers.Control.ScaleLine()
]
};
map = new OpenLayers.Map('map-canvas', options);
- map.addLayer(new OpenLayers.Layer.OSM());
+ // default layer: OpenStreetMap
+ var mapnik = new OpenLayers.Layer.OSM();
+ map.addLayer(mapnik);
+ if (layer_ocm==1) {
+ // OpenCycleMap
+ var ocm = new OpenLayers.Layer.OSM('OpenCycleMap',
+ ['http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png',
+ 'http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png',
+ 'http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png']);
+ map.addLayer(ocm);
+ }
+ if (layer_mq==1) {
+ // MapQuest-OSM
+ var mq = new OpenLayers.Layer.OSM('MapQuest-OSM',
+ ['http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
+ 'http://otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
+ 'http://otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
+ 'http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg']);
+ map.addLayer(mq);
+ }
+ if (layer_osmapa==1) {
+ // osmapa.pl
+ var osmapa = new OpenLayers.Layer.OSM('osmapa.pl',
+ ['http://a.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png',
+ 'http://b.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png',
+ 'http://c.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png']);
+ map.addLayer(osmapa);
+ }
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' );
}
function displayTrack(xml,update) {
altitudes.length = 0;
var totalMeters = 0;
var totalSeconds = 0;
- // init layer
- layerTrack = new OpenLayers.Layer.Vector( 'Track' );
- layerMarkers = new OpenLayers.Layer.Markers( 'Markers' );
var points = new Array();
var latlngbounds = new OpenLayers.Bounds();
var positions = xml.getElementsByTagName('position');
@@ -96,7 +123,7 @@ function displayTrack(xml,update) {
}
}
-function clearMap(){
+function clearMap() {
if (layerTrack){
layerTrack.removeAllFeatures();
}
@@ -152,7 +179,6 @@ function setMarker(p,i,posLen) {
}
}
})());
-
}
function addChartEvent(chart) {
diff --git a/config.php b/config.php
index 7fc2ee1..702f382 100755
--- a/config.php
+++ b/config.php
@@ -17,16 +17,24 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-$version = "2.0";
+$version = "2.1";
-// map drawing framework
+// default map drawing framework
// (gmaps = google maps, openlayers = openlayers/osm)
-$mapapi = "gmaps";
-//$mapapi = "openlayers";
+//$mapapi = "gmaps";
+$mapapi = "openlayers";
-// you may add your google maps api key
+// openlayers additional map layers
+// OpenCycleMap (0 = no, 1 = yes)
+$layer_ocm = 1;
+// MapQuest-OSM (0 = no, 1 = yes)
+$layer_mq = 1;
+// osmapa.pl (0 = no, 1 = yes)
+$layer_osmapa = 1;
+
+// you may set your google maps api key
// this is not obligatory by now
-//$gkey =
+//$gkey = "";
// MySQL config
$dbhost = ""; // mysql host, eg. localhost
diff --git a/index.php b/index.php
index 2149b2b..9919f8b 100755
--- a/index.php
+++ b/index.php
@@ -106,12 +106,15 @@ print
var units = "'.$units.'";
var mapapi = "'.$mapapi.'";
var gkey = '.(isset($gkey)?'"'.$gkey.'"':'null').';
+ var layer_ocm = "'.$layer_ocm.'";
+ var layer_mq = "'.$layer_mq.'";
+ var layer_osmapa = "'.$layer_osmapa.'";
</script>
<script type="text/javascript" src="main.js"></script>
';
if ($mapapi == "gmaps") {
print
-' <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?'.(isset($gkey)?'key='.$gkey.'&':'').'sensor=false"></script>
+' <script type="text/javascript" src="//maps.googleapis.com/maps/api/js?'.(isset($gkey)?'key='.$gkey.'&':'').'sensor=false"></script>
<script type="text/javascript" src="api_gmaps.js"></script>
';
}
@@ -122,7 +125,7 @@ else {
';
}
print '
- <script type="text/javascript" src="https://www.google.com/jsapi"></script>
+ <script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
</script>
@@ -136,7 +139,7 @@ print '
</div>
<div id="trip">
'.$track_form.'
- <input id="latest" type="checkbox" onchange="autoReload();"> '.$lang_autoreload.' (<a href="javascript:void(0);" onclick="setTime()"><span id="auto">'.$interval.'</span></a> s)<br />
+ <input type="checkbox" onchange="autoReload();"> '.$lang_autoreload.' (<a href="javascript:void(0);" onclick="setTime()"><span id="auto">'.$interval.'</span></a> s)<br />
<a href="javascript:void(0);" onclick="loadTrack(userid,trackid,0)">'.$lang_reload.'</a><br />
</div>
<div id="summary"></div>
@@ -152,7 +155,7 @@ print '
<a href="javascript:void(0);" onclick="load(\'gpx\',userid,trackid)">gpx</a><br />
</div>
</div>
- <div id="footer">phpTrackme '.$version.'</div>
+ <div id="footer"><a target="_blank" href="https://github.com/bfabiszewski/phpTrackme">phpTrackme</a> '.$version.'</div>
</div>
<div id="main">
<div id="map-canvas"></div>
diff --git a/main.css b/main.css
index 7cee9d1..a042812 100755
--- a/main.css
+++ b/main.css
@@ -38,17 +38,19 @@ select {
font-weight: normal;
padding-top: 0.2em;
}
-input {
+#menu input,
+#login input {
width: 150px;
text-align: center;
border: 1px solid black;
}
-input[type = "submit"] {
+#menu input[type = "submit"],
+#login input[type = "submit"] {
background-color: black;
color: white;
border: 1px solid white;
}
-input[type = "checkbox"] {
+#menu input[type = "checkbox"] {
width: auto;
}
#main {
@@ -67,6 +69,7 @@ input[type = "checkbox"] {
width: 165px;
height: 100%;
background-color: #666;
+ overflow: hidden;
}
#menu-content {
padding: 10px;
diff --git a/main.js b/main.js
index 35c8074..bd16562 100755
--- a/main.js
+++ b/main.js
@@ -289,7 +289,7 @@ function loadMapAPI(api) {
var url = new Array();
if (api=='gmaps') {
url.push('api_gmaps.js');
- url.push('https://maps.googleapis.com/maps/api/js?'+((gkey!==null)?('key='+gkey+'&'):'')+'sensor=false&callback=init');
+ url.push('//maps.googleapis.com/maps/api/js?'+((gkey!==null)?('key='+gkey+'&'):'')+'sensor=false&callback=init');
}
else {
url.push('api_openlayers.js');
@@ -341,7 +341,8 @@ function isScriptLoaded(url) {
scripts = document.getElementsByTagName('script');
for (var i = scripts.length; i--;) {
// check if url matches src
- if (scripts[i].src != '' && url.indexOf(scripts[i].src) !== -1) return true;
+ var scriptUrl = scripts[i].src.replace(/https?:/,'');
+ if (scriptUrl != '' && url.indexOf(scriptUrl) !== -1) return true;
}
return false;
}