[Mapbender-commits] r1785 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Nov 7 09:28:43 EST 2007


Author: christoph
Date: 2007-11-07 09:28:43 -0500 (Wed, 07 Nov 2007)
New Revision: 1785

Modified:
   trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
Log:
allows to remove wfs confs

Modified: trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php	2007-11-07 14:27:42 UTC (rev 1784)
+++ trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php	2007-11-07 14:28:43 UTC (rev 1785)
@@ -1,5 +1,5 @@
-<?php
-# $Id: mod_wfs_gazetteer_client.php 1326 2007-10-29 10:52:03Z baudson $
+<?php 
+# $Id: mod_wfs_gazetteer_client.php 1370 2007-11-07 14:13:46Z baudson $
 # maintained by http://www.mapbender.org/index.php/User:Verena Diewald
 # http://www.mapbender.org/index.php/WFS_gazetteer
 # Copyright (C) 2002 CCGIS 
@@ -67,7 +67,7 @@
 var cw_fillcolor = "#cc33cc";
 
 
-//parent.mb_registerInitFunctions("window.frames['"+this.name+"'].initModWfsGazetteer()");
+parent.mb_registerInitFunctions("window.frames['"+this.name+"'].appendWfsConf('')");
 
 function openwindow(Adresse) {
 	Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
@@ -77,10 +77,21 @@
 
 function appendWfsConf(newWfsConfIdString) {
 	// merge with existing wfs conf ids
-	wfsConfIdString += "," + newWfsConfIdString;
+	if (wfsConfIdString !== "") {
+		if (newWfsConfIdString !== "") {
+			wfsConfIdString += "," + newWfsConfIdString;
+
+			// rebuild form
+			initModWfsGazetteer();
+		}
+	}
+	else {
+		wfsConfIdString = newWfsConfIdString;
+
+		// rebuild form
+		initModWfsGazetteer();
+	}
 	
-	// rebuild form
-	initModWfsGazetteer();
 }
 
 function removeChildNodes(node) {
@@ -127,7 +138,7 @@
 
 function initModWfsGazetteer() {
 	// empty nodes
-	var nodesToEmpty = ["selectWfsConfForm", "wfsForm", "res"];
+	var nodesToEmpty = ["selectWfsConfForm", "wfsForm", "res", "wfsInfo"];
 	
 	while (nodesToEmpty.length > 0) {
 		var currentId = nodesToEmpty.pop();
@@ -135,6 +146,9 @@
 		removeChildNodes(currentNode);
 	}
 	
+	document.getElementById("wfsGeomType").style.visibility = "hidden";
+	document.getElementById("wfsRemove").style.visibility = "hidden";
+	
 	parent.mb_ajax_json("../php/mod_wfs_gazetteer_server.php", {command:"getWfsConf",wfsConfIdString:wfsConfIdString}, function(json, status) {
 		global_wfsConfObj = json;
 		var wfsCount = 0;
@@ -171,6 +185,7 @@
 	imgNode.border = 0;
 	bulbNode.appendChild(imgNode);
 	bulbNode.href = "javascript:openwindow('../x_geoportal/mod_featuretypeMetadata.php?wfs_conf_id=" + global_selectedWfsConfId.toString() + "');";
+	bulbNode.style.visibility = "visible";
 	
 	// set wfsGeomType image
 	var wfsGeomTypeNode = document.getElementById("wfsGeomType");
@@ -195,8 +210,40 @@
 	else {
 		var e = new Mb_exception("WFS gazetteer: geometry type unknown.");		
 	}
+	
+	// set image: remove this WFS
+	var wfsRemoveNode = document.getElementById("wfsRemove");
+	wfsRemoveNode.src = "../img/button_digitize/geomRemove.png";
+	wfsRemoveNode.style.visibility = 'visible';
+	// Internet explorer
+	if (parent.ie) {
+		wfsRemoveNode.onclick = function() {
+			var x = new Function ("", "delete global_wfsConfObj[global_selectedWfsConfId];setWfsConfIdString();initModWfsGazetteer();parent.mb_setWmcExtensionData({'wfsConfIdString':wfsConfIdString});"); 
+			x(); 
+		};
+	}
+	// Firefox
+	else {
+		wfsRemoveNode.onclick = function () {
+			delete global_wfsConfObj[global_selectedWfsConfId];
+			setWfsConfIdString();
+			initModWfsGazetteer();			
+			parent.mb_setWmcExtensionData({"wfsConfIdString":wfsConfIdString});
+		}
+	}
 }
 
+function setWfsConfIdString() {
+	var str = [];
+	for (var wfsConfId in global_wfsConfObj) {
+		global_selectedWfsConfId = wfsConfId; 
+		if (typeof(global_wfsConfObj[wfsConfId] != 'function')) {
+			str.push(wfsConfId);
+		}
+	}
+	wfsConfIdString = str.join(",");
+}
+
 function appendWfsConfSelectBox() {
 	var selectNode = document.createElement("select");
 	selectNode.name = "wfs_conf_sel";
@@ -410,6 +457,7 @@
 <body leftmargin='0' topmargin='10'  bgcolor='#ffffff'>
 <form name='selectWfsConfForm' id='selectWfsConfForm'></form>
 <img src = "" name='wfsGeomType' id='wfsGeomType'>
+<img src = "" name='wfsRemove' id='wfsRemove'>
 <a name='wfsInfo' id='wfsInfo'/>
 <form name='wfsForm' id='wfsForm' onsubmit='return validate()'></form>
 <div name='res' id='res' style='width:180px'></div>



More information about the Mapbender_commits mailing list