[Mapbender-commits] r8554 - trunk/mapbender/http/geoportal
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Jan 29 11:57:28 PST 2013
Author: armin11
Date: 2013-01-29 11:57:28 -0800 (Tue, 29 Jan 2013)
New Revision: 8554
Modified:
trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php
Log:
Bugfixes for ajax calls and server componet.
Modified: trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php 2013-01-28 20:09:28 UTC (rev 8553)
+++ trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php 2013-01-29 19:57:28 UTC (rev 8554)
@@ -53,12 +53,12 @@
//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
+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
+order by uuid
SQL;
@@ -115,7 +115,8 @@
$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];
+ $insCat = '';
+ $output['aaData'][$metadataIndex]->inspireCategories = '';
$output['aaData'][$metadataIndex]->numberViewServices = 0;
$output['aaData'][$metadataIndex]->numberDownloadServices = 0;
}
@@ -123,6 +124,11 @@
if ($sqlTable['resource_type'][$i] == "layer") {
//addview service element
$output['aaData'][$metadataIndex]->viewServices[]->id = $sqlTable['resource_id'][$i];
+ $catString = $sqlTable['inspire_cat'][$i];
+ $insCat .= $sqlTable['inspire_cat'][$i];
+ if ($insCat != '') {
+ $insCat .= ",";
+ }
//increment amount of view services
$output['aaData'][$metadataIndex]->numberViewServices++;
if ($sqlTable['inspire_download'][$i] == 1) {
@@ -134,8 +140,14 @@
if ($sqlTable['resource_type'][$i] == "wfs_featuretype" && $sqlTable['inspire_download'][$i] == "1") {
//add download service element
$output['aaData'][$metadataIndex]->numberDownloadServices++;
+ $insCat .= $sqlTable['inspire_cat'][$i];
+ if ($insCat != '') {
+ $insCat .= ",";
+ }
//$output['aaData'][$metadataIndex]->downloadServices[]->id = $sqlTable['resource_id'][$i];
}
+ //reduce categories if there are double entries
+ $output['aaData'][$metadataIndex]->inspireCategories = implode(',',array_unique(explode(',',(rtrim($insCat,',')))));
}
}
header('Content-Type: application/json; charset='.CHARSET);
Modified: trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php 2013-01-28 20:09:28 UTC (rev 8553)
+++ trunk/mapbender/http/geoportal/mod_showInspireMonitoring.php 2013-01-29 19:57:28 UTC (rev 8554)
@@ -90,7 +90,37 @@
//$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 */
+
+/* functions for calling detail via ajax*/
+//call dls information
+$html .= "function addDownloadServiceDetails(aData) {";
+$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 .= "$('#dls').append('<li>".$translation['wmslayergetmap']."</li>');";
+$html .= "$('#dls').append('<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><br>');";
+$html .= "break;";
+$html .= "case 'wmslayerdataurl':";
+$html .= "$('#dls').append('<li>".$translation['wmslayerdataurl']."</li>');";
+$html .= "$('#dls').append('<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><br>');";
+$html .= "break;";
+$html .= "case 'wfsrequest':";
+$html .= "$('#dls').append('<li>".$translation['wfsrequest']."</li>');";
+$html .= "$('#dls').append('<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><br>');";
+$html .= "break;";
+$html .= "default:";
+$html .= "}";//end switch
+$html .= "})";//end for each
+$html .= "});";//end ajax call
+$html .= "}";//end function
+//call vs information
$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+'\"/>';";
@@ -100,63 +130,36 @@
$html .= "$('#layerentry'+layerId).append('<b>'+data.wms.srv[0].avail+'%</b>');";
$html .= " });";
$html .= "}";
+//function to pull information via ajax call and add it to detail table
+$html .= "function fnAddDetails ( oTable, nTr ) {";
+$html .= "var aData = oTable.fnGetData( nTr );";
+$html .= "if (undefined != aData['viewServices']) {";
+$html .= "for (var i = 0; i < aData['viewServices'].length; i++){";
+$html .= "var layerId = aData['viewServices'][i].id;";
+$html .= "$('#vs').append('<li id=\"layerentry'+layerId+'\" ><a href=\"../php/mod_showMetadata.php?languageCode=de&resource=layer&layout=tabs&id='+aData['viewServices'][i].id+'\" target=\"_blank\">'+layerId+'</a></li>');";
+$html .= "addViewServiceDetails(layerId,aData,i);";
+$html .= "}";
+$html .= "}";
+$html .= "if (aData['numberDownloadServices'] > 0) {";
+//get json data for download options from ajax request
+$html .= "addDownloadServiceDetails(aData)";
+$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 = [];";
+//generate table with detail
$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 .= "}";
@@ -208,6 +211,7 @@
$html .= "this.src = \"../img/gnome/stock_zoom-out.png\";";
$html .= "oTable.fnClose( nTr );";
$html .= "oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );";
+$html .= "fnAddDetails(oTable, nTr);";
$html .= "}";
$html .= "});";
$html .= "});";
More information about the Mapbender_commits
mailing list