diff options
author | Christian Pointner <equinox@ffgraz.net> | 2013-12-30 02:08:15 +0000 |
---|---|---|
committer | Christian Pointner <equinox@ffgraz.net> | 2013-12-30 02:08:15 +0000 |
commit | 868d5d661987483ac10214216a2ceda5d0c1cd7a (patch) | |
tree | 98b43904dd6f76279c85b7fd633317f814f3f256 | |
parent | 3407c6aea9c93d1abf62fe2bec61cd4f2807f619 (diff) |
reenables login
readded reaload control (basic version)
-rw-r--r-- | login.php | 4 | ||||
-rw-r--r-- | map.css | 26 | ||||
-rw-r--r-- | map.js | 104 |
3 files changed, 63 insertions, 71 deletions
@@ -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"; @@ -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; } @@ -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() { |