[Mapbender-commits] r8507 - in trunk/mapbender/http: classes php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Nov 19 07:23:35 PST 2012
Author: armin11
Date: 2012-11-19 07:23:35 -0800 (Mon, 19 Nov 2012)
New Revision: 8507
Modified:
trunk/mapbender/http/classes/class_metadata_new.php
trunk/mapbender/http/php/mod_callMetadata.php
trunk/mapbender/http/php/mod_inspireDownloadFeed.php
trunk/mapbender/http/php/mod_metadataWrite.php
Log:
Extent searchInterface to give an optional parameter for the resource ids (layer,featuretype, wmc). Bugfix for INSPIRE Download Atom feeds.
Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php 2012-11-12 14:53:37 UTC (rev 8506)
+++ trunk/mapbender/http/classes/class_metadata_new.php 2012-11-19 15:23:35 UTC (rev 8507)
@@ -57,8 +57,9 @@
var $tempFolder;
var $orderBy;
var $hostName;
+ var $resourceIds;
- function __construct($userId, $searchId, $searchText, $registratingDepartments, $isoCategories, $inspireThemes, $timeBegin, $timeEnd, $regTimeBegin, $regTimeEnd, $maxResults, $searchBbox, $searchTypeBbox, $accessRestrictions, $languageCode, $searchEPSG, $searchResources, $searchPages, $outputFormat, $resultTarget, $searchURL, $customCategories, $hostName, $orderBy){
+ function __construct($userId, $searchId, $searchText, $registratingDepartments, $isoCategories, $inspireThemes, $timeBegin, $timeEnd, $regTimeBegin, $regTimeEnd, $maxResults, $searchBbox, $searchTypeBbox, $accessRestrictions, $languageCode, $searchEPSG, $searchResources, $searchPages, $outputFormat, $resultTarget, $searchURL, $customCategories, $hostName, $orderBy, $resourceIds){
$this->userId = (integer)$userId;
$this->searchId = $searchId;
$this->searchText = $searchText;
@@ -84,6 +85,7 @@
$this->searchURL = $searchURL;
$this->hostName = $hostName;
$this->orderBy = $orderBy;
+ $this->resourceIds = $resourceIds;
//definitions for generating tagClouds
$this->maxObjects = 15;
$this->maxFontSize = 30;
@@ -992,6 +994,12 @@
$dep = " department IN (".$this->registratingDepartments.") ";
array_push($whereCondArray, $dep);
}
+ //resourceId conditions
+ if($this->resourceIds != NULL){
+ $resourceCondition = " ".$this->databaseIdColumnName." IN (".$this->resourceIds.") ";
+ array_push($whereCondArray, $resourceCondition);
+ }
+
// Creating the WHERE clause, based on a array
if(count($whereCondArray) > 0){
$txt_whereCond = "";
Modified: trunk/mapbender/http/php/mod_callMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callMetadata.php 2012-11-12 14:53:37 UTC (rev 8506)
+++ trunk/mapbender/http/php/mod_callMetadata.php 2012-11-19 15:23:35 UTC (rev 8507)
@@ -41,6 +41,8 @@
#$searchResources = "wms,wfs,wmc,georss";
#$searchResources = "wms";
$searchPages = "1";
+$resourceIds = NULL; //resourceIds is used to get a comma separated list with ids of the resources - layer - featuretypes - wmc
+//it will be used to filter some results
$resultTarget = "debug";
$preDefinedMaxResults = array(5,10,15,20,25,30);
$searchEPSG = "EPSG:31466";
@@ -56,7 +58,7 @@
$searchURL = urldecode($searchURL);
//control if some request variables are not set and set them explicit to NULL
-$checkForNullRequests = array("registratingDepartments","isoCategories","inspireThemes","customCategories","regTimeBegin","regTimeEnd","timeBegin","timeEnd","searchBbox","searchTypeBbox","searchResources","orderBy","hostName");
+$checkForNullRequests = array("registratingDepartments","isoCategories","inspireThemes","customCategories","regTimeBegin","regTimeEnd","timeBegin","timeEnd","searchBbox","searchTypeBbox","searchResources","orderBy","hostName","resourceIds");
for($i=0; $i < count($checkForNullRequests); $i++){
if (!$_REQUEST[$checkForNullRequests[$i]] or $_REQUEST[$checkForNullRequests[$i]] == 'false' or $_REQUEST[$checkForNullRequests[$i]] == 'undefined') {
@@ -96,6 +98,17 @@
$registratingDepartments = $testMatch;
$testMatch = NULL;
}
+if (isset($_REQUEST["resourceIds"]) & $_REQUEST["resourceIds"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["resourceIds"];
+ $pattern = '/^[\d,]*$/';
+ if (!preg_match($pattern,$testMatch)){
+ echo 'resourceIds: <b>'.$testMatch.'</b> is not valid.<br/>';
+ die();
+ }
+ $resourceIds = $testMatch;
+ $testMatch = NULL;
+}
if (isset($_REQUEST["isoCategories"]) & $_REQUEST["isoCategories"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["isoCategories"];
@@ -939,6 +952,7 @@
$str .= "'".$customCategories."' ";
$str .= "'".$hostName."' ";
$str .= "'".$orderBy."' ";
+ $str .= "'".$resourceIds."' ";
$str .= " & ";
$e = new mb_notice($str);
exec($str);
@@ -946,7 +960,7 @@
}
if ($resultTarget == 'web' or $resultTarget == 'debug' or $resultTarget == 'webclient') {
if (count($searchResources) == 1) {
- $metadata = new searchMetadata($userId, $searchId, $searchText, $registratingDepartments, $isoCategories, $inspireThemes, $timeBegin, $timeEnd, $regTimeBegin, $regTimeEnd, $maxResults, $searchBbox, $searchTypeBbox, $accessRestrictions, $languageCode, $searchEPSG, $searchResources[0], $searchPages[0], $outputFormat, $resultTarget, $searchURL, $customCategories, $hostName, $orderBy);
+ $metadata = new searchMetadata($userId, $searchId, $searchText, $registratingDepartments, $isoCategories, $inspireThemes, $timeBegin, $timeEnd, $regTimeBegin, $regTimeEnd, $maxResults, $searchBbox, $searchTypeBbox, $accessRestrictions, $languageCode, $searchEPSG, $searchResources[0], $searchPages[0], $outputFormat, $resultTarget, $searchURL, $customCategories, $hostName, $orderBy, $resourceIds);
#if ($outputFormat == 'xml') {
# header("Content-type: application/xhtml+xml; charset=UTF-8");
#}
Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2012-11-12 14:53:37 UTC (rev 8506)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2012-11-19 15:23:35 UTC (rev 8507)
@@ -937,7 +937,11 @@
$newBox = $newBox[1].",".$newBox[0].",".$newBox[3].",".$newBox[2];
//generate content link
$feedEntryLink = $feedDoc->createElement("link");
- $feedEntryLink->setAttribute("rel", "section");
+ if ($numberOfTiles > 1) {
+ $feedEntryLink->setAttribute("rel", "section");
+ } else {
+ $feedEntryLink->setAttribute("rel", "alternate");
+ }
$feedEntryLink->setAttribute("href", $furtherLink[$m]);
$feedEntryLink->setAttribute("type", $furtherLinkType[$m]);
$feedEntryLink->setAttribute("hreflang", "de");
@@ -955,6 +959,12 @@
$furtherLinkBbox = array();
//loop for each featuretype
$e = new mb_notice("Count of wfs links: ".count($getFeatureLink));
+ if (count($getFeatureLink) > 1) {
+ $feedEntryContent = $feedDoc->createElement("content");
+ $feedEntryContentText = $feedDoc->createTextNode("Datensatz wird in in ".count($getFeatureLink)." einzelnen Teilen ausgeliefert.");
+ $feedEntryContent->appendChild($feedEntryContentText);
+ $feedEntry->appendChild($feedEntryContent);
+ }
for ($m = 0; $m < count($getFeatureLink); $m++ ) {
$furtherLink[$m] = $getFeatureLink[$m];//was computed before
$furtherLinkType[$m] = "text/xml; subtype=gml/3.1.1";//TODO: set right format for wfs version!
@@ -964,7 +974,11 @@
$furtherLinkBbox[$m] = $featureTypeBboxWGS84[$m];
//generate content links
$feedEntryLink = $feedDoc->createElement("link");
- $feedEntryLink->setAttribute("rel", "section");
+ if (count($getFeatureLink) > 1) {
+ $feedEntryLink->setAttribute("rel", "section");
+ } else {
+ $feedEntryLink->setAttribute("rel", "alternate");
+ }
$feedEntryLink->setAttribute("href", $furtherLink[$m]);
$feedEntryLink->setAttribute("type", $furtherLinkType[$m]);
$feedEntryLink->setAttribute("hreflang", "de");
Modified: trunk/mapbender/http/php/mod_metadataWrite.php
===================================================================
--- trunk/mapbender/http/php/mod_metadataWrite.php 2012-11-12 14:53:37 UTC (rev 8506)
+++ trunk/mapbender/http/php/mod_metadataWrite.php 2012-11-19 15:23:35 UTC (rev 8507)
@@ -24,6 +24,7 @@
$customCategories = $_SERVER["argv"][22];
$hostName = $_SERVER["argv"][23];
$orderBy = $_SERVER["argv"][24];
+$resourceIds = $_SERVER["argv"][25];
-$metadata = new searchMetadata($userId, $searchId, $searchText, $registratingDepartments, $isoCategories, $inspireThemes, $timeBegin, $timeEnd, $regTimeBegin, $regTimeEnd, $maxResults, $searchBbox, $searchTypeBbox, $accessRestrictions, $languageCode, $searchEPSG, $searchResources, $searchPages, $outputFormat, $resultTarget, $searchURL, $customCategories, $hostName, $orderBy);
+$metadata = new searchMetadata($userId, $searchId, $searchText, $registratingDepartments, $isoCategories, $inspireThemes, $timeBegin, $timeEnd, $regTimeBegin, $regTimeEnd, $maxResults, $searchBbox, $searchTypeBbox, $accessRestrictions, $languageCode, $searchEPSG, $searchResources, $searchPages, $outputFormat, $resultTarget, $searchURL, $customCategories, $hostName, $orderBy, $resourceIds);
?>
More information about the Mapbender_commits
mailing list