[Mapbender-commits] r7542 - in trunk/mapbender: http/javascripts http/plugins resources/locale/de_DE/LC_MESSAGES

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Feb 8 04:08:08 EST 2011


Author: armin11
Date: 2011-02-08 01:08:08 -0800 (Tue, 08 Feb 2011)
New Revision: 7542

Modified:
   trunk/mapbender/http/javascripts/mod_savewmc.js
   trunk/mapbender/http/javascripts/mod_savewmc.php
   trunk/mapbender/http/plugins/mb_metadata_select.js
   trunk/mapbender/http/plugins/mb_metadata_server.php
   trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
Log:
Allow to set network_access metadata in metadata editor and bugfixes for storing mapbender wmc to session

Modified: trunk/mapbender/http/javascripts/mod_savewmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.js	2011-02-07 13:55:01 UTC (rev 7541)
+++ trunk/mapbender/http/javascripts/mod_savewmc.js	2011-02-08 09:08:08 UTC (rev 7542)
@@ -98,7 +98,7 @@
 	this.extensionData = {};
 	
 	this.overwrite = overwrite;
-	
+	this.saveInSession = saveInSession;
 	this.events = {
 		saved: new Mapbender.Event()
 	};
@@ -131,7 +131,8 @@
 			extensionDataString = $.toJSON(that.extensionData);
 		}
 	
-		if (storeInSession) {
+		if (storeInSession == 1) {
+			//alert('AJAX will be set to asyncron!');
 			$.ajaxSetup({async:false}); 
 		}
 	
@@ -334,71 +335,72 @@
 			this.src = options.src;
 		}
 	});
-
 	Mapbender.events.afterInit.register(function(){
+		//check if wmc should be saved into session
 		if (saveInSession === 1) {
+			//if onbeforeunload should be supported use it!
 			if (browserCompatibilityMode === 0) {
+				//options.$target.each(function () {
+				var supportsOnbeforeunload = true; //TODO: The problem is the time for a job on onunload - there is not much. Therefor only simple things work - not saving a huge amount of data thru ajax
+				/*for (var prop in window) {
+    					if (prop === 'onbeforeunload') {
+    						supportsOnbeforeunload = true;
+    						break;
+    					}
+				}*/
+				//alert("Support of onBeforeUnload: "+supportsOnbeforeunload+" Browser:"+navigator.userAgent);
+				if (supportsOnbeforeunload) { 
+					//$(window).bind('beforeunload', function(){//after hint in web http://stackoverflow.com/questions/4376596/jquery-unload-or-beforeunload
+					window.onbeforeunload = function(e){//after hint in web http://stackoverflow.com/questions/4376596/jquery-unload-or-beforeunload
+						var e = e || window.event;
+						//alert("Write WMC to session - onBeforeUnload!");
+						if (!window.resetSession) {
+							that.save({
+								session : true
+							});
+							//pausecomp(1000); //hope that fix the synro problem
+							//alert("onbeforeunload: no reset of session stored wmc requested - wmc will be saved into session!");
+							alert(translatedI18nObj.labelSaveInSession);
+						}
+												// For IE and Firefox
+  						//if (e) {
+    						//	e.returnValue = 'Any string';
+  						//}
+  						// For Safari
+  						//return 'Any string';
+					};
+				} else {
+					$(window).bind('unload', function(){ 
+						//alert("Write WMC to session - onUnload!");
+						if (!window.resetSession) {
+							that.save({
+								session : true
+							});
+							//pausecomp(1000);
+							//alert("onunload: no reset of session stored wmc requested - wmc will be saved into session!");
+							alert(translatedI18nObj.labelSaveInSession);
+						}
+					}); 
+				}
+		} else {
+			//alert("Your are in a browser compatibility mode - this make the application slow!");
+			// hack to attach the eventhandler after all initial wms have been added to the map
+			setTimeout(function(){
 				options.$target.each(function () {
-					var supportsOnbeforeunload = true; //TODO: The problem is the time for a job on onunload - there is not much. Therefor only simple things work - not saving a huge amount of data thru ajax
-					/*for (var prop in window) {
-    						if (prop === 'onbeforeunload') {
-    							supportsOnbeforeunload = true;
-						
-    							break;
-    						}
-					}*/
-					//alert("Support of onBeforeUnload: "+supportsOnbeforeunload+" Browser:"+navigator.userAgent);
-					if (supportsOnbeforeunload) { 
-						//$(window).bind('beforeunload', function(){//after hint in web http://stackoverflow.com/questions/4376596/jquery-unload-or-beforeunload
-						window.onbeforeunload = function(e){//after hint in web http://stackoverflow.com/questions/4376596/jquery-unload-or-beforeunload
-							var e = e || window.event;
-							//alert("Write WMC to session - onBeforeUnload!");
-							if (!window.resetSession) {
-								that.save({
-									session : true
-								});
-								//alert("Save Context!");
-							}
-							pausecomp(1000); //hope that fix the synro problem
-							/*// For IE and Firefox
-  							if (e) {
-    								e.returnValue = 'Any string';
-  							}
-  							// For Safari
-  							return 'Any string';*/
-						}; 
-					} else {
-						$(window).bind('unload', function(){ 
-							//alert("Write WMC to session - onUnload!");
-							if (!window.resetSession) {
-								that.save({
-									session : true
-								});
-								//alert("no reset of session stored wmc requested - wmc will be saved into session!");
-							}
-						}); 
-					}
+					$(this).mapbender().events.afterMapRequest.register(function () {
+						if (!window.resetSession) {
+							that.save({
+								session : true
+							});
+							//alert('afterMapRequest Saving!');
+						}
+					});
 				});
-			} else {
-				//alert("Your are in a browser compatibility mode - this make the application slow!");
-				// hack to attach the eventhandler after all initial wms have been added to the map
-				setTimeout(function(){
-					options.$target.each(function () {
-						$(this).mapbender().events.afterMapRequest.register(function () {
-							if (!window.resetSession) {
-								that.save({
-									session : true
-								});
-								//alert("no reset of session stored wmc requested - wmc will be saved into session!");
-							}
-						});
-					});
-				},5000);
-			}
-			
-		}
-
+			},1500);	
+		}	
+	}
 	});
