[Mapbender-commits] r7712 - in trunk/mapbender/http: classes javascripts php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Mar 17 12:29:49 EDT 2011


Author: armin11
Date: 2011-03-17 09:29:49 -0700 (Thu, 17 Mar 2011)
New Revision: 7712

Modified:
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/http/javascripts/mod_legend.php
   trunk/mapbender/http/javascripts/wms.js
   trunk/mapbender/http/php/mod_showMetadata.php
   trunk/mapbender/http/php/mod_wmc2ol.php
Log:
Bugfixes and Debugging

Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2011-03-17 13:44:44 UTC (rev 7711)
+++ trunk/mapbender/http/classes/class_user.php	2011-03-17 16:29:49 UTC (rev 7712)
@@ -509,11 +509,11 @@
 		$arrayGuis = array();
 		$mb_user_groups = array();
 		//exchange for the new role system - there are roles which don't include permissions explicitly
-		/*$sql_groups = "SELECT fkey_mb_group_id FROM ";
+		$sql_groups = "SELECT fkey_mb_group_id FROM ";
 		$sql_groups .= "(SELECT * from mb_user_mb_group left join mb_role on ";
 		$sql_groups .= " mb_user_mb_group.mb_user_mb_group_type = mb_role.role_id ";
-		$sql_groups .= " WHERE mb_role.role_exclude_auth != 1)  AS mb_user_mb_group WHERE fkey_mb_user_id = $1 ";*/
-		$sql_groups = "SELECT fkey_mb_group_id FROM mb_user_mb_group WHERE fkey_mb_user_id = $1 ";
+		$sql_groups .= " WHERE mb_role.role_exclude_auth != 1)  AS mb_user_mb_group WHERE fkey_mb_user_id = $1 ";
+		//$sql_groups = "SELECT fkey_mb_group_id FROM mb_user_mb_group WHERE fkey_mb_user_id = $1 ";
 		$v = array($mb_user_id);
 		$t = array("i");
 		$res_groups = db_prep_query($sql_groups,$v,$t);

Modified: trunk/mapbender/http/javascripts/mod_legend.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_legend.php	2011-03-17 13:44:44 UTC (rev 7711)
+++ trunk/mapbender/http/javascripts/mod_legend.php	2011-03-17 16:29:49 UTC (rev 7712)
@@ -95,7 +95,9 @@
 					var layerStyle = parent.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layerNames[j]);
 					var legendUrl = false;
 					if(layerStyle == false){
-						legendUrl = parent.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],"");	
+						legendUrl = parent.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],"");
+						
+						//alert("mapObj ind: "+ind+" wms index: "+i+"layer name: "+layerNames[j]+" : LegendUrl (style false): "+legendUrl);	
 					}
 					else{
 						legendUrl = parent.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],layerStyle);
@@ -111,6 +113,7 @@
 		                    if(legendlink == 'true'){
 		                    	str_tmp += "<a href='../php/result.php?lingo=deutsch&layer="+layerNames[j]+"' class='link_metadata' title='Zeigt Liste zum Thema: "+layerTitle+"' target='result'>";
 		                    }
+				
 		                    str_tmp += "<img border=0 src = '";			
 							str_tmp += legendUrl;
 							str_tmp += "'></img>";

