[Mapbender-commits] r8340 - in trunk/mapbender: http/img
http/plugins resources/db/pgsql/UTF-8/update
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu May 3 10:54:48 EDT 2012
Author: armin11
Date: 2012-05-03 07:54:48 -0700 (Thu, 03 May 2012)
New Revision: 8340
Added:
trunk/mapbender/http/img/edit-select-all-ilink.png
trunk/mapbender/http/img/link-ilink.png
trunk/mapbender/http/img/server_map-ilink.png
trunk/mapbender/http/img/up-ilink.png
Modified:
trunk/mapbender/http/plugins/mb_metadata_addon.php
trunk/mapbender/http/plugins/mb_metadata_featuretype.js
trunk/mapbender/http/plugins/mb_metadata_showMetadataAddonWfs.js
trunk/mapbender/http/plugins/mb_metadata_submit.js
trunk/mapbender/http/plugins/mb_metadata_wfs_server.php
trunk/mapbender/http/plugins/mb_metadata_wfs_submit.js
trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
Log:
More work on the wfs metadata editor for inspire download services. Now entries from mb_metadata can also be used to be linked to featuretypes.
Added: trunk/mapbender/http/img/edit-select-all-ilink.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/edit-select-all-ilink.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/mapbender/http/img/link-ilink.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/link-ilink.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/mapbender/http/img/server_map-ilink.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/server_map-ilink.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/mapbender/http/img/up-ilink.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/up-ilink.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/mapbender/http/plugins/mb_metadata_addon.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_addon.php 2012-05-02 15:15:55 UTC (rev 8339)
+++ trunk/mapbender/http/plugins/mb_metadata_addon.php 2012-05-03 14:54:48 UTC (rev 8340)
@@ -9,6 +9,7 @@
<table><tr><td><img src='../img/osgeo_graphics/geosilk/link.png' title='linkage' onclick='$("#addonChooser").css("display","none");$("#link_editor").css("display","block");$("#kindOfMetadataAddOn").attr("value","link");' /></td><td><?php echo _mb("Add URL to existing Metadataset");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Here someone can add a url to an existing metadata record, which is available over www. The record can either be harvested and pushed to the own catalogue service or it is only used as a link. This links are pushed into the service metadata record and the new capabilities document.");?>'}" src="../img/questionmark.png" alt="" /></td></tr>
<tr><td><img src='../img/gnome/edit-select-all.png' title='metadata' onclick='$("#addonChooser").css("display","none");$("#simple_metadata_editor").css("display","block");$("#kindOfMetadataAddOn").attr("value","metadataset");' /></td><td><?php echo _mb("Add a simple metadata record which is mostly generated from given layer information");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("With this option someone can generate a very simple metadata record for the data which is distributed thru the wms layer. The record fulfills only the INSPIRE Metadata Regulation! Most of the needed data is pulled from the service, layer and group information of the owner of the service. The metadate will be created on the fly. It is not stored in the database!");?>'}" src="../img/questionmark.png" alt="" /></td></tr>
<tr><td><img onclick='initUploadForm();' src='../img/button_blue_red/up.png' id='uploadImage' title='upload' /></td><td><?php echo _mb("Add a simple metadata record from a local file");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("With this option someone can upload an existing metadata record and couple it to the layer. The uploaded data is pushed to the catalogue and will be available for searching. The uploaded data is not fully controlled and validated. It cannot be edited but must be replaced with a new record if needed!");?>'}" src="../img/questionmark.png" alt="" /></td></tr>
+ <tr><td><img src='../img/osgeo_graphics/geosilk/link.png' title='linkage' onclick='getOwnedMetadata();$("#addonChooser").css("display","none");$("#internal_link").css("display","block");$("#kindOfMetadataAddOn").attr("value","internallink");' /></td><td><?php echo _mb("Linkage to existing internal Metadataset");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Here someone can add a linkage to an existing internal metadata record, which is also available over www. This link is also pushed into the service metadata record and the new capabilities document.");?>'}" src="../img/questionmark.png" alt="" /></td></tr>
</table>
</p>
</fieldset>
@@ -22,6 +23,12 @@
</p>
</fieldset>
+ <!--fieldset for internal link form-->
+ <fieldset id="internal_link" name="internal_link" type="hidden" style="display: none">
+ <legend><?php echo _mb("Internal Link");?></legend>
+ <select name="internal_relation" id="internal_relation" /></select>
+
+ </fieldset>
<!--fieldset for upload metadata form-->
<fieldset id="metadata_upload" name="metadata_upload" type="hidden" style="display: none">
<legend><?php echo _mb("Metadata upload");?></legend>
Modified: trunk/mapbender/http/plugins/mb_metadata_featuretype.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_featuretype.js 2012-05-02 15:15:55 UTC (rev 8339)
+++ trunk/mapbender/http/plugins/mb_metadata_featuretype.js 2012-05-03 14:54:48 UTC (rev 8340)
@@ -105,20 +105,37 @@
featuretypeId = obj.featuretype_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]+","+featuretypeId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteAddedMetadata("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");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]+","+featuretypeId+");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]+","+featuretypeId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteAddedMetadata("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
- }
+ if (obj.md_metadata.origin[i] == "capabilities") {
+ if (obj.md_metadata.internal[i] == 1) {
+ $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/server_map-ilink.png' title='link to metadata from 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><td><img class='' title='delete' src='../img/cross.png' onclick='deleteInternalMetadataLinkage("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
+ } else {
+ $("<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") {
+ if (obj.md_metadata.internal[i] == 1) {
+ $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/link-ilink.png' title='link to external 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]+","+featuretypeId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteInternalMetadataLinkage("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
+ } else {
+ $("<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]+","+featuretypeId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteAddedMetadata("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
+ }
+ }
+ if (obj.md_metadata.origin[i] == "upload") {
+ if (obj.md_metadata.internal[i] == 1) {
+ $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/up-ilink.png' title='link to external 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='deleteInternalMetadataLinkage("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
+ } else {
+ $("<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]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
+ }
+ }
+ if (obj.md_metadata.origin[i] == "metador") {
+ if (obj.md_metadata.internal[i] == 1) {
+ $("<tr class='metadataEntry'><td>"+obj.md_metadata.metadata_id[i]+"</td><td><img src='../img/edit-select-all-ilink.png' title='link to external edited 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]+","+featuretypeId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteInternalMetadataLinkage("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
+ } else {
+ $("<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]+","+featuretypeId+",false);return false;'/></td><td><img class='' title='delete' src='../img/cross.png' onclick='deleteAddedMetadata("+obj.md_metadata.metadata_id[i]+","+featuretypeId+");return false;'/></td></tr>").appendTo($("#metadataTable"));
+ }
+ }
}
$("<img class='metadataEntry' title='new' src='../img/add.png' onclick='initMetadataAddon("+obj.md_metadata.metadata_id[i]+","+featuretypeId+",true);return false;'/>").appendTo($("#metadataTable"));
+
}
this.enableResetButton = function () {
@@ -150,6 +167,11 @@
return wfsId;
}
+ this.getFeaturetypeId = function() {
+ return featuretypeId;
+ }
+
+
this.init = function (obj) {
delete featuretypeId;
//delete metadataURL entries
Modified: trunk/mapbender/http/plugins/mb_metadata_showMetadataAddonWfs.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadataAddonWfs.js 2012-05-02 15:15:55 UTC (rev 8339)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadataAddonWfs.js 2012-05-03 14:54:48 UTC (rev 8340)
@@ -61,6 +61,35 @@
});
req.send();
}
+
+ getOwnedMetadata = function (){
+ // get metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_wfs_server.php",
+ method: "getOwnedMetadata",
+ parameters: {
+ "featuretypeId": Mapbender.modules.mb_md_featuretype.getFeaturetypeId()
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //fill options for of internal linkages
+ $("#internal_relation").empty();
+ var emptyOption = '<option value="">---</option>';
+ $("#internal_relation").append(emptyOption);
+ for ( var i=0 ; i<obj.length ; i++ ) {
+ var optionVal = obj[i].metadataId;
+ var optionName = obj[i].metadataId + " : " + obj[i].metadataTitle;
+ var optionHtml = "<option value='" + optionVal + "'>" + optionName + "</option>";
+ $("#internal_relation").append(optionHtml);
+ }
+
+ }
+ });
+ req.send();
+ }
+
this.getAddedMetadata = function(metadataId, featuretypeId){
// get metadata from server
var req = new Mapbender.Ajax.Request({
@@ -202,8 +231,37 @@
req.send();
- }
+ }
+ deleteInternalMetadataLinkage = function(metadataId, featuretypeId){
+ // push metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_wfs_server.php",
+ method: "deleteInternalMetadataLinkage",
+ parameters: {
+ "metadataId": metadataId,
+ "featuretypeId": featuretypeId
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //delete metadataURL entries
+ $('.metadataEntry').remove();
+ //fill MetadataURLs into metadata_selectbox_id
+ //update featuretype form to show edited data
+ that.fillFeaturetypeForm(featuretypeId);
+ //alert(wfsId);
+ $("<div></div>").text(message).dialog({
+ modal: true
+ });
+ }
+ });
+ req.send();
+
+
+ }
+
this.showForm = function (metadataId, featuretypeId, isNew) {
$metadataAddonPopup.append($metadataAddonForm);
$metadataAddonPopup.dialog({
@@ -280,6 +338,7 @@
$("#addonChooser").css("display","block");
//get initial values (title/abstract)
that.getInitialFeaturetypeMetadata(metadataId, featuretypeId);
+
}
that.showForm(metadataId, featuretypeId, isNew);
$("#uploadImage").click(function () {
Modified: trunk/mapbender/http/plugins/mb_metadata_submit.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_submit.js 2012-05-02 15:15:55 UTC (rev 8339)
+++ trunk/mapbender/http/plugins/mb_metadata_submit.js 2012-05-03 14:54:48 UTC (rev 8340)
@@ -54,6 +54,7 @@
});
return;
}
+ Mapbender.modules.mb_md_layer_tree.init(Mapbender.modules.mb_md_layer.getWmsId());
$("<div></div>").text(message).dialog({
modal: true
});
Modified: trunk/mapbender/http/plugins/mb_metadata_wfs_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_wfs_server.php 2012-05-02 15:15:55 UTC (rev 8339)
+++ trunk/mapbender/http/plugins/mb_metadata_wfs_server.php 2012-05-03 14:54:48 UTC (rev 8340)
@@ -263,7 +263,7 @@
}
//get MetadataURLs from md_metadata table
$sql = <<<SQL
-SELECT metadata_id, uuid, link, linktype, md_format, origin FROM mb_metadata
+SELECT metadata_id, uuid, link, linktype, md_format, origin, relation.internal FROM mb_metadata
INNER JOIN (SELECT * from ows_relation_metadata
WHERE fkey_featuretype_id = $featuretypeId ) as relation ON
mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.origin IN ('capabilities','external','metador','upload')
@@ -274,6 +274,7 @@
$resultObj["md_metadata"]->origin = array();
$resultObj["md_metadata"]->linktype = array();
$resultObj["md_metadata"]->link = array();
+ $resultObj["md_metadata"]->internal = array();
$i = 0;
while ($row = db_fetch_assoc($res)) {
$resultObj["md_metadata"]->metadata_id[$i]= $row["metadata_id"];
@@ -281,6 +282,7 @@
$resultObj["md_metadata"]->uuid[$i]= $row["uuid"];
$resultObj["md_metadata"]->origin[$i]= $row["origin"];
$resultObj["md_metadata"]->linktype[$i]= $row["linktype"];
+ $resultObj["md_metadata"]->internal[$i]= $row["internal"];
$i++;
}
@@ -481,6 +483,33 @@
$ajaxResponse->setMessage("Metadata updated!");
$ajaxResponse->setSuccess(true);
break;
+
+ case "getOwnedMetadata" :
+ $featuretypeId = $ajaxResponse->getParameter("featuretypeId");
+
+ $user = new User(Mapbender::session()->get("mb_user_id"));
+ //$e = new mb_exception("plugins/mb_metadata_wfs_server.php: user_id: ".$user->id);
+ $sql = <<<SQL
+
+SELECT metadata_id, title, fkey_featuretype_id FROM mb_metadata INNER JOIN ows_relation_metadata ON ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id WHERE fkey_mb_user_id = $1 AND fkey_featuretype_id IS DISTINCT FROM $2 ORDER BY metadata_id ASC
+
+SQL;
+ $v = array($user->id, $featuretypeId);
+ $t = array('i','i');
+ $res = db_prep_query($sql,$v,$t);
+ $row = array();
+ $resultObj = array();
+ $i = 0;
+ while ($row = db_fetch_assoc($res)) {
+ $resultObj[$i]->metadataId = $row['metadata_id']; //integer
+ $resultObj[$i]->metadataTitle = $row["title"]; //char
+ $i++;
+ }
+
+ $ajaxResponse->setResult($resultObj);
+ $ajaxResponse->setSuccess(true);
+ break;
+
case "insertFeaturetypeMetadataAddon" :
$featuretypeId = $ajaxResponse->getParameter("featuretypeId");
$data = $ajaxResponse->getParameter("data");
@@ -489,6 +518,25 @@
//use this to distinguish between the to different inserts!
//this insert should also push one entry in the ows_relation_metadata table! - after the insert into md_metadata
//origin
+ if ($data->kindOfMetadataAddOn == 'internallink') {
+ //insert a simple relation to an internal metadata entry - but how can this be distinguished?
+ //we need a new column with type of relation - maybe called internal
+
+ $sql = <<<SQL
+
+INSERT INTO ows_relation_metadata (fkey_metadata_id, fkey_featuretype_id, internal) VALUES ( $1, $2, $3)
+
+SQL;
+ $v = array($data->internal_relation,$featuretypeId, 1);
+ $t = array('i','i','i');
+ $res = db_prep_query($sql,$v,$t);
+ if (!$res){
+ abort(_mb("Could not insert internal metadatalink into database!"));
+ }
+ $ajaxResponse->setMessage("Metadatalink inserted!");
+ $ajaxResponse->setSuccess(true);
+ break;
+ }
if ($data->kindOfMetadataAddOn == 'link') {
//generate metador entry
$origin = 'external';
@@ -754,6 +802,31 @@
$ajaxResponse->setSuccess(true);
}
break;
+
+ case "deleteInternalMetadataLinkage" :
+ $metadataId = $ajaxResponse->getParameter("metadataId");
+ $featuretypeId = $ajaxResponse->getParameter("featuretypeId");
+ $sql = <<<SQL
+
+DELETE FROM ows_relation_metadata WHERE fkey_metadata_id = $1 and fkey_featuretype_id = $2 and internal = 1
+
+SQL;
+ $v = array($metadataId, $featuretypeId);
+ $t = array('i','i');
+ try {
+ $res = db_prep_query($sql,$v,$t);
+ }
+ catch (Exception $e){
+ $ajaxResponse->setSuccess(false);
+ $ajaxResponse->setMessage(_mb("Could not delete internal metadata linkage from database!"));
+ $ajaxResponse->send();
+ die;
+ }
+ $ajaxResponse->setMessage("Internal metadata linkage deleted!");
+ $ajaxResponse->setSuccess(true);
+
+ break;
+
case "deleteFeaturetypeMetadataAddon" :
$metadataId = $ajaxResponse->getParameter("metadataId");
$sql = <<<SQL
Modified: trunk/mapbender/http/plugins/mb_metadata_wfs_submit.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_wfs_submit.js 2012-05-02 15:15:55 UTC (rev 8339)
+++ trunk/mapbender/http/plugins/mb_metadata_wfs_submit.js 2012-05-03 14:54:48 UTC (rev 8340)
@@ -51,6 +51,7 @@
});
return;
}
+ Mapbender.modules.mb_md_featuretype_tree.init(Mapbender.modules.mb_md_featuretype.getWfsId());
$("<div></div>").text(message).dialog({
modal: true
});
Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql 2012-05-02 15:15:55 UTC (rev 8339)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql 2012-05-03 14:54:48 UTC (rev 8340)
@@ -386,3 +386,8 @@
COST 100;
ALTER FUNCTION f_collect_inspire_cat_wfs_featuretype(integer) OWNER TO postgres;
+ALTER TABLE ows_relation_metadata ADD COLUMN internal INTEGER;
+
+
+
+
More information about the Mapbender_commits
mailing list