[Mapbender-commits] r6938 - in trunk/mapbender/http: classes
javascripts php plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Sep 24 03:41:10 EDT 2010
Author: christoph
Date: 2010-09-24 07:41:09 +0000 (Fri, 24 Sep 2010)
New Revision: 6938
Modified:
trunk/mapbender/http/classes/class_wms_1_1_1_factory.php
trunk/mapbender/http/javascripts/wms.js
trunk/mapbender/http/php/wms.php
trunk/mapbender/http/plugins/mb_metadata_server.php
Log:
bug fix: wrong order when loading ah4 service
Modified: trunk/mapbender/http/classes/class_wms_1_1_1_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wms_1_1_1_factory.php 2010-09-23 14:32:11 UTC (rev 6937)
+++ trunk/mapbender/http/classes/class_wms_1_1_1_factory.php 2010-09-24 07:41:09 UTC (rev 6938)
@@ -67,17 +67,20 @@
// SELECT DISTINCT q.layer_id, q.layer_pos, q.layer_parent FROM layer q, layer r WHERE r.layer_parent <> '' AND q.layer_pos = CAST(r.layer_parent AS numeric) and q.layer_parent = '0' and q.fkey_wms_id = r.fkey_wms_id
$currentLayer = $myWms->getLayerById($id);
- $keep = array($currentLayer->layer_uid);
+ $keep = array();
- $children = $currentLayer->getChildren();
- foreach ($children as $child) {
- $keep[]= $child->layer_uid;
- }
$parents = $currentLayer->getParents();
foreach ($parents as $parent) {
$keep[]= $parent->layer_uid;
}
+ $keep[]= $currentLayer->layer_uid;
+
+ $children = $currentLayer->getChildren();
+ foreach ($children as $child) {
+ $keep[]= $child->layer_uid;
+ }
+
//
// 2. delete layers not for keeping
//
Modified: trunk/mapbender/http/javascripts/wms.js
===================================================================
--- trunk/mapbender/http/javascripts/wms.js 2010-09-23 14:32:11 UTC (rev 6937)
+++ trunk/mapbender/http/javascripts/wms.js 2010-09-24 07:41:09 UTC (rev 6938)
@@ -28,38 +28,38 @@
* @param {String} gui_wms_sldurl url to an actual sld
*/
function add_wms(
- wms_id,
- wms_version,
- wms_title,
- wms_abstract,
- wms_getmap,
- wms_getfeatureinfo,
- wms_getlegendurl,
- wms_filter,
- gui_wms_mapformat,
- gui_wms_featureinfoformat,
- gui_wms_exceptionformat,
- gui_wms_epsg,
- gui_wms_visible,
- gui_wms_opacity,
- gui_wms_sldurl){
- wms[wms.length] = new wms_const(
- wms_id,
- wms_version,
- wms_title,
- wms_abstract,
- wms_getmap,
- wms_getfeatureinfo,
- wms_getlegendurl,
- wms_filter,
- gui_wms_mapformat,
- gui_wms_featureinfoformat,
- gui_wms_exceptionformat,
- gui_wms_epsg,
- parseInt(gui_wms_visible, 10),
- parseInt(gui_wms_opacity),
- gui_wms_sldurl);
- wms_layer[wms.length - 1] = [];
+ wms_id,
+ wms_version,
+ wms_title,
+ wms_abstract,
+ wms_getmap,
+ wms_getfeatureinfo,
+ wms_getlegendurl,
+ wms_filter,
+ gui_wms_mapformat,
+ gui_wms_featureinfoformat,
+ gui_wms_exceptionformat,
+ gui_wms_epsg,
+ gui_wms_visible,
+ gui_wms_opacity,
+ gui_wms_sldurl){
+ wms[wms.length] = new wms_const(
+ wms_id,
+ wms_version,
+ wms_title,
+ wms_abstract,
+ wms_getmap,
+ wms_getfeatureinfo,
+ wms_getlegendurl,
+ wms_filter,
+ gui_wms_mapformat,
+ gui_wms_featureinfoformat,
+ gui_wms_exceptionformat,
+ gui_wms_epsg,
+ parseInt(gui_wms_visible, 10),
+ parseInt(gui_wms_opacity),
+ gui_wms_sldurl);
+ wms_layer[wms.length - 1] = [];
}
/**
* @class A class representing the wms
@@ -83,21 +83,21 @@
*
*/
function wms_const(
- wms_id,
- wms_version,
- wms_title,
- wms_abstract,
- wms_getmap,
- wms_getfeatureinfo,
- wms_getlegendurl,
- wms_filter,
- gui_wms_mapformat,
- gui_wms_featureinfoformat,
- gui_wms_exceptionformat,
- gui_wms_epsg,
- gui_wms_visible,
- gui_wms_opacity,
- gui_wms_sldurl){
+ wms_id,
+ wms_version,
+ wms_title,
+ wms_abstract,
+ wms_getmap,
+ wms_getfeatureinfo,
+ wms_getlegendurl,
+ wms_filter,
+ gui_wms_mapformat,
+ gui_wms_featureinfoformat,
+ gui_wms_exceptionformat,
+ gui_wms_epsg,
+ gui_wms_visible,
+ gui_wms_opacity,
+ gui_wms_sldurl){
if (!wms_id) {
var id_ok = false;
@@ -148,15 +148,15 @@
typeof this.gui_miny[crsIndex] === 'number' &&
typeof this.gui_maxx[crsIndex] === 'number' &&
typeof this.gui_maxy[crsIndex] === 'number'
- ) {
+ ) {
var sw = new Proj4js.Point(
this.gui_minx[crsIndex],
this.gui_miny[crsIndex]
- );
+ );
var ne = new Proj4js.Point(
this.gui_maxx[crsIndex],
this.gui_maxy[crsIndex]
- );
+ );
sw = Proj4js.transform(options.source, options.dest, sw);
ne = Proj4js.transform(options.source, options.dest, ne);
var extent = new Mapbender.Extent(sw.x, sw.y, ne.x, ne.y);
@@ -202,7 +202,7 @@
bbox_miny !== null && !isNaN(bbox_miny) &&
bbox_maxx !== null && !isNaN(bbox_maxx) &&
bbox_maxy !== null && !isNaN(bbox_maxy)
- ) {
+ ) {
return new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
}
}
@@ -431,7 +431,7 @@
if (currentLayer.layer_name === layername) {
if (currentLayer.gui_layer_style === '' || currentLayer.gui_layer_style === null){
return "default";
-// return false;
+ // return false;
}
else{
return currentLayer.gui_layer_style;
@@ -459,7 +459,7 @@
if(guiLayerStyle == '' && k == 0){
legendUrl = this.objLayer[i].layer_style[k].legendurl;
if (this.gui_wms_sldurl !== "") {
- legendUrl += "&SLD="+escape(this.gui_wms_sldurl);
+ legendUrl += "&SLD="+escape(this.gui_wms_sldurl);
}
if(legendUrl !=='' && legendUrl !== null && typeof(legendUrl) != 'undefined'){
return legendUrl;
@@ -470,7 +470,7 @@
}else if(this.objLayer[i].layer_style[k].name == guiLayerStyle){
legendUrl = this.objLayer[i].layer_style[k].legendurl;
if (this.gui_wms_sldurl !== "") {
- legendUrl += "&SLD="+escape(this.gui_wms_sldurl);
+ legendUrl += "&SLD="+escape(this.gui_wms_sldurl);
}
if(legendUrl !=='' && legendUrl !== null && typeof(legendUrl) != 'undefined'){
return legendUrl;
@@ -497,8 +497,8 @@
for(var i=0; i< this.objLayer.length; i++){
var isVisible = this.objLayer[i].gui_layer_visible === 1 &&
- this.objLayer[i].gui_layer_minscale <= currentScale &&
- (this.objLayer[i].gui_layer_maxscale >= currentScale ||
+ this.objLayer[i].gui_layer_minscale <= currentScale &&
+ (this.objLayer[i].gui_layer_maxscale >= currentScale ||
this.objLayer[i].gui_layer_maxscale === 0);
if(this.objLayer[i].gui_layer_querylayer === 1 && !this.objLayer[i].has_childs && isVisible){
queryLayers.push(this.objLayer[i].layer_name);
@@ -740,50 +740,50 @@
//TODO: add layerstyle handling....
//layer
function wms_add_layer(
- layer_parent,
- layer_uid,
- layer_name,
- layer_title,
- layer_dataurl_href,
- layer_pos,
- layer_queryable,
- layer_minscale,
- layer_maxscale,
- layer_metadataurl,
- gui_layer_wms_id,
- gui_layer_status,
- gui_layer_style,
- gui_layer_selectable,
- gui_layer_visible,
- gui_layer_queryable,
- gui_layer_querylayer,
- gui_layer_minscale,
- gui_layer_maxscale,
- gui_layer_wfs_featuretype,
- gui_layer_title){
+ layer_parent,
+ layer_uid,
+ layer_name,
+ layer_title,
+ layer_dataurl_href,
+ layer_pos,
+ layer_queryable,
+ layer_minscale,
+ layer_maxscale,
+ layer_metadataurl,
+ gui_layer_wms_id,
+ gui_layer_status,
+ gui_layer_style,
+ gui_layer_selectable,
+ gui_layer_visible,
+ gui_layer_queryable,
+ gui_layer_querylayer,
+ gui_layer_minscale,
+ gui_layer_maxscale,
+ gui_layer_wfs_featuretype,
+ gui_layer_title){
wms[wms.length-1].objLayer[wms[wms.length-1].objLayer.length] = new wms_layer(
- layer_parent,
- layer_uid,
- layer_name,
- layer_title,
- layer_dataurl_href,
- layer_pos,
- layer_queryable,
- layer_minscale,
- layer_maxscale,
- layer_metadataurl,
- gui_layer_wms_id,
- gui_layer_status,
- gui_layer_style,
- parseInt(gui_layer_selectable, 10),
- parseInt(gui_layer_visible, 10),
- parseInt(gui_layer_queryable, 10),
- parseInt(gui_layer_querylayer, 10),
- parseInt(gui_layer_minscale, 10),
- parseInt(gui_layer_maxscale, 10),
- gui_layer_wfs_featuretype,
- gui_layer_title );
+ layer_parent,
+ layer_uid,
+ layer_name,
+ layer_title,
+ layer_dataurl_href,
+ layer_pos,
+ layer_queryable,
+ layer_minscale,
+ layer_maxscale,
+ layer_metadataurl,
+ gui_layer_wms_id,
+ gui_layer_status,
+ gui_layer_style,
+ parseInt(gui_layer_selectable, 10),
+ parseInt(gui_layer_visible, 10),
+ parseInt(gui_layer_queryable, 10),
+ parseInt(gui_layer_querylayer, 10),
+ parseInt(gui_layer_minscale, 10),
+ parseInt(gui_layer_maxscale, 10),
+ gui_layer_wfs_featuretype,
+ gui_layer_title );
var parentLayer = wms[wms.length-1].getLayerByLayerPos(parseInt(layer_parent, 10));
if(parentLayer) {
parentLayer.has_childs = true;
@@ -801,27 +801,27 @@
currentLayer.layer_epsg[k].maxy = maxy;
}
function wms_layer(
- layer_parent,
- wms_layer_uid,
- layer_name,
- layer_title,
- layer_dataurl_href,
- layer_pos,
- layer_queryable,
- layer_minscale,
- layer_maxscale,
- layer_metadataurl,
- gui_layer_wms_id,
- gui_layer_status,
- gui_layer_style,
- gui_layer_selectable,
- gui_layer_visible,
- gui_layer_queryable,
- gui_layer_querylayer,
- gui_layer_minscale,
- gui_layer_maxscale,
- gui_layer_wfs_featuretype,
- gui_layer_title){
+ layer_parent,
+ wms_layer_uid,
+ layer_name,
+ layer_title,
+ layer_dataurl_href,
+ layer_pos,
+ layer_queryable,
+ layer_minscale,
+ layer_maxscale,
+ layer_metadataurl,
+ gui_layer_wms_id,
+ gui_layer_status,
+ gui_layer_style,
+ gui_layer_selectable,
+ gui_layer_visible,
+ gui_layer_queryable,
+ gui_layer_querylayer,
+ gui_layer_minscale,
+ gui_layer_maxscale,
+ gui_layer_wfs_featuretype,
+ gui_layer_title){
this.layer_id = wms_layer_count;
this.layer_uid = wms_layer_uid;
this.layer_parent = layer_parent;
Modified: trunk/mapbender/http/php/wms.php
===================================================================
--- trunk/mapbender/http/php/wms.php 2010-09-23 14:32:11 UTC (rev 6937)
+++ trunk/mapbender/http/php/wms.php 2010-09-24 07:41:09 UTC (rev 6938)
@@ -20,6 +20,8 @@
require_once(dirname(__FILE__)."/../../core/globalSettings.php");
require_once(dirname(__FILE__)."/../classes/class_layer_monitor.php");
+ob_start();
+
//
// make all parameters available as upper case
//
@@ -162,7 +164,7 @@
$doc->standalone = false;
#Check for existing content in database
-#to be adopted TODO armin
+#to be adopted TODO armin
function validate ($contactInformation_column) {
if ($contactInformation_column <> "" AND $contactInformation_column <> NULL) {
$contactinformationcheck = true;
@@ -415,14 +417,14 @@
$formatText = $doc->createTextNode($wms_format_row['data_format']);
$formatText = $format->appendChild($formatText);
}
-#cause the format for capabilities is not read :
- $format = $doc->createElement("Format");
- $format = $getCapabilities->appendChild($format);
- $formatText = $doc->createTextNode('application/vnd.ogc.wms_xml');
- $formatText = $format->appendChild($formatText);
-
-
+#cause the format for capabilities is not read :
+ $format = $doc->createElement("Format");
+ $format = $getCapabilities->appendChild($format);
+ $formatText = $doc->createTextNode('application/vnd.ogc.wms_xml');
+ $formatText = $format->appendChild($formatText);
+
+
#Creating the "DCPType" node
$DCPType = $doc->createElement("DCPType");
$DCPType = $getCapabilities->appendChild($DCPType);
@@ -755,20 +757,20 @@
####### duplicate root layer
-#if layer is root layer itself!
-#<armin>
-##if ($layer_row['layer_pos']=='0'){
+#if layer is root layer itself!
+#<armin>
+##if ($layer_row['layer_pos']=='0'){
#</armin>
##$clonedLayer = $layer->cloneNode(true);
##$clonedLayer->setAttribute("queryable", "0");
##$clonedLayer->setAttribute("cascaded", "0");
##$layer->appendChild($clonedLayer);
-#<armin>
-##}
-#</armin>
-
-
+#<armin>
+##}
+#</armin>
+
+
############## sublayer
#SQL statement to get all layers
@@ -783,24 +785,24 @@
}
$sub_layer_sql .= " ORDER BY layer_pos";
$res_sub_layer_sql = db_prep_query($sub_layer_sql, $v, $t);
-
-
-#<armin>
-$res_sub_layer_sql_2 = db_prep_query($sub_layer_sql, $v, $t);
-$sub_layer_row_2 = db_fetch_array($res_sub_layer_sql_2);
-
-
-if (!isset($sub_layer_row_2['layer_pos'])) {
+
+
+#<armin>
+$res_sub_layer_sql_2 = db_prep_query($sub_layer_sql, $v, $t);
+$sub_layer_row_2 = db_fetch_array($res_sub_layer_sql_2);
+
+
+if (!isset($sub_layer_row_2['layer_pos'])) {
$clonedLayer = $layer->cloneNode(true);
$clonedLayer->setAttribute("queryable", "0");
$clonedLayer->setAttribute("cascaded", "0");
- $layer->appendChild($clonedLayer);
-}
-#</armin>
-
-
-
+ $layer->appendChild($clonedLayer);
+}
+#</armin>
+
+
+
while ($sub_layer_row = db_fetch_array($res_sub_layer_sql)) {
#Creating layer node
@@ -814,13 +816,14 @@
$sub_layer->setAttribute('queryable', $sub_layer_row['layer_queryable']);
}
#Getting information about the hierarchie of layers
- $cascadeSQL = "SELECT COUNT(*) FROM layer WHERE fkey_wms_id = ".$wms_row[0] .
- " AND layer_parent = ".$sub_layer_row['layer_pos']."";
- $res_cascadeSQL = db_query($cascadeSQL);
+ $cascadeSQL = "SELECT COUNT(*) FROM layer WHERE fkey_wms_id = $1 AND layer_parent = $2";
+
+ $v = array($wms_row[0], $sub_layer_row['layer_pos']);
+ $t = array("i", "i");
+ $res_cascadeSQL = db_prep_query($cascadeSQL, $v, $t);
$cascade = 0;
$cascade_row = db_fetch_row($res_cascadeSQL);
- if($cascade_row[0] > 0)
- {
+ if($cascade_row[0] > 0) {
$cascade = 1;
}
$sub_layer->setAttribute('cascaded', $cascade);
@@ -970,16 +973,16 @@
$onlineResource->setAttribute("xlink:href", $sub_layer_row['layer_metadataurl']);
$onlineResource->setAttribute("xlink:type", "simple");
}
-else
-{
- $onlineResource = $doc->createElement("OnlineResource");
- $onlineResource = $metadataUrl->appendChild($onlineResource);
- $onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink" );
- $onlineResource->setAttribute("xlink:type", "simple");
-
-}
-
-
+else
+{
+ $onlineResource = $doc->createElement("OnlineResource");
+ $onlineResource = $metadataUrl->appendChild($onlineResource);
+ $onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink" );
+ $onlineResource->setAttribute("xlink:type", "simple");
+
+}
+
+
}
# Creating DataURL Node
$dataUrl = $doc->createElement("DataURL");
@@ -1011,22 +1014,22 @@
$onlineResource->setAttribute("xlink:href", $sub_layer_row['layer_dataurl']);
$onlineResource->setAttribute("xlink:type", "simple");
}
-else
-{
- $onlineResource = $doc->createElement("OnlineResource");
- $onlineResource = $dataUrl->appendChild($onlineResource);
- $onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink" );
- $onlineResource->setAttribute("xlink:href", $mapbenderMetadataUrl.$sub_layer_row['layer_id']);
- $onlineResource->setAttribute("xlink:type", "simple");
-
-}
-
-
-
-
-
-
-
+else
+{
+ $onlineResource = $doc->createElement("OnlineResource");
+ $onlineResource = $dataUrl->appendChild($onlineResource);
+ $onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink" );
+ $onlineResource->setAttribute("xlink:href", $mapbenderMetadataUrl.$sub_layer_row['layer_id']);
+ $onlineResource->setAttribute("xlink:type", "simple");
+
+}
+
+
+
+
+
+
+
}
@@ -1044,9 +1047,9 @@
$titleText = $doc->createTextNode('default');
$titleText = $title->appendChild($titleText);
-
-
- if($wms_row['wms_getlegendurl'] <> "" AND $wms_row['wms_getlegendurl'] <> NULL){
+
+
+ if($wms_row['wms_getlegendurl'] <> "" AND $wms_row['wms_getlegendurl'] <> NULL){
$legendUrl = $doc->createElement("LegendURL");
$legendUrl = $style->appendChild($legendUrl);
$legendUrl->setAttribute("width", "10" );
@@ -1078,7 +1081,7 @@
}
-}
+}
#Creating "ScaleHint" node
if ($sub_layer_row['layer_minscale'] <> "" AND $sub_layer_row['layer_minscale'] <> NULL) {
$scaleHint = $doc->createElement("ScaleHint");
@@ -1088,6 +1091,6 @@
}
}
-header("Content-type: application/xhtml+xml; charset=UTF-8");
+header("Content-type: application/xml; charset=UTF-8");
echo $doc->saveXml();
-?>
+?>
Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php 2010-09-23 14:32:11 UTC (rev 6937)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php 2010-09-24 07:41:09 UTC (rev 6938)
@@ -371,42 +371,44 @@
}
if ($layerId) {
- $layer = $wms->getLayerById($layerId);
- if (!is_null($layer)) {
- $columns = array(
- "layer_abstract",
- "layer_title",
- "layer_keyword",
- "layer_md_topic_category_id",
- "layer_inspire_category_id",
- "layer_custom_category_id"
- );
-
- foreach ($columns as $c) {
- $value = $data->layer->$c;
- if ($c === "layer_keyword") {
- $layer->$c = explode(",", $value);
- foreach ($layer->$c as &$val) {
- $val = trim($val);
- }
+ try {
+ $layer = $wms->getLayerById($layerId);
+ }
+ catch (Exception $e) {
+ }
+ $columns = array(
+ "layer_abstract",
+ "layer_title",
+ "layer_keyword",
+ "layer_md_topic_category_id",
+ "layer_inspire_category_id",
+ "layer_custom_category_id"
+ );
+
+ foreach ($columns as $c) {
+ $value = $data->layer->$c;
+ if ($c === "layer_keyword") {
+ $layer->$c = explode(",", $value);
+ foreach ($layer->$c as &$val) {
+ $val = trim($val);
}
- elseif ($c === "layer_md_topic_category_id"
- || $c === "layer_inspire_category_id"
- || $c === "layer_custom_category_id"
- ) {
- if (!is_array($value)) {
- $layer->$c = array($value);
- }
- else {
- $layer->$c = $value;
- }
+ }
+ elseif ($c === "layer_md_topic_category_id"
+ || $c === "layer_inspire_category_id"
+ || $c === "layer_custom_category_id"
+ ) {
+ if (!is_array($value)) {
+ $layer->$c = array($value);
}
else {
- if (!is_null($value)) {
- $layer->$c = $value;
- }
+ $layer->$c = $value;
}
}
+ else {
+ if (!is_null($value)) {
+ $layer->$c = $value;
+ }
+ }
}
}
More information about the Mapbender_commits
mailing list