[Mapbender-commits] r6703 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Aug 5 11:46:43 EDT 2010
Author: christoph
Date: 2010-08-05 15:46:43 +0000 (Thu, 05 Aug 2010)
New Revision: 6703
Modified:
trunk/mapbender/http/javascripts/initWmcObj.php
Log:
prototypical implementation of LAYER parameter of GET API
Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php 2010-08-05 15:45:58 UTC (rev 6702)
+++ trunk/mapbender/http/javascripts/initWmcObj.php 2010-08-05 15:46:43 UTC (rev 6703)
@@ -19,14 +19,17 @@
}
}
-//check if WMS param can be found in SESSION, otherwise take it from GET
-if (Mapbender::session()->exists("WMS")) {
- $getParams['WMS'] = Mapbender::session()->get("WMS");
+function getConfiguration ($key) {
+ //check if key param can be found in SESSION,
+ // otherwise take it from GET
+ if (Mapbender::session()->exists($key)) {
+ return Mapbender::session()->get($key);
+ }
+ return $_GET[$key];
}
-else {
- $getParams['WMS'] = $_GET['WMS'];
-}
+$getParams["WMS"] = getConfiguration("WMS");
+
if ($getParams['WMS']) {
// WMS param given as array
if (is_array($getParams['WMS'])) {
@@ -98,6 +101,25 @@
$wmc->mergeWmsArray($wmsArray);
}
+$getParams["LAYER"] = getConfiguration("LAYER");
+
+if ($getParams["LAYER"]) {
+ // Layer param given as array
+ if (is_array($getParams['LAYER'])) {
+ $inputLayerArray = $getParams['LAYER'];
+ }
+ // Layer param given as comma separated list
+ else {
+ $inputLayerArray = split(",",$getParams['LAYER']);
+ }
+
+ // just make it work for a single layer id
+ $wmsFactory = new UniversalWmsFactory();
+ $layerId = intval($getParams["LAYER"]);
+ $wms = $wmsFactory->createLayerFromDb($layerId);
+ $wmc->mergeWmsArray(array($wms));
+}
+
$output = $wmc->wmsToJavaScript();
for ($i = 0; $i < count($output); $i++) {
More information about the Mapbender_commits
mailing list