[Mapbender-commits] r8283 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Mar 9 05:17:59 EST 2012


Author: armin11
Date: 2012-03-09 02:17:59 -0800 (Fri, 09 Mar 2012)
New Revision: 8283

Modified:
   trunk/mapbender/http/classes/class_wms.php
Log:
Bugfix for metadata editor - dont update format and srs if only metadata is updated via editor.

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2012-03-08 16:19:17 UTC (rev 8282)
+++ trunk/mapbender/http/classes/class_wms.php	2012-03-09 10:17:59 UTC (rev 8283)
@@ -2071,7 +2071,7 @@
                		}
 
 			if(!isset($layerObject[0])) {
-				$n = new mb_exception("Layer has no name and title, BBOX will not be generated for ".$epsg);
+				$n = new mb_notice("Layer has no name and title, BBOX will not be generated for ".$epsg);
 				return false;
 			}
 		
@@ -2087,14 +2087,14 @@
 					if(in_array(strtoupper($srs),$confSrsArray)) {
 						array_push($supportedSrsArray, strtoupper($srs));
 						
-						$n = new mb_exception("Requested SRS: ".$srs." is supported by layer: ".$layerName." with layer_id: ".$$layerParentArray[$j]['layer_id']);
+						$n = new mb_notice("Requested SRS: ".$srs." is supported by layer: ".$layerName." with layer_id: ".$$layerParentArray[$j]['layer_id']);
 					}	
 				}
 			}
 		
 		}
 		for($k=0; $k < count($supportedSrs);$k++) {
-			$e = new mb_exception("SRS ".$supportedSrs[$k]." supported for the layer: ".$layerId);
+			$e = new mb_notice("SRS ".$supportedSrs[$k]." supported for the layer: ".$layerId);
 		}
 		if(count($supportedSrsArray) == 0) {
 			$n = new mb_notice("class_wms.php: None of the defined srs are supported by the layer");
@@ -2115,7 +2115,7 @@
 				$this->objLayer[$i]->layer_epsg[$j][minx],$this->objLayer[$i]->layer_epsg[$j][miny],
 				$this->objLayer[$i]->layer_epsg[$j][maxx],$this->objLayer[$i]->layer_epsg[$j][maxy]
 				); 
