[Mapbender-commits] r9438 - trunk/mapbender/http/geoportal
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Apr 8 04:11:09 PDT 2016
Author: armin11
Date: 2016-04-08 04:11:09 -0700 (Fri, 08 Apr 2016)
New Revision: 9438
Modified:
trunk/mapbender/http/geoportal/mod_showCatalogueStatistics.php
trunk/mapbender/http/geoportal/mod_showCatalogueStatistics_server.php
Log:
Possibility to start catalogue search from statistic diagrams
Modified: trunk/mapbender/http/geoportal/mod_showCatalogueStatistics.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_showCatalogueStatistics.php 2016-04-08 11:08:13 UTC (rev 9437)
+++ trunk/mapbender/http/geoportal/mod_showCatalogueStatistics.php 2016-04-08 11:11:09 UTC (rev 9438)
@@ -24,7 +24,7 @@
margin: 0 auto;
}
-#buttons {
+.buttons {
text-align: center;
}
@@ -48,7 +48,7 @@
//css
$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 .= $metadataStr;
-$html .= '<div id="buttons">';
+$html .= '<div id="buttons" class="buttons">';
$html .= '<button class="pulldata" id="NUTS_1" value="NUTS_1">Land</button>';
$html .= '<button class="pulldata" id="NUTS_2" value="NUTS_2">Regierungsbezirk</button>';
$html .= '<button class="pulldata" id="NUTS_3" value="NUTS_3">Kreis</button>';
@@ -56,27 +56,35 @@
$html .= '<button class="pulldata" id="LAU_2" value="LAU_2">Kommune</button>';
$html .= '</div>';
$html .= '<div id="pie" class="inner"></div>';
-$html .= '<div id="dialog" class="inner"><div id="pie2" class="inner"></div></div>';
+$html .= '<div id="dialog" class="inner"><div class="buttons buttoncategory"><button class="pullcategory" id="buttoniso" value="iso">ISO Kategorien</button><button class="pullcategory" id="buttoninspire" value="inspire">EU INSPIRE Kategorien</button></div><div id="pie2" class="inner"></div></div>';
//internal lib javascript part
$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>';
//external javascript part
-$html .= '<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>';
-$html .= '<script type="text/javascript" src="http://raw.githubusercontent.com/benkeen/d3pie/0.1.8/d3pie/d3pie.min.j"></script>';
-$html .= '<script type="text/javascript" src="http://raw.githubusercontent.com/benkeen/d3pie/0.1.8/d3pie/d3pie.js"></script>';
+$html .= '<script type="text/javascript" src="../extensions/d3.v3.min.js"></script>';
+$html .= '<script type="text/javascript" src="../extensions/d3pie.min.js"></script>';
//internal javascript part
$javascript = <<< JAVASCRIPT
<script type="text/javascript">
var pie = new d3pie("pie");
var pie2 = new d3pie("pie2");
+ var currentDepartment;
d3.selectAll(".pulldata")
.on("click", function(){
- if (pie2 !== undefined) {
+ if (pie !== undefined) {
pie.destroy();
}
getStatisticsFromServer(this.value);
});
+ d3.selectAll(".pullcategory")
+ .on("click", function(){
+ $('#error').remove();
+ if (pie2 !== undefined) {
+ pie2.destroy();
+ }
+ getCategoriesFromServer(currentDepartment,this.value);
+ });
function getStatisticsFromServer(adminLevel) {
$.getJSON('mod_showCatalogueStatistics_server.php?adminLevel='+adminLevel, null, function(data) {
if (data !== false) {
@@ -105,13 +113,15 @@
onClickSegment: function(data) {
$("#dialog").dialog({
title: data.data.label,
- height:500,
- width:500,
+ height :600,
+ width:600,
modal: true,
buttons: {
}
});
- getCategoriesFromServer(data.data.id);
+ $(".buttoncategory").css("display","block");
+ getCategoriesFromServer(data.data.id,'iso');
+ currentDepartment = data.data.id;
}
}
});
@@ -121,17 +131,17 @@
});
}
- function getCategoriesFromServer(registratingDepartments) {
+ function getCategoriesFromServer(registratingDepartments,categoryType) {
if (pie2 !== undefined) {
pie2.destroy();
}
- $.getJSON('mod_showCatalogueStatistics_server.php?registratingDepartments='+registratingDepartments, null, function(data) {
+ $.getJSON('mod_showCatalogueStatistics_server.php?registratingDepartments='+registratingDepartments+'&categoryType='+categoryType, null, function(data) {
if (data !== false) {
var pie2 = new d3pie("pie2", {
size: {
pieOuterRadius: "45%",
- canvasHeight: 430,
- canvasWidth: 430
+ canvasHeight: 480,
+ canvasWidth: 480
},
data: {
sortOrder: "value-asc",
@@ -149,6 +159,22 @@
type: "caption"
},
callbacks: {
+ onClickSegment: function(data) {
+ //searchlink
+ searchLink = "http://www.geoportal.rlp.de/portal/nc/servicebereich/erweiterte-suche.html?cat=dienste&searchText=false®istratingDepartments="+currentDepartment+"&";
+ switch (categoryType) {
+ case "iso":
+ searchLink = searchLink+"isoCategories="+data.data.id;
+ break;
+ case "inspire":
+ searchLink = searchLink+"inspireThemes="+data.data.id;
+ break;
+ default:
+ searchLink = searchLink+"isoCategories="+data.data.id;
+ }
+ window.location.href = searchLink;//alert(searchLink);//(data.data.id,'iso');
+
+ }
}
});
} else {
@@ -163,7 +189,9 @@
}
$('#dialog').live("dialogclose", function(){
$('#error').remove();
+ $(".buttoncategory").css("display","none");
});
+ $(".buttoncategory").css("display","none");
</script>
JAVASCRIPT;
$html .= $javascript;
Modified: trunk/mapbender/http/geoportal/mod_showCatalogueStatistics_server.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_showCatalogueStatistics_server.php 2016-04-08 11:08:13 UTC (rev 9437)
+++ trunk/mapbender/http/geoportal/mod_showCatalogueStatistics_server.php 2016-04-08 11:11:09 UTC (rev 9438)
@@ -5,7 +5,7 @@
require_once(dirname(__FILE__)."/../classes/class_Uuid.php");
$adminLevel = "NUTS_1";
$registratingDepartments = false;
-
+$categoryType = "iso";
if (isset($_REQUEST["adminLevel"]) & $_REQUEST["adminLevel"] != "") {
$testMatch = $_REQUEST["adminLevel"];
if (!($testMatch == 'LAU_1' or $testMatch == 'LAU_2' or $testMatch == 'NUTS_3' or $testMatch == 'NUTS_1' or $testMatch == 'NUTS_2')){
@@ -17,6 +17,17 @@
$testMatch = NULL;
}
+if (isset($_REQUEST["categoryType"]) & $_REQUEST["categoryType"] != "") {
+ $testMatch = $_REQUEST["categoryType"];
+ if (!($testMatch == 'iso' or $testMatch == 'inspire' or $testMatch == 'custom')){
+ //echo 'outputFormat: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'Parameter <b>adminLevel</b> is not valid (inspire, iso, custom).<br/>';
+ die();
+ }
+ $categoryType = $testMatch;
+ $testMatch = NULL;
+}
+
if (isset($_REQUEST["registratingDepartments"]) & $_REQUEST["registratingDepartments"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["registratingDepartments"];
@@ -92,15 +103,27 @@
}
} else {
//call searchInterface for categories
- $connector = new connector("http://localhost/mapbender/php/mod_callMetadata.php?searchText=e&outputFormat=json&resultTarget=categories&searchResources=wms&searchId=test®istratingDepartments=".$registratingDepartments);
+ $connector = new connector(MAPBENDER_PATH."/php/mod_callMetadata.php?searchText=e&outputFormat=json&resultTarget=categories&searchResources=wms&searchId=test®istratingDepartments=".$registratingDepartments);
$jsonString = $connector->file;
$jsonObject = json_decode($jsonString);
$i = 0;
$dataCount = 0;
- foreach ($jsonObject->searchMD->category[0]->subcat as $cat) {
+ switch ($categoryType) {
+ case "inspire":
+ $catId = 1;
+ break;
+ case "custom":
+ $catId = 2;
+ break;
+ default:
+ $catId = 0;
+ break;
+ }
+ foreach ($jsonObject->searchMD->category[$catId]->subcat as $cat) {
$resultObj[$i]["label"] = $cat->title . " (".$cat->count.")";
$resultObj[$i]["value"] = $cat->count;
- $resultObj[$i]["caption"] = $cat->title;
+ $resultObj[$i]["caption"] = $cat->title;
+ $resultObj[$i]["id"] = $cat->id;
$dataCount = $dataCount + $resultObj[$i]["value"];
$i++;
}
More information about the Mapbender_commits
mailing list