[Mapbender-commits] r7659 - in trunk/mapbender: http/classes http/geoportal http/plugins owsproxy/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Feb 27 17:04:02 EST 2011


Author: armin11
Date: 2011-02-27 14:04:02 -0800 (Sun, 27 Feb 2011)
New Revision: 7659

Modified:
   trunk/mapbender/http/classes/class_connector.php
   trunk/mapbender/http/classes/class_wmc.php
   trunk/mapbender/http/classes/class_wms.php
   trunk/mapbender/http/geoportal/gaz_wiki.php
   trunk/mapbender/http/geoportal/mod_revertGuiSessionSettings_server.php
   trunk/mapbender/http/plugins/mb_extendedSearch_server.php
   trunk/mapbender/http/plugins/mb_metadata_server.php
   trunk/mapbender/owsproxy/http/index.php
Log:
Bugfixes, resolves most problems with wms metadata server component ;-) - somethings were forgotten to implement last year i think.

Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/http/classes/class_connector.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -235,7 +235,7 @@
 		//check if proxy is set and server not in NOT_PROXY_HOSTS
  	    	if(CONNECTION_PROXY != "" AND (in_array($host, $NOT_PROXY_HOSTS_array)!= true)){
 			curl_setopt($ch, CURLOPT_PROXY,CONNECTION_PROXY.":".CONNECTION_PORT);
-			$e = new mb_exception("class_connector.php: Proxy will be used!");
+			$e = new mb_notice("class_connector.php: Proxy will be used!");
 			if(CONNECTION_PASSWORD != ""){
 				curl_setopt ($ch, CURLOPT_PROXYUSERPWD, CONNECTION_USER.':'.CONNECTION_PASSWORD);	
 			}

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/http/classes/class_wmc.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -919,7 +919,7 @@
 			}
 			$row = db_fetch_array($res);
 			if ($row) {
-				$e = new mb_exception("class_wmc: incrementWmcLoadCount found entry increment should be performed");
+				$e = new mb_notice("class_wmc: incrementWmcLoadCount found entry increment should be performed");
 				$count = $row['load_count'];
 				$count++;
 				$sql = "UPDATE wmc_load_count SET load_count = $2 WHERE fkey_wmc_serial_id = $1;";
@@ -1044,7 +1044,7 @@
 
 	public function featuretypeConfToJavaScript() {
 		$wfsConfIds = $this->generalExtensionArray['WFSCONFIDSTRING'];
-		new mb_notice("app AAAA idstr $wfsConfIds");
+		//new mb_notice("app AAAA idstr $wfsConfIds");
 		$featuretypeConfs = array();
 		$featuretypeConfArray = is_string($wfsConfIds) ?
 			explode(",", $wfsConfIds) : array();

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/http/classes/class_wms.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -8,7 +8,7 @@
 require_once dirname(__FILE__) . "/../../core/globalSettings.php";
 require_once dirname(__FILE__) . "/class_connector.php";
 require_once dirname(__FILE__) . "/class_user.php";
-require_once dirname(__FILE__) . "//class_Uuid.php";
+require_once dirname(__FILE__) . "/class_Uuid.php";
 require_once dirname(__FILE__) . "/class_administration.php";
 require_once dirname(__FILE__) . "/class_georss_factory.php";
 require_once dirname(__FILE__) . "/class_mb_exception.php";
@@ -103,7 +103,14 @@
 		#) . $wmsId;
 		return LOGIN."/../../mapbender/php/mod_showMetadata.php?resource=wms&id=".$wmsId;
 	}
-
+	public static function getLayerMetadataUrl ($layerId) {
+		#return preg_replace(
+		#	"/(.*)frames\/login.php/", 
+		#	"$1php/mod_layerMetadata.php?id=", 
+		#	LOGIN
+		#) . $wmsId;
+		return LOGIN."/../../mapbender/php/mod_showMetadata.php?resource=layer&id=".$layerId;
+	}
 	public static function isOwsProxyUrl ($getmap) {
 //		$e = new mb_notice("isOwsProxyUrl? " . $getmap);
 		$result = preg_match("/^.*owsproxy.([^i][\w\d]+)\/([\w\d]{32})\/?.*$/", $getmap);
@@ -237,7 +244,26 @@
 		}
 		throw new Exception ("Layer not found.");
 	}
