[Mapbender-commits] r9827 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Dec 7 07:26:55 PST 2017
Author: armin11
Date: 2017-12-07 07:26:55 -0800 (Thu, 07 Dec 2017)
New Revision: 9827
Modified:
trunk/mapbender/http/php/mod_showMetadata.php
Log:
Add some first rdf-a metadata to html representation for metatada about wms/wfs/layer/featuretype/wmc
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2017-12-07 13:58:45 UTC (rev 9826)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2017-12-07 15:26:55 UTC (rev 9827)
@@ -640,22 +640,8 @@
$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'] != "") {
- $resourceMetadata['preview'] = "<img class='responsivimg' src = '../geoportal/mod_showPreview.php?resource=layer&id=".$layerId."'>";
-
- //}
- //if ($rowP['layer_legend_preview_filename'] != "") {
- $resourceMetadata['legend'] .= "<img class='responsivimg' src = '../geoportal/mod_showPreview.php?resource=layerlegend&id=".$layerId."'>";
- //}
-/* if ($rowP['layer_extent_preview_filename'] != "") {
- $resourceMetadata['extent'] .= "<img class='responsivimg' src = '../geoportal/layer_preview/".$rowP['layer_extent_preview_filename']."'>";
- }*/
-
+ $resourceMetadata['preview'] = "<img class='responsivimg' src = '../geoportal/mod_showPreview.php?resource=layer&id=".$layerId."'>";
+ $resourceMetadata['legend'] .= "<img class='responsivimg' src = '../geoportal/mod_showPreview.php?resource=layerlegend&id=".$layerId."'>";
}
if ($resource == 'wmc') {
$resourceMetadata['preview'] = "<img class='responsivimg' src = '../geoportal/mod_showPreview.php?resource=wmc&id=".$resourceMetadata['contentid']."'>";
@@ -716,11 +702,8 @@
$j = 0;
}
//generate HTML frame
-
//Give out page
-
//Array with structure of metadata
-
//e.g. tabs and their content
$html = '<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$languageCode.'">';
@@ -740,95 +723,103 @@
$html .= $metadataStr;
$html .= '<body>';
//define the javascripts to include
- $html .= '<link type="text/css" href="../css/metadata_responsiv.css" rel="Stylesheet" />';
-
-if ($layout == 'tabs') {
- $html .= '<link type="text/css" href="../extensions/jquery-ui-1.8.1.custom/css/custom-theme/jquery-ui-1.8.5.custom.css" rel="Stylesheet" />';
- $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-1.4.2.min.js"></script>';
- $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-ui-1.8.1.custom.min.js"></script>';
-//some js for dialog
- //following is added to give a window with an interated link which can be included in external applications
- $html .= '<script type="text/javascript">';
-
- $html .= 'showCapabilitiesUrl = function (url,title) {';
+$html .= '<link type="text/css" href="../css/metadata_responsiv.css" rel="Stylesheet" />';
+/************************/ //Things for rdf-a handling via referencing http://schema.org vocabulary
+//define main vocabulary
+switch ($resource) {
+ case "wms":
+ $mainVocabReference = 'vocab="http://schema.org/" typeof="Map"';
+ break;
+ case "layer":
+ $mainVocabReference = 'vocab="http://schema.org/" typeof="Map"';
+ break;
+ case "wmc":
+ $mainVocabReference = 'vocab="http://schema.org/" typeof="Map"';
+ break;
+ case "wfs":
+ $mainVocabReference = 'vocab="http://schema.org/" typeof="Dataset"';
+ break;
+ case "featuretype":
+ $mainVocabReference = 'vocab="http://schema.org/" typeof="Dataset"';
+ break;
+ default:
+ $mainVocabReference = 'vocab="http://schema.org/" typeof="Dataset"';
+ break;
+}
+$providerOrganizationCategory = 'property="provider" typeof="Organization"';
+$publisherOrganizationCategory = 'property="publisher" typeof="Organization"';
+$producerOrganizationCategory = 'property="producer" typeof="Organization"';
+/************************/
+switch ($layout) {
+ case "tabs":
+ $html .= '<link type="text/css" href="../extensions/jquery-ui-1.8.1.custom/css/custom-theme/jquery-ui-1.8.5.custom.css" rel="Stylesheet" />';
+ $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-1.4.2.min.js"></script>';
+ $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-ui-1.8.1.custom.min.js"></script>';
+ //some js for dialog
+ //following is added to give a window with an interated link which can be included in external applications
+ $html .= '<script type="text/javascript">';
+ $html .= 'showCapabilitiesUrl = function (url,title) {';
$html .= 'hideCapabilitiesUrl();';
$html .= 'var $capabilitiesUrlPopup = $(\'<div><input size="40" type="text" value="\' + url + \'"/></div>\');';
$html .= '$capabilitiesUrlPopup.dialog({';
- $html .= 'title: title,';
- $html .= 'bgiframe: true,';
- $html .= 'autoOpen: true,';
- $html .= 'resizable: false,';
- $html .= 'modal: true,';
- $html .= 'width: innerWidth * 0.8,';
- $html .= 'height: 110';
-
+ $html .= 'title: title,';
+ $html .= 'bgiframe: true,';
+ $html .= 'autoOpen: true,';
+ $html .= 'resizable: false,';
+ $html .= 'modal: true,';
+ $html .= 'width: innerWidth * 0.8,';
+ $html .= 'height: 110';
$html .= '});';
- $html .= '};';
-
- $html .= 'hideCapabilitiesUrl = function () {';
+ $html .= '};';
+ $html .= 'hideCapabilitiesUrl = function () {';
$html .= 'if($(\'capabilitiesUrl.Popup\').size() > 0) {';
- $html .= '$(\'capabilitiesUrl.Popup\').dialog(\'destroy\');';
+ $html .= '$(\'capabilitiesUrl.Popup\').dialog(\'destroy\');';
$html .= '}';
- $html .= '};';
- $html .= '</script>';
-
-/*if ($metadataContactGroup['mb_group_logo_path'] != '') {
- $html .= "<img src='".$metadataContactGroup['mb_group_logo_path']."' height='30'>";
-}
-//TODO use right name
-$html .= displayText($resourceMetadata['contactorganization']);
-$html .= '<h3>'.displayText($resourceMetadata['contenttitle']).'</h3>';
-*/
-
-
-
-//initialize tabs
- $html .= '<script type="text/javascript">';
- $html .= '$(function() {';
- $html .= ' $("#tabs").tabs();';
- $html .= '});';
- $html .= '</script>';
-
-
-
-//window close button top
- $html .= '<div style="padding:10px;display:block;text-align:center;"><a href="javascript:window.close()">'._mb('Close window').'</a>
+ $html .= '};';
+ $html .= '</script>';
+ //initialize tabs
+ $html .= '<script type="text/javascript">';
+ $html .= '$(function() {';
+ $html .= ' $("#tabs").tabs();';
+ $html .= '});';
+ $html .= '</script>';
+ //window close button top
+ $html .= '<div style="padding:10px;display:block;text-align:center;"><a href="javascript:window.close()">'._mb('Close window').'</a>
</div>';
-
-//independently define the headers of the parts
- $html .= '<div class="demo">';
- $html .= '<div id="tabs">';
- $html .= '<ul>';
- $html .= '<li><a href="#tabs-1">'.$translation["overview"].'</a></li>';
- $html .= '<li><a href="#tabs-2">'.$translation["properties"].'</a></li>';
- $html .= '<li><a href="#tabs-3">'.$translation["contact"].'</a></li>';
- $html .= '<li><a href="#tabs-4">'.$translation["termsOfUse"].'</a></li>';
- $html .= '<li><a href="#tabs-5">'.$translation["quality"].'</a></li>';
- $html .= '<li><a href="#tabs-6">'.$translation["interfaces"].'</a></li>';
- $html .= '</ul>';
-
+ //independently define the headers of the parts
+ $html .= '<div '.$mainVocabReference.' class="demo">';
+ $html .= '<div id="tabs">';
+ $html .= '<ul>';
+ $html .= '<li><a href="#tabs-1">'.$translation["overview"].'</a></li>';
+ $html .= '<li><a href="#tabs-2">'.$translation["properties"].'</a></li>';
+ $html .= '<li><a href="#tabs-3">'.$translation["contact"].'</a></li>';
+ $html .= '<li><a href="#tabs-4">'.$translation["termsOfUse"].'</a></li>';
+ $html .= '<li><a href="#tabs-5">'.$translation["quality"].'</a></li>';
+ $html .= '<li><a href="#tabs-6">'.$translation["interfaces"].'</a></li>';
+ $html .= '</ul>';
+ break;
+ case "accordion":
+ $html .= '<link type="text/css" href="../extensions/jquery-ui-1.8.1.custom/css/custom-theme/jquery-ui-1.8.4.custom.css" rel="Stylesheet" />';
+ $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-1.4.2.min.js"></script>';
+ $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-ui-1.8.1.custom.min.js"></script>';
+ //define the javascript functions
+ $html .= '<script type="text/javascript">';
+ $html .= ' $(function() {';
+ $html .= ' $("#accordion").accordion();';
+ //$html .= ' $("#accordion").accordion({ autoHeight: false});';
+ //$html .= ' $("#accordion").accordion({ autoHeight: false , clearStyle: true });';
+ $html .= ' });';
+ $html .= ' </script>';
+ $html .= '<div '.$mainVocabReference.' class="demo">';
+ $html .= '<div id="accordion">';
+ break;
+ case "plain":
+ $html .= '<div '.$mainVocabReference.' class="demo">';
+ $html .= '<div id="plain">';
+ break;
+ default:
+ break;
}
-
-if ($layout == 'accordion') {
- $html .= '<link type="text/css" href="../extensions/jquery-ui-1.8.1.custom/css/custom-theme/jquery-ui-1.8.4.custom.css" rel="Stylesheet" />';
- $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-1.4.2.min.js"></script>';
- $html .= '<script type="text/javascript" src="../extensions/jquery-ui-1.8.1.custom/js/jquery-ui-1.8.1.custom.min.js"></script>';
- //define the javascript functions
- $html .= '<script type="text/javascript">';
- $html .= ' $(function() {';
- $html .= ' $("#accordion").accordion();';
- //$html .= ' $("#accordion").accordion({ autoHeight: false});';
- //$html .= ' $("#accordion").accordion({ autoHeight: false , clearStyle: true });';
- $html .= ' });';
- $html .= ' </script>';
- $html .= '<div class="demo">';
- $html .= '<div id="accordion">';
-}
-if ($layout == 'plain') {
- $html .= '<div class="demo">';
- $html .= '<div id="plain">';
-}
-
//some placeholders
$tableBegin = "<table>\n";
$t_a = "\t<tr>\n\t\t<th>\n\t\t\t";
@@ -840,25 +831,27 @@
$tableEnd = "</table>\n";
//**************************overview part begin******************************
//generate div tags for the content - the divs are defined in the array
-if ($layout == 'accordion') {
- $html .= '<h3><a href="#">'.$translation["overview"].'</a></h3>';
- $html .= '<div style="height:300px">';
+switch ($layout) {
+ case "accordion":
+ $html .= '<h3><a href="#">'.$translation["overview"].'</a></h3>';
+ $html .= '<div style="height:300px">';
+ break;
+ case "tabs":
+ $html .= '<div id="tabs-1">';
+ break;
+ case "plain":
+ $html .= '<h3>'.$translation["overview"].'</h3>';
+ $html .= '<div>';
+ break;
+ default:
+ break;
}
-if ($layout == 'tabs') {
- $html .= '<div id="tabs-1">';
-}
-if ($layout == 'plain') {
- $html .= '<h3>'.$translation["overview"].'</h3>';
- $html .= '<div>';
-}
-//$html .= '<p>';
$html .= $tableBegin;
if ($resourceMetadata['contenttitle'] !='') {
- $html .= $t_a.$translation['resourceTitle'].$t_b."<em>".displayText($resourceMetadata['contenttitle'])."</em>".$t_c;
+ $html .= $t_a.$translation['resourceTitle'].$t_b.'<span property="name"><em>'.displayText($resourceMetadata['contenttitle']).'</em></span>'.$t_c;
} else {
- $html .= $t_a.$translation['resourceTitle'].$t_b."<em>".displayText($resourceMetadata['servicetitle'])."</em>".$t_c;
+ $html .= $t_a.$translation['resourceTitle'].$t_b.'<span property="name"><em>'.displayText($resourceMetadata['servicetitle']).'</em></span>'.$t_c;
}
-
//decide if a root layer have been found - then the type will be a server
#$html .= "<br>".$resourceMetadata['contentpos']."<br>";
#$html .= "<br>".$resource."<br>";
@@ -875,8 +868,6 @@
$html .= $t_a.$translation['contentName'].$t_b.$resourceMetadata['contentname'].$t_c;
}
-
-
if ($resource != 'wmc') {
$html .= $t_a.$translation['serviceId'].$t_b."<a href='".$self."?resource=".$serviceType."&id=".$serviceId."&layout=".$layout."&languageCode=".$languageCode."'>".$serviceId."</a>".$t_c;
}
@@ -889,32 +880,23 @@
//$html .= $t_c;
}
-
-
-
-
if ($metadataContactGroup['mb_group_logo_path'] != '') {
$html .= $t_a.$translation['contactOrganization'].$t_b."<img src='".$metadataContactGroup['mb_group_logo_path']."' height='30'>";
}
$html .= displayText($metadataContactGroup['metadatacontactorganization']).$t_c;
if ($resourceMetadata['contentabstract'] != '') {
- $html .= $t_a.$translation['resourceAbstract'].$t_b.displayText($resourceMetadata['contentabstract']).$t_c;
+ $html .= $t_a.$translation['resourceAbstract'].$t_b.'<span property="name"><em>'.displayText($resourceMetadata['contentabstract']).'</em></span>'.$t_c;
} else {
- $html .= $t_a.$translation['resourceAbstract'].$t_b.displayText($resourceMetadata['serviceabstract']).$t_c;
+ $html .= $t_a.$translation['resourceAbstract'].$t_b.'<span property="name"><em>'.displayText($resourceMetadata['serviceabstract']).'</em></span>'.$t_c;
}
-
$user = new User();
$layerAccessibility = $user->isLayerAccessible ($layerId);
-
-
//
-
//
// Monitoring is only available if the user is allowed to access this service
//
-
if ($resource == 'wms' or $resource == 'layer'){
if ($layerAccessibility) {
$is_public = $user->isPublic();
@@ -940,9 +922,6 @@
$html .= $aboStr;
}
-
-
-
if ($layerAccessibility && WRAPPER_PATH != '' && ($resource == 'layer' or $resource == 'wms' )) {
$pos = stripos($mapbenderBaseUrl.WRAPPER_PATH, "?");
if ($pos>0) {
@@ -951,13 +930,13 @@
else {
$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."?LAYER[zoom]=1&LAYER[id]=".$resourceMetadata['contentid']."&LAYER[visible]=0&LAYER[querylayer]=0";
}
-
+ //add hidden element for show map url
+ $html .= $t_a.$t_b.'<span property="url">'.$showMapUrl.'</span>'.$t_c;
//$html .= $t_a.$translation['addLayerToMap'].$t_b."<a href='".$showMapUrl."' target='_blank'><img src='../img/osgeo_graphics/layer-wms-add.png'></a>".$t_c;
$html .= $t_a."<button onclick='window.open(\"".$showMapUrl."\",
\"windowname1\",
\"width=1024, height=768, scrollbars=yes, resizable=yes\");'
- return false;><img src='../img/osgeo_graphics/layer-wms-add.png'>".$translation['showMap']."</button>".$t_b."".$t_c;
-
+ return false;><img src='../img/osgeo_graphics/layer-wms-add.png'>".$translation['showMap']."</button>".$t_b."".$t_c;
}
if (WRAPPER_PATH != '' && $resource == 'wmc') {
@@ -968,7 +947,8 @@
else {
$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."?WMC=".$resourceMetadata['contentid'];
}
-
+ //add hidden element for show map url
+ $html .= $t_a.$t_b.'<span property="url">'.$showMapUrl.'</span>'.$t_c;
//$html .= $t_a.$translation['addLayerToMap'].$t_b."<a href='".$showMapUrl."' target='_blank'><img src='../img/osgeo_graphics/layer-wms-add.png'></a>".$t_c;
$html .= $t_a."<button onclick='window.open(\"".$showMapUrl."\",
\"windowname1\",
@@ -1022,9 +1002,7 @@
$html .= '<h3>'.$translation["properties"].'</h3>';
$html .= '<div>';
}
-//$html .= '<p>';
$html .= $tableBegin;
-
if ($resource == 'wms' or $resource == 'layer'){
if ($resourceMetadata['layer_queryable'] == '1') {
$html .= $t_a.$translation['queryable'].$t_b."<img src='../img/osgeo_graphics/select.png' title='".$translation['queryableTrue']."' alt='".$translation['queryableTrue']."'>".$t_c;
@@ -1087,6 +1065,8 @@
$html .= $t_a.$translation['wgs84Bbox'].$t_b.$wgs84Bbox.$t_c;
if (defined('EXTENTSERVICEURL')) {
$html .= $t_a.$translation['wgs84BboxGraphic'].$t_b."<img src='".$getMapUrl."'>".$t_c;
+ //add dynamic preview in rdfa
+ $html .= '<span hidden="hidden" property="contentLocation" typeof="Place"><span hidden="hidden" property="hasMap" typeof="Url"><span hidden="hidden" property="url">'.$getMapUrl.'</span></span></span>';
} else {
$html .= $t_a.$translation['wgs84BboxGraphic'].$t_b.$translation['graphicUnavailable'].$t_c;
}
More information about the Mapbender_commits
mailing list