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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Jul 13 23:04:01 PDT 2019


Author: armin11
Date: 2019-07-13 23:04:01 -0700 (Sat, 13 Jul 2019)
New Revision: 10182

Modified:
   trunk/mapbender/http/classes/class_wmc.php
   trunk/mapbender/http/javascripts/map.php
   trunk/mapbender/http/javascripts/mod_loadwmc.js
   trunk/mapbender/http/php/mod_loadwmc_server.php
   trunk/mapbender/http/plugins/jq_upload.js
   trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
Log:
New option to prohibit update of wms urls and layer name/titles when loading a wmc - needed if the wmc is from another mapbender installation! jq_upload has now an optional checkbox field.

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2019-07-09 04:40:52 UTC (rev 10181)
+++ trunk/mapbender/http/classes/class_wmc.php	2019-07-14 06:04:01 UTC (rev 10182)
@@ -1395,8 +1395,13 @@
 			$e = new mb_notice("class_wmc.php: Updated load_count of layers in wmc!");
 			return true;
 		}*/
-		$monitor = new Layer_load_count();
-		$monitor->incrementMultiLayers($layerIdArray);
+		if (is_array($layerIdArray) && count($layerIdArray) > 0) {
+			$monitor = new Layer_load_count();
+			$monitor->incrementMultiLayers($layerIdArray);
+			return true;
+		} else {
+			return false;
+		}
 	}
 
 	//http://stackoverflow.com/questions/3361036/php-simplexml-insert-node-at-certain-position

Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php	2019-07-09 04:40:52 UTC (rev 10181)
+++ trunk/mapbender/http/javascripts/map.php	2019-07-14 06:04:01 UTC (rev 10182)
@@ -90,9 +90,8 @@
 		die;
 	}
 }
-
+//unset($_GET['WMS']);
 echo "var getParams = ".json_encode($_GET).";";
-
 //
 // Load internal JavaScript libraries
 //

Modified: trunk/mapbender/http/javascripts/mod_loadwmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_loadwmc.js	2019-07-09 04:40:52 UTC (rev 10181)
+++ trunk/mapbender/http/javascripts/mod_loadwmc.js	2019-07-14 06:04:01 UTC (rev 10182)
@@ -69,7 +69,8 @@
 	"labelDisplayWmc": "display WMC XML",
 	"labelWmcDocument": "WMC Document",
 	"labelOpenLayersExport": "export to OpenLayers",
-	"confirmLoadAnyway": "load Service anyway?"
+	"confirmLoadAnyway": "load Service anyway?",
+	"labelUploadCheckbox": "Update URLs and layer name/titles"
 };
 
 var translatedI18nObject = Mapbender.cloneObject(originalI18nObject);
@@ -823,11 +824,15 @@
 					executeJavaScript({
 						method: "loadWmcFromFile",
 						parameters: {
-							filename: filename
+							filename: filename,
+							checkboxvalue: $("#" + options.id + "_wmcUpload_checkbox").is(':checked')
 						},
 						message: translatedI18nObject.messageLoadSuccess
 					});
-				}
+				},
+				displayCheck: true,
+				displayCheckTitle: translatedI18nObject.labelUploadCheckbox,
+				displayCheckChecked: "checked"
 			});
 		}
 
@@ -847,6 +852,10 @@
 */
 	};
 
+/*	var getCheckboxStatus = function (checkBoxId) {
+		return $("#" + checkBoxId).is(':checked');
+	};
+*/
 	var constraintCheckRequired = function () {
 		return options.checkLayerIdExists
 			|| options.checkLayerIdValid

Modified: trunk/mapbender/http/php/mod_loadwmc_server.php
===================================================================
--- trunk/mapbender/http/php/mod_loadwmc_server.php	2019-07-09 04:40:52 UTC (rev 10181)
+++ trunk/mapbender/http/php/mod_loadwmc_server.php	2019-07-14 06:04:01 UTC (rev 10182)
@@ -131,9 +131,14 @@
 			$ajaxResponse->setSuccess(false);
 		}
 		$wmc->createFromXml($wmcDoc);
-
-		$updatedWMC = $wmc->updateUrlsFromDb();
-        	$wmc->createFromXml($updatedWMC);
+		/*$e = new mb_exception("value from checkbox: ".json_encode($ajaxResponse->getParameter("checkboxvalue")));
+		$e = new mb_exception("value from checkbox: ".gettype($ajaxResponse->getParameter("checkboxvalue")));*/
+		//only update urls and layer names if this is explicitly wished! If the wmc is from another mapbender installation, the resource ids are others - they are not bind to the installation til now!
+		$e = new mb_notice("php/loadwmc_server.php: Try to update URLs and layer/names: ".json_encode($ajaxResponse->getParameter("checkboxvalue")));
+		if ($ajaxResponse->getParameter("checkboxvalue")) {
+			$updatedWMC = $wmc->updateUrlsFromDb();
+        		$wmc->createFromXml($updatedWMC);
+		}
         	$jsArray = $wmc->toJavaScript();
 		if ($jsArray) {
 			$resultObj["javascript"] = $jsArray;

Modified: trunk/mapbender/http/plugins/jq_upload.js
===================================================================
--- trunk/mapbender/http/plugins/jq_upload.js	2019-07-09 04:40:52 UTC (rev 10181)
+++ trunk/mapbender/http/plugins/jq_upload.js	2019-07-14 06:04:01 UTC (rev 10182)
@@ -29,6 +29,11 @@
 		var timeinterval = options.interval || 200;
 		// we want the default to be true, and we want the user to be able to write {displaySubmit: false}
 		var displaySubmit = options.displaySubmit === undefined ? true : !!options.displaySubmit;
+		// new 2019-07: allow a flexible checkbox *********************************************************************
+		var displayCheck = options.displayCheck === undefined ? false : !!options.displayCheck;
+		var displayCheckTitle = options.displayCheckTitle === undefined ? "checkbox title" : options.displayCheckTitle;
+		var displayCheckChecked = options.displayCheckChecked === undefined ? "checked" : options.displayCheckChecked;
+		// ************************************************************************************************************
 		var url = options.url || "../plugins/jq_upload.php";
 		var width = options.width || 30;
 
@@ -100,6 +105,8 @@
 
 				(displaySubmit ? "<input id='" + id + "_submit' type='submit' value='Upload' />": "") + 
 
+				(displayCheck ? "<br><input id='" + id + "_checkbox' name='" + id + "_checkbox' type='checkbox' checked='"+ displayCheckChecked +"' > " + displayCheckTitle : "") + 
+
 			"</span>"
 		);
 		var iframeStr = "<iframe name='" + id + "_target' id='" + id + "_target' src='../html/mod_blank.html' " + 

Modified: trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2019-07-09 04:40:52 UTC (rev 10181)
+++ trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2019-07-14 06:04:01 UTC (rev 10182)
@@ -4320,4 +4320,7 @@
 msgid "Notice"
 msgstr "Hinweis"
 
+msgid "Update URLs and layer name/titles"
+msgstr "Aktualisiere URLs und Namen/Titel der Layer"
 
+



More information about the Mapbender_commits mailing list