[Mapbender-commits] r8743 - in trunk/mapbender: conf http/geoportal http/php http/print owsproxy/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Dec 1 07:27:48 PST 2013


Author: armin11
Date: 2013-12-01 07:27:47 -0800 (Sun, 01 Dec 2013)
New Revision: 8743

Modified:
   trunk/mapbender/conf/mapbender.conf-dist
   trunk/mapbender/http/geoportal/jquery.dataTables.geoportal.css
   trunk/mapbender/http/php/mod_inspireDownloadFeed.php
   trunk/mapbender/http/print/mod_printPDF_pdf.php
   trunk/mapbender/http/print/printPDF.conf
   trunk/mapbender/http/print/printPDF_b.conf
   trunk/mapbender/owsproxy/http/index.php
Log:
Enhancement to solve problem when printing secured services via vendor specific high quality print (mapservers _4.map files). This enhancement is actually only available for the old print module. There has to be made a little change to the new one also!

Modified: trunk/mapbender/conf/mapbender.conf-dist
===================================================================
--- trunk/mapbender/conf/mapbender.conf-dist	2013-11-28 12:44:54 UTC (rev 8742)
+++ trunk/mapbender/conf/mapbender.conf-dist	2013-12-01 15:27:47 UTC (rev 8743)
@@ -67,6 +67,9 @@
 # Allow the use of an existing session for other calling applications. The url will be used to identify an existing session and the application will use this identity! Beware of security problems if the url is given to an other user. This one may alter the original identity! For security reasons set this value to false or at minimum give a whitelist to allow printing - see OWSPROXY_SESSION_GRABBING_WHITELIST.
 define("OWSPROXY_ALLOW_SESSION_GRABBING", false);
 #define("OWSPROXY_SESSION_GRABBING_WHITELIST", "localhost,127.0.0.1");
+#Parameter to steer if owsproxy support mapbender hq printing for mapserver with duplicated mapfiles named _4.map
+define("OWSPROXY_SUPPORT_HQ_PRINTING", false);
+#
 # --------------------------------------------
 # Definitions for HTTP Authentication
 # --------------------------------------------

Modified: trunk/mapbender/http/geoportal/jquery.dataTables.geoportal.css
===================================================================
--- trunk/mapbender/http/geoportal/jquery.dataTables.geoportal.css	2013-11-28 12:44:54 UTC (rev 8742)
+++ trunk/mapbender/http/geoportal/jquery.dataTables.geoportal.css	2013-12-01 15:27:47 UTC (rev 8743)
@@ -176,6 +176,6 @@
 	background-color: white;
 }
 a {
-	color:#8b8b8b:
+	color: #8b8b8b;
 }
 

Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2013-11-28 12:44:54 UTC (rev 8742)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2013-12-01 15:27:47 UTC (rev 8743)
@@ -565,38 +565,38 @@
 	switch ($generateFrom) {
 		case "dataurl":
 			$sql = <<<SQL
-select *, 'dataurl' as origin from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name,layer_relation.inspire_download, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey_layer_id = layer_metadata.layer_id) as layer_
 relation_data inner join datalink on layer_relation_data.fkey_datalink_id = datalink.datalink_id) as layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';  
+select *, 'dataurl' as origin from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name,layer_relation.inspire_download, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey
 _layer_id = layer_metadata.layer_id) as layer_relation_data inner join datalink on layer_relation_data.fkey_datalink_id = datalink.datalink_id) as layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';  
 SQL;
 		$generateFromDataurl = true;
 		break;
 
 		case "wmslayer":
 			$sql = <<<SQL
-select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id,layer_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and
  layer_epsg.epsg = 'EPSG:4326' and layer_wms.layer_id = $2;  
+select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id,layer_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where lay
 er_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326' and layer_wms.layer_id = $2;  
 SQL;
 		break;
 
 		case "wfs":
 			$sql = <<<SQL
-select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.featuretype_id,featuretype_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace,  featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs, mb_metadata.lastchanged as md_timestamp from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_relation.fkey_metadata_id = mb_metadata.metadat
 a_id where mb_metadata.uuid = $1) as featuretype_data inner join wfs on featuretype_data.fkey_wfs_id = wfs.wfs_id where wfs.wfs_id = $2;
+select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.featuretype_id,featuretype_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace,  featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs, mb_metadata.lastchanged as md_timestamp from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_r
 elation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as featuretype_data inner join wfs on featuretype_data.fkey_wfs_id = wfs.wfs_id where wfs.wfs_id = $2;
 SQL;
 		break;
 		case "metadata":
 			$sql = <<<SQL
