[Mapbender-commits] r7691 - in branches/kmq_dev: . http/extensions http/javascripts http/php http/plugins http/print resources/locale/de_DE/LC_MESSAGES tools

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Mar 8 04:21:57 EST 2011


Author: kmq
Date: 2011-03-08 01:21:56 -0800 (Tue, 08 Mar 2011)
New Revision: 7691

Modified:
   branches/kmq_dev/
   branches/kmq_dev/http/extensions/jqjson.min.js
   branches/kmq_dev/http/javascripts/mod_coordsLookup.php
   branches/kmq_dev/http/javascripts/mod_digitize_tab.php
   branches/kmq_dev/http/javascripts/mod_sandclock.js
   branches/kmq_dev/http/php/mod_wmc2ol.php
   branches/kmq_dev/http/plugins/mb_sessionWmc.js
   branches/kmq_dev/http/print/mapbender_template.json
   branches/kmq_dev/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
   branches/kmq_dev/tools/mod_mailAbo.php
Log:
 Merged r7678 through r7690 from trunk


Property changes on: branches/kmq_dev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/kmq_dev:4021-4487
/trunk/mapbender:7670-7677
   + /branches/kmq_dev:4021-4487
/trunk/mapbender:7670-7690


Property changes on: branches/kmq_dev/http/extensions/jqjson.min.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/mapbender/http/extensions/jqjson.min.js:7670-7677
   + /trunk/mapbender/http/extensions/jqjson.min.js:7670-7690

Modified: branches/kmq_dev/http/javascripts/mod_coordsLookup.php
===================================================================
--- branches/kmq_dev/http/javascripts/mod_coordsLookup.php	2011-03-04 08:52:47 UTC (rev 7690)
+++ branches/kmq_dev/http/javascripts/mod_coordsLookup.php	2011-03-08 09:21:56 UTC (rev 7691)
@@ -118,7 +118,7 @@
 		for(var i = 0; i < options.perimeters.length; i++) {
 			var optionValue = options.perimeters[i] + '';
 			
-			optionValue = (optionValue.length < 4) ? (optionValue + ' m') : optionValue.replace(/(\d+)(\d{3})/, '$1' + '.' + '$2' + ' m');
+			optionValue = (optionValue.length < 4) ? (optionValue + ' m') : optionValue.replace(/(\d+)(\d{3})/, '$1' + '$2' + ' m');
 			
 			$(this.perimeterSelect).append('<option value=' + optionValue + ' >' + optionValue + '</option>');
 		}

Modified: branches/kmq_dev/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/kmq_dev/http/javascripts/mod_digitize_tab.php	2011-03-04 08:52:47 UTC (rev 7690)
+++ branches/kmq_dev/http/javascripts/mod_digitize_tab.php	2011-03-08 09:21:56 UTC (rev 7691)
@@ -2087,7 +2087,7 @@
 // --- wfs window form check (end) -----------------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------------------------------
 
-function getAvailableWfsForGeom(geom, wfsConf) {
+function getAvailableWfsForGeom(geom, wfsConf) {	
 	var wfsConfIndices = [];
 	
 	for (var attr in wfsConf) {
@@ -2095,13 +2095,14 @@
 		if (!isTrans) {
 			continue;
 		}
+		/*
 		if (isValidWfsConfIndex(wfsConf, parseInt(geom.wfs_conf))) {
-			
-//			if (parseInt(geom.wfs_conf) == parseInt(attr)) {
+			if (parseInt(geom.wfs_conf) == parseInt(attr)) {
 				wfsConfIndices.push(attr);
-//			}
+			}
 		}
 		else {
+		*/
 			for (var elementIndex = 0; elementIndex < wfsConf[attr]['element'].length ; elementIndex++) {
 				var isGeomColumn = (parseInt(wfsConf[attr]['element'][elementIndex]['f_geom']) == 1); 
 				if (isGeomColumn) {
@@ -2148,7 +2149,7 @@
 					}
 				}
 			}
-		}	
+		//}	
 	}
 	return wfsConfIndices;
 }