Modified: trunk/mapbender/http/javascripts/wms.js
===================================================================
--- trunk/mapbender/http/javascripts/wms.js	2011-03-17 13:44:44 UTC (rev 7711)
+++ trunk/mapbender/http/javascripts/wms.js	2011-03-17 16:29:49 UTC (rev 7712)
@@ -728,7 +728,12 @@
 	wms[wms.length-1].gui_maxy[wms[wms.length-1].gui_maxy.length] = maxy;
 }
 function wms_addLayerStyle(styleName, styleTitle, count, layerCount, styleLegendUrl, styleLegendUrlFormat){
+	//TODO for debug purposes:	
+	//alert(styleName+":"+styleTitle+":"+count+":"+layerCount+":"+styleLegendUrl+":"+styleLegendUrlFormat);
+	//var test = wms.length-1;
+	//alert("add layer style["+count+"] for layer["+layerCount+"] for wms["+test+"]:"+styleLegendUrl);
 	var currentLayer = wms[wms.length-1].objLayer[layerCount]; 
+
 	if (currentLayer) {
 		currentLayer.layer_style[count] = {};
 		currentLayer.layer_style[count].name = styleName;

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2011-03-17 13:44:44 UTC (rev 7711)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2011-03-17 16:29:49 UTC (rev 7712)
@@ -454,7 +454,7 @@
 
 
 //$e = new mb_exception("mod_showMetadata: fkey_mb_group_id from wms or wfs table: ".$resourceMetadata['fkey_mb_group_id']);
-if (!isset($resourceMetadata['fkey_mb_group_id']) or is_null($resourceMetadata['fkey_mb_group_id'])){
+if (!isset($resourceMetadata['fkey_mb_group_id']) or is_null($resourceMetadata['fkey_mb_group_id']) or $resourceMetadata['fkey_mb_group_id'] == 0){
 	$e = new mb_notice("mod_showMetadata: fkey_mb_group_id not found!");
 	//Get information about owning user of the relation mb_user_mb_group - alternatively the defined fkey_mb_group_id from the service must be used!
 	$sqlDep = "SELECT mb_group_name as metadatapointofcontactorgname, mb_group_title as metadatapointofcontactorgtitle, mb_group_id, mb_group_logo_path  as metadatapointofcontactorglogo, mb_group_address as metadatapointofcontactorgaddress, mb_group_email as metadatapointofcontactorgemail, mb_group_postcode as metadatapointofcontactorgpostcode, mb_group_city as metadatapointofcontactorgcity, mb_group_voicetelephone as metadatapointofcontactorgtelephone, mb_group_facsimiletelephone as metadatapointofcontactorgfax FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1  AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND c.mb_user_mb_group_type=2 LIMIT 1";
@@ -487,18 +487,18 @@
 $e = new mb_notice("mod_showMetadata: mb_group_name: ".$metadataContactGroup['mb_group_name']);
 //db select for layer previews
 if ($resource == 'wms' or $resource == 'layer') {
-	$sqlP = "SELECT * FROM layer_preview WHERE fkey_layer_id = $1 LIMIT 1";
-	$vP = array($layerId);
-	$tP = array('i');
-	$resP = db_prep_query($sqlP, $vP, $tP);
-	$rowP = db_fetch_array($resP);
-	if ($rowP['layer_map_preview_filename'] != "") {
+	//$sqlP = "SELECT * FROM layer_preview WHERE fkey_layer_id = $1 LIMIT 1";
+	//$vP = array($layerId);
+	//$tP = array('i');
+	//$resP = db_prep_query($sqlP, $vP, $tP);
+	//$rowP = db_fetch_array($resP);
+	//if ($rowP['layer_map_preview_filename'] != "") {
 		$resourceMetadata['preview'] = "<img src = '../geoportal/mod_showPreview.php?resource=layer&id=".$layerId."'>";
 
-	}
-	if ($rowP['layer_legend_preview_filename'] != "") {
+	//}
+	//if ($rowP['layer_legend_preview_filename'] != "") {
 		$resourceMetadata['legend'] .= "<img src = '../geoportal/mod_showPreview.php?resource=layerlegend&id=".$layerId."'>";
-	}
+	//}
 /*	if ($rowP['layer_extent_preview_filename'] != "") {
 		$resourceMetadata['extent'] .= "<img src = '../geoportal/layer_preview/".$rowP['layer_extent_preview_filename']."'>";
 	}*/

Modified: trunk/mapbender/http/php/mod_wmc2ol.php
===================================================================
--- trunk/mapbender/http/php/mod_wmc2ol.php	2011-03-17 13:44:44 UTC (rev 7711)
+++ trunk/mapbender/http/php/mod_wmc2ol.php	2011-03-17 16:29:49 UTC (rev 7712)
@@ -205,9 +205,11 @@
 		$html.="var layer".$i.";\n";
 		$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')){
+		if (($layer_array_queryable[$i]=='1') and ($xml->LayerList->Layer[$i]->attributes()->hidden=='0') and ($mb_extensions->layer_parent!='')){
 			$someLayerQueryable=true;
-		}	
+		} else {
+			$layer_array_queryable[$i]=0;
+		}
 	}
 	//define special BBOX
 	$out_box=0.3;
@@ -388,7 +390,7 @@
 		$layer_name=$xml->LayerList->Layer[$i]->Name;
 		$wms_id=dom_import_simplexml($extensions->wms_id)->nodeValue;
 		$has_permission=$admin->getLayerPermission($wms_id, $layer_name, $userId);
-		if (($xml->LayerList->Layer[$i]->attributes()->hidden=='0' && $has_permission) ||
+		if (($xml->LayerList->Layer[$i]->attributes()->hidden=='0' && $has_permission && $extensions->layer_parent != '') ||
 			($layer_id=='' && $xml->LayerList->Layer[$i]->attributes()->hidden=='0')){
 			$html.="	layer".$i." = new OpenLayers.Layer.WMS( \"".$xml->LayerList->Layer[$i]->Title."\",\n";
 			$getMapUrl = $xml->LayerList->Layer[$i]->Server->OnlineResource->attributes('http://www.w3.org/1999/xlink')->href;



More information about the Mapbender_commits mailing list