[Mapbender-commits] r8181 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Oct 11 17:45:23 EDT 2011
Author: armin11
Date: 2011-10-11 14:45:23 -0700 (Tue, 11 Oct 2011)
New Revision: 8181
Modified:
trunk/mapbender/http/plugins/mb_metadata_layer.js
trunk/mapbender/http/plugins/mb_metadata_layerTree.js
trunk/mapbender/http/plugins/mb_metadata_server.php
trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
Log:
some enhancement to show symbols at the layertree elements
Modified: trunk/mapbender/http/plugins/mb_metadata_layer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.js 2011-10-10 09:53:41 UTC (rev 8180)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.js 2011-10-11 21:45:23 UTC (rev 8181)
@@ -142,7 +142,9 @@
}
});
};
-
+ this.getWmsId = function() {
+ return wmsId;
+ }
this.init = function (obj) {
delete layerId;
Modified: trunk/mapbender/http/plugins/mb_metadata_layerTree.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layerTree.js 2011-10-10 09:53:41 UTC (rev 8180)
+++ trunk/mapbender/http/plugins/mb_metadata_layerTree.js 2011-10-11 21:45:23 UTC (rev 8181)
@@ -45,12 +45,23 @@
} else {
annex = set.attr.layer_title;
}
+ //following things can be done to show icons in the title element - problem: if the span is clicked, the checkbox is set an no layer is selected - TODO should be fixed
+ /*leafTitle = "<span>";
+ if (set.attr.layer_coupling != 0) {
+ //create html annex to title element
+ leafTitle = leafTitle+"<img src=\"../img/osgeo_graphics/geosilk/link.png\" title=\"coupled\">";
+ //annex = set.attr.layer_title;
+ }
+ if (set.attr.inspire_cats != 0) {
+ leafTitle = leafTitle+"<img width=\"15\" height=\"15\" src=\"../img/inspire_tr_36.png\" title=\"INSPIRE classified\">";
+ }
+ leafTitle = leafTitle+set.attr.layer_title+"</span>";*/
return {
attr: {
data: $.toJSON(set.attr)
},
data: {
- title: annex
+ title: leafTitle
}
};
};
Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php 2011-10-10 09:53:41 UTC (rev 8180)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php 2011-10-11 21:45:23 UTC (rev 8181)
@@ -223,7 +223,7 @@
$sql = <<<SQL
-SELECT layer_id, layer_name, layer_title, layer_abstract, layer_searchable
+SELECT layer_id, layer_name, layer_title, layer_abstract, layer_searchable, fkey_wms_id as wms_id
FROM layer WHERE layer_id = $layerId;
SQL;
@@ -308,7 +308,7 @@
$sql = <<<SQL
-SELECT layer_id, f_count_layer_couplings(layer_id) as count_coupling, layer_pos, layer_parent, layer_name, layer_title, layer_abstract, layer_searchable
+SELECT layer_id, f_count_layer_couplings(layer_id) as count_coupling, f_collect_inspire_cat_layer(layer_id) AS inspire_cats, layer_pos, layer_parent, layer_name, layer_title, layer_abstract, layer_searchable
FROM layer WHERE fkey_wms_id = $wmsId ORDER BY layer_pos;
SQL;
@@ -324,6 +324,12 @@
$left = 1;
function createNode ($left, $right, $row) {
+ $inspireCatsArray = explode(",",str_replace("}","",str_replace("{","",$row["inspire_cats"])));
+ if (count($inspireCatsArray) >= 0) {
+ $inspireCats = 1;
+ } else {
+ $inspireCats = 0;
+ }
return array(
"left" => $left,
"right" => $right,
@@ -335,7 +341,8 @@
"layer_title" => $row["layer_title"],
"layer_abstract" => $row["layer_abstract"],
"layer_searchable" => intval($row["layer_searchable"]),
- "layer_coupling" => intval($row["count_coupling"])
+ "layer_coupling" => intval($row["count_coupling"]),
+ "inspire_cats" => intval($inspireCats)
)
);
}
Modified: trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js 2011-10-10 09:53:41 UTC (rev 8180)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js 2011-10-11 21:45:23 UTC (rev 8181)
@@ -9,6 +9,7 @@
var that = this;
var layerId;
var metadataId;
+ //var wmsId;
//Function, which pulls the metadata out off the mapbender registry and give a possibility to edit the record or link
this.valid = function () {
if (validator && validator.numberOfInvalids() > 0) {
@@ -32,6 +33,7 @@
}
$metadataAddonForm.easyform("reset");
$metadataAddonForm.easyform("fill", obj);
+
//that.showForm(metadataId, layerId);
/*
//enable link element to edit link!
@@ -161,55 +163,18 @@
if (!result) {
return;
}
+ //this.wmsId = obj.wms_id;
//delete metadataURL entries
$('.metadataEntry').remove();
- //fill MetadataURLs into metadata_selectbox_id
- that.fillMetadataURLs(obj);
+ //fill MetadataURLs into metadata_selectbox_id - notice: the name of the module is fix!
+ Mapbender.modules.mb_md_layer.fillMetadataURLs(obj);
+ //reload layer tree for showing symbols
+ Mapbender.modules.mb_md_layer_tree.init(Mapbender.modules.mb_md_layer.getWmsId());
}
});
req.send();
};
-
- //function generate updated metadataUrl entries TODO: this function is defined in mb_metadata_layer.js before but it cannot be called - maybe s.th. have to be changed
- this.fillMetadataURLs = function (obj) {
- layerId = obj.layer_id;
- //for size of md_metadata records:
- for (i=0;i<obj.md_metadata.metadata_id.length;i++) {
- if (obj.md_metadata.origin[i] == "capabilities") {
- $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/osgeo_graphics/geosilk/server_map.png' title='capabilities'/></td><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"' target='_blank'>"+obj.md_metadata.uuid[i]+"</a></td><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"&validate=true' target='_blank'>validate</a></td><td></td></tr>").appendTo($("#metadataTable"));
- }
- if (obj.md_metadata.origin[i] == "external") {
- $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/osgeo_graphics/geosilk/link.png' title='linkage'/><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"' target='_blank'>"+obj.md_metadata.uuid[i]+"</a></td><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"&validate=true' target='_blank'>validate</a></td><td><img class='' title='edit' src='../img/pencil.png' onclick='initMetadataAddon("+obj.md_metadata.metadata_id[i]+","+layerId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteAddedMetadata("+obj.md_metadata.metadata_id[i]+","+layerId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
- }
- if (obj.md_metadata.origin[i] == "upload") {
- $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/button_blue_red/up.png' title='uploaded data'/><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"' target='_blank'>"+obj.md_metadata.uuid[i]+"</a></td><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"&validate=true' target='_blank'>validate</a></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteAddedMetadata("+obj.md_metadata.metadata_id[i]+","+layerId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
- }
- if (obj.md_metadata.origin[i] == "metador") {
- $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/gnome/edit-select-all.png' title='metadata'/><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"' target='_blank'>"+obj.md_metadata.uuid[i]+"</a></td><td><a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id="+obj.md_metadata.uuid[i]+"&validate=true' target='_blank'>validate</a></td><td><img class='' title='edit' src='../img/pencil.png' onclick='initMetadataAddon("+obj.md_metadata.metadata_id[i]+","+layerId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteAddedMetadata("+obj.md_metadata.metadata_id[i]+","+layerId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
- }
- }
- $("<img class='metadataEntry' title='new' src='../img/add.png' onclick='initMetadataAddon("+obj.md_metadata.metadata_id[i]+","+layerId+",true);return false;'/>").appendTo($("#metadataTable"));
- }
-
- getWmsId = function(layerId){
- var req = new Mapbender.Ajax.Request({
- url: "../plugins/mb_metadata_server.php",
- method: "getWmsIdByLayerId",
- parameters: {
- "layerId": layerId
- },
- callback: function (obj, result, message) {
- if (!result) {
- return;
- }
- return obj;
- }
- });
- req.send();
- }
-
-
deleteAddedMetadata = function(metadataId, layerId){
// push metadata from server
var req = new Mapbender.Ajax.Request({
@@ -221,23 +186,23 @@
callback: function (obj, result, message) {
if (!result) {
return;
- }
+ }
//delete metadataURL entries
$('.metadataEntry').remove();
//fill MetadataURLs into metadata_selectbox_id
//update layer form to show edited data
that.fillLayerForm(layerId);
- //alert(getWmsId(layerId));
+ //alert(wmsId);
$("<div></div>").text(message).dialog({
modal: true
});
}
});
req.send();
- //Mapbender.modules.mb_md_layer_tree.init(950); klappt ganz gut aber wo steht die wms_id
+
+
}
-
this.showForm = function (metadataId, layerId, isNew) {
$metadataAddonPopup.append($metadataAddonForm);
$metadataAddonPopup.dialog({
More information about the Mapbender_commits
mailing list