-select 'metadata' as origin,mb_metadata.metadata_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.fkey_mb_user_id,  mb_metadata.lastchanged as md_timestamp, box2d(the_geom) as bbox2d, datalinks FROM mb_metadata where uuid = $1 and inspire_download = 1;
+select 'metadata' as origin,mb_metadata.metadata_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.fkey_mb_user_id,  mb_metadata.lastchanged as md_timestamp, box2d(the_geom) as bbox2d, datalinks FROM mb_metadata where uuid = $1 and inspire_download = 1;
 SQL;
 		break;
 		case "all":
 			$sql = array();
 			$sql[0] = <<<SQL
-select *, 'dataurl' as origin from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id,layer_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey_layer_id = layer_metadata.layer_id) as layer_
 relation_data inner join datalink on layer_relation_data.fkey_datalink_id = datalink.datalink_id) as layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326'				
+select *, 'dataurl' as origin from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id,layer_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey
 _layer_id = layer_metadata.layer_id) as layer_relation_data inner join datalink on layer_relation_data.fkey_datalink_id = datalink.datalink_id) as layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326'				
 SQL;
 			$sql[1] =  <<<SQL
-select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name,layer_relation.inspire_download, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and
  layer_epsg.epsg = 'EPSG:4326';		
+select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name,layer_relation.inspire_download, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, mb_metadata.lastchanged as md_timestamp   from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id)  as layer_wms, layer_epsg where lay
 er_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';		
 		
 SQL;
 			$sql[2] =  <<<SQL
-select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.inspire_download, featuretype_relation.featuretype_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs, mb_metadata.lastchanged as md_timestamp from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_relation.fkey_metadata_id = mb_metadata.metadat
 a_id where mb_metadata.uuid = $1) as featuretype_data inner join wfs on featuretype_data.fkey_wfs_id = wfs.wfs_id;		
+select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.inspire_download, featuretype_relation.featuretype_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs, mb_metadata.lastchanged as md_timestamp from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_r
 elation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as featuretype_data inner join wfs on featuretype_data.fkey_wfs_id = wfs.wfs_id;		
 SQL;
 		break;
 	}
@@ -1038,9 +1038,12 @@
 				$georssPolygon .= $mapbenderMetadata["maxx"]." ".$mapbenderMetadata["maxy"]." ".$mapbenderMetadata["minx"]." ".$mapbenderMetadata["maxy"]." ";
 				$georssPolygon .= $mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"];
 				echo $georssPolygon;*/
+				
+					
 				//TODO: check if epsg, and bbox are filled correctly!
 
 				$sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".$mapbenderMetadata[$m]->minx." ".$mapbenderMetadata[$m]->miny.")',4326),".$epsgId.")) as minx";
+				$e = new mb_exception($sqlMinx);
 				$resMinx = db_query($sqlMinx);
 				$minx = floatval(db_result($resMinx,0,"minx"));
 			
@@ -1643,6 +1646,16 @@
 	die();
 }
 
