[Mapbender-commits] r8553 - in trunk/mapbender/http: geoportal img/gnome php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jan 28 12:09:28 PST 2013
Author: armin11
Date: 2013-01-28 12:09:28 -0800 (Mon, 28 Jan 2013)
New Revision: 8553
Added:
trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php
trunk/mapbender/http/geoportal/urlencode.js
trunk/mapbender/http/img/gnome/scheduler.png
trunk/mapbender/http/img/gnome/stock_zoom-in.png
trunk/mapbender/http/img/gnome/stock_zoom-out.png
Modified:
trunk/mapbender/http/php/mod_getDownloadOptions.php
Log:
New module to show the inspire monitoring list. The list is selected from the mapbender registry and showed via jquery datatables. Someone can filter for categories, organizations and more features. The list is generated by following the relations of the service - data - metadata coupling of ows.
Added: trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php (rev 0)
+++ trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php 2013-01-28 20:09:28 UTC (rev 8553)
@@ -0,0 +1,231 @@
+<?php
+//Server-side script to pull INSPIRE monitoring information out of the mapbender database
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+$inspireCatId = 11;
+$outputFormat = 'json';
+$lang = 'de';
+//check http get parameters
+if (isset($_REQUEST["outputFormat"]) & $_REQUEST["outputFormat"] != "") {
+ $testMatch = $_REQUEST["outputFormat"];
+ if (!($testMatch == 'json' or $testMatch == 'table')){
+ echo 'outputFormat: <b>'.$testMatch.'</b> is not valid.<br/>';
+ die();
+ }
+ $outputFormat = $testMatch;
+ $testMatch = NULL;
+}
+if (isset($_REQUEST["language"]) & $_REQUEST["language"] != "") {
+ $testMatch = $_REQUEST["language"];
+ if (!($testMatch == 'de' or $testMatch == 'en' or $testMatch == 'fr')){
+ echo 'language: <b>'.$testMatch.'</b> is not valid.<br/>';
+ die();
+ }
+ $lang = $testMatch;
+ $testMatch = NULL;
+}
+//get inspire category information from db
+$sql = <<<SQL
+ select inspire_category_id, inspire_category_key, inspire_category_code_$lang from inspire_category
+SQL;
+$result = db_query($sql);
+$inspireCategories = array();
+while ($row = db_fetch_array($result)) {
+ $inspireCategories['key'][$row['inspire_category_id']] = $row['inspire_category_key'];
+ $inspireCategories['title'][$row['inspire_category_id']] = $row['inspire_category_code_'.$lang];
+}
+//Define sql to select relevant information out of the registry.
+//The direction is from the classified service layer/featuretype information to the coupled metadata.
+//The classifications of the layers are used to decide if the resource is in the outgoing table.
+ $sql = <<<SQL
+
+select metadata_layer.title, metadata_layer.uuid, resource_id, resource_type, service_id, inspire_download, wms_owner as service_owner, fkey_mb_group_id as service_group, wms_title as service_title, f_collect_inspire_cat_layer(resource_id) as inspire_cat from (select title,uuid, layer_id as resource_id, 'layer' as resource_type, fkey_wms_id as service_id, inspire_download from (select layer.layer_id, layer.fkey_wms_id, layer.inspire_download, layer_custom_category.fkey_custom_category_id from layer inner join layer_custom_category on layer.layer_id = layer_custom_category.fkey_layer_id where layer_custom_category.fkey_custom_category_id = $inspireCatId AND layer_searchable = 1 ORDER BY layer_id) as layer_inspire inner join (select metadata_id, uuid, title, fkey_layer_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_layer_id = layer_inspire.layer_id) as meta
data_layer INNER JOIN wms ON metadata_layer.service_id = wms_id
+
+union
+
+select metadata_featuretype.title, metadata_featuretype.uuid, resource_id, resource_type, service_id, inspire_download, wfs_owner as service_owner, fkey_mb_group_id as service_group, wfs_title as service_title, f_collect_inspire_cat_wfs_featuretype(resource_id) as inspire_cat from (select title, uuid, featuretype_id as resource_id, 'wfs_featuretype' as resource_type, fkey_wfs_id as service_id, inspire_download from (select wfs_featuretype.featuretype_id ,wfs_featuretype.fkey_wfs_id, wfs_featuretype.inspire_download from wfs_featuretype) as featuretype_inspire inner join (select metadata_id, uuid, title, fkey_featuretype_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_featuretype_id = featuretype_inspire.featuretype_id) as metadata_featuretype INNER JOIN wfs ON metadata_featuretype.service_id = wfs_id
+ order by uuid
+
+SQL;
+
+$startTime = microtime();
+//get all service / owner / fkey_group information for the list of services
+$result = db_query($sql);
+//initialize result array
+$sqlTable = array();
+while ($row = db_fetch_array($result)) {
+ $sqlTable['uuid'][] = $row['uuid'];
+ $sqlTable['title'][] = $row['title'];
+ $sqlTable['service_id'][] = $row['service_id'];
+ $sqlTable['resource_type'][] = $row['resource_type'];
+ $sqlTable['resource_id'][] = $row['resource_id'];
+ $sqlTable['service_group'][] = $row['service_group'];
+ $sqlTable['service_owner'][] = $row['service_owner'];
+ $sqlTable['inspire_cat'][] = replaceCategories($row['inspire_cat'], $inspireCategories);
+ $sqlTable['inspire_download'][] = $row['inspire_download'];
+}
+$groupOwnerArray = array();
+$groupOwnerArray[0] = $sqlTable['service_group'];
+$groupOwnerArray[1] = $sqlTable['service_owner'];
+//get orga information
+$groupOwnerArray = getOrganizationInfoForServices($groupOwnerArray);
+//exchange category ids with titles and keys
+//2 - user_id
+//3 - metadatapointofcontactorgname
+//multisort?
+//push information from groupOwnerArray to sqlTable
+$sqlTable['organization'] = $groupOwnerArray[3];
+$sqlTable['userId'] = $groupOwnerArray[2];
+//TODO: check sorting
+//$wfsMatrix = $this->flipDiagonally($wfsMatrix); //- see class_metadata_new.php
+array_multisort($sqlTable['uuid'], SORT_STRING);
+//array_multisort($sqlTable['uuid'], SORT_STRING, $sqlTable['resource_type'], SORT_STRING);
+//debug output option:
+if ($outputFormat == 'table') {
+ for ($i=0; $i < count($sqlTable['uuid']); $i++){
+ echo $sqlTable['uuid'][$i]." - ".$sqlTable['title'][$i]." - ".$sqlTable['resource_type'][$i]." - ".$sqlTable['resource_id'][$i]." - ".$groupOwnerArray[3][$i]." - ".$sqlTable['inspire_cat'][$i]." - ".$sqlTable['organization'][$i]."<br>";
+ }
+} else {
+ //normal output as json
+ $metadataIndex = -1;
+ $currentUuid = "";
+ $output = array(
+ "aaData" => array()
+ );
+ for ($i=0; $i < count($sqlTable['uuid']); $i++){
+ if ($sqlTable['uuid'][$i] != $currentUuid) {
+ //new metadataset identified - initialize it
+ $currentUuid = $sqlTable['uuid'][$i];
+ $metadataIndex++;
+ $output['aaData'][$metadataIndex]->detailImage = "<img id=\"expander\" src=\"../img/gnome/stock_zoom-in.png\">";
+ $output['aaData'][$metadataIndex]->title = $sqlTable['title'][$i];
+ $output['aaData'][$metadataIndex]->uuid = $sqlTable['uuid'][$i];
+ $output['aaData'][$metadataIndex]->organization = $groupOwnerArray[3][$i];
+ $output['aaData'][$metadataIndex]->inspireCategories = $sqlTable['inspire_cat'][$i];
+ $output['aaData'][$metadataIndex]->numberViewServices = 0;
+ $output['aaData'][$metadataIndex]->numberDownloadServices = 0;
+ }
+ if ($metadataIndex > -1) { //prohibit indexes which are not real - otherwise the json array will become an object
+ if ($sqlTable['resource_type'][$i] == "layer") {
+ //addview service element
+ $output['aaData'][$metadataIndex]->viewServices[]->id = $sqlTable['resource_id'][$i];
+ //increment amount of view services
+ $output['aaData'][$metadataIndex]->numberViewServices++;
+ if ($sqlTable['inspire_download'][$i] == 1) {
+ //add further inspire_download service element for this layer
+ //increment amount of view services
+ $output['aaData'][$metadataIndex]->numberDownloadServices++;
+ }
+ }
+ if ($sqlTable['resource_type'][$i] == "wfs_featuretype" && $sqlTable['inspire_download'][$i] == "1") {
+ //add download service element
+ $output['aaData'][$metadataIndex]->numberDownloadServices++;
+ //$output['aaData'][$metadataIndex]->downloadServices[]->id = $sqlTable['resource_id'][$i];
+ }
+ }
+ }
+ header('Content-Type: application/json; charset='.CHARSET);
+ echo json_encode($output, JSON_NUMERIC_CHECK);
+ //$endTime = microtime();
+ //$diffTime = $endTime - $startTime;
+ //echo "<br>".$diffTime."<br>";
+ //echo "Ready!";
+}
+function getOrganizationInfoForServices($groupOwnerArray) {
+ //split array into two lists which are requested in two separate sqls
+ $listGroupIds = array();
+ $listOwnerIds = array();
+ //echo "<br>count groupOwnerArray: ".count($groupOwnerArray[0]);
+ for ($i=0; $i < count($groupOwnerArray[0]); $i++){
+ $key = $i;
+ if (!isset($groupOwnerArray[0][$i]) || is_null($groupOwnerArray[0][$i]) || $groupOwnerArray[0][$i] == 0){
+ $listOwnerIds[$key] = $groupOwnerArray[1][$i];
+ } else {
+ $listGroupIds[$key] = $groupOwnerArray[0][$i];
+ }
+ }
+ //for ownerList
+ $metadataContactArray = array();
+ $metadataContact = array();
+ $listGroupIdsKeys = array_keys($listGroupIds);
+ $listOwnerIdsKeys = array_keys($listOwnerIds);
+ $listOwnerIdsString = implode(",",$listOwnerIds);
+ $listGroupIdsString = implode(",",$listGroupIds);
+ //do the database requests
+ if ($listOwnerIdsString != "") {
+ $sql = "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 , b.mb_user_id as mb_user_id FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id IN (".$listOwnerIdsString.") 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=2";
+ $resultOrgaOwner = db_query($sql);
+ $index = 0;
+ while ($row = db_fetch_array($resultOrgaOwner)) {
+ //push information into metadataContactArray
+ $metadataContactOwnerArray[$index]['metadatapointofcontactorgname'] = $row['metadatapointofcontactorgname'];
+ $metadataContactOwnerArray[$index]['mb_user_id'] = $row['mb_user_id'];
+ $index++;
+ }
+ $index = 0;
+ //push information directly into $groupOwnerArray at indizes from
+ for ($i=0; $i < count($listOwnerIds); $i++){
+ //find index of user with special id in array $metadataContactOwnerArray['user_id']
+ $index = findIndexInMultiDimArray($metadataContactOwnerArray, $listOwnerIds[$i], 'mb_user_id');
+ $groupOwnerArray[2][$listOwnerIdsKeys[$i]] = $metadataContactOwnerArray[$index]['user_id']; //user_id - 2
+ $groupOwnerArray[3][$listOwnerIdsKeys[$i]] = $metadataContactOwnerArray[$index]['metadatapointofcontactorgname']; //orga_name - 3
+ }
+ }
+ //for groupList
+ if ($listGroupIdsString != "") {
+ $sql = "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, mb_group_id FROM mb_group WHERE mb_group_id IN (".$listGroupIdsString.")";
+ $resultOrgaGroup = db_query($sql);
+ $index = 0;
+ while ($row = db_fetch_array($resultOrgaGroup)) {
+ //push information into metadataContactArray
+ $metadataContactGroupArray[$index]['metadatapointofcontactorgname'] = $row['metadatapointofcontactorgname'];
+ $metadataContactGroupArray[$index]['mb_user_id'] = $row['mb_user_id'];
+ $index++;
+ }
+ $index = 0;
+ //push information directly into $groupOwnerArray at indizes from
+ for ($i=0; $i < count($listGroupIds); $i++){
+ //find index of user with special id in array $metadataContactGroupArray['user_id']
+ $index = findIndexInMultiDimArray($metadataContactGroupArray, $listGroupIds[$i], 'mb_user_id');
+ $groupOwnerArray[2][$listGroupIdsKeys[$i]] = $metadataContactGroupArray[$index]['mb_user_id']; //user_id - 2
+ $groupOwnerArray[3][$listGroupIdsKeys[$i]] = $metadataContactGroupArray[$index]['metadatapointofcontactorgname']; //orga_name - 3
+ }
+ }
+ return $groupOwnerArray;
+}
+
+function replaceCategories($idString, $inspireCategories){
+ $idString = str_replace('}{',',',$idString);
+ $idString = str_replace('{','',str_replace('}','',$idString));
+ $idArray = explode(',',$idString);
+ $catStringNew = "";
+ for ($i=0; $i < count($idArray); $i++){
+ if (isset($inspireCategories['title'][$idArray[$i]]) && $inspireCategories['title'][$idArray[$i]] != '') {
+ $catStringNew .= $inspireCategories['title'][$idArray[$i]]." (".$inspireCategories['key'][$idArray[$i]]."),";
+ }
+ }
+ $catStringNew = rtrim($catStringNew,',');
+ return $catStringNew;
+}
+
+function findIndexInMultiDimArray($multiDimArray, $needle, $columnName) {
+ foreach($multiDimArray as $index => $object) {
+ if($object[$columnName] == $needle) return $index;
+ }
+ return FALSE;
+}
+?>
Added: trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php (rev 0)
+++ trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php 2013-01-28 20:09:28 UTC (rev 8553)
@@ -0,0 +1,248 @@
+<?php
+require_once dirname(__FILE__) . "/../../core/globalSettings.php";
+$sessionLang = Mapbender::session()->get("mb_lang");
+if (isset($sessionLang) && ($sessionLang!='')) {
+ $e = new mb_notice("mod_showMetadata.php: language found in session: ".$sessionLang);
+ $language = $sessionLang;
+ $langCode = explode("_", $language);
+ $langCode = $langCode[0];
+ $languageCode = $langCode;
+}
+//Array with translations:
+switch ($languageCode) {
+ case "de":
+ $translation['Detail'] = 'Detail';
+ $translation['Title'] = 'Titel';
+ $translation['Identifier'] = 'Identifikator';
+ $translation['Organization'] = 'Organisation';
+ $translation['INSPIRE Themes'] = 'INSPIRE Themen';
+ $translation['# of View Services'] = 'Zahl der Darstellungsdienste';
+ $translation['# of Download Services'] = 'Zahl der Downloaddienste';
+ $translation['wmslayergetmap'] = 'Download über WMS Aufrufe';
+ $translation['wmslayerdataurl'] = 'Download über direkten Link';
+ $translation['wfsrequest'] = 'Download über WFS 1.1.0';
+ $translation['inspireViewServices'] = 'INSPIRE Darstellungsdienste';
+ $translation['inspireDownloadServices'] = 'INSPIRE Downloaddienste';
+ break;
+ case "en":
+ $translation['Detail'] = 'Detail';
+ $translation['Title'] = 'Title';
+ $translation['Identifier'] = 'Identifier';
+ $translation['Organization'] = 'Organization';
+ $translation['INSPIRE Themes'] = 'INSPIRE Themen';
+ $translation['# of View Services'] = '# of View Services';
+ $translation['# of Download Services'] = '# of Download Services';
+ $translation['wmslayergetmap'] = 'Download über WMS Aufrufe';
+ $translation['wmslayerdataurl'] = 'Download über direkten Link';
+ $translation['wfsrequest'] = 'Download über WFS 1.1.0';
+ $translation['inspireViewServices'] = 'INSPIRE Darstellungsdienste';
+ $translation['inspireDownloadServices'] = 'INSPIRE Downloaddienste';
+ break;
+ case "fr":
+ $translation['Detail'] = 'Detail';
+ $translation['Title'] = 'Title';
+ $translation['Identifier'] = 'Identifier';
+ $translation['Organization'] = 'Organization';
+ $translation['INSPIRE Themes'] = 'INSPIRE Themen';
+ $translation['# of View Services'] = '# of View Services';
+ $translation['# of Download Services'] = '# of Download Services';
+ $translation['wmslayergetmap'] = 'Download über WMS Aufrufe';
+ $translation['wmslayerdataurl'] = 'Download über direkten Link';
+ $translation['wfsrequest'] = 'Download über WFS 1.1.0';
+ $translation['inspireViewServices'] = 'INSPIRE Darstellungsdienste';
+ $translation['inspireDownloadServices'] = 'INSPIRE Downloaddienste';
+ break;
+ default: #to english
+ $translation['Detail'] = 'Detail';
+ $translation['Title'] = 'Title';
+ $translation['Identifier'] = 'Identifier';
+ $translation['Organization'] = 'Organization';
+ $translation['INSPIRE Themes'] = 'INSPIRE Themes';
+ $translation['# of View Services'] = '# of View Services';
+ $translation['# of Download Services'] = '# of Download Services';
+ $translation['wmslayergetmap'] = 'Download über WMS Aufrufe';
+ $translation['wmslayerdataurl'] = 'Download über direkten Link';
+ $translation['wfsrequest'] = 'Download über WFS 1.1.0';
+ $translation['inspireViewServices'] = 'INSPIRE Darstellungsdienste';
+ $translation['inspireDownloadServices'] = 'INSPIRE Downloaddienste';
+}
+//Do html output
+$html = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$languageCode.'">';
+$html .= '<body>';
+$metadataStr .= '<head>' .
+ '<title>'.$translation['header'].'</title>' .
+ '<meta name="description" content="'.$translation['header'].'" xml:lang="'.$languageCode.'" />'.
+ '<meta name="keywords" content="'.$translation['header'].'" xml:lang="'.$languageCode.'" />' .
+ '<meta http-equiv="cache-control" content="no-cache">'.
+ '<meta http-equiv="pragma" content="no-cache">'.
+ '<meta http-equiv="expires" content="0">'.
+ '<meta http-equiv="content-language" content="'.$languageCode.'" />'.
+ '<meta http-equiv="content-style-type" content="text/css" />'.
+ '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">' ;
+$html .= $metadataStr;
+//define the javascripts to include
+$html .= '<link type="text/css" href="../extensions/DataTables-1.9.4/media/css/jquery.dataTables.css" rel="Stylesheet" />';
+$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="urlencode.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>';
+$html .= '<script type="text/javascript" src="../extensions/DataTables-1.9.4/media/js/jquery.dataTables.min.js"></script>';
+//$html .= '<script type="text/javascript" src="http://www.datatables.net/download/build/jquery.dataTables.min.js"></script>';
+//TODO: some js for ui-dialog
+$html .= '<script type="text/javascript">';
+/* Formating function for row details */
+$html .= "function addViewServiceDetails(layerId,aData,i) {";
+$html .= "$.getJSON('../php/mod_callMetadata.php?resourceIds='+aData['viewServices'][i].id+'&resultTarget=web', null, function(data) {";
+//$html .= "var preview = '<br><img src=\"'+data.wms.srv[0].layer[0].previewURL+'\"/>';";
+$html .= "$('#layerentry'+layerId).append('<br>'+data.wms.srv[0].title+' - '+data.wms.srv[0].layer[0].title+'</b>');";
+$html .= "$('#layerentry'+layerId).append('<br><img src=\"'+data.wms.srv[0].layer[0].previewURL+'\"/>');";
+//show availability information
+$html .= "$('#layerentry'+layerId).append('<b>'+data.wms.srv[0].avail+'%</b>');";
+$html .= " });";
+$html .= "}";
+//function for open details of current row
+$html .= "function fnFormatDetails ( oTable, nTr ) {";
+$html .= "var aData = oTable.fnGetData( nTr );";
+$html .= "var itemsViewService = [];";
+$html .= "var itemsDownloadService = [];";
+$html .= "var sOut = '<table id=\"detailInformation\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\" style=\"padding-left:50px;\">';";
+//check if some view service is available
+$html .= "if (undefined != aData['viewServices']) {";
+$html .= "sOut += '<tr id=\"vs\"><td>".$translation['inspireViewServices']."</td><td></td></tr>';";
+$html .= "for (var i = 0; i < aData['viewServices'].length; i++){";
+$html .= "var listEntry = '';";
+$html .= "var layerId = aData['viewServices'][i].id;";
+$html .= "listEntry = '<li id=\"layerentry'+aData['viewServices'][i].id+'\" ><a href=\"../php/mod_showMetadata.php?languageCode=de&resource=layer&layout=tabs&id='+aData['viewServices'][i].id+'\" target=\"_blank\">'+aData['viewServices'][i].id+'</a>';";
+//add details thru ajax request
+$html .= "addViewServiceDetails(layerId,aData,i);";
+$html .= "listEntry += '</li>';";
+$html .= "itemsViewService.push(listEntry);";
+$html .= "}";
+$html .= "}";
+$html .= "if (aData['numberDownloadServices'] > 0) {";
+//get json data for download options from ajax request
+$html .= "sOut += '<tr id=\"dls\"><td>".$translation['inspireDownloadServices']."</td><td></td></tr>';";
+$html .= "$.getJSON('../php/mod_getDownloadOptions.php?id='+aData['uuid'], function(data) {";
+$html .= "var uuid = aData['uuid'];";
+//problem with uuid as name - exchange it
+$html .= "var dataString = JSON.stringify(data);";
+$html .= "dataString = dataString.replace(uuid, 'dummy');";
+$html .= "data = JSON.parse(dataString);";
+$html .= "$.each(data.dummy.option, function(index, value) {";
+$html .= "switch(value.type)";
+$html .= "{";
+$html .= "case 'wmslayergetmap':";
+$html .= "itemsDownloadService.push('<li>".$translation['wmslayergetmap']."</li>');";
+$html .= "itemsDownloadService.push('<a href=\"../plugins/mb_downloadFeedClient.php?url='+urlencode('http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id='+uuid+'&type=SERVICE&generateFrom=wmslayer&layerid='+value.resourceId)+'\" target=\"_blank\"><img src=\"../img/osgeo_graphics/geosilk/raster_download.png\" title=\"".$translation['Title']."\"/></a>');";
+$html .= "break;";
+$html .= "case 'wmslayerdataurl':";
+$html .= "itemsDownloadService.push('<li>".$translation['wmslayerdataurl']."</li>');";
+$html .= "itemsDownloadService.push('<a href=\"../plugins/mb_downloadFeedClient.php?url='+urlencode('http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id='+uuid+'&type=SERVICE&generateFrom=dataurl&layerid='+value.resourceId)+'\" target=\"_blank\"><img src=\"../img/osgeo_graphics/geosilk/link_download.png\" title=\"".$translation['Title']."\"/></a>');";
+$html .= "break;";
+$html .= "case 'wfsrequest':";
+$html .= "itemsDownloadService.push('<li>".$translation['wfsrequest']."</li>');";
+$html .= "itemsDownloadService.push('<a href=\"../plugins/mb_downloadFeedClient.php?url='+urlencode('http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id='+uuid+'&type=SERVICE&generateFrom=wfs&wfsid='+value.serviceId)+'\" target=\"_blank\"><img src=\"../img/osgeo_graphics/geosilk/vector_download.png\" title=\"".$translation['Title']."\"/></a>');";
+$html .= "break;";
+$html .= "default:";
+$html .= "}";
+$html .= "});";
+$html .= "$('<ul/>', {";
+$html .= "'class': 'my-new-list',";
+$html .= "html: itemsViewService.join('')";
+$html .= "}).appendTo($('#vs'));";
+$html .= "$('<ul/>', {";
+$html .= "'class': 'my-new-list',";
+$html .= "html: itemsDownloadService.join('')";
+$html .= "}).appendTo($('#dls'));";
+//$html .= "alert(JSON.stringify(data.dummy));";
+$html .= "});";
+$html .= "}";
+$html .= "sOut += '</table>';";
+$html .= "return sOut;";
+$html .= "}";
+$html .= "$(document).ready(function() {";
+$html .= " var oTable = $('#example').dataTable( {";
+//$html .= "\"aoColumnDefs\": [";
+//$html .= "{ \"bSortable\": false, \"aTargets\": [ 0 ] }";
+//$html .= "],";
+$html .= "\"bProcessing\": true,";
+$html .= "\"sAjaxDataProp\": \"aaData\",";
+$html .= "\"sAjaxSource\": \"mod_pullInspireMonitoring.php\",";
+$html .= "\"aoColumns\": [";
+//$html .= "\"<img src='../img/add.png'>\",";
+$html .= "{ \"mData\": \"detailImage\" },";
+$html .= "{ \"mData\": \"title\" },";
+$html .= "{ \"mData\": \"uuid\" },";
+$html .= "{ \"mData\": \"organization\" },";
+$html .= "{ \"mData\": \"inspireCategories\" },";
+$html .= "{ \"mData\": \"numberViewServices\" },";
+$html .= "{ \"mData\": \"numberDownloadServices\" }";
+$html .= "]";
+$html .= "});";
+//$html .= "} );";
+/* Add event listener for opening and closing details
+ * Note that the indicator for showing which row is open is not controlled by DataTables,
+ * rather it is done here
+*/
+$html .= "$('#expander').live('click', function () {";
+//close all open nodes
+$html .= "var nTr = $(this).parents('tr')[0];";
+$html .= "if ( oTable.fnIsOpen(nTr) )";
+$html .= "{";
+/* This row is already open - close it */
+$html .= "this.src = \"../img/gnome/stock_zoom-in.png\";";
+//$html .= "oTable.fnDestroy();";
+$html .= "oTable.fnClose( nTr );";
+//close all open nodes!
+/* Close any rows which are already open */
+$html .= "}";
+$html .= "else";
+$html .= "{";
+$html .= "$(\"td img\", oTable.fnGetNodes()).each(function () {";
+$html .= "if (this.src.match('stock_zoom-out.png')) {";
+$html .= "this.src = \"../img/gnome/stock_zoom-in.png\";";
+$html .= "oTable.fnClose(this.parentNode.parentNode);";
+$html .= "}";
+$html .= "});";
+/* Open this row */
+$html .= "this.src = \"../img/gnome/stock_zoom-out.png\";";
+$html .= "oTable.fnClose( nTr );";
+$html .= "oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );";
+$html .= "}";
+$html .= "});";
+$html .= "});";
+$html .= "</script>";
+$html .= "</head>";
+$html .= "<table id=\"example\">";
+$html .= " <thead>";
+$html .= " <tr>";
+$html .= " <th>".$translation['Detail']."</th>";
+$html .= " <th>".$translation['Title']."</th>";
+$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>";
+$html .= " </tr>";
+$html .= " </thead>";
+$html .= " <tbody>";
+/*$html .= " <tr>";
+$html .= " <td>Row 1 Data 1</td>";
+$html .= " <td>Row 1 Data 2</td>";
+$html .= " <td>etc</td>";
+$html .= " <td>etc</td>";
+$html .= " <td>etc</td>";
+$html .= " </tr>";
+$html .= " <tr>";
+$html .= " <td>Row 2 Data 1</td>";
+$html .= " <td>Row 2 Data 2</td>";
+$html .= " <td>etc</td>";
+$html .= " <td>etc</td>";
+$html .= " <td>etc</td>";
+$html .= " </tr>";*/
+$html .= " </tbody>";
+$html .= " </table>";
+//$html.="eof";
+$html .= "</body></html>";
+echo $html;
+?>
Added: trunk/mapbender/http/geoportal/urlencode.js
===================================================================
--- trunk/mapbender/http/geoportal/urlencode.js (rev 0)
+++ trunk/mapbender/http/geoportal/urlencode.js 2013-01-28 20:09:28 UTC (rev 8553)
@@ -0,0 +1,32 @@
+function urlencode (str) {
+ // http://kevin.vanzonneveld.net
+ // + original by: Philip Peterson
+ // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + input by: AJ
+ // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + improved by: Brett Zamir (http://brett-zamir.me)
+ // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + input by: travc
+ // + input by: Brett Zamir (http://brett-zamir.me)
+ // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + improved by: Lars Fischer
+ // + input by: Ratheous
+ // + reimplemented by: Brett Zamir (http://brett-zamir.me)
+ // + bugfixed by: Joris
+ // + reimplemented by: Brett Zamir (http://brett-zamir.me)
+ // % note 1: This reflects PHP 5.3/6.0+ behavior
+ // % note 2: Please be aware that this function expects to encode into UTF-8 encoded strings, as found on
+ // % note 2: pages served as UTF-8
+ // * example 1: urlencode('Kevin van Zonneveld!');
+ // * returns 1: 'Kevin+van+Zonneveld%21'
+ // * example 2: urlencode('http://kevin.vanzonneveld.net/');
+ // * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'
+ // * example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
+ // * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'
+ str = (str + '').toString();
+
+ // Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current
+ // PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following.
+ return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
+ replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
+}
\ No newline at end of file
Added: trunk/mapbender/http/img/gnome/scheduler.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/gnome/scheduler.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/mapbender/http/img/gnome/stock_zoom-in.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/gnome/stock_zoom-in.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/mapbender/http/img/gnome/stock_zoom-out.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/gnome/stock_zoom-out.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/mapbender/http/php/mod_getDownloadOptions.php
===================================================================
--- trunk/mapbender/http/php/mod_getDownloadOptions.php 2013-01-23 16:57:05 UTC (rev 8552)
+++ trunk/mapbender/http/php/mod_getDownloadOptions.php 2013-01-28 20:09:28 UTC (rev 8553)
@@ -109,5 +109,7 @@
}
}
$result = json_encode($downloadOptions);
+header('Content-Type: application/json; charset='.CHARSET);
+
echo $result;
?>
More information about the Mapbender_commits
mailing list