various minor fixes
This commit is contained in:
parent
36df283a69
commit
bf662e9949
3
README
3
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
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
@ -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');
|
||||
@ -152,7 +179,6 @@ function setMarker(p,i,posLen) {
|
||||
}
|
||||
}
|
||||
})());
|
||||
|
||||
}
|
||||
|
||||
function addChartEvent(chart) {
|
||||
|
20
config.php
20
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
|
||||
|
11
index.php
11
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>
|
||||
|
9
main.css
9
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;
|
||||
|
5
main.js
5
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user