[Mapbender-commits] r2979 - branches/2.5/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Sep 18 09:28:02 EDT 2008
Author: verenadiewald
Date: 2008-09-18 09:28:02 -0400 (Thu, 18 Sep 2008)
New Revision: 2979
Modified:
branches/2.5/http/javascripts/mod_addWMSfromfilteredList_ajax.php
Log:
http://trac.osgeo.org/mapbender/ticket/220
Modified: branches/2.5/http/javascripts/mod_addWMSfromfilteredList_ajax.php
===================================================================
--- branches/2.5/http/javascripts/mod_addWMSfromfilteredList_ajax.php 2008-09-18 13:25:39 UTC (rev 2978)
+++ branches/2.5/http/javascripts/mod_addWMSfromfilteredList_ajax.php 2008-09-18 13:28:02 UTC (rev 2979)
@@ -139,29 +139,46 @@
removeChildNodes(document.getElementById("resultTableBody"));
}
-function addRow(tableId, leftText, rightText, onClick) {
+function addRow(tableId, leftText, rightText, onClick, cnt) {
var leftNode = document.createElement("td");
- var leftDivNode = createDiv(leftText, onClick);
+ var leftDivNode = createDiv(leftText, onClick,"leftDiv"+cnt);
leftNode.appendChild(leftDivNode);
var rightNode = document.createElement("td");
- var rightDivNode = createDiv(rightText, onClick);
+ var rightDivNode = createDiv(rightText, onClick,"rightDiv"+cnt);
rightNode.appendChild(rightDivNode);
var rowNode = document.createElement("tr");
- rowNode.setAttribute("onmouseover", "this.style.backgroundColor = \"#F08080\"");
- rowNode.setAttribute("onmouseout", "this.style.backgroundColor = \"#FFFFFF\"");
+ rowNode.id = "tr"+cnt;
+ var nodeId = rowNode.id;
+ rowNode.onmouseover = function () {
+ setBackgroundColor(nodeId,"#F08080");
+ }
+ rowNode.onmouseout = function () {
+ setBackgroundColor(nodeId,"#FFFFFF");
+ }
+ //rowNode.setAttribute("onmouseover", "this.style.backgroundColor = '#F08080'");
+ //rowNode.setAttribute("onmouseout", "this.style.backgroundColor = '#FFFFFF'");
+
rowNode.appendChild(leftNode);
rowNode.appendChild(rightNode);
document.getElementById(tableId).appendChild(rowNode);
}
-function createDiv(text, onClick) {
+function setBackgroundColor(nodeId, color){
+ document.getElementById(nodeId).style.backgroundColor = color;
+}
+
+function createDiv(text, onClick, divId) {
var divNode = document.createElement("div");
+ divNode.id = divId;
divNode.style.cursor = "pointer";
- divNode.setAttribute("onclick", onClick);
+ divNode.onclick = onClick;
+
+ //divNode.setAttribute("onclick", onClick);
divNode.innerHTML = text;
+
return divNode;
}
@@ -206,8 +223,13 @@
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);
+ (function () {
+ var index = i;
+ var onClick = function () {
+ getWMSByGroup(groupArray[index].id);
+ }
+ addRow("resultTableBody", groupArray[i].name, groupArray[i].description, onClick, i);
+ }());
}
}
else {
@@ -220,8 +242,13 @@
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);
+ (function () {
+ var index = i;
+ var onClick = function () {
+ getWMSByGUI(guiArray[index].id);
+ }
+ addRow("resultTableBody", guiArray[i].name, guiArray[i].description, onClick, i);
+ }())
}
}
else {
@@ -235,14 +262,21 @@
for (var i = 0; i < wmsArray.length; i++) {
- if (global_source == "db" && typeof(guiId) !== "undefined" ) {
- var onClick = "mod_addWMSfromDB('" + guiId + "', '" + wmsArray[i].id + "')";
- }
- else {
- var onClick = "mod_addWMSfromDB('" + guiId + "', '" + wmsArray[i].id + "')";
-// var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
- }
- addRow("resultTableBody", wmsArray[i].title, wmsArray[i].abstract, onClick);
+ (function () {
+ var index = i;
+ if (global_source == "db" && typeof(guiId) !== "undefined" ) {
+ var onClick = function () {
+ mod_addWMSfromDB(guiId, wmsArray[index].id);
+ }
+ }
+ else {
+ var onClick = function () {
+ mod_addWMSfromDB(guiId, wmsArray[index].id);
+ }
+ // var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
+ }
+ addRow("resultTableBody", wmsArray[i].title, wmsArray[i].abstract, onClick, i);
+ }());
}
}
else {
More information about the Mapbender_commits
mailing list