[Mapbender-commits] r7039 - in trunk/mapbender: conf http/classes
http/geoportal http/geoportal/preview http/php
resources/db/pgsql/UTF-8/update
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Oct 12 03:20:11 EDT 2010
Author: armin11
Date: 2010-10-12 00:20:11 -0700 (Tue, 12 Oct 2010)
New Revision: 7039
Added:
trunk/mapbender/http/geoportal/mod_showPreview.php
trunk/mapbender/http/geoportal/preview/
trunk/mapbender/http/geoportal/preview/keinevorschau.png
Modified:
trunk/mapbender/conf/mapbender.conf-dist
trunk/mapbender/http/classes/class_metadata_new.php
trunk/mapbender/http/php/mod_showMetadata.php
trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql
Log:
adopt metadata show module and some other to handle previews of wmc resources
Modified: trunk/mapbender/conf/mapbender.conf-dist
===================================================================
--- trunk/mapbender/conf/mapbender.conf-dist 2010-10-11 09:03:04 UTC (rev 7038)
+++ trunk/mapbender/conf/mapbender.conf-dist 2010-10-12 07:20:11 UTC (rev 7039)
@@ -147,6 +147,12 @@
define("GEO_RSS_FILE", "../tmp/georss.xml");
+#---------------------------------------------
+# PREVIEW
+#---------------------------------------------
+define("PREVIEW_DIR", "../geoportal/preview");
+
+
# --------------------------------------------
# UPLOAD
# --------------------------------------------
Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php 2010-10-11 09:03:04 UTC (rev 7038)
+++ trunk/mapbender/http/classes/class_metadata_new.php 2010-10-12 07:20:11 UTC (rev 7039)
@@ -108,24 +108,33 @@
$this->resourceClassifications[0]['requestName'] = 'isoCategories';
$this->resourceClassifications[0]['id_wms'] = 'layer_id';
$this->resourceClassifications[0]['id_wfs'] = 'featuretype_id';
+ $this->resourceClassifications[0]['id_wmc'] = 'wmc_serial_id';
$this->resourceClassifications[0]['relation_wms'] = 'layer_md_topic_category';
- $this->resourceClassifications[0]['relation_wfs'] = 'featuretype_md_topic_category';//TODO: define this in mapbender
+ $this->resourceClassifications[0]['relation_wfs'] = 'featuretype_md_topic_category';
+ $this->resourceClassifications[0]['relation_wmc'] = 'wmc_md_topic_category';
+//TODO: define this in mapbender
$this->resourceClassifications[1]['title'] = "INSPIRE"; //TODO: define the translations somewhere? - This is done in call_metadata.php before. Maybe we can get them from there? - It will be shown in the rightside categories table
$this->resourceClassifications[1]['tablename'] = 'inspire_category';
$this->resourceClassifications[1]['requestName'] = 'inspireThemes';
$this->resourceClassifications[1]['id_wms'] = 'layer_id';
$this->resourceClassifications[1]['id_wfs'] = 'featuretype_id';
+ $this->resourceClassifications[1]['id_wmc'] = 'wmc_serial_id';
$this->resourceClassifications[1]['relation_wms'] = 'layer_inspire_category';
- $this->resourceClassifications[1]['relation_wfs'] = 'featuretype_inspire_category';//TODO: define this in mapbender
+ $this->resourceClassifications[1]['relation_wfs'] = 'featuretype_inspire_category';
+ $this->resourceClassifications[1]['relation_wmc'] = 'wmc_inspire_category';
+//TODO: define this in mapbender
$this->resourceClassifications[2]['title'] = "Custom"; //TODO: define the translations somewhere? - This is done in call_metadata.php before. Maybe we can get them from there? - It will be shown in the rightside categories table
$this->resourceClassifications[2]['tablename'] = 'custom_category';
$this->resourceClassifications[2]['requestName'] = 'customCategories';
$this->resourceClassifications[2]['id_wms'] = 'layer_id';
$this->resourceClassifications[2]['id_wfs'] = 'featuretype_id';
+ $this->resourceClassifications[2]['id_wmc'] = 'wmc_serial_id';
$this->resourceClassifications[2]['relation_wms'] = 'layer_custom_category';
- $this->resourceClassifications[2]['relation_wfs'] = 'featuretype_custom_category';//TODO: define this in mapbender
+ $this->resourceClassifications[2]['relation_wfs'] = 'featuretype_custom_category';
+ $this->resourceClassifications[2]['relation_wmc'] = 'wmc_custom_category';
+//TODO: define this in mapbender
@@ -241,15 +250,15 @@
}
if (isset($this->searchResources) & strtolower($this->searchResources) === "wmc") {
$this->searchView = 'search_wmc_view';
- $this->databaseIdColumnName = 'wmc_id';
+ $this->databaseIdColumnName = 'wmc_serial_id';
$this->databaseTableName = 'wmc';
switch ($this->orderBy) {
case "rank":
- $this->orderBy = " ORDER BY wmc_serial_id ";
+ $this->orderBy = " ORDER BY wmc_id ";
break;
case "id":
- $this->orderBy = " ORDER BY wmc_serial_id ";
+ $this->orderBy = " ORDER BY wmc_id ";
break;
case "title":
$this->orderBy = " ORDER BY wmc_title ";
@@ -261,7 +270,7 @@
$this->orderBy = " ORDER BY wmc_title ";
}
- $this->resourceClasses = NULL; #TODO adopt to count classifications
+ $this->resourceClasses = array(0,1,2); #TODO adopt to count classifications
$this->generateWMCMetadata($this->wmcDoc);
}
}
@@ -452,13 +461,14 @@
$wmcMatrix = $this->flipDiagonally($wmcMatrix);
//read out first server entry - maybe this a little bit timeconsuming TODO
for($i=0; $i<count($wmcMatrix);$i++){
- $this->wmcJSON->wmc->srv[$i]->id = $wmcMatrix[$i]['wmc_serial_id'];
+ $this->wmcJSON->wmc->srv[$i]->id = $wmcMatrix[$i]['wmc_id'];
$this->wmcJSON->wmc->srv[$i]->title = $wmcMatrix[$i]['wmc_title'];
$this->wmcJSON->wmc->srv[$i]->abstract = $wmcMatrix[$i]['abstract'];
$this->wmcJSON->wmc->srv[$i]->date = date("d.m.Y",$wmcMatrix[$i]['wmc_timestamp']);
$this->wmcJSON->wmc->srv[$i]->respOrg = $wmcMatrix[$i]['mb_group_name'];
- $this->wmcJSON->wmc->srv[$i]->mdLink = "http://".$this->hostName."/mapbender/x_geoportal/showWMCMetadata.php?id=".$wmcMatrix[$i]['wmc_serial_id'];
- $this->wmcJSON->wmc->srv[$i]->previewURL = "http://".$this->hostName."/mapbender/x_geoportal/mod_wmcPreview.php?id=".$wmcMatrix[$i]['wmc_serial_id'];
+ $this->wmcJSON->wmc->srv[$i]->logoUrl = $wmcMatrix[$i]['mb_group_logo_path'];
+ $this->wmcJSON->wmc->srv[$i]->mdLink = "http://".$this->hostName."/mapbender/php/mod_showMetadata.php?languageCode=".$this->languageCode."&resource=wmc&layout=tabs&id=".$wmcMatrix[$i]['wmc_id'];
+ $this->wmcJSON->wmc->srv[$i]->previewURL = "http://".$this->hostName."/mapbender/geoportal/mod_showPreview.php?resource=wmc&id=".$wmcMatrix[$i]['wmc_id'];
$spatialSource = "";
$stateOrProvince = $wmcMatrix[$i]['mb_group_stateorprovince'];
if ($stateOrProvince == "NULL" || $stateOrProvince == "") {
@@ -617,7 +627,7 @@
$this->wmsJSON->wms->srv[$j]->layer[0]->title = $subLayers[$rootIndex]['layer_title'];
$this->wmsJSON->wms->srv[$j]->layer[0]->abstract = $subLayers[$rootIndex]['layer_abstract'];
$this->wmsJSON->wms->srv[$j]->layer[0]->mdLink = "http://".$this->hostName."/mapbender/php/mod_showMetadata.php?languageCode=".$this->languageCode."&resource=layer&layout=tabs&id=".(integer)$subLayers[$rootIndex]['layer_id'];
- $this->wmsJSON->wms->srv[$j]->layer[0]->previewURL = "http://".$this->hostName."/mapbender/x_geoportal/mod_layerPreview.php?id=".(integer)$subLayers[$rootIndex]['layer_id'];
+ $this->wmsJSON->wms->srv[$j]->layer[0]->previewURL = "http://".$this->hostName."/mapbender/geoportal/mod_showPreview.php?resource=layer&id=".(integer)$subLayers[$rootIndex]['layer_id'];
if ($subLayers[$rootIndex]['layer_name'] == ''){
$this->wmsJSON->wms->srv[$j]->layer[0]->loadable = 0;
}
@@ -902,7 +912,7 @@
}
//search filter for inspire_categories
//
- if (strtolower($this->searchResources) === "wms" & $this->inspireThemes != NULL) {
+ if ((strtolower($this->searchResources) === "wms" or strtolower($this->searchResources) === "wmc") & $this->inspireThemes != NULL) {
$inspireArray = explode(',',$this->inspireThemes);
$inspireCond = "(";
@@ -918,7 +928,7 @@
}
//search filter for custom_categories
//
- if (strtolower($this->searchResources) === "wms" & $this->customCategories != NULL) {
+ if ((strtolower($this->searchResources) === "wms" or strtolower($this->searchResources) === "wmc") & $this->customCategories != NULL) {
$customArray = explode(',',$this->customCategories);
$customCond = "(";
@@ -1521,7 +1531,7 @@
$servObject->layer[$countsublayer]->id = $child['layer_id'];
$servObject->layer[$countsublayer]->title = $child['layer_title'];
$servObject->layer[$countsublayer]->abstract = $child['layer_abstract'];
- $servObject->layer[$countsublayer]->previewURL = "http://".$this->hostName."/mapbender/x_geoportal/mod_layerPreview.php?id=".$child['layer_id'];
+ $servObject->layer[$countsublayer]->previewURL = "http://".$this->hostName."/mapbender/geoportal/mod_showPreview.php?resource=layer&id=".$child['layer_id'];
$servObject->layer[$countsublayer]->mdLink = "http://".$this->hostName."/mapbender/php/mod_showMetadata.php?languageCode=".$this->languageCode."&resource=layer&layout=tabs&id=".$child['layer_id'];
if ($child['layer_name'] == ''){
$servObject->layer[$countsublayer]->loadable = 0;
Added: trunk/mapbender/http/geoportal/mod_showPreview.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_showPreview.php (rev 0)
+++ trunk/mapbender/http/geoportal/mod_showPreview.php 2010-10-12 07:20:11 UTC (rev 7039)
@@ -0,0 +1,88 @@
+<?php
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+//get type of resource and id of resource - normally layer and wmc
+$resource = 'layer';
+$id = 0;
+if (isset($_REQUEST["resource"]) & $_REQUEST["resource"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["resource"];
+ if (!($testMatch == 'layer' or $testMatch == 'wmc' or $testMatch == 'layerlegend')){
+ echo 'resource: <b>'.$testMatch.'</b> is not valid.<br/>';
+ die();
+ }
+ $resource = $testMatch;
+ $testMatch = NULL;
+}
+if (isset($_REQUEST["id"]) & $_REQUEST["id"] != "") {
+ //validate to integer
+ $testMatch = $_REQUEST["id"];
+ $pattern = '/^[0-9]*$/';
+ if (!preg_match($pattern,$testMatch)){
+ echo 'id: <b>'.$testMatch.'</b> is not valid.<br/>';
+ die();
+ }
+ $id = $testMatch;
+ $testMatch = NULL;
+}
+
+if ($resource == 'layer'){
+ if (file_exists(PREVIEW_DIR."/".$id."_layer_map_preview.png")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/png');
+ readfile(PREVIEW_DIR."/".$id."_layer_map_preview.png");
+ } else {
+ if (file_exists(PREVIEW_DIR."/"."keinevorschau.png")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/png');
+ readfile(PREVIEW_DIR."/"."keinevorschau.png");
+ } else {
+ echo "No preview dummy found!";
+ }
+ }
+}
+elseif ($resource == 'wmc') {
+ if (file_exists(PREVIEW_DIR."/".$id."_wmc_preview.png")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/png');
+ readfile(PREVIEW_DIR."/".$id."_wmc_preview.png");
+ } else {
+ if (file_exists(PREVIEW_DIR."/"."keinevorschau.png")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/png');
+ readfile(PREVIEW_DIR."/"."keinevorschau.png");
+ } else {
+ echo "No preview dummy found!";
+ }
+ }
+
+}
+elseif ($resource == 'layerlegend') {
+ if (file_exists(PREVIEW_DIR."/".$id."_layer_legend_preview.png")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/png');
+ readfile(PREVIEW_DIR."/".$id."_layer_legend_preview.png");
+ } else {
+ if (file_exists(PREVIEW_DIR."/"."keinevorschau.png")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/png');
+ readfile(PREVIEW_DIR."/"."keinevorschau.png");
+ } else {
+ echo "No preview dummy found!";
+ }
+ }
+
+} else die();
+
+?>
Added: trunk/mapbender/http/geoportal/preview/keinevorschau.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/geoportal/preview/keinevorschau.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2010-10-11 09:03:04 UTC (rev 7038)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2010-10-12 07:20:11 UTC (rev 7039)
@@ -400,14 +400,14 @@
$resP = db_prep_query($sqlP, $vP, $tP);
$rowP = db_fetch_array($resP);
if ($rowP['layer_map_preview_filename'] != "") {
- $resourceMetadata['preview'] = "<img src = '../x_geoportal/layer_preview/".$rowP['layer_map_preview_filename']."'>";
+ $resourceMetadata['preview'] = "<img src = '".PREVIEW_DIR."/".$rowP['layer_map_preview_filename']."'>";
}
if ($rowP['layer_legend_preview_filename'] != "") {
- $resourceMetadata['legend'] .= "<img src = '../x_geoportal/layer_preview/".$rowP['layer_legend_preview_filename']."'>";
+ $resourceMetadata['legend'] .= "<img src = '".PREVIEW_DIR."/".$rowP['layer_legend_preview_filename']."'>";
}
- if ($rowP['layer_extent_preview_filename'] != "") {
+/* if ($rowP['layer_extent_preview_filename'] != "") {
$resourceMetadata['extent'] .= "<img src = '../x_geoportal/layer_preview/".$rowP['layer_extent_preview_filename']."'>";
- }
+ }*/
}
Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql 2010-10-11 09:03:04 UTC (rev 7038)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql 2010-10-12 07:20:11 UTC (rev 7039)
@@ -2506,18 +2506,24 @@
DROP VIEW search_wmc_view;
--TODO: get group information out of mb_group table instead of ows information, cause in this case there can be more than one different service in a resource
--TODO: set public flag to some wmc docs to generate usefull results
+--TODO: get infos from old wmc docs into table structure (abstract, coords, ...)
+-- View: search_wmc_view
+-- DROP VIEW search_wmc_view;
+
CREATE OR REPLACE VIEW search_wmc_view AS
- SELECT wmc_dep.fkey_user_id as user_id, wmc_dep.wmc_id , wmc_dep.srs as wmc_srs, wmc_dep.wmc_title , wmc_dep.abstract as wmc_abstract, f_collect_searchtext_wmc(wmc_dep.wmc_id) AS searchtext
- , wmc_dep.wmc_timestamp, wmc_dep.department, wmc_dep.mb_group_name,wmc_dep.mb_group_title,wmc_dep.mb_group_country, wmc_dep.mb_group_stateorprovince ,f_collect_topic_cat_wmc(wmc_dep.wmc_id) as md_topic_cats,transform(geometryfromtext(((((((((((((((((((('POLYGON(('::text || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || '))'::text, regexp_replace(UPPER(wmc_dep.srs), 'EPSG:', '')::INTEGER),4326) AS the_geom, (((((wmc_dep.minx::text || ','::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.maxx::text) || ','::text) || wmc_dep.maxy::text AS bbox , wmc_dep.mb_group_logo_path
- FROM ( SELECT mb_user_wmc.wmc_public, mb_user_wmc.maxy ,mb_user_wmc.maxx ,mb_user_wmc.miny ,mb_user_wmc.minx ,mb_user_wmc.srs ,mb_user_wmc.wmc_serial_id as wmc_id, mb_user_wmc.wmc_title, mb_user_wmc.abstract, mb_user_wmc.wmc_timestamp, mb_user_wmc.fkey_user_id, user_dep.mb_group_id AS department, user_dep.mb_group_name,
-user_dep.mb_group_title,user_dep.mb_group_country, user_dep.mb_group_stateorprovince, user_dep.mb_group_logo_path
- FROM ( SELECT registrating_groups.fkey_mb_user_id AS mb_user_id, mb_group.mb_group_id, mb_group.mb_group_name, mb_group.mb_group_title, mb_group.mb_group_country, mb_group.mb_group_stateorprovince, mb_group.mb_group_logo_path
- FROM registrating_groups, mb_group WHERE registrating_groups.fkey_mb_group_id = mb_group.mb_group_id) as user_dep, mb_user_wmc
- WHERE user_dep.mb_user_id = mb_user_wmc.fkey_user_id) wmc_dep WHERE wmc_dep.wmc_public = 1 ORDER BY wmc_dep.wmc_id;
+ SELECT wmc_dep.fkey_user_id AS user_id, wmc_dep.wmc_id, wmc_dep.srs AS wmc_srs, wmc_dep.wmc_title, wmc_dep.abstract AS wmc_abstract, f_collect_searchtext_wmc(wmc_dep.wmc_id) AS searchtext, wmc_dep.wmc_timestamp, wmc_dep.department, wmc_dep.mb_group_name, wmc_dep.mb_group_title, wmc_dep.mb_group_country, wmc_dep.wmc_serial_id, wmc_dep.mb_group_stateorprovince, f_collect_inspire_cat_wmc(wmc_dep.wmc_serial_id) AS md_inspire_cats, f_collect_custom_cat_wmc(wmc_dep.wmc_serial_id) AS md_custom_cats, f_collect_topic_cat_wmc(wmc_dep.wmc_id) AS md_topic_cats, transform(geometryfromtext(((((((((((((((((((('POLYGON(('::text || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || '))'::tex
t, regexp_replace(upper(wmc_dep.srs::text), 'EPSG:'::text, ''::text)::integer), 4326) AS the_geom, (((((wmc_dep.minx::text || ','::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.maxx::text) || ','::text) || wmc_dep.maxy::text AS bbox, wmc_dep.mb_group_logo_path
+ FROM ( SELECT mb_user_wmc.wmc_public, mb_user_wmc.maxy, mb_user_wmc.maxx, mb_user_wmc.miny, mb_user_wmc.minx, mb_user_wmc.srs, mb_user_wmc.wmc_serial_id AS wmc_id, mb_user_wmc.wmc_serial_id, mb_user_wmc.wmc_title, mb_user_wmc.abstract, mb_user_wmc.wmc_timestamp, mb_user_wmc.fkey_user_id, user_dep.mb_group_id AS department, user_dep.mb_group_name, user_dep.mb_group_title, user_dep.mb_group_country, user_dep.mb_group_stateorprovince, user_dep.mb_group_logo_path
+ FROM ( SELECT registrating_groups.fkey_mb_user_id AS mb_user_id, mb_group.mb_group_id, mb_group.mb_group_name, mb_group.mb_group_title, mb_group.mb_group_country, mb_group.mb_group_stateorprovince, mb_group.mb_group_logo_path
+ FROM registrating_groups, mb_group
+ WHERE registrating_groups.fkey_mb_group_id = mb_group.mb_group_id) user_dep, mb_user_wmc
+ WHERE user_dep.mb_user_id = mb_user_wmc.fkey_user_id) wmc_dep
+ WHERE wmc_dep.wmc_public = 1
+ ORDER BY wmc_dep.wmc_id;
ALTER TABLE search_wmc_view OWNER TO postgres;
+
-- insert deleteWFSConf modul in admin1
--
-- add delete wfs conf module from geoportal.rlp
More information about the Mapbender_commits
mailing list