[Mapbender-commits] r9968 - in trunk/mapbender/http: classes javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Oct 1 08:37:16 PDT 2018
Author: armin11
Date: 2018-10-01 08:37:16 -0700 (Mon, 01 Oct 2018)
New Revision: 9968
Modified:
trunk/mapbender/http/classes/class_elementVar.php
trunk/mapbender/http/javascripts/initWmcObj.php
Log:
Fix error when element var 'removeUnaccessableLayers' is missing in loadwmc module
Modified: trunk/mapbender/http/classes/class_elementVar.php
===================================================================
--- trunk/mapbender/http/classes/class_elementVar.php 2018-09-28 16:27:54 UTC (rev 9967)
+++ trunk/mapbender/http/classes/class_elementVar.php 2018-10-01 15:37:16 UTC (rev 9968)
@@ -34,6 +34,7 @@
$this->applicationId = func_get_arg(0);
$this->elementId = func_get_arg(1);
$this->name = func_get_arg(2);
+ $this->success = false;
$this->load();
}
catch (Exception $e) {
@@ -94,14 +95,19 @@
$v = array($this->applicationId, $this->elementId, $this->name);
$t = array("s", "s", "s");
$res = db_prep_query($sql, $v, $t);
-
- if ($row = db_fetch_array($res)) {
- $this->value = $row["var_value"];
- $this->context = $row["context"];
- $this->type = $row["var_type"];
+ try {
+ $row = db_fetch_array($res);
+ if ($row !== false) {
+ $this->value = $row["var_value"];
+ $this->context = $row["context"];
+ $this->type = $row["var_type"];
+ $this->success = true;
+ } else {
+ $this->success = false;
+ }
}
- else {
- throw new Exception("no such element var");
+ catch (Exception $e) {
+ throw new Exception ("no such element var");
}
}
Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php 2018-09-28 16:27:54 UTC (rev 9967)
+++ trunk/mapbender/http/javascripts/initWmcObj.php 2018-10-01 15:37:16 UTC (rev 9968)
@@ -153,8 +153,10 @@
$removeUnaccessableLayers = false;
$removeUnaccessableLayers = new ElementVar($app, "loadwmc", "removeUnaccessableLayers");
-if ($wmcDocSession && $removeUnaccessableLayers->value === "1") {
- $removeUnaccessableLayers = true;
+if ($removeUnaccessableLayers->success == true){
+ if ($wmcDocSession && $removeUnaccessableLayers->value === "1") {
+ $removeUnaccessableLayers = true;
+ }
}
//TODO: if no GET API is given then don't do the following things
More information about the Mapbender_commits
mailing list