[Mapbender-commits] r1286 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Apr 30 05:18:09 EDT 2007
Author: christoph
Date: 2007-04-30 05:18:08 -0400 (Mon, 30 Apr 2007)
New Revision: 1286
Modified:
trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList_ajax.php
Log:
more element vars
Modified: trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList_ajax.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList_ajax.php 2007-04-27 15:16:31 UTC (rev 1285)
+++ trunk/mapbender/http/javascripts/mod_addWMSfromfilteredList_ajax.php 2007-04-30 09:18:08 UTC (rev 1286)
@@ -75,32 +75,84 @@
}
}
+// ----------------- Retrieve data --------------------
+
+function setSource(sourceValue) {
+ global_source = sourceValue;
+}
+
+function getGroups() {
+ imageOn();
+ window.opener.mb_ajax_json(phpUrl, {"command":"getGroups"}, function (json, status) {
+ imageOff();
+ displayGroups(json.group);
+ });
+}
+
+function getGUIs() {
+ imageOn();
+ window.opener.mb_ajax_json(phpUrl, {"command":"getGUIs"}, function (json, status) {
+ imageOff();
+ displayGUIs(json.gui);
+ });
+}
+
+function getWMSByGUI(guiId) {
+ imageOn();
+ window.opener.mb_ajax_json(phpUrl, {"command":"getWMSByGUI", "guiId":guiId}, function (json, status) {
+ imageOff();
+ displayWMS(json.wms, guiId);
+ });
+}
+
+function getWMSByGroup(groupId) {
+ imageOn();
+ window.opener.mb_ajax_json(phpUrl, {"command":"getWMSByGroup", "groupId":groupId}, function (json, status) {
+ imageOff();
+ displayWMS(json.wms);
+ });
+}
+
+function getAllWMS() {
+ imageOn();
+ window.opener.mb_ajax_json(phpUrl, {"command":"getAllWMS"}, function (json, status) {
+ imageOff();
+ displayWMS(json.wms);
+ });
+}
+
// ----------------- Display results --------------------
-function createTable(id, titleLeft, titleRight) {
+function removeChildNodes(node) {
+ while (node.childNodes.length > 0) {
+ var childNode = node.firstChild;
+ node.removeChild(childNode);
+ }
+}
+
+function setTableHeader(text, titleLeft, titleRight) {
+ document.getElementById("resultTable").style.visibility = 'visible';
+ document.getElementById("resultString").innerHTML = text;
document.getElementById("titleLeft").innerHTML = titleLeft;
document.getElementById("titleRight").innerHTML = titleRight;
- return tableNode;
+ removeChildNodes(document.getElementById("resultTableBody"));
}
function addRow(tableId, leftText, rightText, onClick) {
-
+ var leftNode = document.createElement("td");
var leftDivNode = createDiv(leftText, onClick);
- var rightDivNode = createDiv(rightText, onClick);
-
- var leftNode = document.createElement("td");
leftNode.appendChild(leftDivNode);
var rightNode = document.createElement("td");
+ var rightDivNode = createDiv(rightText, onClick);
rightNode.appendChild(rightDivNode);
var rowNode = document.createElement("tr");
- rowNode.setAttribute("class", "Farbe");
rowNode.setAttribute("onmouseover", "this.style.backgroundColor = \"#F08080\"");
rowNode.setAttribute("onmouseout", "this.style.backgroundColor = \"#FFFFFF\"");
rowNode.appendChild(leftNode);
rowNode.appendChild(rightNode);
- console.log("addRow");
+
document.getElementById(tableId).appendChild(rowNode);
}
@@ -109,41 +161,26 @@
divNode.style.cursor = "pointer";
divNode.setAttribute("onclick", onClick);
divNode.innerHTML = text;
-
return divNode;
}
-function removeChildNodes(node) {
- while (node.childNodes.length > 0) {
- var childNode = node.firstChild;
- node.removeChild(childNode);
- }
-}
-
function imageOn() {
- var imgNode = document.createElement("img");
- imgNode.setAttribute("src", "../img/indicator_wheel.gif");
- document.getElementById("searchImageTable").firstChild.firstChild.appendChild(imgNode);
-// document.getElementById("searchImageTable").firstChild.firstChild.appendChild(imgNode);
- document.getElementById("searchImageTable").style.visibility = "visible";
+ document.getElementById("searchImage").style.visibility = "visible";
document.getElementById("resultTable").style.visibility = "hidden";
document.getElementById("resultString").style.visibility = "hidden";
}
function imageOff() {
- document.getElementById("searchImageTable").style.visibility = "hidden";
+ document.getElementById("searchImage").style.visibility = "hidden";
document.getElementById("resultTable").style.visibility = "visible";
document.getElementById("resultString").style.visibility = "visible";
}
-function setTitle (text) {
- document.getElementById("resultString").innerHTML = text;
+function noResult() {
+ document.getElementById("resultTable").style.visibility = 'hidden';
+ document.getElementById("resultString").innerHTML = noResultText;
}
-function setSource(sourceValue) {
- global_source = sourceValue;
-}
-
function setButtons() {
if (typeof(option_all) != "undefined" && option_all == '0') {
var child = document.getElementById("button_all");
@@ -162,74 +199,38 @@
child.parentNode.removeChild(child);
}
}
-// ----------------- Retrieve data --------------------
-
-function getGroups() {
- imageOn();
- window.opener.mb_ajax_json(phpUrl, {"command":"getGroups"}, function (json, status) {
- imageOff();
- displayGroups(json.group);
- });
-}
-
-function getGUIs() {
- imageOn();
- window.opener.mb_ajax_json(phpUrl, {"command":"getGUIs"}, function (json, status) {
- imageOff();
- displayGUIs(json.gui);
- });
-}
-
-function getWMSByGUI(guiId) {
- imageOn();
- window.opener.mb_ajax_json(phpUrl, {"command":"getWMSByGUI", "guiId":guiId}, function (json, status) {
- imageOff();
- displayWMS(json.wms, guiId);
- });
-}
-
-function getWMSByGroup(groupId) {
- imageOn();
- window.opener.mb_ajax_json(phpUrl, {"command":"getWMSByGroup", "groupId":groupId}, function (json, status) {
- imageOff();
- displayWMS(json.wms);
- });
-}
-
-function getAllWMS() {
- imageOn();
- window.opener.mb_ajax_json(phpUrl, {"command":"getAllWMS"}, function (json, status) {
- imageOff();
- displayWMS(json.wms);
- });
-}
-
function displayGroups (groupArray) {
- setTitle(selectGroupText);
-
- var newTable = createTable("groupList", groupNameText, groupAbstractText);
-
- for (var i = 0; i < groupArray.length; i++) {
- var onClick = "getWMSByGroup('" + groupArray[i].id + "')";
- addRow("resultTable", groupArray[i].name, groupArray[i].description, onClick);
+ if (groupArray.length > 0) {
+ setTableHeader(selectGroupText, groupNameText, groupAbstractText);
+
+ for (var i = 0; i < groupArray.length; i++) {
+ var onClick = "getWMSByGroup('" + groupArray[i].id + "')";
+ addRow("resultTableBody", groupArray[i].name, groupArray[i].description, onClick);
+ }
}
+ else {
+ noResult();
+ }
}
function displayGUIs (guiArray) {
- setTitle(selectGuiText);
- var newTable = createTable("guiList", guiNameText, guiAbstractText);
-
- for (var i = 0; i < guiArray.length; i++) {
- var onClick = "getWMSByGUI('" + guiArray[i].id + "')";
- addRow("resultTable", guiArray[i].name, guiArray[i].description, onClick);
+ if (guiArray.length > 0) {
+ setTableHeader(selectGuiText, guiNameText, guiAbstractText);
+
+ for (var i = 0; i < guiArray.length; i++) {
+ var onClick = "getWMSByGUI('" + guiArray[i].id + "')";
+ addRow("resultTableBody", guiArray[i].name, guiArray[i].description, onClick);
+ }
}
+ else {
+ noResult();
+ }
}
function displayWMS (wmsArray, guiId) {
- if (wmsArray.length) {
- setTitle(selectWmsText);
- var newTable = createTable("wmsList", wmsTitleText, wmsAbstractText);
+ if (wmsArray.length > 0) {
+ setTableHeader(selectWmsText, wmsNameText, wmsAbstractText);
for (var i = 0; i < wmsArray.length; i++) {
@@ -239,11 +240,11 @@
else {
var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
}
- addRow("resultTable", wmsArray[i].title, wmsArray[i].abstract, onClick);
+ addRow("resultTableBody", wmsArray[i].title, wmsArray[i].abstract, onClick);
}
}
else {
- document.getElementById("divResults").innerHTML = "No result.";
+ noResult();
}
}
@@ -263,24 +264,23 @@
</table>
</form>
-<div class='divResults' id='divResults'>
+<div id='searchImage' name='searchImage' style='visibility:hidden'>
+ <img src='../img/indicator_wheel.gif'>
+</div>
-<table id='searchImageTable' name='searchImageTable'>
- <tr>
- <td></td>
- <td></td>
- </tr>
-</table>
-
<div id='resultString' name='resultString'></div>
-<table id='resultTable' name='resultTable' border=1 width="98%" cellpadding=3>
+<br>
+
+<table id='resultTable' name='resultTable' border=1 width="98%" cellpadding=3 rules='rows' style='visibility:hidden'>
<thead bgcolor="#FAEBD7">
<tr>
<td id='titleLeft' name='titleLeft' width=200 height=10></td>
<td id='titleRight' name='titleRight' align=left class=fieldnames_s></td>
</tr>
</thead>
+ <tbody id='resultTableBody' name='resultTableBody'>
+ </tbody>
</table>
</div>
</body>
More information about the Mapbender_commits
mailing list