+	public function &getLayerReferenceById ($id) {
+		$adm = new administration();
+		for ($i = 0; $i < count($this->objLayer); $i++) {
+			if (strval($this->objLayer[$i]->layer_uid) === strval($id)) {
+				if ($adm->getLayerPermission(
+							$this->wms_id, 
+							$this->objLayer[$i]->layer_name, 
+							Mapbender::session()->get("mb_user_id")
+				)) {
+					return $this->objLayer[$i];
+				}
+				else {
+					throw new AccessDeniedException ($id);
+				}
+			}
+		}
+		throw new Exception ("Layer not found.");
+	}
 
+
 	public function getLayerByPos ($pos) {
 		for ($i = 0; $i < count($this->objLayer); $i++) {
 			if (strval($this->objLayer[$i]->layer_pos) === strval($pos)) {
@@ -2189,6 +2215,7 @@
 			if($i>0){$sql .= ',';}
 			$sql .= "$".$c;
 			array_push($v,$this->objLayer[$i]->layer_name);
+			//$e = new mb_exception("class_wms: old layer name added for read: ".$this->objLayer[$i]->layer_name);
 			array_push($t,'s');		
 			$c++;
 		}
@@ -2213,6 +2240,7 @@
 			if($i>0){$sql .= ',';}
 			$sql .= "$".$c;
 			array_push($v,$this->objLayer[$i]->layer_name);
+			//$e = new mb_exception("class_wms: old layer name added for delete: ".$this->objLayer[$i]->layer_name);
 			array_push($t,'s');		
 			$c++;
 		}
@@ -2294,7 +2322,7 @@
 				$geoRssItemNewLayer = new GeoRssItem();
 				$geoRssItemNewLayer->setTitle("NEW LAYER: " . $currentLayer->layer_title." (".$currentLayer->layer_id.")");
 				$geoRssItemNewLayer->setDescription($currentLayer->layer_abstract);
-				$geoRssItemNewLayer->setUrl(layer::getLayerMetadataUrl($currentLayer->layer_id));
+				$geoRssItemNewLayer->setUrl(self::getLayerMetadataUrl($currentLayer->layer_id));
 				$geoRssItemNewLayer->setPubDate(self::rssDate());
 				for ($j = 0; $j < count($currentLayer->layer_epsg); $j++) {
 					$currentEpsg = $currentLayer->layer_epsg[$j];
@@ -2314,8 +2342,8 @@
 			}
 			foreach ($oldLayerNameArray as $oldLayer) {
 				$geoRssItemOldLayer = new GeoRssItem();
-				$geoRssItemOldLayer->setTitle("DELETED LAYER: " . $oldLayer["title"]." (".$oldLayer["id"].")");
-				$geoRssItemNewLayer->setUrl(layer::getLayerMetadataUrl($oldLayer["id"]));
+				$geoRssItemOldLayer->setTitle("DELETED LAYER: " . $oldLayer['title']." (".$oldLayer['id'].")");
+				$geoRssItemOldLayer->setUrl(self::getLayerMetadataUrl($oldLayer['id']));
 				$geoRssItemOldLayer->setDescription($oldLayer["abstract"]);
 				$geoRssItemOldLayer->setPubDate(self::rssDate());
 //				$geoRssItem->setUrl();
@@ -2787,7 +2815,8 @@
 			$layer_cnt=count($this->objLayer)-1;
 			$this->objLayer[$layer_cnt]->layer_uid = $row2["layer_id"];
 			$this->objLayer[$layer_cnt]->layer_name = administration::convertIncomingString($row2["layer_name"]);
-			$this->objLayer[$layer_cnt]->layer_title = administration::convertIncomingString($row2["layer_title"]);	
+			$this->objLayer[$layer_cnt]->layer_title = administration::convertIncomingString($row2["layer_title"]);
+			$this->objLayer[$layer_cnt]->layer_abstract = administration::convertIncomingString($row2["layer_abstract"]);	
 			$this->objLayer[$layer_cnt]->gui_layer_title = $this->objLayer[$layer_cnt]->layer_title;			
 			$this->objLayer[$layer_cnt]->layer_dataurl_href =$row2["layer_dataurl"];
 			$this->objLayer[$layer_cnt]->layer_metadataurl =$row2["layer_metadataurl"];
@@ -2822,7 +2851,51 @@
 				$this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxy"]=$row2["maxy"];
 				$count_layer_epsg++;
 			}
+			### read out keywords
+			$sql = "SELECT keyword FROM keyword, layer_keyword 
+WHERE keyword_id = fkey_keyword_id AND fkey_layer_id = $1";
+			$v = array($this->objLayer[$layer_cnt]->layer_uid);
+			$t = array('i');
+			$res_layer_keywords = db_prep_query($sql,$v,$t);
 			
+			$count_layer_keywords=0;
+			while($row2 = db_fetch_array($res_layer_keywords)){
+				$this->objLayer[$layer_cnt]->layer_keyword[$count_layer_keywords]=$row2["keyword"];
+				$count_layer_keywords++;
+			}
+			### read out layer_md_topic_category_id
+			$sql = "SELECT fkey_md_topic_category_id FROM layer_md_topic_category WHERE fkey_layer_id =  $1";
+			$v = array($this->objLayer[$layer_cnt]->layer_uid);
+			$t = array('i');
+			$res_layer_md_topic_category = db_prep_query($sql,$v,$t);
+			
+			$count_layer_md_topic_category=0;
+			while($row2 = db_fetch_array($res_layer_md_topic_category)){
+				$this->objLayer[$layer_cnt]->layer_md_topic_category_id[$count_layer_md_topic_category]=$row2["fkey_md_topic_category_id"];
+				$count_layer_md_topic_category++;
+			}
+			### read out layer_inspire_category_id
+			$sql = "SELECT fkey_inspire_category_id FROM layer_inspire_category WHERE fkey_layer_id =  $1";
+			$v = array($this->objLayer[$layer_cnt]->layer_uid);
+			$t = array('i');
+			$res_layer_inspire_category = db_prep_query($sql,$v,$t);
+			
+			$count_layer_inspire_category=0;
+			while($row2 = db_fetch_array($res_layer_inspire_category)){
+				$this->objLayer[$layer_cnt]->layer_inspire_category_id[$count_layer_inspire_category]=$row2["fkey_inspire_category_id"];
+				$count_layer_inspire_category++;
+			}
+			### read out layer_custom_category_id
+			$sql = "SELECT fkey_custom_category_id FROM layer_custom_category WHERE fkey_layer_id =  $1";
+			$v = array($this->objLayer[$layer_cnt]->layer_uid);
+			$t = array('i');
+			$res_layer_custom_category = db_prep_query($sql,$v,$t);
+			
+			$count_layer_custom_category=0;
+			while($row2 = db_fetch_array($res_layer_custom_category)){
+				$this->objLayer[$layer_cnt]->layer_custom_category_id[$count_layer_custom_category]=$row2["fkey_custom_category_id"];
+				$count_layer_custom_category++;
+			}
 			### handle styles
 			$sql = "SELECT * FROM layer_style WHERE fkey_layer_id = $1 ";
 			$v = array($this->objLayer[$layer_cnt]->layer_uid);
@@ -3013,15 +3086,6 @@
 		return false;
 	}
 