+//parses box2d string from postgis to bbox array [minx, miny, maxx, maxy]
+function parseBox2d($box2d) {
+	//"BOX(6.9213399887085 50.1331939697266,6.93241024017334 50.138801574707)"
+	//delete BOX( and ), replace , with blank
+	$bbox = str_replace(","," ",str_replace(")","",str_replace("BOX(", "", $box2d)));
+	//explode with blank
+	$bbox = explode(" ",$bbox);
+	return $bbox;
+}
+
 function transformBbox($oldBbox, $fromCRS, $toCRS) {
 	//Transform the given BBOX to $toCRS
 	$arrayBbox = explode(',',$oldBbox);
@@ -1738,6 +1751,7 @@
 				$mapbenderMetadata[$indexMapbenderMetadata]->metadata_title = $row['metadata_title'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->layer_title = $row['layer_title'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->metadata_abstract = $row['metadata_abstract'];
+				$mapbenderMetadata[$indexMapbenderMetadata]->metadata_bbox = $row['metadata_bbox'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->layer_abstract = $row['layer_abstract'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->accessconstraints = $row['accessconstraints'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->metadata_uuid = $row['metadata_uuid'];
@@ -1768,6 +1782,7 @@
 				$mapbenderMetadata[$indexMapbenderMetadata]->md_timestamp = $row['md_timestamp'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->wms_timestamp = $row['wms_timestamp'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->wfs_timestamp = $row['wfs_timestamp'];
+
 				//$mapbenderMetadata[$indexMapbenderMetadata]->format = $row['format'];
 				//check if codespace was given in metadata or it must be generated from uuid and default codespace
 				if (($mapbenderMetadata[$indexMapbenderMetadata]->datasetid_codespace == '' or !isset($mapbenderMetadata[$indexMapbenderMetadata]->datasetid_codespace)) or ($mapbenderMetadata[$indexMapbenderMetadata]->datasetid == '' or !isset($mapbenderMetadata[$indexMapbenderMetadata]->datasetid))) {
@@ -1782,6 +1797,14 @@
 					$mapbenderMetadata[$indexMapbenderMetadata]->maxx = $latlonbbox[2];
 					$mapbenderMetadata[$indexMapbenderMetadata]->maxy = $latlonbbox[3];
 				}
+				//overwrite mapbenderMetadata->minx ... which came from layer/featuretype metadata with bbox of metadata itself, if given
+				if (isset($mapbenderMetadata[$indexMapbenderMetadata]->metadata_bbox) && $mapbenderMetadata[$indexMapbenderMetadata]->metadata_bbox !== "") {
+					$bbox = parseBox2d($mapbenderMetadata[$indexMapbenderMetadata]->metadata_bbox);
+					$mapbenderMetadata[$indexMapbenderMetadata]->minx = $bbox[0];
+					$mapbenderMetadata[$indexMapbenderMetadata]->miny = $bbox[1];
+					$mapbenderMetadata[$indexMapbenderMetadata]->maxx = $bbox[2];
+					$mapbenderMetadata[$indexMapbenderMetadata]->maxy = $bbox[3];	
+				}	
 				$indexMapbenderMetadata++;
 			}
 		}

Modified: trunk/mapbender/http/print/mod_printPDF_pdf.php
===================================================================
--- trunk/mapbender/http/print/mod_printPDF_pdf.php	2013-11-28 12:44:54 UTC (rev 8742)
+++ trunk/mapbender/http/print/mod_printPDF_pdf.php	2013-12-01 15:27:47 UTC (rev 8743)
@@ -18,7 +18,6 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
 include (dirname(__FILE__)."/../classes/class.ezpdf.php");
 include (dirname(__FILE__)."/../classes/class_stripRequest.php");
 include (dirname(__FILE__)."/../classes/class_weldMaps2PNG.php");
@@ -55,6 +54,32 @@
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
 }
+
+//function to check for HQ printing with owsproxy
+function owsproxyHqPrinting($url) {
+	$proxyPattern = preg_match("/^.*owsproxy.([^i][\w\d]+)\/([\w\d]+)\/?/",$url, $result);	
+ 	if ($proxyPattern === false){
+		//$e = new mb_notice("print/mod_printPDF_pdf.php: Owsproxy url not found when printing");
+		return false;
+	} else {
+		//get id of wms
+		//$e = new mb_notice("print/mod_printPDF_pdf.php: Owsproxy url found for printing!");
+		$owsproxy = $result[2];
+		//getMapUrl 
+		$sql = "SELECT wms_getmap FROM wms WHERE ";
+		$sql .= "wms_owsproxy = $1";
+		$v = array($owsproxy);
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		if ($row = db_fetch_array($res)) {
+			return $row['wms_getmap'];
+		}
+		else {
+			return false;
+		}
+	}
+}
+
 $time_start = microtime_float();
 // END DURATION TIME
 
@@ -156,6 +181,12 @@
 		$newArray_urls[] = $array_urls[$i];
 	}
 }
+//exchange owsproxy urls with real urls if user has right to access layer!
+//if not, use owsproxy url, because permission denied will be printed anyhow
+//use function
+//newUrlArray = function exchangeUrls(oldUrlArray, $currentUserId);
+//
+
 $array_urls = $newArray_urls;
 $myURL = new stripRequest($array_urls[0]);
 $map_width = round($myURL->get("width"));
@@ -166,12 +197,30 @@
 		$m = new stripRequest($array_urls[$i]);
 		$m->set('width',(intval($m->get('width'))*4));
 		$m->set('height',(intval($m->get('height'))*4));
-		if(in_array($m->get('map'),$highqualitymapfiles)){	
-			$m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));			
+		//check if hq printing is demanded in conf and add option to owsproxy url if owsproxy is activated
+		$owsGetMapUrl = owsproxyHqPrinting($array_urls[$i]);
+		if ($owsGetMapUrl) {
+			//$e = new mb_exception("print/mod_printPDF_pdf.php: getmapurl from owsproxy: ".$owsGetMapUrl);
+			$checkMap = new stripRequest($owsGetMapUrl);
+			//$e = new mb_exception("print/mod_printPDF_pdf.php: map param to check: ".$checkMap->get('map'));
+			if(in_array($checkMap->get('map'),$highqualitymapfiles)){	
+				//$m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));
+				//add mapbenderHighQualityPrint	to owsproxy url
+				$array_urls[$i] = $m->url."&mapbenderHighQualityPrint=true";		
+				//$e = new mb_exception("print/mod_printPDF_pdf.php: extented url for hq printing: ".$array_urls[$i]);
+			} else {
+				
+				$array_urls[$i] = $m->url;
+			}
+		} else {
+			if(in_array($m->get('map'),$highqualitymapfiles)){	
+				$m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));			
+			}
+			$array_urls[$i] = $m->url;
 		}