-			$e = new mb_exception("class_wms.php: insertLayerEPSG: INSERT SQL:".$sql. " for Layer ".$this->objLayer[$i]->db_id);
+			$e = new mb_notice("class_wms.php: insertLayerEPSG: INSERT SQL:".$sql. " for Layer ".$this->objLayer[$i]->db_id);
 			$t = array('i','s','d','d','d','d');
 			$res = db_prep_query($sql,$v,$t);
 			if(!$res){
@@ -2166,7 +2166,7 @@
 		$supportedSrs = $supportedSrsNew;
 		
 		for($k=0; $k < count($supportedSrs);$k++) {
-			$e = new mb_exception("SRS ".$supportedSrs[$k]." for the layer: ".$this->objLayer[$i]->db_id);
+			$e = new mb_notice("SRS ".$supportedSrs[$k]." for the layer: ".$this->objLayer[$i]->db_id);
 			//compute this only, if the srs was not already in the current layer - see array epsg!
 			if(!in_array($supportedSrs[$k],$epsg) && $supportedSrs[$k] != '') {
 				$n = new mb_notice("Calculation for: ".$supportedSrs[$k]);
@@ -2350,16 +2350,16 @@
 					$datasetid = 'undefined';
 					$code = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString');
 					if (isset($code[0]) && $code[0] != '') {
-						$e = new mb_exception("class_wms.php: code given thru MD_Identifier: ".$code[0]);
+						$e = new mb_notice("class_wms.php: code given thru MD_Identifier: ".$code[0]);
 						//check if code is defined by codespace and code
 						$codeSplit = explode("#",$code);
 						if (isset($codeSplit[0]) && $codeSplit[0] != '' && isset($codeSplit[1]) && $codeSplit[1] != '') {
-							$e = new mb_exception("class_wms.php: code was constructed via codespace#code !");	
+							$e = new mb_notice("class_wms.php: code was constructed via codespace#code !");	
 							$datasetid = $codeSplit[0]."#".$codeSplit[1];
 						
 							
 						} else {
-							$e = new mb_exception("class_wms.php: code was not constructed via codespace#code !");	
+							$e = new mb_notice("class_wms.php: code was not constructed via codespace#code !");	
 							$datasetid = $code;
 						}
 					} else { //try to read code from RS_Identifier 		
@@ -2369,10 +2369,10 @@
 					#$e = new mb_exception("class_wms.php: codeSpace: ".$codeSpace[0]);
 						if (isset($codeSpace[0]) && isset($code[0]) && $codeSpace[0] != '' && $code[0] != '') {
 							$datasetid = $codeSpace[0]."#".$code[0];
-							$e = new mb_exception("class_wms.php: datasetid: ".$datasetid);
+							$e = new mb_notice("class_wms.php: datasetid: ".$datasetid);
 						} else {
 							//neither MD_Identifier nor RS_Identifier are defined in a right way
-							$e = new mb_exception("class_wms.php: the service data coupling has problems, cause the metadata doesnt have defined a datasetid");
+							$e = new mb_notice("class_wms.php: the service data coupling has problems, cause the metadata doesnt have defined a datasetid");
 						}
 					}
 					//abstract
@@ -2469,7 +2469,7 @@
 
 
 
-	function updateObjInDB($myWMS){
+	function updateObjInDB($myWMS,$updateMetadataOnly=false){ //TODO give return true or false to allow feedback to user!!!
 		if (!isset($this->wms_network_access) || ($this->wms_network_access == '')) {
 			$this->wms_network_access = intval('0');
 		}
@@ -2550,29 +2550,33 @@
 			db_rollback();	
 		}
 		$this->insertTermsOfUse($myWMS);
+		//the following things should not be updated by using the metadata editor! Therefor 
+		//if ($updateMetadataOnly) {
+		//	die();
+		//}
+		if (!$updateMetadataOnly) {
+			# delete and refill srs and formats
+			$sql = "DELETE FROM wms_srs WHERE fkey_wms_id = $1 ";
+			$v = array($myWMS);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			if(!$res){
+				db_rollback();	
+			}
+			$this->insertSRS($myWMS);
+			$e = new mb_exception("update formats, srs and gui confs!");
+			$sql = "DELETE FROM wms_format WHERE fkey_wms_id = $1 ";
+			$v = array($myWMS);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			if(!$res){
+				db_rollback();	
+			}
+			$this->insertFormat($myWMS);
 		
-		# delete and refill srs and formats
-		$sql = "DELETE FROM wms_srs WHERE fkey_wms_id = $1 ";
-		$v = array($myWMS);
-		$t = array('i');
-		$res = db_prep_query($sql,$v,$t);
-		if(!$res){
-			db_rollback();	
+			# update gui_wms
+			$this->update_gui_wms($myWMS);
 		}
-		$this->insertSRS($myWMS);
-		
-		$sql = "DELETE FROM wms_format WHERE fkey_wms_id = $1 ";
-		$v = array($myWMS);
-		$t = array('i');
-		$res = db_prep_query($sql,$v,$t);
-		if(!$res){
-			db_rollback();	
-		}
-		$this->insertFormat($myWMS);
-		
-		# update gui_wms
-		$this->update_gui_wms($myWMS);
-		
 		# update TABLE layer	
 		$oldLayerNameArray = array();
 		$v = array($myWMS);
@@ -3149,7 +3153,7 @@
 				$this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
 				$this->wms_getlegendurl = $row2["wms_getlegendurl"];
 			}			
-			// TO DO: Capabilities document needs to 
+			// TODO: Capabilities document needs to 
 			// be encoded to the original encoding
 			// if different from the database encoding
 			$this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
@@ -3182,6 +3186,7 @@
 			$this->gui_wms_visible = 1;
 			$this->gui_wms_opacity = 100;
 			$this->gui_wms_epsg=$row["gui_wms_epsg"];
+			//$e = new mb_exception("gui_wms_epsg: ".$this->gui_wms_epsg); --this is not there if update of metadata is made! Problem when updateing metadata with metadata editor
 			$this->gui_wms_sldurl = $row["gui_wms_sldurl"];
 			
 			if($this->wms_version == "1.0.0"){
@@ -3513,7 +3518,7 @@
 	}
 
 	public function __toString () {
-		$e = new mb_exception("TITLE: " . $this->layer_title);
+		//$e = new mb_exception("TITLE: " . $this->layer_title);
 		return $this->layer_title;
 	}
 	



More information about the Mapbender_commits mailing list