summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfabiszewski <github@ushuaia.pl>2013-07-25 23:34:13 +0200
committerbfabiszewski <github@ushuaia.pl>2013-07-25 23:34:13 +0200
commitbc0aac55c50260ae1dc26effc6323f37c6acc096 (patch)
treef5e1c23abffbf85bd662a9850cadd3e68c13101a
parent07e9dca31309e301c7fa649e7c106fb5e6ca3099 (diff)
downloadRunnerUpLive-bc0aac55c50260ae1dc26effc6323f37c6acc096.zip
display comments in popups
-rwxr-xr-xapi_gmaps.js1
-rwxr-xr-xapi_openlayers.js1
-rwxr-xr-xauth.php1
-rwxr-xr-xgetpositions.php7
-rwxr-xr-xindex.php2
-rwxr-xr-xmain.css6
-rwxr-xr-xmain.js2
7 files changed, 15 insertions, 5 deletions
diff --git a/api_gmaps.js b/api_gmaps.js
index 968f9aa..26a787c 100755
--- a/api_gmaps.js
+++ b/api_gmaps.js
@@ -130,6 +130,7 @@ function setMarker(p,i,posLen) {
'<div id="pheader">'+lang_user+': '+p.username.toUpperCase()+'<br />'+lang_track+': '+p.trackname.toUpperCase()+
'</div>'+
'<div id="pbody">'+
+ ((p.comments != null)?'<div id="pcomments">'+p.comments+'</div>':'')+
'<div id="pleft"><b>'+lang_time+':</b> '+p.dateoccured+'<br />'+
((p.speed != null)?'<b>'+lang_speed+':</b> '+(p.speed.toKmH()*factor_kmh)+' '+unit_kmh+'<br />':'')+
((p.altitude != null)?'<b>'+lang_altitude+':</b> '+(p.altitude*factor_m).toFixed()+' '+unit_m+'<br />':'')+'</div>'+
diff --git a/api_openlayers.js b/api_openlayers.js
index 228eff5..87f0abf 100755
--- a/api_openlayers.js
+++ b/api_openlayers.js
@@ -162,6 +162,7 @@ function setMarker(p,i,posLen) {
'<div id="pheader">'+lang_user+': '+p.username.toUpperCase()+'<br />'+lang_track+': '+p.trackname.toUpperCase()+
'</div>'+
'<div id="pbody">'+
+ ((p.comments != null)?'<div id="pcomments">'+p.comments+'</div>':'')+
'<div id="pleft"><b>'+lang_time+':</b> '+p.dateoccured+'<br />'+
((p.speed != null)?'<b>'+lang_speed+':</b> '+(p.speed.toKmH()*factor_kmh)+' '+unit_kmh+'<br />':'')+
((p.altitude != null)?'<b>'+lang_altitude+':</b> '+(p.altitude*factor_m).toFixed()+' '+unit_m+'<br />':'')+'</div>'+
diff --git a/auth.php b/auth.php
index c7d881b..c3ac8c5 100755
--- a/auth.php
+++ b/auth.php
@@ -29,6 +29,7 @@ if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
+$mysqli->set_charset("utf8");
$auth = NULL;
if ($require_authentication) {
/* authentication */
diff --git a/getpositions.php b/getpositions.php
index 2f22aa0..9a3acc1 100755
--- a/getpositions.php
+++ b/getpositions.php
@@ -36,16 +36,16 @@ function haversine_distance($lat1, $lon1, $lat2, $lon2) {
if ($userid) {
if ($trackid) {
// get all track data
- $query = $mysqli->prepare("SELECT positions.ID,Latitude,Longitude,Altitude,Speed,Angle,DateOccurred,username,trips.Name,trips.ID FROM positions LEFT JOIN users ON (positions.FK_Users_ID=users.ID) LEFT JOIN trips ON (positions.FK_Trips_ID=trips.ID) WHERE positions.FK_Users_ID=? AND positions.FK_Trips_ID=? ORDER BY positions.DateOccurred");
+ $query = $mysqli->prepare("SELECT positions.ID,positions.Latitude,positions.Longitude,positions.Altitude,positions.Speed,positions.Angle,positions.DateOccurred,positions.Comments,users.username,trips.Name,trips.ID FROM positions LEFT JOIN users ON (positions.FK_Users_ID=users.ID) LEFT JOIN trips ON (positions.FK_Trips_ID=trips.ID) WHERE positions.FK_Users_ID=? AND positions.FK_Trips_ID=? ORDER BY positions.DateOccurred");
$query->bind_param('ii', $userid, $trackid);
}
else {
// get data only for latest point
- $query = $mysqli->prepare("SELECT positions.ID,Latitude,Longitude,Altitude,Speed,Angle,DateOccurred,username,trips.Name,trips.ID FROM positions LEFT JOIN users ON (positions.FK_Users_ID=users.ID) LEFT JOIN trips ON (positions.FK_Trips_ID=trips.ID) WHERE positions.FK_Users_ID=? ORDER BY positions.DateOccurred DESC LIMIT 1");
+ $query = $mysqli->prepare("SELECT positions.ID,positions.Latitude,positions.Longitude,positions.Altitude,positions.Speed,positions.Angle,positions.DateOccurred,positions.Comments,users.username,trips.Name,trips.ID FROM positions LEFT JOIN users ON (positions.FK_Users_ID=users.ID) LEFT JOIN trips ON (positions.FK_Trips_ID=trips.ID) WHERE positions.FK_Users_ID=? ORDER BY positions.DateOccurred DESC LIMIT 1");
$query->bind_param('i', $userid);
}
$query->execute();
- $query->bind_result($positionid,$latitude,$longitude,$altitude,$speed,$angle,$dateoccured,$username,$trackname,$trackid);
+ $query->bind_result($positionid,$latitude,$longitude,$altitude,$speed,$angle,$dateoccured,$comments,$username,$trackname,$trackid);
header("Content-type: text/xml");
$xml = new XMLWriter();
@@ -63,6 +63,7 @@ if ($userid) {
$xml->writeElement("speed", $speed);
$xml->writeElement("angle", $angle);
$xml->writeElement("dateoccured", $dateoccured);
+ $xml->writeElement("comments", $comments);
$xml->writeElement("username", $username);
$xml->writeElement("trackid", $trackid);
$xml->writeElement("trackname", $trackname);
diff --git a/index.php b/index.php
index b9df43c..f2f4e4c 100755
--- a/index.php
+++ b/index.php
@@ -36,7 +36,7 @@ else {
<u>'.$lang_user.'</u><br />
<form>
<select name="user" onchange="selectUser(this)">
- <option value=\"0\">'.$lang_suser.'</option>';
+ <option value="0">'.$lang_suser.'</option>';
$query = "SELECT ID,username FROM users ORDER BY username";
$result = $mysqli->query($query);
while ($row = $result->fetch_assoc()) {
diff --git a/main.css b/main.css
index dbcc682..049a5b8 100755
--- a/main.css
+++ b/main.css
@@ -129,7 +129,7 @@ select {
}
#popup {
width:370px;
- height:130px;
+ min-height:130px;
}
#popup * {
font-family: Roboto, Verdana, sans-serif;
@@ -140,6 +140,10 @@ select {
padding-bottom: 5px;
border-bottom: 1px solid gray;
}
+#pcomments {
+ clear: both;
+ color: #903;
+}
#pleft,#pright {
float:left;
padding-top: 5px;
diff --git a/main.js b/main.js
index 33f7d63..7d18bb1 100755
--- a/main.js
+++ b/main.js
@@ -141,6 +141,7 @@ function parsePosition(p) {
if (speed != null) { speed = parseInt(speed); }
var angle = getNode(p,'angle'); // may be null
if (angle != null) { angle = parseInt(angle); }
+ var comments = getNode(p,'comments'); // may be null
var username = getNode(p,'username');
var trackname = getNode(p,'trackname');
var tid = getNode(p,'trackid');
@@ -153,6 +154,7 @@ function parsePosition(p) {
'altitude': altitude,
'speed': speed,
'angle': angle,
+ 'comments': comments,
'username': username,
'trackname': trackname,
'tid': tid,