@@ -2334,13 +2335,13 @@
 	var selected = false;
 	// set the current wfs_conf as the selected
 	// if wfs_conf is not yet set (for example when creating a new feature, just select the first one)
-	var selectedIndex = d.get(geometryIndex).wfs_conf || 0;
+	var selectedIndex = d.get(geometryIndex).wfs_conf || wfsConfIndices[0];
 	for (var i = 0; i < wfsConfIndices.length ; i++) {
 		for (var j in wfsConf[i].element){
 
 		}
 		str += "<option value='" + wfsConfIndices[i] + "'";
-		if (i == selectedIndex ) {
+		if (wfsConfIndices[i] == selectedIndex ) {
 			str += " selected";
 			selected = true;
 			defaultIndex = parseInt(wfsConfIndices[i]);
@@ -2882,7 +2883,34 @@
 				return;
 			}
 		}
-
+		
+		// Extract the current, possibly new WfsConf
+		var newWfsConfId = parseInt(wfsWindow.document.getElementById('wfs').wfs.value);
+		var newWfsConf = wfsConf[newWfsConfId]; 
+		newWfsConfId = newWfsConf['wfs_conf_id'];
+		
+		// Check each feature attribute if it is part of the WfsConf element type. If not, delete.
+		var e = d.get(m).e;
+		var elementsToDelete = [];
+		for(var i in e.name) {
+			var validElement = false;
+			for(var j in newWfsConf.element) {
+				if(e.name[i] == newWfsConf.element[j]['element_name']) {
+					validElement = true;
+					break;
+				}
+			}
+			if(!validElement) {
+				elementsToDelete.push(i);
+			}
+		}
+		
+		// Delete. As the arrays shrink, the indices into the arrays are shrunk, too
+		for(var i in elementsToDelete) {
+			e.name.splice(elementsToDelete[i] - i, 1);
+			e.value.splice(elementsToDelete[i] - i, 1);
+		}
+		
 		var geoJson = d.featureToString(m);
 
 		parent.mb_ajax_post(
@@ -2890,7 +2918,7 @@
 			{
 				'geoJson' : geoJson,
 				'method' : type,
-				'wfs_conf_id' : wfsConf[d.get(m).wfs_conf]['wfs_conf_id']
+				'wfs_conf_id' : newWfsConfId
 			}, 
 			function(json,status){
 				var result = typeof(json) == 'object' ? json :  eval('('+json+')');


Property changes on: branches/kmq_dev/http/javascripts/mod_sandclock.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/mapbender/http/javascripts/mod_sandclock.js:7670-7677
   + /trunk/mapbender/http/javascripts/mod_sandclock.js:7670-7690

Modified: branches/kmq_dev/http/php/mod_wmc2ol.php
===================================================================
--- branches/kmq_dev/http/php/mod_wmc2ol.php	2011-03-04 08:52:47 UTC (rev 7690)
+++ branches/kmq_dev/http/php/mod_wmc2ol.php	2011-03-08 09:21:56 UTC (rev 7691)
@@ -16,9 +16,14 @@
 #http://www.geoportal.rlp.de/mapbender/php/mod_wmc2ol.php?wmc_id=45_1291218568&GEORSS=1&LayerSwitcher=1
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-$userId = Mapbender::session()->get("mb_user_id");
-
+//require_once(dirname(__FILE__)."/../classes/class_wmc.php");
+require_once(dirname(__FILE__)."/../classes/class_user.php");
+//require_once(dirname(__FILE__)."/../classes/class_json.php");
+//require_once(dirname(__FILE__)."/../classes/class_administration.php");
+//require_once(dirname(__FILE__)."/../classes/class_wmcToXml.php");
+//$userId = Mapbender::session()->get("mb_user_id");
+$user = new User();
+$userId = $user->id;
 //check for parameter wmc_id
 if(!isset($_GET["wmc_id"])){
 	echo 'Error: wmc_id not requested<br>';
@@ -126,6 +131,17 @@
 			return false;
 		}
 	}
+function getWmsGetMapUrl($wmsId){
+	$sql = "SELECT wms_getmap FROM wms WHERE wms_id =$1";
+	$v = array($wmsId);
+	$t = array("i");
+	$res = db_prep_query($sql,$v,$t);
+	if ($row = db_fetch_array($res)){
+		return $row['wms_getmap'];
+	} else {
+		return false;
+	}
+}
 function getGuisByPermission($mb_user_id,$ignoreublic){
 	$arrayGuis = array();
 	$mb_user_groups = array();
@@ -176,19 +192,25 @@
 #**************************************************************************
 //Function to create an OpenLayers Javascript from a mapbender wmc document
 function createOlFromWMC_id($wmc_id, $pointRadius, $fillColor){
+	//$myWmc = new wmc();
 	global $userId;
 	//Get WMC out of mb Database
-	$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_serial_id = $1";
+	$sql = "SELECT wmc, wmc_serial_id FROM mb_user_wmc WHERE wmc_serial_id = $1";
 	$res = db_prep_query($sql, array($wmc_id), array("s"));
 	$wmc = db_fetch_row($res);
 	//control if wmc was found else use old wmc_id
 	if (!$wmc[0]) {
-		$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = $1";
+		$sql = "SELECT wmc, wmc_serial_id FROM mb_user_wmc WHERE wmc_id = $1";
 		$res = db_prep_query($sql, array($wmc_id), array("s"));
 		$wmc = db_fetch_row($res);
 		//echo "Wmc with this id was not found in Database!<br>";
 		//die;
 	}
+	//generate wmc object and update urls of services in this object:
+	$wmcId = $wmc[1];
+	//$myWmc->createFromDb($wmcId);
+	//$updatedWmc = $myWmc->updateUrlsFromDb();//TODO: check why this functions need a session??
+	
 	//Read out WMC into XML object
 	$xml=simplexml_load_string($wmc[0], "SimpleXMLElement", LIBXML_NOBLANKS);
 	if ($_REQUEST['withoutBody'] == '1') { 
@@ -258,7 +280,7 @@
 	$someLayerQueryable=false;
 	for ($i=0; $i<count($layer_array); $i++) {
 		$html.="var layer".$i.";\n";
-		$mb_extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org');
+		$mb_extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org/context');
 		$layer_array_queryable[$i]=$mb_extensions->querylayer;
 		if (($layer_array_queryable[$i]=='1') and ($xml->LayerList->Layer[$i]->attributes()->hidden=='0')){
 			$someLayerQueryable=true;
@@ -372,15 +394,28 @@
 	$html.="	var bounds = new OpenLayers.Bounds(".$minx.",".$miny.",".$maxx.",".$maxy.");\n";
 	//if some layer defined, create base layer -> first layer in the wmc document
 	if (count($layer_array) != 0){
-		$i=0;
+		//get layer id for the base layer - this should be the first layer which is not hidden - in the wmc this should be visible (active)!!
+		//first get this id:
+		for ($i=0; $i<count($layer_array); $i++) {
+			if ($xml->LayerList->Layer[$i]->attributes()->hidden=='0'){ 
+				$firstLayerId = $i;
+				break;
+			}
+		}
+		$i = $firstLayerId;
 		$html.="	layer0 = new OpenLayers.Layer.WMS( \"".$xml->LayerList->Layer[$i]->Title."\",\n";
-		$extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org');
+		$extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org/context');
 		$layer_id=dom_import_simplexml($extensions->layer_id)->nodeValue;
-		$wms_id=$extensions->wms_id;
+		$wms_id=dom_import_simplexml($extensions->wms_id)->nodeValue;
 		$has_permission=getLayerPermission($wms_id,$layer_id,$userId);//problem: guest user must have fix id
 		//echo $layer_id."<br>";
 		if ($has_permission || $layer_id==''){
-			$html.="		\"".$xml->LayerList->Layer[$i]->Server->OnlineResource->attributes('http://www.w3.org/1999/xlink')->href."\",\n";
+			$getMapUrl = $xml->LayerList->Layer[$i]->Server->OnlineResource->attributes('http://www.w3.org/1999/xlink')->href;
+			if (getWmsGetMapUrl($wms_id) != false) {
+				$e = new mb_notice("mod_wmc2ol.php: update GetMap found in database - change url to :".$getMapUrl);
+				$getMapUrl = getWmsGetMapUrl($wms_id);
+			}
+			$html.="		\"".$getMapUrl."\",\n";
 			$html.="		{\n";
 			$html.="		layers: \"".$xml->LayerList->Layer[$i]->Name."\",\n";
 			//get FormatList and the current active format -> TODO: make a function for getting actual format for request
@@ -403,7 +438,7 @@
 			$html.="		numZoomLevels: ".$numberZoomLevels.",\n";
 			$minScale=dom_import_simplexml($extensions->gui_minscale)->nodeValue;
 			$maxScale=dom_import_simplexml($extensions->gui_maxscale)->nodeValue;
-			$maxScale=$extensions->guiScaleHint->attributes()->max;
+			$maxScale=$extensions->guiScaleHint->attributes()->max;//this set the maxscale to unknown - for the baselayer
 			if (!$maxScale){
 				$maxScale='10000000';
 			}
@@ -421,17 +456,23 @@
 		}
 	}
 	//create the overlay layers for which the user guest has permissions
-	for ($i=1; $i<count($layer_array); $i++) {
-		$extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org');
+	$startLayerId = $firstLayerId+1;
+	for ($i=$startLayerId; $i<count($layer_array); $i++) {
+		$extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org/context');
 		#$layer_id=$extensions->layer_id;
 		$wms_id=$extensions->wms_id;
 		$layer_id=dom_import_simplexml($extensions->layer_id)->nodeValue;
-
+		$wms_id=dom_import_simplexml($extensions->wms_id)->nodeValue;
 		$has_permission=getLayerPermission($wms_id,$layer_id,$userId);//problem: guest user must have fix id TODO
 		if (($xml->LayerList->Layer[$i]->attributes()->hidden=='0' && $has_permission) ||
 			($layer_id=='' && $xml->LayerList->Layer[$i]->attributes()->hidden=='0')){
 			$html.="	layer".$i." = new OpenLayers.Layer.WMS( \"".$xml->LayerList->Layer[$i]->Title."\",\n";
-			$html.="		\"".$xml->LayerList->Layer[$i]->Server->OnlineResource->attributes('http://www.w3.org/1999/xlink')->href."\",\n";
+			$getMapUrl = $xml->LayerList->Layer[$i]->Server->OnlineResource->attributes('http://www.w3.org/1999/xlink')->href;
+			if (getWmsGetMapUrl($wms_id) != false) {
+				$e = new mb_notice("mod_wmc2ol.php: update GetMap found in database - change url to :".$getMapUrl);
+				$getMapUrl = getWmsGetMapUrl($wms_id);
+			}
+			$html.="		\"".$getMapUrl."\",\n";
 			$html.="		{\n";
 			$html.="		layers: \"".$xml->LayerList->Layer[$i]->Name."\",\n";
 			//Get FormatList and the current active format
@@ -452,7 +493,7 @@
 			$html.="		units: \"m\",\n"; 
 			$html.="		singleTile: true,\n";
 			$html.="		numZoomLevels: ".$numberZoomLevels.",\n";
-			//$extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org');
+			//$extensions=$xml->LayerList->Layer[$i]->Extension->children('http://www.mapbender.org/context');
 			$minScale=dom_import_simplexml($extensions->gui_minscale)->nodeValue;
 			$maxScale=dom_import_simplexml($extensions->gui_maxscale)->nodeValue;
 			if (!$maxScale){

Modified: branches/kmq_dev/http/plugins/mb_sessionWmc.js
===================================================================
--- branches/kmq_dev/http/plugins/mb_sessionWmc.js	2011-03-04 08:52:47 UTC (rev 7690)
+++ branches/kmq_dev/http/plugins/mb_sessionWmc.js	2011-03-08 09:21:56 UTC (rev 7691)
@@ -111,9 +111,10 @@
 			},
 			callback: function (obj, result, message) {
 				window.resetSession = true;
-				//alert(message);
-				location.reload();
-				//mapbender reload!
+				//unset the get api params cause they will load the old state!
+				var currentURL = location;
+				var newHref = currentURL.protocol+'//'+currentURL.host+currentURL.pathname;
+				window.location.href = newHref;
 			}
 		});
 		req.send();


Property changes on: branches/kmq_dev/http/print/mapbender_template.json
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/mapbender/http/print/mapbender_template.json:7670-7677
   + /trunk/mapbender/http/print/mapbender_template.json:7670-7690

Modified: branches/kmq_dev/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- branches/kmq_dev/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-03-04 08:52:47 UTC (rev 7690)
+++ branches/kmq_dev/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-03-08 09:21:56 UTC (rev 7691)
@@ -1763,7 +1763,7 @@
 
 #: ../http/php/mod_abo_show.php:41
 msgid "Confirmation of subscribers notification"
-msgstr "Bestätigung der Abonenntenbenachrichtigung"
+msgstr "Bestätigung der Abonnentenbenachrichtigung"
 
 #: ../http/php/mod_abo_show.php:43
 msgid "Mapbender monitoring subscriber"
@@ -1771,7 +1771,7 @@
 
 #: ../http/php/mod_abo_show.php:44
 msgid "Mapbender subscribers notification"
-msgstr "Abonenntenbenachrichtigung"
+msgstr "Abonnentenbenachrichtigung"
 
 #: ../http/php/mod_abo_show.php:45
 msgid "The following services are affected"
@@ -1779,11 +1779,11 @@
 
 #: ../http/php/mod_abo_show.php:46
 msgid "e-mail form for notifications to the subscribers of the following WMS"
-msgstr ""
+msgstr "EMail Formular für die Benachrichtigung der Abonnenten folgender WMS "
 
 #: ../http/php/mod_abo_show.php:47
 msgid "Subscriber notification for Mapbender service providers"
-msgstr ""
+msgstr "Abo Benachrichtigung für die Anbieter von OWS"
 
 #: ../http/php/mod_abo_show.php:48
 msgid "Notifications have been sent. You will receive a confirmation mail shortly."
@@ -1795,7 +1795,7 @@
 
 #: ../http/php/mod_abo_show.php:50
 msgid "The subscribers to these WMS have been notified"
-msgstr "Die Abonnenten folgender WMS wurde benachrichtigt"
+msgstr "Die Abonnenten folgender WMS wurden benachrichtigt"
 
 #: ../http/php/mod_abo_show.php:51
 msgid "For further inquiries contact"
@@ -2305,12 +2305,12 @@
 msgid "Preview saved"
 msgstr "Vorschau gespeichert"
 
-msgid "Preview saved - but following service urls are not included cause the firewall prevent this!"
-msgstr "Vorschau gespeichert - aber folgende Dienste fehlen, weil die Firewall sie rausschmeißt!"
+msgid "Preview saved - but following service urls are not included !"
+msgstr "Vorschau gespeichert - aber folgende Dienste fehlen! "
 
 msgid "Preview could not be created"
 msgstr "Vorschau konnte nicht gespeichert werden"
 
 #:../tools/mod_mailAbo.php
-msgid "test1"
-msgstr "test2"
+msgid "Mapbender was unable to access the services listed above. These service may be unreachable on short notice. Please contact the service provider listed in the service metadata. You will find the metadata by following the link mentioned above. Note: This e-mail has been sent automatically because you subscribed to this service. You can unsubscribe by logging in and clicking the unsubscribe button in the Mapbender metadata dialogue."
+msgstr "Das GeoPortal hat Probleme beim Zugriff auf die oben in dieser E-Mail genannten Dienste. Es ist möglich, dass diese kurzfristig nicht verfügbar sind. Weitere Informationen erhalten Sie auf Anfrage beim Dienstebereitsteller, der in den Metadaten des Dienstes angegeben ist. Folgen Sie dazu dem oben in dieser E-Mail aufgeführten Link. Hinweis: Diese E-Mail wurde automatisiert erzeugt und der Versand von Ihnen beantragt. Diese E-Mail-Benachrichtigung können Sie jederzeit abbestellen, indem Sie das Abonnement über die Metadatenanzeige im GeoPortal deaktivieren."

Modified: branches/kmq_dev/tools/mod_mailAbo.php
===================================================================
--- branches/kmq_dev/tools/mod_mailAbo.php	2011-03-04 08:52:47 UTC (rev 7690)
+++ branches/kmq_dev/tools/mod_mailAbo.php	2011-03-08 09:21:56 UTC (rev 7691)
@@ -38,7 +38,7 @@
 	$cnt++;
 }
 $cnt=0;
-$mail_user_topic = _mb("Mapbender subscribers notification"); // "GeoPortal.rlp Mitteilung WMS Abonennten"
+$mail_user_topic = _mb("Mapbender subscribers notification"); // "GeoPortal.rlp Mitteilung WMS Abonnenten"
 $number_of_users_text = _mb("Number of users"); // "Zahl der eingetragenen User IDs"
 $subscribed_wms_text = _mb("All WMS subscribed by this user"); // "Alle abonnierten WMS des Users"
 $wms_with_problems_text = _mb("WMS with problems"); // "WMS mit Problemen"
@@ -47,7 +47,7 @@
 $body_text = _mb("Mapbender was unable to access the services listed above. " . 
 	"These service may be unreachable on short notice. Please contact the " . 
 	"service provider listed in the service metadata. You will find the " . 
-	"metadata by following the link mentioned above.\n" . 
+	"metadata by following the link mentioned above. " . 
 	"Note: This e-mail has been sent automatically because you subscribed " . 
 	"to this service. You can unsubscribe by logging in and clicking the " . 
 	"unsubscribe button in the Mapbender metadata dialogue."
@@ -104,11 +104,15 @@
 		$res_wms_t = db_prep_query($sql, $v_wms_t, $t_wms_t);
 		$row_wms_t = db_fetch_array($res_wms_t);
 		if ($wms_monitor_status == '-1') {
-			$metadataUrl = preg_replace(
-				"/(.*)frames\/login.php/", 
-				"$1php/mod_layerMetadata.php?id=", 
-				LOGIN
-			);
+			if (isset(MAPBENDER_PATH) && MAPBENDER_PATH != '') {
+				$metadataUrl = MAPBENDER_PATH."/php/mod_showMetadata.php?resource=layer&id=";
+			} else {
+				$metadataUrl = preg_replace(
+					"/(.*)frames\/login.php/", 
+					"$1php/mod_showMetadata.php?resource=layer&id=", 
+					LOGIN
+				);
+			}
 			echo "WMS: ".$wmsid."\n";
 			$body .= _mb($wms_unreachable_text, $row_wms_t["wms_title"], $wmsid) . 
 				" (" . $wms_monitor_timestamp_end . ")\n" . 



More information about the Mapbender_commits mailing list