[OpenLayers-Commits] r4737 - in sandbox/timandseb/wfsv: examples lib/OpenLayers

commits at openlayers.org commits at openlayers.org
Mon Oct 1 14:58:27 EDT 2007


Author: sbenthall
Date: 2007-10-01 14:58:26 -0400 (Mon, 01 Oct 2007)
New Revision: 4737

Modified:
   sandbox/timandseb/wfsv/examples/wfs-v.html
   sandbox/timandseb/wfsv/lib/OpenLayers/Popup.js
Log:
Cancel functionality on both Cancel and closed popup works now.  Worked around problem with getFeature requests and map projections by simply updating the _attributes_ of the old feature, rather than replacing it with a new feature entirely.


Modified: sandbox/timandseb/wfsv/examples/wfs-v.html
===================================================================
--- sandbox/timandseb/wfsv/examples/wfs-v.html	2007-10-01 17:47:39 UTC (rev 4736)
+++ sandbox/timandseb/wfsv/examples/wfs-v.html	2007-10-01 18:58:26 UTC (rev 4737)
@@ -227,6 +227,8 @@
                                     new OpenLayers.Size(250,75),
                                     content,
                                     null, true);
+									
+			popup.onHide = function () {recallFeature(feature)}
 									 
 			feature.popup = popup;
             map.addPopup(popup,true);	
@@ -246,16 +248,13 @@
 		
 
 
+	
+		
 		function onViewStart(feature){
 			
-			recallFeature(feature);		
 			
-		}
-		
-		function onViewContinue(feature){
+			OpenLayers.Console.log("Feature _attributes_ have been recalled")
 			
-			OpenLayers.Console.log("onViewContinue")
-			
 			OpenLayers.Console.log(feature)
 			var view = document.createElement("div")
 			var table = document.createElement("table");
@@ -337,15 +336,18 @@
 		var xxyzzy = function(request){
 				var recalledFeature = panel.gml.read(request.responseXML);
 				
-				potentialFeature = panel.vectorLayer.fids[feature.fid];
-            	if(potentialFeature) {
-					panel.vectorLayer.removeFeatures([potentialFeature]);             	   
-            	}
-							
+				clientFeature = panel.vectorLayer.fids[feature.fid];
+            	
+				clientFeature.attributes = recalledFeature[0].attributes;
 				
-				panel.vectorLayer.addFeatures(recalledFeature,true)
+				/*
+				 * if(potentialFeature) {
+				 *  	panel.vectorLayer.removeFeatures([potentialFeature]);             	   
+            	 * }
+				 * 				
+				 * panel.vectorLayer.addFeatures(recalledFeature,true)
+				 */
 		
-				onViewContinue(recalledFeature[0]);
 			};
             
         new OpenLayers.Ajax.Request(url,
@@ -463,7 +465,7 @@
 			var tabedit = document.createElement("div");
 			tabedit.appendChild(form);
 			var cancel = document.createElement('button')
-			cancel.innerHTML = "*Cancel"
+			cancel.innerHTML = "Cancel"
 			cancel.onclick = function () {OpenLayers.Console.log("Cancel will be broken until View and Modify take their information from a feature created by a new geoserver requesst as opposed to from the client-side stored feature (which needs to be modified in order for the panel to realize there has been something modified(?))"); onModificationEnd(feature); onViewStart(feature);}
 			tabedit.appendChild(cancel);
 			var save = document.createElement("button")
@@ -506,6 +508,8 @@
 		
 
         function onModificationEnd(feature) {
+			recallFeature(feature)
+			
 			OpenLayers.Console.log('onModificationEnd(feature)')
             var element = document.getElementById("output");
             element.innerHTML = "";

Modified: sandbox/timandseb/wfsv/lib/OpenLayers/Popup.js
===================================================================
--- sandbox/timandseb/wfsv/lib/OpenLayers/Popup.js	2007-10-01 17:47:39 UTC (rev 4736)
+++ sandbox/timandseb/wfsv/lib/OpenLayers/Popup.js	2007-10-01 18:58:26 UTC (rev 4737)
@@ -475,6 +475,7 @@
 	 */
     hide: function()
     {
+		if(this.onHide) {this.onHide()}
         if (this.map) this.map.removePopup(this); 
         OpenLayers.Element.hide(this.div);
     },



More information about the Commits mailing list