[Mapbender-commits] r9004 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jul 28 03:13:05 PDT 2014
Author: armin11
Date: 2014-07-28 03:13:05 -0700 (Mon, 28 Jul 2014)
New Revision: 9004
Modified:
trunk/mapbender/http/php/mod_getDownloadOptions.php
Log:
Minimalistic client for list of INSPIRE Download Services
Modified: trunk/mapbender/http/php/mod_getDownloadOptions.php
===================================================================
--- trunk/mapbender/http/php/mod_getDownloadOptions.php 2014-07-28 09:26:10 UTC (rev 9003)
+++ trunk/mapbender/http/php/mod_getDownloadOptions.php 2014-07-28 10:13:05 UTC (rev 9004)
@@ -25,6 +25,19 @@
//require_once dirname(__FILE__) . "/../../core/epsg.php";
require_once(dirname(__FILE__) . "/../classes/class_Uuid.php");
+$outputFormat = "json";
+
+if (isset($_REQUEST["outputFormat"]) & $_REQUEST["outputFormat"] != "") {
+ $testMatch = $_REQUEST["outputFormat"];
+ if (!($testMatch == 'json' or $testMatch == 'html')){
+ //echo 'outputFormat: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'Parameter <b>outputFormat</b> is not valid (json,html).<br/>';
+ die();
+ }
+ $outputFormat = $testMatch;
+ $testMatch = NULL;
+}
+
function checkUrlInDatalink($url, $datalinkIds) {
$sql = "SELECT datalink_id FROM datalink WHERE datalink_id in (".explode(",",$datalinkIds).") AND datalink_url = ".urldecode($url);
$res = db_query($sql);
@@ -177,8 +190,46 @@
}
$downloadOptions = getDownloadOptions($idList);
-if ($downloadOptions != "null") {
+if ($downloadOptions != "null" && $outputFormat == "json") {
header('Content-Type: application/json; charset='.CHARSET);
echo $downloadOptions;
}
+if ($downloadOptions != "null" && $outputFormat == "html") {
+ $options = json_decode($downloadOptions);
+ echo "<HTML><Body>";
+ if (defined("MAPBENDER_PATH") && MAPBENDER_PATH != '') {
+ $mapbenderUrl = MAPBENDER_PATH;
+ } else {
+ $mapbenderUrl = "http://www.geoportal.rlp.de/mapbender";
+ }
+
+ $metadataList = "Used dataset(s):<br>";
+
+ foreach ($idList as $currentUuid){
+ //$metadataList .= "<a href='../php/mod_iso19139ToHtml.php?url=".urlencode($mapbenderUrl."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$currentUuid)."'>".$options->{$currentUuid}->title."</a> <a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$currentUuid."&validate=true'>".'validate'."</a>";
+ $metadataList .= "<a href='../php/mod_iso19139ToHtml.php?url=".urlencode($mapbenderUrl."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$currentUuid)."'>".$options->{$currentUuid}->title."</a>";
+ //echo $options->{$currentUuid}->title;
+ //$metadataList .= "<br>";
+ if ($downloadOptions != null) {
+ foreach ($options->{$currentUuid}->option as $option) {
+ switch ($option->type) {
+ case "wmslayergetmap":
+ $metadataList .= " <a href='../plugins/mb_downloadFeedClient.php?url=".urlencode($mapbenderUrl."/php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=wmslayer&layerid=".$option->resourceId)."'><img src='../img/osgeo_graphics/geosilk/raster_download.png' title='".'Download raster data from INSPIRE Download Service'."'/></a>";
+ break;
+ case "wmslayerdataurl":
+ $metadataList .= " <a href='../plugins/mb_downloadFeedClient.php?url=".urlencode($mapbenderUrl."/php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=dataurl&layerid=".$option->resourceId)."'><img src='../img/osgeo_graphics/geosilk/link_download.png' title='".'Download linked data from INSPIRE Download Service'."'/></a>";
+ break;
+ case "wfsrequest":
+ $metadataList .= " <a href='../plugins/mb_downloadFeedClient.php?url=".urlencode($mapbenderUrl."/php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=wfs&wfsid=".$option->serviceId)."'><img src='../img/osgeo_graphics/geosilk/vector_download.png' title='".'Download GML data from INSPIRE Download Service'."'/></a>";
+ break;
+ case "downloadlink":
+ $metadataList .= " <a href='../plugins/mb_downloadFeedClient.php?url=".urlencode($mapbenderUrl."/php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=metadata")."'><img src='../img/osgeo_graphics/geosilk/link_download.png' title='".'Download linked data from INSPIRE Download Service'."'/></a>";
+ break;
+ }
+ }
+ }
+ }
+ echo $metadataList;
+ echo "</Body></HTML>";
+}
?>
More information about the Mapbender_commits
mailing list