[Mapbender-commits] r8603 - trunk/mapbender/http/geoportal
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Apr 16 00:46:28 PDT 2013
Author: armin11
Date: 2013-04-16 00:46:27 -0700 (Tue, 16 Apr 2013)
New Revision: 8603
Modified:
trunk/mapbender/http/geoportal/mod_initialStartWmc.php
trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php
trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php
Log:
Allow some filtering in inspire catalogue table, integration of the new inspire validator at metadata search level, some security fix for initial wmc docs.
Modified: trunk/mapbender/http/geoportal/mod_initialStartWmc.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_initialStartWmc.php 2013-04-16 07:37:30 UTC (rev 8602)
+++ trunk/mapbender/http/geoportal/mod_initialStartWmc.php 2013-04-16 07:46:27 UTC (rev 8603)
@@ -14,7 +14,7 @@
if (isset($_REQUEST["outputFormat"]) & $_REQUEST["outputFormat"] != "") {
$testMatch = $_REQUEST["outputFormat"];
if (!($testMatch == 'html' or $testMatch == 'json')){
- echo 'outputFormat: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'outputFormat is not valid.<br/>';
die();
}
$outputFormat = $testMatch;
@@ -24,12 +24,12 @@
$testMatch = $_REQUEST["maxObjects"];
$pattern = '/^[0-9]*$/';
if (!preg_match($pattern,$testMatch)){
- echo 'maxObjects: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'maxObjects is not valid.<br/>';
die();
}
$maxObjects = (integer)$testMatch;
if ($maxObjects > 15){
- echo '<b>'.$maxObjects.'</b> objects are too much, at maximum 15 ojects are allowed.<br/>';
+ echo 'objects are too much, at maximum 15 ojects are allowed.<br/>';
die();
}
$testMatch = NULL;
@@ -38,7 +38,7 @@
$testMatch = $_REQUEST["maxAge"];
$pattern = '/^[0-9]*$/';
if (!preg_match($pattern,$testMatch)){
- echo 'maxAge: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'maxAge is not valid.<br/>';
die();
}
$maxAge = (integer)$testMatch;
@@ -48,7 +48,7 @@
//validate to wms, wfs
$testMatch = $_REQUEST["languageCode"];
if (!($testMatch == 'de' or $testMatch == 'en' or $testMatch == 'fr')){
- echo 'languageCode: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'languageCode is not valid.<br/>';
die();
}
$languageCode = $testMatch;
@@ -60,9 +60,9 @@
//look for whitelist in mapbender.conf
$HOSTNAME_WHITELIST_array = explode(",",HOSTNAME_WHITELIST);
if (!in_array($testMatch,$HOSTNAME_WHITELIST_array)) {
- echo "Requested hostname <b>".$testMatch."</b> not whitelist! Please control your mapbender.conf.";
+ echo "Requested hostname not in whitelist! Please control your mapbender.conf.";
$e = new mb_notice("Whitelist: ".HOSTNAME_WHITELIST);
- $e = new mb_notice($testMatch." not found in whitelist!");
+ $e = new mb_notice("hostname not found in whitelist!");
die();
}
$hostName = $testMatch;
Modified: trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php 2013-04-16 07:37:30 UTC (rev 8602)
+++ trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php 2013-04-16 07:46:27 UTC (rev 8603)
@@ -4,6 +4,7 @@
#$con = db_connect(DBSERVER,OWNER,PW);
#db_select_db(DB,$con);
require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../php/mod_validateInspire.php");
require_once dirname(__FILE__) . "/../../tools/wms_extent/extent_service.conf";
$languageCode = "de";
$layout = "tabs";
@@ -104,41 +105,6 @@
}
}
-//function to validate against the inspire validation service
-function validateInspireMetadataFromData($iso19139Xml){
- $validatorUrl = 'http://inspire-geoportal.ec.europa.eu/INSPIREValidatorService/resources/validation/inspire';
- #$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php'; //for debugging purposes
- //send inspire xml to validator and push the result to requesting user
- $validatorInterfaceObject = new connector();
- $validatorInterfaceObject->set('httpType','POST');
- $validatorInterfaceObject->set('httpContentType','multipart/form-data'); # maybe given automatically
- //first test with data from ram - doesn't function :-(
- $fields = array(
- 'dataFile'=>urlencode($iso19139Xml)
- );
- //generate file identifier:
- $fileId = guid();
- //generate temporary file under tmp
- if($h = fopen(TMPDIR."/".$fileId."iso19139_validate_tmp.xml","w")){
- if(!fwrite($h,$iso19139Xml)){
- $e = new mb_exception("geoportal/mod_readCSWResultsDetail.php: cannot write to file: ".TMPDIR."iso19139_validate_tmp.xml");
- }
- fclose($h);
- }
- //send file as post like described under http://www.tecbrat.com/?itemid=13&catid=1
- $fields['dataFile']='@'.TMPDIR.'/'.$fileId.'iso19139_validate_tmp.xml';
- $postData = $fields;
- $validatorInterfaceObject->set('httpPostFieldsNumber',count($postData));
- $validatorInterfaceObject->set('curlSendCustomHeaders',false);
- $validatorInterfaceObject->set('httpPostData', $postData); #give an array
- $validatorInterfaceObject->load($validatorUrl);
- header("Content-type: text/html; charset=UTF-8");
- echo $validatorInterfaceObject->file;
- //delete file in tmp
- //TODO - this normally done by a cronjob
- die();
-}
-
//INSPIRE Mapping
$md_ident = array(
//Metadata Identifier - not neccessary?
@@ -789,7 +755,7 @@
if ($_REQUEST['mdtype']=='iso19139' && $_REQUEST['validate'] == 'true') {
$MD_Metadata = str_replace('<csw:GetRecordByIdResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">', '', $openSearchDetail);
$MD_Metadata = str_replace('</csw:GetRecordByIdResponse>', '', $MD_Metadata);
- validateInspireMetadataFromData($MD_Metadata);
+ validateInspire($MD_Metadata);
}
$j=0;
Modified: trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php 2013-04-16 07:37:30 UTC (rev 8602)
+++ trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php 2013-04-16 07:46:27 UTC (rev 8603)
@@ -2,6 +2,7 @@
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
$registratingDepartments = null;
$sessionLang = Mapbender::session()->get("mb_lang");
+$withCounts = true;
if (isset($sessionLang) && ($sessionLang!='')) {
$e = new mb_notice("mod_showMetadata.php: language found in session: ".$sessionLang);
$language = $sessionLang;
@@ -14,12 +15,27 @@
$testMatch = $_REQUEST["registratingDepartments"];
$pattern = '/^[\d,]*$/';
if (!preg_match($pattern,$testMatch)){
- echo 'registratingDepartments: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'Parameter <b>registratingDepartments</b> is not valid.<br/>';
die();
}
$registratingDepartments = $testMatch;
$testMatch = NULL;
}
+if (isset($_REQUEST["withCounts"]) & $_REQUEST["withCounts"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["withCounts"];
+ //$pattern = '/^[\d,]*$/';
+ if (!($testMatch == "false" || $testMatch == "true")){
+ echo 'Parameter <b>withCounts</b> is not valid.<br/>';
+ die();
+ }
+ $withCounts = $testMatch;
+ if ($withCounts == 'false') {
+ $withCounts = false;
+ }
+ $testMatch = NULL;
+}
+
//Array with translations:
switch ($languageCode) {
case "de":
@@ -183,6 +199,19 @@
//$html .= "{ \"bSortable\": false, \"aTargets\": [ 0 ] }";
//$html .= "],";
$html .= "\"bProcessing\": true,";
+
+//internationalization
+$html .= "\"oLanguage\": {";
+$html .= " \"sSearch\": \"Volltextsuche:\",";
+$html .= " \"sInfo\": \"Zeige _START_ bis _END_ von _TOTAL_ Einträgen\",";
+$html .= " \"sLengthMenu\": \"Zeige _MENU_ Einträge\",";
+$html .= " \"oPaginate\": {";
+$html .= " \"sFirst\": \"Erste\",";
+$html .= " \"sLast\": \"Letzte\",";
+$html .= " \"sNext\": \"Nächste\",";
+$html .= " \"sPrevious\": \"Vorige\"";
+$html .= " }";
+$html .= " },";
$html .= "\"sAjaxDataProp\": \"aaData\",";
if ($registratingDepartments != null) {
$html .= "\"sAjaxSource\": \"mod_pullInspireMonitoring.php?registratingDepartments=".$registratingDepartments."\",";
@@ -195,9 +224,13 @@
$html .= "{ \"mData\": \"title\" },";
$html .= "{ \"mData\": \"uuid\" },";
$html .= "{ \"mData\": \"organization\" },";
-$html .= "{ \"mData\": \"inspireCategories\" },";
-$html .= "{ \"mData\": \"numberViewServices\" },";
-$html .= "{ \"mData\": \"numberDownloadServices\" }";
+if ($withCounts) {
+ $html .= "{ \"mData\": \"inspireCategories\" },";
+ $html .= "{ \"mData\": \"numberViewServices\" },";
+ $html .= "{ \"mData\": \"numberDownloadServices\" }";
+} else {
+ $html .= "{ \"mData\": \"inspireCategories\" }";
+}
$html .= "]";
$html .= "});";
//$html .= "} );";
@@ -243,8 +276,10 @@
$html .= " <th>".$translation['Identifier']."</th>";
$html .= " <th>".$translation['Organization']."</th>";
$html .= " <th>".$translation['INSPIRE Themes']."</th>";
-$html .= " <th>".$translation['# of View Services']."</th>";
-$html .= " <th>".$translation['# of Download Services']."</th>";
+if ($withCounts) {
+ $html .= " <th>".$translation['# of View Services']."</th>";
+ $html .= " <th>".$translation['# of Download Services']."</th>";
+}
$html .= " </tr>";
$html .= " </thead>";
$html .= " <tbody>";
More information about the Mapbender_commits
mailing list