Pārlūkot izejas kodu

Map refresh after remove geom in table; fix popup message

Piotr Labudda 11 gadi atpakaļ
vecāks
revīzija
67957677a3
3 mainītis faili ar 23 papildinājumiem un 5 dzēšanām
  1. 1 1
      SE/VERSION
  2. 1 0
      SE/se-lib/TableAjax.php
  3. 21 4
      SE/se-lib/TableAjaxMap.php

+ 1 - 1
SE/VERSION

@@ -1 +1 @@
-3.9.8-7
+3.9.8-8

+ 1 - 0
SE/se-lib/TableAjax.php

@@ -1070,6 +1070,7 @@ class TableAjax extends ViewAjax {
 														if (priv.options.debug) console.log('data.record.the_geom:2:', data.record.the_geom);
 														if (priv.options.debug) console.log('data.record.the_geom:2:', data.record.the_geom);
 														geomField.setValue(data.record.the_geom);
 														geomField.setValue(data.record.the_geom);
 													}
 													}
+													_mapEditor.TableAjaxMapRefresh();
 												})
 												})
 												.fail(function(jqXHR){// jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
 												.fail(function(jqXHR){// jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
 													if (jqXHR.responseJSON) {
 													if (jqXHR.responseJSON) {

+ 21 - 4
SE/se-lib/TableAjaxMap.php

@@ -442,14 +442,15 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
 		};
 		};
 
 
 		priv.showPopup = function(feature) {
 		priv.showPopup = function(feature) {
-			console.log('showPopup() ... ');
+			if (priv.options.debug) console.log('showPopup() ... ');
 			if (!feature) return;
 			if (!feature) return;
-			var popupContent = "<div style='font-size:.8em'>Feature: " + feature.id +"<br>Area: " + feature.geometry.getArea()+"</div>";
+			var popupContent = '';
 			if (feature.attributes._newRecordId > 0) {
 			if (feature.attributes._newRecordId > 0) {
 				popupContent = 'Rekord: ' + feature.attributes._newRecordId;
 				popupContent = 'Rekord: ' + feature.attributes._newRecordId;
 			} else if (feature.attributes.recordId > 0) {
 			} else if (feature.attributes.recordId > 0) {
 				popupContent = 'Rekord: ' + feature.attributes.recordId;
 				popupContent = 'Rekord: ' + feature.attributes.recordId;
 			}
 			}
+			if (!popupContent) return;
 			popupContent = '<div style="font-size:.8em">' + popupContent + '</div>';
 			popupContent = '<div style="font-size:.8em">' + popupContent + '</div>';
 			var popup = new OpenLayers.Popup("popups",
 			var popup = new OpenLayers.Popup("popups",
 				feature.geometry.getBounds().getCenterLonLat(),
 				feature.geometry.getBounds().getCenterLonLat(),
@@ -463,7 +464,7 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
 		};
 		};
 
 
 		priv.hidePopup = function(feature) {
 		priv.hidePopup = function(feature) {
-			console.log('hidePopup() ... ');
+			if (priv.options.debug) console.log('hidePopup() ... ');
 			if (feature && feature.popup) {
 			if (feature && feature.popup) {
 				_map.removePopup(feature.popup);
 				_map.removePopup(feature.popup);
 				feature.popup.destroy();
 				feature.popup.destroy();
@@ -472,7 +473,7 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
 		};
 		};
 
 
 		priv.onPopupClose = function() {
 		priv.onPopupClose = function() {
-			console.log('onPopupClose() ...');
+			if (priv.options.debug) console.log('onPopupClose() ...');
 			priv.hidePopup(_selectedFeature);
 			priv.hidePopup(_selectedFeature);
 		};
 		};
 
 
@@ -863,6 +864,11 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
 			_map.updateSize();
 			_map.updateSize();
 		};
 		};
 
 
+		publ.refresh = function(options) {
+			if (priv.options.debug) console.log('publ.refresh ... ', options);
+			_layer.refresh({force:true});
+		};
+
 		publ.zoomToExtent = function(extent) {
 		publ.zoomToExtent = function(extent) {
 			if (!extent) return;
 			if (!extent) return;
 			var sourceProj = new OpenLayers.Projection("EPSG:4326");
 			var sourceProj = new OpenLayers.Projection("EPSG:4326");
@@ -913,6 +919,17 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
 		return this;
 		return this;
 	};
 	};
 
 
+	$.fn.TableAjaxMapRefresh = function(options) {
+		options = options || {};
+		return this.each(function() {
+			var tblAjaxMap = $(this).data('TableAjaxMap');
+			if (tblAjaxMap) {
+				tblAjaxMap.refresh(options);
+			}
+		});
+		return this;
+	};
+
 	$.fn.TableAjaxMapZoomToExtent = function(extent) {
 	$.fn.TableAjaxMapZoomToExtent = function(extent) {
 		if (!extent) return;
 		if (!extent) return;
 		return this.each(function() {
 		return this.each(function() {