[Mapbender-commits] r5968 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Apr 16 11:31:51 EDT 2010


Author: christoph
Date: 2010-04-16 11:31:50 -0400 (Fri, 16 Apr 2010)
New Revision: 5968

Modified:
   trunk/mapbender/http/plugins/mb_metadata_edit.html
   trunk/mapbender/http/plugins/mb_metadata_edit.js
   trunk/mapbender/http/plugins/mb_metadata_server.php
Log:


Modified: trunk/mapbender/http/plugins/mb_metadata_edit.html
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_edit.html	2010-04-16 15:31:08 UTC (rev 5967)
+++ trunk/mapbender/http/plugins/mb_metadata_edit.html	2010-04-16 15:31:50 UTC (rev 5968)
@@ -1,107 +1,166 @@
+<!--
+<style type="text/css">
+     * {
+        font-family: Verdana;
+        font-size: 96%;
+    }
+    
+    label {
+        width: 250px;
+        float: left;
+    }
+    
+    p {
+        clear: both;
+    }
+    
+    em {
+        font-weight: bold;
+        padding-right: 1em;
+        vertical-align: top;
+    }
+</style>
+-->
 <fieldset class="ui-widget">
-	<legend>Service level metadata</legend>
-	<p>
-		<label for="wms_title">WMS Title (OWS)</label>
-		<em>*</em><input title="WMS Title" id="wms_title" name="wms_title">
-		<img src="../img/misc/inspire_eu_klein.png"></img>
-	</p>
-	<p>
-      <label for="wms_abstract">WMS Abstract (OWS)</label>
-      <input title="WMS Abstract" id="wms_abstract" name="wms_abstract">
-      <img src="../img/misc/inspire_eu_klein.png"></img>
-	</p>
-</fieldset>
-<table>
-<tbody>
-    <tr>
-      <td>WMS Kewords (OWS)</td>
-      <td><input class="required" title="WMS Kewords" name=""></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-    <tr>
-      <td>WMS Fees (OWS)</td>
-      <td><input title="WMS Fees" name="fees"></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-    <tr>
-      <td>WMS AccessConstraints (OWS)</td>
-      <td><input title="WMS AccessConstraints" name="accessconstraints"></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-    <tr>
-      <td>WMS Predefined Licence (Registry)</td>
-      <td><input class="required" title="WMS Predefined Licence" name=""></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-    <tr>
-      <td>WMS Provider Section (OWS)</td>
-      <td></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Individual Name (OWS)</td>
-      <td><input title="Contact Individual Name" name="contactperson"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Position Name (OWS)</td>
-      <td><input title="Contact Position Name" name="contactposition"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Phone Voice (OWS)</td>
-      <td><input title="Contact Phone Voice" name="contactvoicetelephone"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Phone Fax (OWS)</td>
-      <td><input title="Contact Phone Fax" name="contactfacsimiletelephone"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Organisation (WMS)</td>
-      <td><input title="Contact Organisation" name="contactorganization"></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-    <tr>
-      <td>Contact Address (WMS)</td>
-      <td><input title="Contact Address" name="address"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact City (WMS)</td>
-      <td><input title="Contact City" name="city"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact State or Province (WMS) - ISO 3166-II</td>
-      <td><input title="Contact State or Province" name="stateorprovince"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Post Code (WMS)</td>
-      <td><input title="Contact Post Code" name="postcode"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Post Country (WMS) - ISO 3166</td>
-      <td><input title="Contact Post Country" name="country"></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Contact Electronic Mail Address (WMS)</td>
-      <td><input title="Contact Electronic Mail Address" name="contactelectronicmailaddress"></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-    <tr>
-      <td>Date of first registration (Registry)</td>
-      <td><input class="required" title="Date of first registration" name=""></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-    <tr>
-      <td>Date of last revision (Registry)</td>
-      <td><input class="required" title="Date of last revision" name=""></td>
-      <td><img src="../img/misc/inspire_eu_klein.png"></img></td>
-    </tr>
-  </tbody>
-</table>
\ No newline at end of file
+    <legend>
+        Service Level Metadata
+    </legend>
+    <p>
+        <label for="wms_title">
+            WMS Title (OWS)
+        </label>
+        <em>*</em>
+        <input name="wms_title" id="wms_title" class="required"/><img src="../img/misc/inspire_eu_klein.png">
+        </img>
+    </p>
+    <p>
+        <label for="wms_abstract">
+            WMS Abstract (OWS)
+        </label>
+        <input name="wms_abstract" id="wms_abstract"/><img src="../img/misc/inspire_eu_klein.png">
+        </img>
+    </p><i>
+        <p>
+            <label for="">
+                WMS Kewords (OWS)
+            </label>
+            <input name=" "id=""/><img src="../img/misc/inspire_eu_klein.png">
+            </img>
+        </p>
+    </i>
+    <p>
+        <label for="fees">
+            WMS Fees (OWS)
+        </label>
+        <input name="fees" id="fees"/><img src="../img/misc/inspire_eu_klein.png">
+        </img>
+    </p>
+    <p>
+        <label for="accessconstraints">
+            WMS AccessConstraints (OWS)
+        </label>
+        <input name="accessconstraints" id="accessconstraints"/><img src="../img/misc/inspire_eu_klein.png">
+        </img>
+    </p><i>
+        <p>
+            <label for="">
+                WMS Predefined Licence (Registry)
+            </label>
+            <input name="" id""/><img src="../img/misc/inspire_eu_klein.png">
+            </img>
+        </p>
+    </i>
+    <p>
+        <label>
+            WMS Provider Section (OWS)
+        </label>
+    </p>
+    <p>
+        <label for="contactperson">
+            Contact Individual Name (OWS)
+        </label>
+        <input name="contactperson" id="contactperson"/>
+    </p>
+    <p>
+        <label for="contactposition">
+            Contact Position Name (OWS)
+        </label>
+        <input name="contactposition" id="contactposition"/>
+    </p>
+    <p>
+        <label for="contactvoicetelephone">
+            Contact Phone Voice (OWS)
+        </label>
+        <input name="contactvoicetelephone" id="contactvoicetelephone"/>
+    </p>
+    <p>
+        <label for="contactfacsimiletelephone">
+            Contact Phone Fax (OWS)
+        </label>
+        <input name="contactfacsimiletelephone" id="contactfacsimiletelephone"/>
+    </p>
+    <p>
+        <label for="contactorganization">
+            Contact Organisation (WMS)
+        </label>
+        <input name="contactorganization" id="contactorganization"/><img src="../img/misc/inspire_eu_klein.png">
+        </img>
+    </p>
+    <p>
+        <label for="address">
+            Contact Address (WMS)
+        </label>
+        <input name="address" id="address"/>
+    </p>
+    <p>
+        <label for="city">
+            Contact City (WMS)
+        </label>
+        <input name="city" id="city"/>
+    </p>
+    <p>
+        <label for="stateorprovince">
+            Contact State or Province (WMS) - ISO 3166-II
+        </label>
+        <input name="stateorprovince" id="stateorprovince"/>
+    </p>
+    <p>
+        <label for="postcode">
+            Contact Post Code (WMS)
+        </label>
+        <input name="postcode" id="postcode"/>
+    </p>
+    <p>
+        <label for="country">
+            Contact Post Country (WMS) - ISO 3166
+        </label>
+        <input name="country" id="country"/>
+    </p>
+    <p>
+        <label for="contactelectronicmailaddress">
+            Contact Electronic Mail Address (WMS)
+        </label>
+        <input name="contactelectronicmailaddress" id="contactelectronicmailaddress" class="required email"/><img src="../img/misc/inspire_eu_klein.png">
+        </img>
+    </p><i>
+        <p>
+            <label for="">
+                Date of first registration (Registry)
+            </label>
+            <input name="" id=""/><img src="../img/misc/inspire_eu_klein.png">
+            </img>
+        </p>
+    </i><i>
+        <p>
+            <label for="">
+                Date of last revision (Registry)
+            </label>
+            <td>
+            <input name="" id=""/><img src="../img/misc/inspire_eu_klein.png">
+            </img>
+        </p>
+    </i>
+    <p>
+        <input class="submit" type="submit" value="Submit"/>
+    </p>
+</fieldset>
\ No newline at end of file

