diff options
author | Christian Pointner <equinox@ffgraz.net> | 2008-12-06 22:51:19 +0000 |
---|---|---|
committer | Christian Pointner <equinox@ffgraz.net> | 2008-12-06 22:51:19 +0000 |
commit | c222c0230e5bdbea39b097946228d9e2fd92c434 (patch) | |
tree | c3d035e56c880f82c8a84eb42c4bcb6e85f40925 | |
parent | 8a847c82e6eaa5e1ce91f66b977b655bf929fafd (diff) |
added feedback to reload button
-rw-r--r-- | data.php | 4 | ||||
-rw-r--r-- | index.php | 7 | ||||
-rw-r--r-- | map.css | 19 | ||||
-rw-r--r-- | map.js | 27 |
4 files changed, 47 insertions, 10 deletions
@@ -141,11 +141,11 @@ foreach ($links as $link) }
echo "</links>\n";
-echo "<count>\n";
+echo "<counts>\n";
printf("\t" . '<count number="');
echo sizeof($count);
printf('" />' . "\n");
-echo "</count>\n";
+echo "</counts>\n";
echo "</root>";
@@ -45,11 +45,16 @@ if(empty($marker)) $marker="online"; <tr><td align="center"><img src="./img/link_blue.png" /></td><td> </td><td>Tunnel</td></tr>
</table>
</div>
+ <div id="countbox" class="box">
+ </div>
<div id="visibox" class="box">
<b>Elemente<br />ausblenden</b>
<form name="visibleform">
<table class="legend">
- <tr><td><input type="checkbox" name="offline" value="true" onclick="javascript:toggleVisible('offline')" <?php if($marker == "online") printf(' checked="checked"'); ?> ></td><td> </td><td>Offline</td></tr>
+ <tr>
+ <td><input type="checkbox" name="offline" value="true" onclick="javascript:toggleVisible('offline')" <?php if($marker == "online") printf(' checked="checked"'); ?> ></td>
+ <td> </td><td><img src="./img/marker_offline.png" /> Offline</td>
+ </tr>
</table>
</from>
</div>
@@ -32,6 +32,19 @@ div.box { top: 4em; } +#countbox { + position: absolute; + top: 20em; + right: 10px; + font-weight: bold; +} + +#visibox { + position: absolute; + top: 24em; + right: 10px; +} + #addressbox { position: absolute; right: 10px; @@ -53,12 +66,6 @@ div.box { text-align: center; } -#visibox { - position: absolute; - top: 20em; - right: 10px; -} - div.btn { color: #0000cc; background-color: white; @@ -1,11 +1,13 @@ var map = null; var physicalMaxLevel; var geocoder = null; +var countboxText = null; var overlays = new Array(); overlays["newmarker"] = null; overlays["ruler"] = new Array(); overlays["locations"] = new Array(); var locations = new Array(); +var reloadcon = null; function initialize(lat, lng, res) { if (!checkBrowser()) { @@ -27,7 +29,8 @@ function initialize(lat, lng, res) { map.setZoom(res); } map.addControl(new RulerControl()); - map.addControl(new ReloadControl()); + reloadcon = new ReloadControl(); + map.addControl(reloadcon); map.addControl(new GSmallMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10,20))); map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50,10))); @@ -43,6 +46,12 @@ function initialize(lat, lng, res) { geocoder = new GClientGeocoder(); + var countbox = document.getElementById("countbox"); + countboxText = document.createTextNode("Aktiv: 0"); + countbox.appendChild(countboxText); + + document.getElementById("map").style.cursor = "wait"; + reloadcon.started(); GDownloadUrl("data.php", onData); } @@ -94,6 +103,7 @@ function onMapClick(overlay, point) function onData(data, responseCode) { if (responseCode < 200 || responseCode > 299) { + reloadcon.finished(); return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")"); } xmlData = GXml.parse(data); @@ -104,6 +114,12 @@ function onData(data, responseCode) { overlays["locations"] = []; locations = []; drawLocations(xmlData); + + var element = xmlData.getElementsByTagName("count"); + var count = element[0].getAttribute("number"); + countboxText.data = "Aktiv: " + count; + + reloadcon.finished(); } function drawLocations(xmlData) { @@ -263,6 +279,7 @@ ReloadControl.prototype.initialize = function(map) { btnText = document.createTextNode("Daten neu laden"); btnDiv.appendChild(btnText); GEvent.addDomListener(btnDiv, "click", function() { + reloadcon.started(); GDownloadUrl("data.php", onData); }); @@ -270,6 +287,14 @@ ReloadControl.prototype.initialize = function(map) { return container; } +ReloadControl.prototype.started = function() { + btnText.data = "wird geladen..."; +} + +ReloadControl.prototype.finished = function() { + btnText.data = "Daten neu laden"; +} + ReloadControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7)); } |