[Mapbender-commits] r9584 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 7 22:55:19 PDT 2016


Author: armin11
Date: 2016-09-07 22:55:19 -0700 (Wed, 07 Sep 2016)
New Revision: 9584

Modified:
   trunk/mapbender/http/php/mod_transformTimeDimension.php
Log:
Bugfix for handling string current in default attribute  for wms time dimension

Modified: trunk/mapbender/http/php/mod_transformTimeDimension.php
===================================================================
--- trunk/mapbender/http/php/mod_transformTimeDimension.php	2016-09-07 14:39:41 UTC (rev 9583)
+++ trunk/mapbender/http/php/mod_transformTimeDimension.php	2016-09-08 05:55:19 UTC (rev 9584)
@@ -41,8 +41,8 @@
 //$iso8601Pattern = '/^(?:[1-9]\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:Z|[+-][01]\d:[0-5]\d)$/i';
 if (isset($_REQUEST["default"]) & $_REQUEST["default"] != "") {
 	$testMatch = urldecode($_REQUEST["default"]);
-	if (!preg_match($iso8601Pattern,$testMatch)){
-		abort("The value for the default parameter is not a valid iso8601 dateTime string."); 	
+	if (!preg_match($iso8601Pattern,$testMatch) && $testMatch !== 'current'){
+		abort("The value for the default parameter is not a valid iso8601 dateTime string or has the value 'current'."); 	
  	}
 	$default = $testMatch;
 }
@@ -168,7 +168,11 @@
 					} else {
 						$result->data[0]->id = 0;
 						$result->data[0]->content = $default;
-						$result->data[0]->start = $default;
+						if ($default == 'current') {
+							$result->data[0]->start = $endTime->format('c');
+						} else {
+							$result->data[0]->start = $default;
+						}
 					}
 					//set options to make a moving of value possible
 					$result->options->editable->updateTime = true;
@@ -215,6 +219,7 @@
 			//use first and last entry as borders
 			$result->options->min = $extentArray[0];
 			$result->options->max = $extentArray[count($extentArray) - 1];
+			$result->options->editable = false;
 			$result->result->error = false;
 			$result->result->message = "All done";
 			break;



More information about the Mapbender_commits mailing list