[Mapbender-commits] r6155 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon May 10 11:28:00 EDT 2010
Author: christoph
Date: 2010-05-10 11:28:00 -0400 (Mon, 10 May 2010)
New Revision: 6155
Modified:
trunk/mapbender/http/plugins/mb_metadata_edit.php
trunk/mapbender/http/plugins/mb_metadata_layer.html
trunk/mapbender/http/plugins/mb_metadata_layer.js
trunk/mapbender/http/plugins/mb_metadata_server.php
trunk/mapbender/http/plugins/mb_metadata_submit.js
Log:
Modified: trunk/mapbender/http/plugins/mb_metadata_edit.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_edit.php 2010-05-10 15:27:27 UTC (rev 6154)
+++ trunk/mapbender/http/plugins/mb_metadata_edit.php 2010-05-10 15:28:00 UTC (rev 6155)
@@ -2,6 +2,7 @@
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
?>
<fieldset class="ui-widget">
+ <input name="wms_id" id="wms_id" type="hidden"/>
<legend>Service Level Metadata: <img class="help-dialog" help="{text:'Noch ein Text.'}" src="../img/questionmark.png"></img></legend>
<p>
@@ -21,7 +22,7 @@
</p>
<p>
<label for="wms_keywords">WMS Keywords (OWS):</label>
- <input name="wms_keywords" id="wms_keywords"/>
+ <input readonly="readonly" name="wms_keywords" id="wms_keywords"/>
<img class="metadata_img" src="../img/misc/inspire_eu_klein.png"></img>
</p>
<p>
@@ -105,12 +106,12 @@
</p>
<p>
<label for="wms_timestamp_create">Date of first registration (Registry):</label>
- <input disabled="disabled" name="wms_timestamp_create" id="wms_timestamp_create"/>
+ <input readonly="readonly" name="wms_timestamp_create" id="wms_timestamp_create"/>
<img class="metadata_img" src="../img/misc/inspire_eu_klein.png"></img>
</p>
<p>
<label for="wms_timestamp">Date of last revision (Registry):</label>
- <td><input disabled="disabled" name="wms_timestamp" id="wms_timestamp"/>
+ <td><input readonly="readonly" name="wms_timestamp" id="wms_timestamp"/>
<img class="metadata_img" src="../img/misc/inspire_eu_klein.png"></img>
</p>
</fieldset>
Modified: trunk/mapbender/http/plugins/mb_metadata_layer.html
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.html 2010-05-10 15:27:27 UTC (rev 6154)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.html 2010-05-10 15:28:00 UTC (rev 6155)
@@ -11,7 +11,7 @@
<label for="layer_id">Number of Layer (Registry):</label>
<span class="metadata_span"></span>
<span class="metadata_span"></span>
- <input disabled="disabled" name="layer_id" id="layer_id"/>
+ <input readonly="readonly" name="layer_id" id="layer_id"/>
</p>
<p>
<label for="layer_title">Layer Title (WMS):</label>
Modified: trunk/mapbender/http/plugins/mb_metadata_layer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.js 2010-05-10 15:27:27 UTC (rev 6154)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.js 2010-05-10 15:28:00 UTC (rev 6155)
@@ -65,9 +65,9 @@
this.fillForm = function (obj) {
// layer data
- for (var i in obj) {
- $("#" + i).val(obj[i]);
- }
+ $metadataForm.easyform("reset");
+ $metadataForm.easyform("fill", obj);
+ return;
// layer keywords
var req = new Mapbender.Ajax.Request({
url: "../plugins/mb_metadata_server.php",
Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php 2010-05-10 15:27:27 UTC (rev 6154)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php 2010-05-10 15:28:00 UTC (rev 6155)
@@ -105,11 +105,11 @@
$keywordSql = <<<SQL
-SELECT keyword FROM keyword, layer_keyword
+SELECT DISTINCT keyword FROM keyword, layer_keyword
WHERE keyword_id = fkey_keyword_id AND fkey_layer_id IN (
SELECT layer_id from layer, wms
- WHERE layer_pos = 0 AND fkey_wms_id = wms_id AND wms_id = $wmsId
-)
+ WHERE fkey_wms_id = wms_id AND wms_id = $wmsId
+) ORDER BY keyword
SQL;
@@ -341,6 +341,76 @@
break;
+ case "save":
+ $data = $ajaxResponse->getParameter("data");
+
+ try {
+ $wmsId = intval($data->wms->wms_id);
+ }
+ catch (Exception $e) {
+ $ajaxResponse->setSuccess(false);
+ $ajaxResponse->setMessage(_mb("Invalid WMS ID."));
+ $ajaxResponse->send();
+ }
+ getWms($wmsId);
+
+ $wms = new wms();
+ $wms->createObjFromDBNoGui($wmsId);
+
+ $columns = array(
+ "wms_abstract",
+ "wms_title",
+ "fees",
+ "accessconstraints",
+ "contactperson",
+ "contactposition",
+ "contactvoicetelephone",
+ "contactfacsimiletelephone",
+ "contactorganization",
+ "address",
+ "city",
+ "stateorprovince",
+ "postcode",
+ "country",
+ "contactelectronicmailaddress"
+ );
+ foreach ($columns as $c) {
+ $value = $data->wms->$c;
+ if (!is_null($value)) {
+ $wms->$c = $value;
+ }
+ }
+
+ try {
+ $layerId = intval($data->layer->layer_id);
+ }
+ catch (Exception $e) {
+ }
+
+ if ($layerId) {
+ $layer = $wms->getLayerById($layerId);
+ if (!is_null($layer)) {
+ $columns = array(
+ "layer_abstract",
+ "layer_title"
+ );
+
+ foreach ($columns as $c) {
+ $value = $data->layer->$c;
+ if (!is_null($value)) {
+ $layer->$c = $value;
+ }
+ }
+ }
+ }
+
+ $wms->updateObjInDB($wmsId);
+
+
+ $ajaxResponse->setMessage("Updated WMS metadata for ID " . $wmsId);
+ $ajaxResponse->setSuccess(true);
+
+ break;
default:
$ajaxResponse->setSuccess(false);
$ajaxResponse->setMessage(_mb("An unknown error occured."));
Modified: trunk/mapbender/http/plugins/mb_metadata_submit.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_submit.js 2010-05-10 15:27:27 UTC (rev 6154)
+++ trunk/mapbender/http/plugins/mb_metadata_submit.js 2010-05-10 15:28:00 UTC (rev 6155)
@@ -13,7 +13,23 @@
this.events.submit.trigger({
callback: serializeCallback
});
- console.log(formData);
+// console.log(formData);
+
+ // get metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "save",
+ parameters: {
+ "data": formData
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+
+ }
+ });
+ req.send();
};
this.events = {
More information about the Mapbender_commits
mailing list