-		$array_urls[$i] = $m->url;
 	}
 }
+
 $coord = mb_split(",",$map_extent);
 
 if($overview === true){
@@ -183,9 +232,22 @@
 	if($factor>1){
 		$o_url->set('width',(intval($o_url->get('width'))*4));
 		$o_url->set('height',(intval($o_url->get('height'))*4));
-		if(in_array($o_url->get('map'),$highqualitymapfiles)){	
-				$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));		
-				$overview_url = $o_url->url;	
+		//check if hq printing is demanded in conf and add option to owsproxy url if owsproxy is activated
+		$owsGetMapUrl = owsproxyHqPrinting($overview_url);
+		if ($owsGetMapUrl) {
+			//$e = new mb_exception("print/mod_printPDF_pdf.php: getmapurl from owsproxy: ".$owsGetMapUrl);
+			$checkMap = new stripRequest($owsGetMapUrl);
+			if(in_array($checkMap->get('map'),$highqualitymapfiles)){	
+				//add mapbenderHighQualityPrint	to owsproxy url
+				$overview_url = $o_url->url."&mapbenderHighQualityPrint=true";		
+			} else {
+				$overview_url = $o_url->url;
+			}
+		} else {
+			if(in_array($o_url->get('map'),$highqualitymapfiles)){	
+				$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));			
+			}
+			$overview_url = $o_url->url;
 		}
 	}
 	

Modified: trunk/mapbender/http/print/printPDF.conf
===================================================================
--- trunk/mapbender/http/print/printPDF.conf	2013-11-28 12:44:54 UTC (rev 8742)
+++ trunk/mapbender/http/print/printPDF.conf	2013-12-01 15:27:47 UTC (rev 8743)
@@ -111,7 +111,8 @@
 $highquality = true;
 $highqualitymapfiles = array(
 	"/data/umn/germany/germany_demo.map",
-	"/data/umn/mapbender_user/mapbender_user.map"
+	"/data/umn/mapbender_user/mapbender_user.map",
+	"/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map"
 );
 
 # Dots per cm (72 dpi):

Modified: trunk/mapbender/http/print/printPDF_b.conf
===================================================================
--- trunk/mapbender/http/print/printPDF_b.conf	2013-11-28 12:44:54 UTC (rev 8742)
+++ trunk/mapbender/http/print/printPDF_b.conf	2013-12-01 15:27:47 UTC (rev 8743)
@@ -110,7 +110,8 @@
 $highquality = true;
 $highqualitymapfiles = array(
 	"/data/umn/germany/germany_demo.map",
-	"/data/umn/mapbender_user/mapbender_user.map"
+	"/data/umn/mapbender_user/mapbender_user.map",
+	"/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map"
 );
 
 # Dots per cm (72 dpi):

Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php	2013-11-28 12:44:54 UTC (rev 8742)
+++ trunk/mapbender/owsproxy/http/index.php	2013-12-01 15:27:47 UTC (rev 8743)
@@ -220,7 +220,6 @@
 		$request = $query->getRequest();
 		if(isset($auth)){
 			getCapabilities($request,$auth);
-			#$mb_notice = new mb_notice("auth: ".$auth['auth_type']);
 		}
 		else {
 			getCapabilities($request);
@@ -246,7 +245,20 @@
 			die();
 		}
 		$query->setParam("layers",urldecode($layers));//the decoding of layernames dont make problems - but not really good names will be requested also ;-)
-		$request = $query->getRequest();
+		//Following is only needed for high quality print and is vendor specific for mapservers mapfiles!
+		if (defined("OWSPROXY_SUPPORT_HQ_PRINTING") && OWSPROXY_SUPPORT_HQ_PRINTING) {
+			//if url has integrated mapfile - exchange it
+			//$e = new mb_notice("owsproxy/http/index.php: OWSPROXY_SUPPORT_HQ_PRINTING is set");
+			if ($reqParams['mapbenderhighqualityprint'] === "true") {
+				//exchange mapfiles with high quality ones
+				$request = preg_replace("/\.map/","_4.map",$query->getRequest());	
+			} else {
+				$request = $query->getRequest();
+			}
+		} else {
+			$request = $query->getRequest();
+		}
+		//$request = $query->getRequest();
 		#log proxy requests
 		if($n->getWmsLogTag($arrayOnlineresources['wms_id'])==1) {
 			#do log to db
@@ -255,6 +267,7 @@
 			$price=intval($n->getWmsPrice($arrayOnlineresources['wms_id']));
 			$n->logWmsProxyRequest($arrayOnlineresources['wms_id'],$_SESSION['mb_user_id'],$request,$price);
 		}
+		//$e = new mb_exception("owsproxy/http/index.php: ".$request);
 		if(isset($auth)){
 			getImage($request,$auth);
 		}



More information about the Mapbender_commits mailing list