'.$testMatch.' is not valid.
';
die();
}
$resource = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["id"]) & $_REQUEST["id"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["id"];
$pattern = '/^[\d,]*$/';
if (!preg_match($pattern,$testMatch)){
echo 'id: '.$testMatch.' is not valid.
';
die();
}
$id = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["outputFormat"]) & $_REQUEST["outputFormat"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["outputFormat"];
if (!($testMatch == 'iso19139' or $testMatch == 'html' or $testMatch == 'georss')){
echo 'outputFormat: '.$testMatch.' is not valid.
';
die();
}
$outputFormat = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["languageCode"]) & $_REQUEST["languageCode"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["languageCode"];
if (!($testMatch == 'de' or $testMatch == 'fr' or $testMatch == 'en')){
echo 'languageCode: '.$testMatch.' is not valid.
';
die();
}
$languageCode = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["layout"]) & $_REQUEST["layout"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["layout"];
if (!($testMatch == 'tabs' or $testMatch == 'accordion' or $testMatch == 'plain')){
echo 'layout: '.$testMatch.' is not valid.
';
die();
}
$layout = $testMatch;
$testMatch = NULL;
}
if (isset($_REQUEST["subscribe"]) & $_REQUEST["subscribe"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["subscribe"];
if (!($testMatch == '1' or $testMatch == '0')){
echo 'layout: '.$testMatch.' is not valid.
';
die();
}
$subscribe = $testMatch;
$testMatch = NULL;
}
$subscribe = intval($subscribe);
$hostName = $_SERVER['HTTP_HOST'];
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
$mapbenderBaseUrl = "https://".$hostName;
$mapbenderProtocol = "https://";
}
else {
$mapbenderBaseUrl = "http://".$hostName;
$mapbenderProtocol = "http://";
}
//Array with translations:
switch ($languageCode) {
case "de":
$translation['overview'] = 'Übersicht';
$translation['properties'] = 'Eigenschaften';
$translation['termsOfUse'] = 'Nutzungsbedingungen';
$translation['contact'] = 'Kontakt';
$translation['quality'] = 'Qualität';
$translation['interfaces'] = 'Schnittstellen';
$translation['metadata'] = 'Metadaten';
$translation['kindOfResource'] = 'Art der Ressource';
$translation['wms'] = 'Kartendienst';
$translation['wfs'] = 'Datendienst';
$translation['layer'] = 'Kartenebene';
$translation['featuretype'] = 'Objektart';
$translation['geomtype'] = 'Geometrietyp';
$translation['contentId'] = 'Resourcenidentifikator';
$translation['contentName'] = 'Name der Ressouce';
$translation['serviceId'] = 'Informationen zum Dienst';
$translation['preview'] = 'Voransicht';
$translation['extent'] = 'Ausdehnung';
$translation['resourceAbstract'] = 'Zusammenfassung';
$translation['resourceTitle'] = 'Titel';
$translation['metadataProvider'] = 'Inhaltlich verantwortliche Stelle';
$translation['serviceProvider'] = 'Technisch verantwortliche Stelle';
$translation['contactPerson'] = 'Ansprechpartner';
$translation['contactOrganization'] = 'Organisation';
$translation['contactAddress'] = 'Adresse';
$translation['email'] = 'Email';
$translation['city'] = 'Ort';
$translation['logo'] = 'Logo';
$translation['status'] = 'Status';
$translation['availability'] = 'Verfügbarkeit';
$translation['statusRed'] = 'Probleme beim letzten Monitoring!';
$translation['statusGreen'] = 'Letztes Monitoring OK';
$translation['statusYellow'] = 'Dienstebeschreibung hat sich geändert!';
$translation['queryableFalse'] = 'Ebene nicht abfragbar';
$translation['queryableTrue'] = 'Ebene abfragbar';
$translation['queryable'] = 'Abfragbarkeit';
$translation['restrictedScale'] = 'Sichtbarkeit';
$translation['minscale'] = 'Minimaler Maßstab';
$translation['maxscale'] = 'Maximaler Maßstab';
$translation['crs'] = 'Koordinatenreferenzsysteme (mit BBOX)';
$translation['wmccrs'] = 'Eingestelltes Koordinatenreferenzsystem';
$translation['wgs84Bbox'] = 'Eckpunkte in geogr. Koordinaten';
$translation['wgs84BboxGraphic'] = 'Kartenübersicht';
$translation['mapbenderCapabilities'] = 'Geoportal Capabilities';
$translation['originalCapabilities'] = 'Original Capabilities';
$translation['describeFeaturetype'] = 'Link zum Datenschema';
$translation['kml'] = 'KML';
$translation['inspireMetadata'] = 'INSPIRE Service Metadaten';
$translation['showInspireMetadata'] = 'Metadatendatei';
$translation['securedCapabilities'] = 'Secured Capabilities URL';
$translation['capabilities'] = 'Link zum Capabilities Dokument';
$translation['inspireMetadataValidation'] = 'Validierung gegen INSPIRE Geoportal';
$translation['showInspireMetadataValidation'] = 'Validierung starten';
$translation['statusOK'] = 'Stabil';
$translation['statusChanged'] = 'Beschreibung hat sich geändert - Aktualisierung nötig';
$translation['statusProblem'] = 'Problem bei letzter Kontrolle';
$translation['contactTelephone'] = 'Telefon';
$translation['wmc'] = 'Web Map Context Dokument';
$translation['graphicUnavailable'] = 'Grahische Übersicht nicht aktiviert';
$translation['notMonitored'] = 'Informationen über die Qualität sind nur verfügbar, wenn das Service Monitoring aktiv ist!';
$translation['wmcQualityText'] = 'Für Web Map Context Dokumente entfällt die Angabe zur Qualität!';
$translation['noTouInformation'] = 'Es sind keine Informationen über Nutzungsbedingungen verfügbar!';
break;
case "en":
$translation['overview'] = 'Overview';
$translation['properties'] = 'Properties';
$translation['termsOfUse'] = 'Terms Of Use';
$translation['contact'] = 'Contact';
$translation['quality'] = 'Quality';
$translation['interfaces'] = 'Interfaces';
$translation['metadata'] = 'Metadata';
$translation['kindOfResource'] = 'Kind of resource';
$translation['wms'] = 'Map Service';
$translation['wfs'] = 'Data Service';
$translation['layer'] = 'Map Layer';
$translation['featuretype'] = 'Featuretype';
$translation['geomtype'] = 'Type of geometry';
$translation['contentId'] = 'Resourceidentifier';
$translation['contentName'] = 'Name of the resource';
$translation['serviceId'] = 'Information about the service';
$translation['preview'] = 'Preview';
$translation['extent'] = 'Extent';
$translation['resourceAbstract'] = 'Abstract';
$translation['resourceTitle'] = 'Title';
$translation['metadataProvider'] = 'Responsible party for content';
$translation['serviceProvider'] = 'Responsible party for service';
$translation['contactPerson'] = 'Contact person';
$translation['contactOrganization'] = 'Organization';
$translation['contactAddress'] = 'Address';
$translation['email'] = 'Email';
$translation['city'] = 'City';
$translation['logo'] = 'Logo';
$translation['status'] = 'Status';
$translation['availability'] = 'Availability';
$translation['statusRed'] = 'Problem with last monitoring!';
$translation['statusGreen'] = 'Last Monitoring: OK';
$translation['statusYellow'] = 'Servicedescription changed!';
$translation['queryableFalse'] = 'Layer not queryable';
$translation['queryableTrue'] = 'Layer queryable';
$translation['queryable'] = 'Query';
$translation['restrictedScale'] = 'Visibility';
$translation['minscale'] = 'Minimum scale';
$translation['maxscale'] = 'Maximum scale';
$translation['crs'] = 'Coordinate Reference System';
$translation['wmccrs'] = 'Used Coordinate Reference System';
$translation['wgs84Bbox'] = 'Corner in geographic Coordinates';
$translation['wgs84BboxGraphic'] = 'Map View';
$translation['mapbenderCapabilities'] = 'Geoportal Capabilities';
$translation['originalCapabilities'] = 'Original Capabilities';
$translation['describeFeaturetype'] = 'Dataschema';
$translation['kml'] = 'KML';
$translation['inspireMetadata'] = 'INSPIRE Service Metadata';
$translation['showInspireMetadata'] = 'Metadatendatei';
$translation['securedCapabilities'] = 'Secured Capabilities URL';
$translation['capabilities'] = 'Link zum Capabilities Dokument';
$translation['inspireMetadataValidation'] = 'Validation against INSPIRE Geoportal';
$translation['showInspireMetadataValidation'] = 'Start Validation';
$translation['statusOK'] = 'stable';
$translation['statusChanged'] = 'Description changed - update necessary';
$translation['statusProblem'] = 'Problem at last control';
$translation['contactTelephone'] = 'Telephon';
$translation['wmc'] = 'Web Map Context document';
$translation['graphicUnavailable'] = 'Graphical Overview not active';
$translation['notMonitored'] = 'Information about Quality is only available if the service monitoring is activated!';
$translation['wmcQualityText'] = 'In case of Web Map Context Documents the Quality part is not applicable!';
$translation['noTouInformation'] = 'No informations about terms of use are available!';
break;
default: #to english
$translation['overview'] = 'Overview';
$translation['properties'] = 'Properties';
$translation['termsOfUse'] = 'Terms Of Use';
$translation['contact'] = 'Contact';
$translation['quality'] = 'Quality';
$translation['interfaces'] = 'Interfaces';
$translation['metadata'] = 'Metadata';
$translation['kindOfResource'] = 'Kind of resource';
$translation['wms'] = 'Map Service';
$translation['wfs'] = 'Data Service';
$translation['layer'] = 'Map Layer';
$translation['featuretype'] = 'Featuretype';
$translation['geomtype'] = 'Type of geometry';
$translation['contentId'] = 'Resourceidentifier';
$translation['contentName'] = 'Name of the resource';
$translation['serviceId'] = 'Information about the service';
$translation['preview'] = 'Preview';
$translation['extent'] = 'Extent';
$translation['resourceAbstract'] = 'Abstract';
$translation['resourceTitle'] = 'Title';
$translation['metadataProvider'] = 'Responsible party for content';
$translation['serviceProvider'] = 'Responsible party for service';
$translation['contactPerson'] = 'Contact person';
$translation['contactOrganization'] = 'Organization';
$translation['contactAddress'] = 'Address';
$translation['email'] = 'Email';
$translation['city'] = 'City';
$translation['logo'] = 'Logo';
$translation['status'] = 'Status';
$translation['availability'] = 'Availability';
$translation['statusRed'] = 'Problem with last monitoring!';
$translation['statusGreen'] = 'Last Monitoring: OK';
$translation['statusYellow'] = 'Servicedescription changed!';
$translation['queryableFalse'] = 'Layer not queryable';
$translation['queryableTrue'] = 'Layer queryable';
$translation['queryable'] = 'Query';
$translation['restrictedScale'] = 'Visibility';
$translation['minscale'] = 'Minimum scale';
$translation['maxscale'] = 'Maximum scale';
$translation['crs'] = 'Coordinate Reference System';
$translation['wmccrs'] = 'Used Coordinate Reference System';
$translation['wgs84Bbox'] = 'Corner in geographic Coordinates';
$translation['wgs84BboxGraphic'] = 'Map View';
$translation['mapbenderCapabilities'] = 'Geoportal Capabilities';
$translation['originalCapabilities'] = 'Original Capabilities';
$translation['describeFeaturetype'] = 'Dataschema';
$translation['kml'] = 'KML';
$translation['inspireMetadata'] = 'INSPIRE Service Metadata';
$translation['showInspireMetadata'] = 'Metadatendatei';
$translation['securedCapabilities'] = 'Secured Capabilities URL';
$translation['capabilities'] = 'Link zum Capabilities Dokument';
$translation['inspireMetadataValidation'] = 'Validation against INSPIRE Geoportal';
$translation['showInspireMetadataValidation'] = 'Start Validation';
$translation['statusOK'] = 'stable';
$translation['statusChanged'] = 'Description changed - update necessary';
$translation['statusProblem'] = 'Problem at last control';
$translation['contactTelephone'] = 'Telephon';
$translation['wmc'] = 'Web Map Context document';
$translation['graphicUnavailable'] = 'Graphical Overview not active';
$translation['notMonitored'] = 'Information about Quality is only available if the service monitoring is activated!';
$translation['wmcQualityText'] = 'In case of Web Map Context Documents the Quality part is not applicable!';
$translation['noTouInformation'] = 'No informations about terms of use are available!';
}
//Array with infos about the different elements which are shown in the tabs
//Check if an id and a resource was given
if (!isset($_REQUEST["id"]) or !isset($_REQUEST["resource"])) {
echo 'Not enough input parameters. resource and id must be given!
';
die();
}
//Read out information from mapbender database
switch ($resource) {
case "wms":
//get root layer information
$sql = "SELECT layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_pos = 0";
$v = array($id);
$t = array("i");
$res = db_prep_query($sql, $v, $t);
$row = db_fetch_array($res);
$layerId = $row["layer_id"];
$sql = "SELECT ";
$sql .= "layer.layer_id as contentid, layer.layer_title as contenttitle, layer.layer_abstract as contentabstract, layer.layer_pos as contentpos, layer.layer_parent as contentparent, ";
$sql .= "layer.layer_minscale as contentminscale, layer.layer_maxscale as contentmaxscale, layer.layer_queryable,";
$sql .= "wms.wms_title as servicetitle, wms.wms_abstract as serviceabstract, wms.wms_id as serviceid, wms.fees, wms.accessconstraints, wms.contactperson, wms.wms_getcapabilities,";
$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp as timestamp, wms_owner as owner, wms.wms_owsproxy as owsproxy, wms.fkey_mb_group_id,";
$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
$sql .= "wms.contactelectronicmailaddress, wms.country ";
$sql .= "FROM layer, wms WHERE layer.layer_id = $1 AND layer.fkey_wms_id = wms.wms_id LIMIT 1";
$v = array($layerId);
$t = array('i');
$serviceType = 'wms';
$resourceSymbol = " - ".$translation['wms'];
break;
case "layer":
$layerId = $id;
$sql = "SELECT ";
$sql .= "layer.layer_id as contentid, layer.layer_title as contenttitle, layer.layer_abstract as contentabstract, layer.layer_pos as contentpos, layer.layer_parent as contentparent,layer.layer_name as contentname, ";
$sql .= "layer.layer_minscale as contentminscale, layer.layer_maxscale as contentmaxscale, layer.layer_queryable,";
$sql .= "wms.wms_title as servicetitle, wms.wms_abstract as serviceabstract, wms.wms_id as serviceid, wms.fees, wms.accessconstraints, wms.contactperson, wms.wms_getcapabilities,";
$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp as timestamp, wms_owner as owner, wms.wms_owsproxy as owsproxy, wms.fkey_mb_group_id,";
$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
$sql .= "wms.contactelectronicmailaddress, wms.country ";
$sql .= "FROM layer, wms WHERE layer.layer_id = $1 AND layer.fkey_wms_id = wms.wms_id LIMIT 1";
$v = array($layerId);
$t = array('i');
$serviceType = 'wms';
$resourceSymbol = "
- ".$translation['layer'];
break;
case "wfs":
$wfsId = $id;
$sql = "SELECT ";
$sql .= "wfs.wfs_title as servicetitle, wfs.wfs_version as serviceversion, wfs.wfs_abstract as serviceabstract, wfs.wfs_id as serviceid, wfs.wfs_id as contentid,wfs.fees, wfs.accessconstraints, wfs.individualname as contactperson, wfs.wfs_getcapabilities,";
$sql .= "wfs.positionname as contactposition, wfs.providername as contactorganization, wfs.deliverypoint as address, wfs.city, wfs_timestamp as timestamp, wfs_owner as owner, wfs.wfs_owsproxy as owsproxy, wfs.fkey_mb_group_id,";
$sql .= "wfs.administrativearea as stateorprovince, wfs.postalcode as postcode, wfs.voice as contactvoicetelephone, wfs.facsimile as contactfacsimiletelephone, ";
$sql .= "wfs.electronicmailaddress as contactelectronicmailaddress, wfs.country ";
$sql .= "FROM wfs WHERE wfs_id = $1";
$v = array($wfsId);
$t = array('i');
$resourceSymbol = "
- ".$translation['wfs'];
$serviceType = 'wfs';
break;
case "featuretype":
$featuretypeId = $id;
$sql = "SELECT ";
$sql .= "wfs_featuretype.featuretype_id as contentid, wfs_featuretype.featuretype_title as contenttitle, wfs_featuretype.featuretype_abstract as contentabstract, wfs_featuretype.featuretype_name as contentname,wfs_featuretype.featuretype_srs, ";
$sql .= "wfs.wfs_title as servicetitle, wfs.wfs_version as serviceversion, wfs.wfs_abstract as serviceabstract, wfs.wfs_id as serviceid, wfs.fees, wfs.accessconstraints, wfs.individualname as contactperson, wfs.wfs_getcapabilities, wfs.wfs_describefeaturetype, ";
$sql .= "wfs.positionname as contactposition, wfs.providername as contactorganization, wfs.deliverypoint as address, wfs.city, wfs_timestamp as timestamp, wfs_owner as owner, wfs.wfs_owsproxy as owsproxy, wfs.fkey_mb_group_id,";
$sql .= "wfs.administrativearea as stateorprovince, wfs.postalcode as postcode, wfs.voice as contactvoicetelephone, wfs.facsimile as contactfacsimiletelephone, ";
$sql .= "wfs.electronicmailaddress as contactelectronicmailaddress, wfs.country ";
$sql .= "FROM wfs_featuretype, wfs WHERE wfs_featuretype.featuretype_id = $1 AND wfs_featuretype.fkey_wfs_id = wfs.wfs_id LIMIT 1";
$v = array($featuretypeId);
$t = array('i');
$serviceType = 'wfs';
$resourceSymbol = "
- ".$translation['featuretype'];
$serviceType = 'wfs';
break;
case "wfs-conf":
echo 'Not yet implemented!';
$serviceType = 'wfs';
die();
break;
case "wmc":
$wmcId = $id;
$sql = "SELECT ";
$sql .= "mb_user_wmc.wmc_serial_id as contentid, mb_user_wmc.wmc_title as contenttitle, mb_user_wmc.abstract as contentabstract, mb_user_wmc.minx as contentminx,mb_user_wmc.miny as contentminy,mb_user_wmc.maxx as contentmaxx,mb_user_wmc.maxy as contentmaxy,mb_user_wmc.srs as contentcrs, ";
$sql .= "mb_user.mb_user_position_name as contactposition, mb_user.mb_user_organisation_name as contactorganization, (mb_user.mb_user_street || ' ' || mb_user.mb_user_housenumber) as address, mb_user.mb_user_city as city, mb_user_wmc.wmc_timestamp as timestamp, mb_user_wmc.fkey_user_id as owner,";
$sql .= "mb_user.mb_user_country as stateorprovince, mb_user.mb_user_postal_code as postcode, mb_user.mb_user_phone as contactvoicetelephone, mb_user.mb_user_phone1 as contactfacsimiletelephone, ";
$sql .= "mb_user.mb_user_email as contactelectronicmailaddress ";
$sql .= "FROM mb_user_wmc, mb_user WHERE mb_user_wmc.wmc_serial_id = $1 AND mb_user_wmc.fkey_user_id = mb_user.mb_user_id LIMIT 1";
$v = array($wmcId);
$t = array('i');
$serviceType = 'wmc';
$resourceSymbol = "
- ".$translation['wmc'];
break;
}
//read resource information from database
//$e = new mb_exception("mod_showMetadata: sql: ".$sql);
$res = db_prep_query($sql,$v,$t);
$resourceMetadata = db_fetch_array($res);
if (!isset($resourceMetadata['contentid']) or ($resourceMetadata['contentid'] == '')) {
echo 'No result for the requested id found in the registry!';
die();
}
if($resourceMetadata['owsproxy']!='') {
$resourceSecured = true;
}
else {
$resourceSecured = false;
}
$serviceId = $resourceMetadata['serviceid'];
/*switch ($serviceType) {
case "wms":
#$resourceSymbol = "
";
die();
break;
case "wfs":
#$resourceSymbol = "
";
die();
break;
case "wmc":
$resourceSymbol = "
";
die();
break;
case "kml":
die();
break;
case "georss":
die();
break;
}
*/
//$e = new mb_exception("mod_showMetadata: fkey_mb_group_id from wms or wfs table: ".$resourceMetadata['fkey_mb_group_id']);
if (!isset($resourceMetadata['fkey_mb_group_id']) or isnull($resourceMetadata['fkey_mb_group_id'])){
$e = new mb_notice("mod_showMetadata: fkey_mb_group_id not found!");
//Get information about owning user of the relation mb_user_mb_group - alternatively the defined fkey_mb_group_id from the service must be used!
$sqlDep = "SELECT mb_group_name as metadatapointofcontactorgname, mb_group_title as metadatapointofcontactorgtitle, mb_group_id, mb_group_logo_path as metadatapointofcontactorglogo, mb_group_address as metadatapointofcontactorgaddress, mb_group_email as metadatapointofcontactorgemail, mb_group_postcode as metadatapointofcontactorgpostcode, mb_group_city as metadatapointofcontactorgcity, mb_group_voicetelephone as metadatapointofcontactorgtelephone, mb_group_facsimiletelephone as metadatapointofcontactorgfax FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1 AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND c.mb_user_mb_group_type=1 LIMIT 1";
$vDep = array($resourceMetadata['owner']);
$tDep = array('i');
$resDep = db_prep_query($sqlDep, $vDep, $tDep);
$metadataContactGroup = db_fetch_array($resDep);
$e = new mb_notice("mod_showMetadata: mb_group_id: ".$metadataContactGroup['mb_group_id']);
$e = new mb_notice("mod_showMetadata: mb_group_logo_path: ".$metadataContactGroup['metadatapointofcontactorglogo']);
} else {
$e = new mb_notice("mod_showMetadata: fkey_mb_group_id found!");
$sqlDep = "SELECT mb_group_name as metadatapointofcontactorgname, mb_group_title as metadatapointofcontactorgtitle, mb_group_id, mb_group_logo_path as metadatapointofcontactorglogo, mb_group_address as metadatapointofcontactorgaddress, mb_group_email as metadatapointofcontactorgemail, mb_group_postcode as metadatapointofcontactorgpostcode, mb_group_city as metadatapointofcontactorgcity, mb_group_voicetelephone as metadatapointofcontactorgtelephone, mb_group_facsimiletelephone as metadatapointofcontactorgfax FROM mb_group WHERE mb_group_id = $1 LIMIT 1";
$vDep = array($resourceMetadata['fkey_mb_group_id']);
$tDep = array('i');
$resDep = db_prep_query($sqlDep, $vDep, $tDep);
$metadataContactGroup = db_fetch_array($resDep);
}
//Get Geometry Type if featuretype info was requested
if ($resource == 'featuretype') {
$getTypeSql = "SELECT element_id, element_type from wfs_element WHERE fkey_featuretype_id = $1 AND element_type LIKE '%PropertyType';";
$vgetType = array($resourceMetadata['contentid']);
$tgetType = array('i');
$resGetType = db_prep_query($getTypeSql,$vgetType,$tgetType);
$featuretypeElements = db_fetch_array($resGetType);
$resourceMetadata['featuretype_geomType'] = $featuretypeElements['element_type'];
}
$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'] = "
";
}
if ($rowP['layer_legend_preview_filename'] != "") {
$resourceMetadata['legend'] .= "
";
}
/* if ($rowP['layer_extent_preview_filename'] != "") {
$resourceMetadata['extent'] .= "
";
}*/
}
if ($resource == 'wmc') {
$resourceMetadata['preview'] = "
";
}
//db select for service quality
if ($resource == 'wms' or $resource == 'layer') {
$sql = "SELECT availability, last_status FROM mb_wms_availability WHERE fkey_wms_id = $1";
$v = array($serviceId);
$t = array('i');
$res = db_prep_query($sql, $v, $t);
$serviceQuality = db_fetch_array($res);
}
//db select for content properties
if ($resource == 'wms' or $resource == 'layer') {
//get bbox and crs codes for single layer - maybe some entries ;-)
$sql = "SELECT * FROM layer_epsg WHERE fkey_layer_id = $1";
$contentBboxes = array();
$v = array($layerId);
$t = array('i');
$res = db_prep_query($sql, $v, $t);
$j = 0;
while ($row = db_fetch_array($res)){
$contentBboxes[$j] = array();
$contentBboxes[$j]['epsg'] = $row['epsg'];
$contentBboxes[$j]['minx'] = $row['minx'];
$contentBboxes[$j]['miny'] = $row['miny'];
$contentBboxes[$j]['maxx'] = $row['maxx'];
$contentBboxes[$j]['maxy'] = $row['maxy'];
$j++;
}
$j = 0;
}
if ($resource == 'wmc') {
$contentBboxes[$j]['epsg'] = $resourceMetadata['srs'];
$contentBboxes[$j]['minx'] = $resourceMetadata['minx'];
$contentBboxes[$j]['miny'] = $resourceMetadata['miny'];
$contentBboxes[$j]['maxx'] = $resourceMetadata['maxx'];
$contentBboxes[$j]['maxy'] = $resourceMetadata['maxy'];
}
//generate HTML frame
//Give out page
//Array with structure of metadata
//e.g. tabs and their content
$html = '';
$html .= '
\n\t\t\t"; $t_b = "\n\t\t | \n\t\t\n\t\t\t"; $t_c = "\n\t\t | \n\t
---|
';
$html .= $tableBegin;
if ($resourceMetadata['contenttitle'] !='') {
$html .= $t_a.$translation['resourceTitle'].$t_b."".displayText($resourceMetadata['contenttitle'])."".$t_c;
} else {
$html .= $t_a.$translation['resourceTitle'].$t_b."".displayText($resourceMetadata['servicetitle'])."".$t_c;
}
//decide if a root layer have been found - then the type will be a server
#$html .= "
".$resourceMetadata['contentpos']."
";
#$html .= "
".$resource."
";
if ($resource == 'layer' & $resourceMetadata['contentpos'] == 0) {
$resourceSymbol = " - ".$translation['wms'];
}
$html .= $t_a.$translation['kindOfResource'].$t_b.$resourceSymbol.$t_c;
//identification information:
$html .= $t_a.$translation['contentId'].$t_b.$resourceMetadata['contentid'].$t_c;
if (isset($resourceMetadata['contentname']) && ($resourceMetadata['contentname'] != '')) {
$html .= $t_a.$translation['contentName'].$t_b.$resourceMetadata['contentname'].$t_c;
}
if ($resource != 'wmc') {
$html .= $t_a.$translation['serviceId'].$t_b."".$serviceId."".$t_c;
}
if (($resource == 'wms' or $resource == 'layer' or $resource == 'wmc' ) and isset($resourceMetadata['preview'])) {
$html .= $t_a.$translation['preview'].$t_b.$resourceMetadata['preview'];
if (isset($resourceMetadata['legend'])) {
$html .= $resourceMetadata['legend'];
}
$html .= $t_c;
}
if ($metadataContactGroup['metadatapointofcontactorglogo'] != '') {
$html .= $t_a.$translation['contactOrganization'].$t_b."
";
}
$html .= displayText($metadataContactGroup['metadatacontactorganization']).$t_c;
if ($resourceMetadata['contentabstract'] != '') {
$html .= $t_a.$translation['resourceAbstract'].$t_b.displayText($resourceMetadata['contentabstract']).$t_c;
} else {
$html .= $t_a.$translation['resourceAbstract'].$t_b.displayText($resourceMetadata['serviceabstract']).$t_c;
}
$user = new User();
//
// Monitoring is only available if the user is allowed to access this service
//
if ($resource == 'wms' or $resource == 'layer'){
if ($user->isLayerAccessible($layerId)) {
$is_public = $user->isPublic();
//show abo function to registred and authorized users
if (!$is_public) {
if ($subscribe == 1) {
$user->addSubscription($resourceMetadata['serviceid']);
}
else if ($subscribe == 0) {
$user->cancelSubscription($resourceMetadata['serviceid']);
}
$is_subscribed = $user->hasSubscription($resourceMetadata['serviceid']);
if ($is_subscribed) {
$aboStr = "
';
$html .= $tableBegin;
if ($resource == 'wms' or $resource == 'layer'){
if ($resourceMetadata['layer_queryable'] == '1') {
$html .= $t_a.$translation['queryable'].$t_b."".$t_c;
} else {
$html .= $t_a.$translation['queryable'].$t_b."
".$t_c;
}
}
$epsgString = '';
if (($resource == 'wms') || ($resource == 'layer')) {
for ($j = 0; $j < count($contentBboxes); $j++) {
$epsgString .= $contentBboxes[$j]['epsg']." ";
if ($contentBboxes[$j]['epsg'] == 'EPSG:4326') {
$wgs84Bbox = $contentBboxes[$j]['minx'].",".$contentBboxes[$j]['miny'].",".$contentBboxes[$j]['maxx'].",".$contentBboxes[$j]['maxy'];
$getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
}
}
$html .= $t_a.$translation['crs'].$t_b.$epsgString.$t_c;
}
if (($resource == 'featuretype') ) {
$epsgString .= $resourceMetadata['featuretype_srs'];
$html .= $t_a.$translation['crs'].$t_b.$epsgString.$t_c;
}
if ($resource == 'wmc') {
$epsgString .= $resourceMetadata['contentcrs']." ";
if ($resourceMetadata['contentcrs'] == 'EPSG:4326') {
$wgs84Bbox = $resourceMetadata['contentminx'].",".$resourceMetadata['contentminy'].",".$resourceMetadata['contentmaxx'].",".$resourceMetadata['contentmaxy'];
$getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
} elseif ($resourceMetadata['contentcrs'] != ''){
//transform crs
$oldEPSG = preg_replace("/EPSG:/","", $resourceMetadata['contentcrs']);
$ll = transform(
floatval($resourceMetadata['contentminx']),
floatval($resourceMetadata['contentminy']),
$oldEPSG,
"4326"
);
$ur = transform(
floatval($resourceMetadata['contentmaxx']),
floatval($resourceMetadata['contentmaxy']),
$oldEPSG,
"4326"
);
$wgs84Bbox = round($ll["x"],4).",".round($ll["y"],4).",".round($ur["x"],4).",".round($ur["y"],4);
$getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
}
$html .= $t_a.$translation['wmccrs'].$t_b.$epsgString.$t_c;
}
if (isset($wgs84Bbox)) {
$html .= $t_a.$translation['wgs84Bbox'].$t_b.$wgs84Bbox.$t_c;
if (defined('EXTENTSERVICEURL')) {
$html .= $t_a.$translation['wgs84BboxGraphic'].$t_b."
".$t_c;
} else {
$html .= $t_a.$translation['wgs84BboxGraphic'].$t_b.$translation['graphicUnavailable'].$t_c;
}
//show preview map - dynamically
}
$html .= $tableEnd;
$html .= $tableBegin;
//Scales
if ((isset($resourceMetadata['contentminscale']) & $resourceMetadata['contentminscale'] != '0') or (isset($resourceMetadata['contentmaxscale']) & $resourceMetadata['contentmaxscale'] != '0')){
$html .= '
'; $html .= '
'; if ($resource == 'wms' or $resource == 'layer') { $touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../mod_getServiceDisclaimer.php?resource=wms&id=".$resourceMetadata['serviceid']."&languageCode=".$languageCode."&asTable=true"); $tou = $touServiceConnector->file; } if ($resource == 'wmc' ) { $e = new mb_notice("mod_showMetadata: wmcid for disclaimer: ".$resourceMetadata['contentid']); $touWmcConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../mod_getWmcDisclaimer.php?&id=".$resourceMetadata['contentid']."&languageCode=".$languageCode."&hostName=".$hostName); $tou = $touWmcConnector->file; } if ($tou == ''){ $html .= $translation['noTouInformation']; } else { $html .= $tou; } $html .= '
'; $html .= '';
$html .= $tableBegin;
if ($resource != 'wmc') {
switch ($serviceQuality['last_status']) {
case '1':
$html .= $t_a.$translation['status'].$t_b."".$t_c;
break;
case '0':
$html .= $t_a.$translation['status'].$t_b."
".$t_c;
break;
case '-1':
$html .= $t_a.$translation['status'].$t_b."
".$t_c;
break;
}
if (isset($serviceQuality['availability'])) {
$html .= $t_a.$translation['availability'].$t_b.$serviceQuality['availability']." %".$t_c;
} else {
$html .= $t_a.$translation['availability'].$t_b.$translation['notMonitored'].$t_c;
}
} else { //resource is wmc
$html .= $translation['wmcQualityText'];
}
$html .= $tableEnd;
$html .= '
';
/*$translation['mapbenderCapabilities'] = 'Geoportal Capabilities';
$translation['originalCapabilities'] = 'Original Capabilities';
$translation['kml'] = 'KML';
$translation['inspireMetadata'] = 'INSPIRE Service Metadaten';
$translation['securedCapabilities'] = 'Secured Capabilities URL';*/
$html .= $tableBegin;
if ($resource == 'wmc') {
$html .= $t_a.$translation['wmc'].$t_b."XML".$t_c;
}
if ($resource == 'wfs') {
}
if ($resource == 'wms' or $resource == 'layer'){
$html .= $t_a.$translation['mapbenderCapabilities'].$t_b."".$translation['capabilities']."".$t_c;
$html .= $t_a.$translation['originalCapabilities'].$t_b."".$translation['capabilities']."".$t_c;
$html .= $t_a.$translation['inspireMetadata'].$t_b."".$t_c;
$html .= $t_a.$translation['inspireMetadataValidation'].$t_b."".$translation['showInspireMetadataValidation']."".$t_c;
//if service is secured and http_auth is adjusted show secured url
if ($resourceSecured) {
$securedLink = HTTP_AUTH_PROXY."/".$layerId."?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS";
$html .= $t_a.$translation['securedCapabilities'].$t_b."".$translation['capabilities']."".$t_c;
}
//kml
$html .= $t_a.$translation['kml'].$t_b."
".$t_c;
}
$html .= $tableEnd;
$html .= '