[Mapbender-commits] r6170 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue May 11 08:43:04 EDT 2010
Author: christoph
Date: 2010-05-11 08:43:02 -0400 (Tue, 11 May 2010)
New Revision: 6170
Modified:
trunk/mapbender/http/plugins/mb_metadata_layer.js
trunk/mapbender/http/plugins/mb_metadata_layer.php
trunk/mapbender/http/plugins/mb_metadata_server.php
Log:
Modified: trunk/mapbender/http/plugins/mb_metadata_layer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.js 2010-05-11 11:33:43 UTC (rev 6169)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.js 2010-05-11 12:43:02 UTC (rev 6170)
@@ -20,11 +20,12 @@
*/
var $metadataLayer = $(this);
-var $metadataForm = $("<form>No WMS selected.</form>").appendTo($metadataLayer);
+var $metadataForm = $("<form>No layer selected.</form>").appendTo($metadataLayer);
var MetadataLayerApi = function (o) {
var that = this;
var validator;
+ var formReady = false;
this.valid = function () {
if (validator && validator.numberOfInvalids() > 0) {
@@ -48,21 +49,6 @@
submit: new Mapbender.Event()
};
- var initialized = function (obj) {
- for (var id in obj.categories) {
- var cat = obj.categories[id];
- var $select = $metadataForm.find("#" + id);
- for (var j = 0; j < cat.length; j++) {
- $select.append("<option value='" + cat[j][0] + "'>" + cat[j][1] + "</option>");
- }
- }
-
- that.events.initialized.trigger({
- wmsId: obj.wmsId
- });
- that.events.initialized.done = true;
- };
-
this.fillForm = function (obj) {
// layer data
$metadataForm.easyform("reset");
@@ -117,38 +103,34 @@
};
- this.init = function (obj) {
- if (!that.events.initialized.done) {
+ this.init = function (wmsId) {
+ var formData = arguments.length >= 2 ? arguments[1] : undefined;
+
+ if (!formReady) {
$metadataForm.load("../plugins/mb_metadata_layer.php", function () {
validator = $metadataForm.validate();
-
- var req = new Mapbender.Ajax.Request({
- url: "../plugins/mb_metadata_server.php",
- method: "getCategories",
- parameters: {
- "id": obj
- },
- callback: function(o, r, m) {
- if (!r) {
- return;
- }
- initialized($.extend({
- wmsId: obj
- }, o));
- }
+
+ that.events.initialized.trigger({
+ wmsId: wmsId
});
- req.send();
+ formReady = true;
+ // select layer in tree if set
+
+ // fill layer form if set
});
return;
}
that.events.initialized.trigger({
- wmsId: obj
+ wmsId: wmsId
});
};
Mapbender.events.localize.register(function () {
that.valid();
+ var formData = $metadataForm.easyform("serialize");
+ formReady = false;
+ that.init(wmsId, formData);
});
Mapbender.events.init.register(function () {
that.valid();
Modified: trunk/mapbender/http/plugins/mb_metadata_layer.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.php 2010-05-11 11:33:43 UTC (rev 6169)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.php 2010-05-11 12:43:02 UTC (rev 6170)
@@ -1,8 +1,6 @@
<?php
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
- $firephp->log($_SESSION);
-
function displayCategories ($sql) {
if (Mapbender::session()->get("mb_lang") === "de") {
$sql = str_replace("category_code_en", "category_code_de", $sql);
@@ -82,7 +80,7 @@
</p>
</fieldset>
</div>
-<div id="map">
+<div id="preview">
<fieldset class="">
<legend>Preview</legend>
<div id="map"></div>
Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php 2010-05-11 11:33:43 UTC (rev 6169)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php 2010-05-11 12:43:02 UTC (rev 6170)
@@ -139,37 +139,7 @@
$ajaxResponse->setSuccess(true);
break;
-
- case "getCategories":
- $resultObj = array(
- "categories" => array(
- "fkey_md_topic_category_id" => array(),
- "fkey_inspire_category_id" => array(),
- "fkey_custom_category_id" => array()
- )
- );
-
- $sql = "SELECT md_topic_category_id, md_topic_category_code_en FROM md_topic_category";
- $res = db_query($sql);
- while ($row = db_fetch_row($res)) {
- $resultObj["categories"]["fkey_md_topic_category_id"][]= $row;
- }
-
- $sql = "SELECT inspire_category_id, inspire_category_code_en FROM inspire_category";
- $res = db_query($sql);
- while ($row = db_fetch_row($res)) {
- $resultObj["categories"]["fkey_inspire_category_id"][]= $row;
- }
-
- $sql = "SELECT custom_category_id, custom_category_code_en FROM custom_category";
- $res = db_query($sql);
-
- while ($row = db_fetch_row($res)) {
- $resultObj["categories"]["fkey_custom_category_id"][]= $row;
- }
- $ajaxResponse->setResult($resultObj);
- $ajaxResponse->setSuccess(true);
- break;
+
case "getLayerMetadata" :
$layerId = $ajaxResponse->getParameter("id");
getLayer($layerId);
More information about the Mapbender_commits
mailing list