summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@ffgraz.net>2013-12-30 02:08:15 +0000
committerChristian Pointner <equinox@ffgraz.net>2013-12-30 02:08:15 +0000
commit868d5d661987483ac10214216a2ceda5d0c1cd7a (patch)
tree98b43904dd6f76279c85b7fd633317f814f3f256
parent3407c6aea9c93d1abf62fe2bec61cd4f2807f619 (diff)
reenables login
readded reaload control (basic version)
-rw-r--r--login.php4
-rw-r--r--map.css26
-rw-r--r--map.js104
3 files changed, 63 insertions, 71 deletions
diff --git a/login.php b/login.php
index 8a65bcb..4f9363a 100644
--- a/login.php
+++ b/login.php
@@ -1,4 +1,4 @@
-<?php
+<?php
session_start();
header("Content-Type: text/xml");
@@ -28,7 +28,7 @@ else if (isset($_POST['logout']))
$_SESSION['logged_in'] = false;
}
-if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'])
+if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'])
{
echo '<status code="'.'logged_in'.'" />'."\n";
echo '<username name="'.$_SESSION['username'].'" />'."\n";
diff --git a/map.css b/map.css
index 034feb7..dcaf43c 100644
--- a/map.css
+++ b/map.css
@@ -91,14 +91,21 @@ div.box {
}
div.btn {
- color: #0000cc;
- background-color: white;
- border: 1px solid black;
- font: small Arial;
- text-decoration: underline;
+ overflow: hidden;
text-align: center;
- padding: 2px;
- margin-bottom: 3px;
+ position: relative;
+ color: black;
+ font-family: Roboto,Arial,sans-serif;
+ font-size: 11px;
+ background-color: white;
+ padding: 1px 6px;
+ border-bottom-left-radius: 2px;
+ border-top-left-radius: 2px;
+ background-clip: padding-box;
+ border: 1px solid rgba(0, 0, 0, 0.15);
+ box-shadow: 0px 1px 4px -1px rgba(0, 0, 0, 0.3);
+ min-width: 28px;
+ font-weight: 500;
cursor: pointer;
}
@@ -106,10 +113,6 @@ div.btn {
width: 10em;
}
-#reloadbtn {
- width: 10em;
-}
-
*.locinfo,table {
font-size: 8pt;
color: black;
@@ -119,6 +122,7 @@ div.btn {
font-size: 8pt;
color: black;
}
+
table.legend {
margin-top: 3px;
}
diff --git a/map.js b/map.js
index 7eb01ce..f2aa9aa 100644
--- a/map.js
+++ b/map.js
@@ -35,8 +35,12 @@ function initialize(lat, lng, res) {
map = new google.maps.Map(document.getElementById("map"), mapOptions);
//##// map.addControl(new RulerControl());
-//##// reloadcon = new reloadcontrol();
-//##// map.addcontrol(reloadcon);
+
+ var reloadconDiv = document.createElement('div');
+ var reloadcon = new ReloadControl(reloadconDiv, map);
+
+ reloadconDiv.index = 1;
+ map.controls[google.maps.ControlPosition.TOP_RIGHT].push(reloadconDiv);
google.maps.event.addListener(map, "click", onMapClick);
@@ -509,16 +513,11 @@ function setNewMarker(point) {
}
function fflogin(username, password) {
- var postbody = "username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password) + "&login=Einloggen#";
-//##// GDownloadUrl("login.php", onFFLogin, postbody);
+ $.post("login.php", { username: username, password: password, login: "Einloggen#" } )
+ .done(function(data) { onFFLogin(data); });
}
-function onFFLogin(data, responseCode) {
- if (responseCode < 200 || responseCode > 299) {
- return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")");
- }
- xmlData = GXml.parse(data);
-
+function onFFLogin(xmlData) {
var error = xmlData.getElementsByTagName("error");
if(error.length > 0) {
alert(error[0].getAttribute("string"));
@@ -528,7 +527,6 @@ function onFFLogin(data, responseCode) {
if(status[0].getAttribute("code") == "logged_in") {
var username = xmlData.getElementsByTagName("username")[0].getAttribute("name");
showFFLogout(username);
-
//##// reloadcon.started();
$.get( "data.php",onData);
}
@@ -550,25 +548,19 @@ function showFFLogin() {
}
function fflogout() {
- var postbody = "logout=Ausloggen#";
-//##// GDownloadUrl("login.php", onFFLogout, postbody);
+ $.post("login.php", { logout: "Ausloggen#" } )
+ .done(function(data) { onFFLogout(data); });
}
-function onFFLogout(data, responseCode) {
- if (responseCode < 200 || responseCode > 299) {
- return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")");
- }
- xmlData = GXml.parse(data);
-
+function onFFLogout(xmlData) {
var error = xmlData.getElementsByTagName("error");
if(error.length > 0) {
alert(error[0].getAttribute("string"));
}
else {
showFFLogin();
-
//##// reloadcon.started();
- $.get( "data.php",onData);
+ $.get("data.php", onData);
}
}
@@ -596,43 +588,39 @@ function showAddress(address) {
}
}
-//##//function ReloadControl() {
-//##//}
-//##//
-//##//ReloadControl.prototype = new GControl();
-//##//
-//##//ReloadControl.prototype.initialize = function(map) {
-//##// var container = document.createElement("div");
-//##// var btnDiv = document.createElement("div");
-//##// btnDiv.className = "btn";
-//##// btnDiv.id = "reloadbtn";
-//##// container.appendChild(btnDiv);
-//##// btnText = document.createTextNode("Daten neu laden");
-//##// btnDiv.appendChild(btnText);
-//##// google.maps.event.addDomListener(btnDiv, "click", function() {
-//##// reloadcon.started();
-//##// GDownloadUrl("data.php", onData);
-//##// });
-//##//
-//##// map.getContainer().appendChild(container);
-//##// return container;
-//##//}
-//##//
-//##//ReloadControl.prototype.started = function() {
-//##// btnText.data = "wird geladen...";
-//##//}
-//##//
-//##//ReloadControl.prototype.loaded = function() {
-//##// btnText.data = "wird verarbeitet...";
-//##//}
-//##//
-//##//ReloadControl.prototype.finished = function() {
-//##// btnText.data = "Daten neu laden";
-//##//}
-//##//
-//##//ReloadControl.prototype.getDefaultPosition = function() {
-//##// return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
-//##//}
+function ReloadControl(controlDiv, map) {
+ controlDiv.style.padding = '5px';
+
+ var controlUI = document.createElement('div');
+ controlUI.className = 'btn';
+ controlUI.title = 'Click to reload data';
+ controlDiv.appendChild(controlUI);
+
+ var controlText = document.createElement('div');
+ controlText.innerHTML = '<strong>Daten neu laden</strong>';
+ controlUI.appendChild(controlText);
+
+ google.maps.event.addDomListener(controlUI, 'click', function() {
+// reloadcon.started();
+ $.get("data.php", onData);
+ });
+}
+
+// ReloadControl.prototype.started = function() {
+// btnText.data = "wird geladen...";
+// }
+
+// ReloadControl.prototype.loaded = function() {
+// btnText.data = "wird verarbeitet...";
+// }
+
+// ReloadControl.prototype.finished = function() {
+// btnText.data = "Daten neu laden";
+// }
+
+// ReloadControl.prototype.getDefaultPosition = function() {
+// return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
+// }
//##//function RulerControl() {