[Commits] r1268 - in core/trunk/geoext: lib/GeoExt/widgets tests/lib/GeoExt/widgets
commits at geoext.org
commits at geoext.org
Wed Jul 15 19:16:49 CEST 2009
Author: bartvde
Date: 2009-07-15 19:16:49 +0200 (Wed, 15 Jul 2009)
New Revision: 1268
Modified:
core/trunk/geoext/lib/GeoExt/widgets/LegendWMS.js
core/trunk/geoext/tests/lib/GeoExt/widgets/LegendPanel.html
Log:
support WMS layers with an array type LAYERS param, includes test case, thanks julien for the catch, non-functional change (closes #121)
Modified: core/trunk/geoext/lib/GeoExt/widgets/LegendWMS.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/LegendWMS.js 2009-07-15 17:05:26 UTC (rev 1267)
+++ core/trunk/geoext/lib/GeoExt/widgets/LegendWMS.js 2009-07-15 17:16:49 UTC (rev 1268)
@@ -99,7 +99,8 @@
* Add one BoxComponent per sublayer to this panel.
*/
createLegend: function() {
- var layers = this.layer.params.LAYERS.split(",");
+ var layers = (this.layer.params.LAYERS instanceof Array) ?
+ this.layer.params.LAYERS : this.layer.params.LAYERS.split(",");
var styleNames = this.layer.params.STYLES &&
this.layer.params.STYLES.split(",");
var styles = this.record && this.record.get("styles");
Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/LegendPanel.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/LegendPanel.html 2009-07-15 17:05:26 UTC (rev 1267)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/LegendPanel.html 2009-07-15 17:16:49 UTC (rev 1268)
@@ -28,7 +28,7 @@
}
function test_legendurl(t) {
- t.plan(2);
+ t.plan(3);
var mapPanel = loadMapPanel();
var lp = new GeoExt.LegendPanel({
renderTo: 'legendpanel'});
@@ -48,6 +48,11 @@
t.eq(lp.items.length, 1, "Currently there are no legends for non WMS layers");
+ var wms = new OpenLayers.Layer.WMS("testArray", '/ows', {layers: ['a', 'b', 'c']});
+ mapPanel.map.addLayer(wms);
+
+ t.eq(lp.items.length, 2, "The legend panel can deal with WMS layers which have a LAYERS params which is an array");
+
lp.destroy();
mapPanel.destroy();
}
More information about the Commits
mailing list