[Mapbender-commits] r4672 - in branches/2.6: core http/classes http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Sep 22 04:07:09 EDT 2009


Author: christoph
Date: 2009-09-22 04:07:04 -0400 (Tue, 22 Sep 2009)
New Revision: 4672

Modified:
   branches/2.6/core/system.php
   branches/2.6/http/classes/class_administration.php
   branches/2.6/http/classes/class_connector.php
   branches/2.6/http/classes/class_element.php
   branches/2.6/http/classes/class_locale.php
   branches/2.6/http/classes/class_map.php
   branches/2.6/http/classes/class_wms.php
   branches/2.6/http/javascripts/geometry.js
   branches/2.6/http/javascripts/mod_digitize_tab.php
   branches/2.6/http/javascripts/mod_wfs_SpatialRequest.php
Log:
bug fixes

Modified: branches/2.6/core/system.php
===================================================================
--- branches/2.6/core/system.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/core/system.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -21,7 +21,7 @@
 #
 define("MB_VERSION_NUMBER", "2.6");
 define("MB_VERSION_APPENDIX", "");
-define("MB_RELEASE_DATE", mktime(0,0,0,9,21,2009));//h, min,sec,month,day,year
+define("MB_RELEASE_DATE", mktime(0,0,0,9,22,2009));//h, min,sec,month,day,year
 
 #
 # constants from map.js

Modified: branches/2.6/http/classes/class_administration.php
===================================================================
--- branches/2.6/http/classes/class_administration.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/classes/class_administration.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -1090,13 +1090,14 @@
 		$t = array('i','s');
 		$res = db_prep_query($sql,$v,$t);
 		if($row = db_fetch_array($res)){
-			return $row['layer_id'];
+			if (is_numeric($row['layer_id'])) {
+				return intval($row['layer_id']);
+			}
 		}
-		else{
-			return false;
-		}
+		$e = new mb_warning("Unknown Layer (WMS ID: " . $wms_id . ", layer name: " . $layer_name . ")");
+		return false;
 	}
