various minor fixes

This commit is contained in:
bfabiszewski 2013-06-23 00:17:28 +02:00
parent 36df283a69
commit bf662e9949
7 changed files with 67 additions and 31 deletions

3
README
View File

@ -26,7 +26,8 @@ Features:
Todo Todo
- install script - install script
- user level customization, storing settings in cookies? - user level customization, storing settings in cookies
- custom icons
- write opensource client? - write opensource client?
License License

View File

@ -161,12 +161,6 @@ function addChartEvent(chart) {
var id = selection.row; var id = selection.row;
var icon = markers[id].getIcon(); var icon = markers[id].getIcon();
markers[id].setIcon('http://maps.google.com/mapfiles/marker_orange.png'); 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); altTimeout = setTimeout(function() { markers[id].setIcon(icon); },2000);
} }
}); });

View File

@ -31,25 +31,52 @@ function init() {
var options = { controls: [ var options = { controls: [
new OpenLayers.Control.ArgParser(), // default new OpenLayers.Control.ArgParser(), // default
new OpenLayers.Control.Attribution(), // default new OpenLayers.Control.Attribution(), // default
new OpenLayers.Control.LayerSwitcher({'ascending':false}), new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(), // default new OpenLayers.Control.Navigation(), // default
new OpenLayers.Control.PanZoomBar(),// do we need it? new OpenLayers.Control.PanZoomBar(),// do we need it?
new OpenLayers.Control.ScaleLine() new OpenLayers.Control.ScaleLine()
] ]
}; };
map = new OpenLayers.Map('map-canvas', options); 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 position = new OpenLayers.LonLat(21.01,52.23).transform(wgs84, mercator);
var zoom = 8; var zoom = 8;
map.setCenter(position, zoom); map.setCenter(position, zoom);
// init layers
layerTrack = new OpenLayers.Layer.Vector( 'Track' );
layerMarkers = new OpenLayers.Layer.Markers( 'Markers' );
} }
function displayTrack(xml,update) { function displayTrack(xml,update) {
altitudes.length = 0; altitudes.length = 0;
var totalMeters = 0; var totalMeters = 0;
var totalSeconds = 0; var totalSeconds = 0;
// init layer
layerTrack = new OpenLayers.Layer.Vector( 'Track' );
layerMarkers = new OpenLayers.Layer.Markers( 'Markers' );
var points = new Array(); var points = new Array();
var latlngbounds = new OpenLayers.Bounds(); var latlngbounds = new OpenLayers.Bounds();
var positions = xml.getElementsByTagName('position'); var positions = xml.getElementsByTagName('position');
@ -152,7 +179,6 @@ function setMarker(p,i,posLen) {
} }
} }
})()); })());
} }
function addChartEvent(chart) { function addChartEvent(chart) {

View File

@ -17,16 +17,24 @@
* License along with this program; if not, write to the Free Software * License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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) // (gmaps = google maps, openlayers = openlayers/osm)
$mapapi = "gmaps"; //$mapapi = "gmaps";
//$mapapi = "openlayers"; $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 // this is not obligatory by now
//$gkey = //$gkey = "";
// MySQL config // MySQL config
$dbhost = ""; // mysql host, eg. localhost $dbhost = ""; // mysql host, eg. localhost

View File

@ -106,12 +106,15 @@ print
var units = "'.$units.'"; var units = "'.$units.'";
var mapapi = "'.$mapapi.'"; var mapapi = "'.$mapapi.'";
var gkey = '.(isset($gkey)?'"'.$gkey.'"':'null').'; var gkey = '.(isset($gkey)?'"'.$gkey.'"':'null').';
var layer_ocm = "'.$layer_ocm.'";
var layer_mq = "'.$layer_mq.'";
var layer_osmapa = "'.$layer_osmapa.'";
</script> </script>
<script type="text/javascript" src="main.js"></script> <script type="text/javascript" src="main.js"></script>
'; ';
if ($mapapi == "gmaps") { if ($mapapi == "gmaps") {
print 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> <script type="text/javascript" src="api_gmaps.js"></script>
'; ';
} }
@ -122,7 +125,7 @@ else {
'; ';
} }
print ' 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"> <script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]}); google.load("visualization", "1", {packages:["corechart"]});
</script> </script>
@ -136,7 +139,7 @@ print '
</div> </div>
<div id="trip"> <div id="trip">
'.$track_form.' '.$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 /> <a href="javascript:void(0);" onclick="loadTrack(userid,trackid,0)">'.$lang_reload.'</a><br />
</div> </div>
<div id="summary"></div> <div id="summary"></div>
@ -152,7 +155,7 @@ print '
<a href="javascript:void(0);" onclick="load(\'gpx\',userid,trackid)">gpx</a><br /> <a href="javascript:void(0);" onclick="load(\'gpx\',userid,trackid)">gpx</a><br />
</div> </div>
</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>
<div id="main"> <div id="main">
<div id="map-canvas"></div> <div id="map-canvas"></div>

View File

@ -38,17 +38,19 @@ select {
font-weight: normal; font-weight: normal;
padding-top: 0.2em; padding-top: 0.2em;
} }
input { #menu input,
#login input {
width: 150px; width: 150px;
text-align: center; text-align: center;
border: 1px solid black; border: 1px solid black;
} }
input[type = "submit"] { #menu input[type = "submit"],
#login input[type = "submit"] {
background-color: black; background-color: black;
color: white; color: white;
border: 1px solid white; border: 1px solid white;
} }
input[type = "checkbox"] { #menu input[type = "checkbox"] {
width: auto; width: auto;
} }
#main { #main {
@ -67,6 +69,7 @@ input[type = "checkbox"] {
width: 165px; width: 165px;
height: 100%; height: 100%;
background-color: #666; background-color: #666;
overflow: hidden;
} }
#menu-content { #menu-content {
padding: 10px; padding: 10px;

View File

@ -289,7 +289,7 @@ function loadMapAPI(api) {
var url = new Array(); var url = new Array();
if (api=='gmaps') { if (api=='gmaps') {
url.push('api_gmaps.js'); 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 { else {
url.push('api_openlayers.js'); url.push('api_openlayers.js');
@ -341,7 +341,8 @@ function isScriptLoaded(url) {
scripts = document.getElementsByTagName('script'); scripts = document.getElementsByTagName('script');
for (var i = scripts.length; i--;) { for (var i = scripts.length; i--;) {
// check if url matches src // 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; return false;
} }