-	public static function getLayerMetadataUrl ($layerId) {
-		#return preg_replace(
-		#	"/(.*)frames\/login.php/", 
-		#	"$1php/mod_showMetadata.php?resource=layer&id=", 
-		#	LOGIN
-		#) . $layerId;
-		return LOGIN."/../../mapbender/php/mod_showMetadata.php?resource=layer&id=".$layerId;
-	}
-
 	public function __toString () {
 		$e = new mb_exception("TITLE: " . $this->layer_title);
 		return $this->layer_title;

Modified: trunk/mapbender/http/geoportal/gaz_wiki.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz_wiki.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/http/geoportal/gaz_wiki.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -51,7 +51,7 @@
 $e = new mb_notice("gaz_wiki: xml after parsing with php simplexml: ".$wikiXmlObject->asXML());
 //get the list of results 
 $lists = $wikiXmlObject->xpath('/api/query/search/p/@title');
-$e = new mb_exception("gaz_wiki: number of results: ".count($lists));
+$e = new mb_notice("gaz_wiki: number of results: ".count($lists));
 //debug
 //while(list( , $node) = each($lists)) {
 //	$e = new mb_exception('/api/query/search/p/@title: '.$node);
@@ -71,7 +71,7 @@
 } else {
 	//parse title matches 
 	while(list( , $node) = each($lists)) {
-     		$e = new mb_exception('/api/query/search/p/@title: '.$node);
+     		$e = new mb_notice('/api/query/search/p/@title: '.$node);
 		$link = $surl.$node;
 		$title = $node;
 		$m = $xml->createElement('member');

Modified: trunk/mapbender/http/geoportal/mod_revertGuiSessionSettings_server.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_revertGuiSessionSettings_server.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/http/geoportal/mod_revertGuiSessionSettings_server.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -17,8 +17,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-$e = new mb_exception("revert GUI session settings:");
-$e = new mb_exception("curr: " . Mapbender::session()->get("mb_user_gui"));
-$e = new mb_exception("prev: " . Mapbender::session()->get("previous_gui"));
+$e = new mb_notice("revert GUI session settings:");
+$e = new mb_notice("curr: " . Mapbender::session()->get("mb_user_gui"));
+$e = new mb_notice("prev: " . Mapbender::session()->get("previous_gui"));
 Mapbender::session()->set("mb_user_gui", Mapbender::session()->get("previous_gui"));
 ?>

Modified: trunk/mapbender/http/plugins/mb_extendedSearch_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_extendedSearch_server.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/http/plugins/mb_extendedSearch_server.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -12,7 +12,7 @@
 //get language parameter out of mapbender session if it is set else set default language to de_DE
 $sessionLang = Mapbender::session()->get("mb_lang");
 if (($sessionLang != false) && ($sessionLang != '')) {
-	$e = new mb_exception("mb_extentedSearch_server.php: language in session: ".$sessionLang);
+	$e = new mb_notice("mb_extentedSearch_server.php: language in session: ".$sessionLang);
 	$language = $sessionLang;
 } else {
 	$language = "de_DE";//use locale for compatibility with later mapbender version
@@ -26,7 +26,7 @@
 
 #$langCode="de";
 
-$e = new mb_exception("mb_extendendSearch_server.php: language: ".$langCode);
+$e = new mb_notice("mb_extendendSearch_server.php: language: ".$langCode);
 
 //workflow:
 switch($obj->action){

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -177,6 +177,7 @@
 		while ($row = db_fetch_assoc($res)) {
 			foreach ($row as $key => $value) {
 				$resultObj[$key] = $value;
+				$e = new mb_exception("plugins/mb_metadata_server.php: get ".$value." for ".$key);
 			}
 		}
 
@@ -372,13 +373,20 @@
 			$layerId = intval($data->layer->layer_id);
 		}
 		catch (Exception $e) {
+		  	$ajaxResponse->setSuccess(false);
+			$ajaxResponse->setMessage(_mb("Could not read layer ID ".$data->layer->layer_id));
+			$ajaxResponse->send();						
 		}
 		
 		if ($layerId) {
+			$e = new mb_exception("Got following layer id from wms metadata editor client: ".$layerId);
 			try {
-				$layer = $wms->getLayerById($layerId);
+				$layer = &$wms->getLayerReferenceById($layerId);
 			}
 			catch (Exception $e) {
+				$ajaxResponse->setSuccess(false);
+				$ajaxResponse->setMessage(_mb("Could not get layer with ID ".$layerId));
+				$ajaxResponse->send();						
 			}
 			$columns = array(
 				"layer_abstract",
@@ -391,6 +399,7 @@
 
 			foreach ($columns as $c) {
 				$value = $data->layer->$c;
+				$e = new mb_exception("plugins/mb_metadata_server.php: layer entry for ".$c.": ".$data->layer->$c);
 				if ($c === "layer_keyword") {
 					$layer->$c = explode(",", $value);
 					foreach ($layer->$c as &$val) {
@@ -420,8 +429,16 @@
 		} else {
 			$wms->wms_network_access = intval('0');
 		}
-		$wms->updateObjInDB($wmsId);
+		//try {
+			$wms->updateObjInDB($wmsId);
+		//}
+		//catch (Exception $e) {
+		//	$ajaxResponse->setSuccess(false);
+		//	$ajaxResponse->setMessage(_mb("Could not update wms object in database!"));
+		//	$ajaxResponse->send();						
+		//}
 		
+		
 		$ajaxResponse->setMessage("Updated WMS metadata for ID " . $wmsId);
 		$ajaxResponse->setSuccess(true);		
 		

Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php	2011-02-27 16:28:53 UTC (rev 7658)
+++ trunk/mapbender/owsproxy/http/index.php	2011-02-27 22:04:02 UTC (rev 7659)
@@ -391,11 +391,11 @@
 	preg_match_all($pattern,$content,$matches);
 	for($i=0; $i<count($matches[1]); $i++){
 		$req = $matches[1][$i];
-		$e = new mb_exception("Gefundene URL ".$i.": ".$req);
+		$e = new mb_notice("owsproxy found URL ".$i.": ".$req);
 		#$notice = new mb_notice("owsproxy id:".$req);
 		$id = registerURL($req);
 		$extReq = setExternalRequest($id);
-		$e = new mb_exception("MD5 URL ".$id."-Externer Link: ".$extReq);
+		$e = new mb_notice("MD5 URL ".$id." - external link: ".$extReq);
 		$content = str_replace($req,$extReq,$content);
 	}
 	return $content;



More information about the Mapbender_commits mailing list