+	
 	Mapbender.events.init.register(function () {
 	
 		var t = translatedI18nObj;

Modified: trunk/mapbender/http/javascripts/mod_savewmc.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.php	2011-02-07 13:55:01 UTC (rev 7541)
+++ trunk/mapbender/http/javascripts/mod_savewmc.php	2011-02-08 09:08:08 UTC (rev 7542)
@@ -43,7 +43,8 @@
 	"labelCategories" => "Categories",
 	"labelCancel" => "Abort",
 	"labelSave" => "Save",
-	"title" => $e_title
+	"title" => $e_title,
+	"labelSaveInSession" => "Save configuration"
 );
 
 $translatedI18nObj = array();
@@ -88,4 +89,4 @@
 HTML;
 
 include(dirname(__FILE__) . "/../javascripts/mod_savewmc.js");
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/plugins/mb_metadata_select.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_select.js	2011-02-07 13:55:01 UTC (rev 7541)
+++ trunk/mapbender/http/plugins/mb_metadata_select.js	2011-02-08 09:08:08 UTC (rev 7542)
@@ -100,4 +100,4 @@
 
 $metadataSelect.mapbender(new MetadataSelectApi(options));
 
-$metadataSelect.mapbender("getData");
\ No newline at end of file
+$metadataSelect.mapbender("getData");

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2011-02-07 13:55:01 UTC (rev 7541)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2011-02-08 09:08:08 UTC (rev 7542)
@@ -45,7 +45,7 @@
 		$wmsList = implode(",", $wmsIdArray);
 		$sql = <<<SQL
 	
-SELECT wms.wms_id, wms.wms_title, wms.wms_timestamp, wms_version, m.status_comment
+SELECT wms.wms_id, wms.wms_title, to_timestamp(wms.wms_timestamp),to_timestamp(wms.wms_timestamp_create), wms_version, m.status_comment, wms_id
 FROM wms LEFT JOIN mb_wms_availability AS m
 ON wms.wms_id = m.fkey_wms_id 
 WHERE wms_id IN ($wmsList);
@@ -54,11 +54,13 @@
 		$res = db_query($sql);
 		$resultObj = array(
 			"header" => array(
-				"WMS ID",
-				"Titel",
-				"Timestamp",
-				"Version",
-				"Status"
+				_mb("WMS ID"),
+				_mb("title"),
+				_mb("last change"),
+				_mb("creation"),
+				_mb("version"),
+				_mb("status"),
+				_mb("wms id")
 			), 
 			"data" => array()
 		);

Modified: trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-02-07 13:55:01 UTC (rev 7541)
+++ trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-02-08 09:08:08 UTC (rev 7542)
@@ -1013,6 +1013,9 @@
 msgid "my lines"
 msgstr "meine Linien"
 
+msgid "Save configuration"
+msgstr "Konfiguration speichern"
+
 #: ../http/javascripts/mod_loadwmc.js:68
 msgid "List"
 msgstr "Liste"



More information about the Mapbender_commits mailing list