Modified: trunk/mapbender/http/plugins/mb_metadata_edit.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_edit.js	2010-04-16 15:31:08 UTC (rev 5967)
+++ trunk/mapbender/http/plugins/mb_metadata_edit.js	2010-04-16 15:31:50 UTC (rev 5968)
@@ -20,28 +20,69 @@
  */
 
 var $metadataEdit = $(this);
+var $metadataForm = $("<form></form>").appendTo($metadataEdit);
 
 var MetadataEditApi = function (o) {
+	var that = this;
+	var validator;
+	var originalMessages = $.extend({}, jQuery.validator.messages);
+	
+	var setLanguage = function (languageCode) {
+		var url = "../extensions/jquery-validate/localization/messages_" + languageCode + ".js";
+		if (!Mapbender.phpjs.file_exists(url)) {
+			jQuery.extend(jQuery.validator.messages, originalMessages);
+			that.valid();
+			return;
+		}
+		$.get(url , function (js) {
+			if (js) {
+				eval(js);
+				that.valid();
+			}
+		});		
+	};
+
+	this.valid = function () {
+		if (validator && validator.numberOfInvalids() > 0) {
+			$metadataForm.valid();
+		}
+	};
+
+	this.init = function () {
+		$metadataForm.load("../plugins/mb_metadata_edit.html", function () {
+			validator = $metadataForm.validate();
+		});
+	};
+	
 	this.edit = function (obj) {
 		// empty form
 
 		// get metadata from server
 		var req = new Mapbender.Ajax.Request({
 			url: "../plugins/mb_metadata_server.php",
-			method: "getWms",
+			method: "getWmsMetadata",
 			parameters: {
+				"id": obj.wmsId
 			},
 			callback: function (obj, result, message) {
 				if (!result) {
 					return;
 				}
-				console.log(obj);
+				$metadataForm.easyform("reset");
+				$metadataForm.easyform("fill", obj);
 			}
 		});
 		req.send();		
-		// fill form
-
 	};
+	
+	this.init();
+	
+	Mapbender.events.localize.register(function () {
+		setLanguage(Mapbender.locale.substr(0, 2));
+	});
+	Mapbender.events.init.register(function () {
+		setLanguage(Mapbender.locale.substr(0, 2));
+	});
 };
 
 $metadataEdit.mapbender(new MetadataEditApi(options));

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2010-04-16 15:31:08 UTC (rev 5967)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2010-04-16 15:31:50 UTC (rev 5968)
@@ -57,7 +57,7 @@
 		$ajaxResponse->setSuccess(true);
 		break;
 
-	case "getWms" :
+	case "getWmsMetadata" :
 		$wmsId = $ajaxResponse->getParameter("id");
 		getWms($wmsId);
 
@@ -69,8 +69,9 @@
 		$res = db_query($sql);
 
 		$resultObj = array();
-		while ($row = db_fetch_row($res)) {
-			$resultObj[]= $row;
+		while ($row = db_fetch_assoc($res)) {
+			
+			$resultObj = $row;
 		}
 		$ajaxResponse->setResult($resultObj);
 		$ajaxResponse->setSuccess(true);



More information about the Mapbender_commits mailing list