[Mapbender-commits] r8175 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Oct 3 09:01:04 EDT 2011
Author: armin11
Date: 2011-10-03 06:01:03 -0700 (Mon, 03 Oct 2011)
New Revision: 8175
Modified:
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:
Extent layer tree for howing coupling information
Modified: trunk/mapbender/http/plugins/mb_metadata_layerTree.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layerTree.js 2011-10-03 09:55:57 UTC (rev 8174)
+++ trunk/mapbender/http/plugins/mb_metadata_layerTree.js 2011-10-03 13:01:03 UTC (rev 8175)
@@ -38,12 +38,19 @@
};
var createLeaf = function (set) {
+ if (set.attr.layer_coupling != 0) {
+ //create html annex to title element
+ //annex = set.attr.layer_title+" - "+set.attr.layer_coupling+" x coupled";
+ annex = set.attr.layer_title;
+ } else {
+ annex = set.attr.layer_title;
+ }
return {
attr: {
data: $.toJSON(set.attr)
},
data: {
- title: set.attr.layer_title
+ title: annex
}
};
};
@@ -114,6 +121,8 @@
"checkbox" :{
"check_recursively": false
},
+ "core" : {"html_titles" : true},
+
"plugins" : [ "themes", "json_data", "ui", "checkbox" ]
});
Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php 2011-10-03 09:55:57 UTC (rev 8174)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php 2011-10-03 13:01:03 UTC (rev 8175)
@@ -308,10 +308,13 @@
$sql = <<<SQL
-SELECT layer_id, layer_pos, layer_parent, layer_name, layer_title, layer_abstract, layer_searchable
+SELECT layer_id, f_count_layer_couplings(layer_id) as count_coupling, layer_pos, layer_parent, layer_name, layer_title, layer_abstract, layer_searchable
FROM layer WHERE fkey_wms_id = $wmsId ORDER BY layer_pos;
SQL;
+
+
+
$res = db_query($sql);
$rows = array();
@@ -331,7 +334,8 @@
"layer_name" => $row["layer_name"],
"layer_title" => $row["layer_title"],
"layer_abstract" => $row["layer_abstract"],
- "layer_searchable" => intval($row["layer_searchable"])
+ "layer_searchable" => intval($row["layer_searchable"]),
+ "layer_coupling" => intval($row["count_coupling"])
)
);
}
@@ -611,6 +615,26 @@
$ajaxResponse->setResult($resultObj);
$ajaxResponse->setSuccess(true);
break;
+case "getInitialLayerMetadata" :
+ $layerId = $ajaxResponse->getParameter("layerId");
+ $metadataId = $ajaxResponse->getParameter("metadataId");
+ $sql = <<<SQL
+
+SELECT layer_title, layer_abstract from layer where layer_id = $1
+
+SQL;
+ $v = array($layerId);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $row = array();
+ if ($res) {
+ $row = db_fetch_assoc($res);
+ $resultObj["title"]= $row['layer_title']; //serial
+ $resultObj["abstract"] = $row["layer_abstract"]; //char
+ }
+ $ajaxResponse->setResult($resultObj);
+ $ajaxResponse->setSuccess(true);
+ break;
case "updateLayerMetadataAddon" :
$layerId = $ajaxResponse->getParameter("layerId");
$metadataId = $ajaxResponse->getParameter("metadataId");
Modified: trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js 2011-10-03 09:55:57 UTC (rev 8174)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js 2011-10-03 13:01:03 UTC (rev 8175)
@@ -17,7 +17,47 @@
}
return true;
};
+ this.getInitialLayerMetadata = function(metadataId, layerId){
+ // get metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getInitialLayerMetadata",
+ parameters: {
+ "layerId": layerId,
+ "metadataId": metadataId
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ $metadataAddonForm.easyform("reset");
+ $metadataAddonForm.easyform("fill", obj);
+ //that.showForm(metadataId, layerId);
+ /*
+ //enable link element to edit link!
+ $("#link").removeAttr("disabled");
+ switch (obj.origin) {
+ case "external":
+ $("#metadataUrlEditor").css("display","block");
+ $("#link_editor").css("display","block");
+ break;
+ case "metador":
+ $("#metadataUrlEditor").css("display","block");
+ $("#simple_metadata_editor").css("display","block");
+ break;
+ case "capabilities":
+ $("#metadataUrlEditor").css("display","block");
+ $("#simple_metadata_editor").css("display","block");
+ break;
+ default:
+ break;
+ }
+ */
+ }
+ });
+ req.send();
+ }
this.getAddedMetadata = function(metadataId, layerId){
// get metadata from server
var req = new Mapbender.Ajax.Request({
@@ -250,8 +290,12 @@
$("#metadataUrlEditor").css("display","block");
$("#addonChooser").css("display","block");
$("#uploadImage").attr('onclick', 'initUploadForm('+layerId+')');
+ //get initial values (title/abstract)
+ that.getInitialLayerMetadata(metadataId, layerId);
}
that.showForm(metadataId, layerId, isNew);
+ //TODO: make the fields resizable
+ //$( "#abstract" ).resizable({ minWidth: 75 });
});
//upload form
More information about the Mapbender_commits
mailing list