-	
+
 	function getWmsIdByWmsGetmap($getmap) {
 		$sql = "SELECT wms_id FROM wms WHERE ";
 		$sql .= "wms_getmap LIKE $1 LIMIT 1";

Modified: branches/2.6/http/classes/class_connector.php
===================================================================
--- branches/2.6/http/classes/class_connector.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/classes/class_connector.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -62,12 +62,12 @@
 		        $NOT_PROXY_HOSTS_array = explode(",", NOT_PROXY_HOSTS);
 
 				if (in_array($host, $NOT_PROXY_HOSTS_array)){
-				        $e = new mb_notice("HTTP host:".$host);
+				    $e = new mb_notice("HTTP host:".$host);
 					$this->file = $this->getHTTP($url);
 				}
 				else {
-				     	$e = new mb_notice("CURL host:".$host);
-					$this->file = $this->getCURL($url);	
+				    $e = new mb_notice("CURL host:".$host);
+					$this->file = $this->getCURL($url);
 				}
 				break;
 			case "http":

Modified: branches/2.6/http/classes/class_element.php
===================================================================
--- branches/2.6/http/classes/class_element.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/classes/class_element.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -127,6 +127,10 @@
 
 	private function getHtmlOpenTag () {
 		$openTag = "";
+		
+		if (!$this->element) {
+			return "";
+		}
 	
 		if ($this->id) {
 			// tag name
@@ -222,7 +226,7 @@
 	
 	private function getHtmlContent () {
 		$htmlContent = "";
-		if ($this->content != "") {
+		if ($this->content != "" && $this->element) {
 			$htmlContent .= stripslashes($this->content);
 		}
 		return $htmlContent;
@@ -257,4 +261,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>

Modified: branches/2.6/http/classes/class_locale.php
===================================================================
--- branches/2.6/http/classes/class_locale.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/classes/class_locale.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -221,7 +221,7 @@
 				'windows' => 'hu_HU.1250',
 				'bsd' => 'hu_HU',
 				'posix' => 'hu_HU'
-			);			
+			);
         }
 
         /**
@@ -266,4 +266,4 @@
             }
         }
 }
-?>
\ No newline at end of file
+?>

Modified: branches/2.6/http/classes/class_map.php
===================================================================
--- branches/2.6/http/classes/class_map.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/classes/class_map.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -250,11 +250,10 @@
 	 * @param $jsMapObject Object
 	 */
 	public function createFromJs ($jsMapObject) {
-		$arrayBBox = explode(",", $jsMapObject->extent);
-		$minx = floatval($arrayBBox[0]);
-		$miny = floatval($arrayBBox[1]);
-		$maxx = floatval($arrayBBox[2]);
-		$maxy = floatval($arrayBBox[3]);
+		$minx = $jsMapObject->extent->min->x;
+		$miny = $jsMapObject->extent->min->y;
+		$maxx = $jsMapObject->extent->max->x;
+		$maxy = $jsMapObject->extent->max->y;
 		$srs = $jsMapObject->epsg;
 		$bbox = new Mapbender_bbox($minx, $miny, $maxx, $maxy, $srs);
 
@@ -472,10 +471,20 @@
 			// reset the WMS array
 			// BEWARE, SUPER UGLY CODE AHEAD!!
 			// (BUT THERE IS NO OTHER WAY TO DO IT)
-			if (strpos($row["e_src"], "mod_mapOV.php?wms") !== false) {
+			if (strpos($row["e_js_file"], "ovnf.php") !== false) {
 //				$e = new mb_exception("guess this is the OV");
-				$pattern = "/[\.\/a-zA-Z_]*\?wms=([0-9]*)[^0-9]*/";
-				$ovIndex = preg_replace($pattern, "\$1", $row["e_src"]);
+
+				$ov_sql = "SELECT var_value FROM gui_element_vars WHERE " . 
+					"var_name = 'overview_wms' AND fkey_e_id = $1 AND " . 
+					"fkey_gui_id = $2";
+				$ov_v = array($frameName, $appId);
+				$ov_t = array('s', 's');
+				$ov_res = db_prep_query($ov_sql, $ov_v, $ov_t);
+				$ov_row = db_fetch_array($ov_res);
+				if ($ov_row) {
+					$ov_index = intval($row["var_value"]);
+				}
+				
 //				$e = new mb_exception("OV index: " . $ovIndex);
 				if (!$ovIndex) {
 					$ovIndex = 0;

Modified: branches/2.6/http/classes/class_wms.php
===================================================================
--- branches/2.6/http/classes/class_wms.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/classes/class_wms.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -73,6 +73,14 @@
 	function wms() {
 	} 
 
+	public static function getWmsMetadataUrl ($wmsId) {
+		return preg_replace(
+			"/(.*)frames\/login.php/", 
+			"$1php/mod_layerMetadata.php?id=", 
+			LOGIN
+		) . $wmsId;
+	}
+
 	public static function getConjunctionCharacter ($url) {
 		if (mb_strpos($url, "?") !== false) { 
 			if (mb_substr($url, mb_strlen($url)-1, 1) == "?") { 
@@ -624,7 +632,7 @@
 				
 				if(mb_strtoupper($element[tag]) == "SRS"){
 					// unique srs only, see http://www.mapbender.org/index.php/Arrays_with_unique_entries
-					$this->wms_srs = array_keys(array_flip(array_merge($this->wms_srs, explode(" ", strtoupper($element[value])))));  				
+					$this->wms_srs = array_keys(array_flip(array_merge($this->wms_srs, explode(" ", strtoupper($element[value])))));
 				}						      
 				if(mb_strtoupper($element[tag]) == "LATLONBOUNDINGBOX"){
 					$cnt_epsg++;
@@ -815,7 +823,7 @@
 		echo "gui_wms_featureinfoformat: " . $this->gui_wms_featureinfoformat . " <br>";
 		echo "gui_wms_exceptionformat: " . $this->gui_wms_exceptionformat . " <br>";	
 		echo "gui_wms_epsg: " . $this->gui_wms_epsg . " <br>";
-		echo "wms_srs: " . implode(", ", $this->wms_srs) . " <br>";		
+		echo "wms_srs: " . implode(", ", $this->wms_srs) . " <br>";
 		echo "gui_wms_visible: " . $this->gui_wms_visible . " <br>";
 		echo "gui_wms_opacity: " . $this->gui_wms_opacity . " <br>";
 		echo "support_sld: " . $this->wms_supportsld . " <br>";
@@ -1033,11 +1041,11 @@
 					$this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');";
 			}
 			for($j=0; $i==0 && $j<count($this->wms_srs);$j++){
-					if($parent){
+				if($parent){
 					$str .= "parent.";
-					}
-					$str .= "wms_addSRS('". 
-						$this->wms_srs[$j] ."', null, null, null, null);\n";
+				}
+				$str .= "wms_addSRS('". 
+				$this->wms_srs[$j] ."', null, null, null, null);\n";
 			}
 			for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
 				if($parent){
@@ -1178,6 +1186,7 @@
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
 			db_rollback();
+			return null;
 		}
 		
 		$myWMS = db_insert_id($con,'wms', 'wms_id');
@@ -1202,9 +1211,12 @@
 		$v = array($gui_id);
 		$t = array('s');
 		$res = db_prep_query($sql,$v,$t);
-		if(db_result($res, 0,"pos") > -1){
+		if (db_result($res, 0,"pos") > -1) {
 			$position = db_result($res, 0,"pos") + 1;
-		} else{ $position = 0; }
+		} 
+		else { 
+			$position = 0; 
+		}
 		
 		$sql ="INSERT INTO gui_wms (fkey_gui_id, fkey_wms_id, gui_wms_position, gui_wms_mapformat, ";
 		$sql .= "gui_wms_featureinfoformat, gui_wms_exceptionformat, gui_wms_epsg)";
@@ -1216,6 +1228,7 @@
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
 			db_rollback();	
+			return null;
 		}
 		db_commit();
 	    
@@ -2249,6 +2262,14 @@
 		//var_dump($this);	
 	}
 
+	public static function getLayerMetadataUrl ($layerId) {
+		return preg_replace(
+			"/(.*)frames\/login.php/", 
+			"$1php/mod_layerMetadata.php?id=", 
+			LOGIN
+		) . $layerId;
+	}
+
 	public function __toString () {
 		$e = new mb_exception("TITLE: " . $this->layer_title);
 		return $this->layer_title;

Modified: branches/2.6/http/javascripts/geometry.js
===================================================================
--- branches/2.6/http/javascripts/geometry.js	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/javascripts/geometry.js	2009-09-22 08:07:04 UTC (rev 4672)
@@ -115,7 +115,17 @@
  * @param {GeometryArray} geom GeometryArray
  */
 GeometryArray.prototype.union = function(geom){
-	return this.importGeoJSON(geom.toString());
+	var oldLen = this.count();
+	this.importGeoJSON(geom.toString());
+	var j = 0;
+	for (var i = oldLen; i < this.count(); i++) {
+		if (typeof geom.get(j).wfs_conf !== "undefined") {
+			this.get(i).wfs_conf = geom.get(j).wfs_conf;
+		}
+		j++;
+	}
+	return this;
+
 };
 
 /**

Modified: branches/2.6/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/2.6/http/javascripts/mod_digitize_tab.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/javascripts/mod_digitize_tab.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -170,9 +170,7 @@
 
 function appendGeometryArray(obj) {
 	executeDigitizePreFunctions();
-	for (i=0; i<obj.count(); i++) {
-		d.addCopy(obj.get(i));
-	}
+	d.union(obj);
 	executeDigitizeSubFunctions();
 }
 

Modified: branches/2.6/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- branches/2.6/http/javascripts/mod_wfs_SpatialRequest.php	2009-09-21 14:19:22 UTC (rev 4671)
+++ branches/2.6/http/javascripts/mod_wfs_SpatialRequest.php	2009-09-22 08:07:04 UTC (rev 4672)
@@ -657,7 +657,9 @@
 
 function appendGeometryArrayToDigitize(geom){
 	var mapIndex = getMapObjIndexByName(mod_wfs_spatialRequest_target);
-
+	if (!geom || geom.count() === 0) {
+		return;
+	}
 	var proceed = true;
 	if (geom.get(0).getEpsg() !== mb_mapObj[mapIndex].epsg) {
 		var msg = "SRS mismatch. Geometry is in " + geom.get(0).getEpsg() + 



More information about the Mapbender_commits mailing list