[Commits] r2589 - in core/trunk/geoext: lib/GeoExt/widgets tests/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Tue Feb 1 18:39:05 CET 2011


Author: ahocevar
Date: 2011-02-01 18:39:05 +0100 (Tue, 01 Feb 2011)
New Revision: 2589

Modified:
   core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js
   core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html
Log:
update WMS legends after a forced layer redraw, even when the url comes from the GetCapabilities response. r=tschaub (closes #406)


Modified: core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js	2011-02-01 17:37:10 UTC (rev 2588)
+++ core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js	2011-02-01 17:39:05 UTC (rev 2589)
@@ -150,6 +150,10 @@
         }
         var params = this.baseParams || {};
         Ext.applyIf(params, {FORMAT: 'image/gif'});
+        if (layer.params._OLSALT) {
+            // update legend after a forced layer redraw
+            params._OLSALT = layer.params._OLSALT;
+        }
         if(url.indexOf('?') > 0) {
             url = Ext.urlEncode(params, url);
         }

Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html	2011-02-01 17:37:10 UTC (rev 2588)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html	2011-02-01 17:39:05 UTC (rev 2589)
@@ -164,7 +164,7 @@
         }
 
         function test_update(t) {
-            t.plan(8);
+            t.plan(9);
 
             // set up
 
@@ -239,6 +239,19 @@
                  "update does not use the legend href from the " +
                  "styles field if SLD is set in the layer params");
 
+            // #6
+            layerRecord.getLayer().mergeNewParams({
+                sld: null
+            });
+            // take url from record for next update
+            layerRecord.set("styles", [{legend: {href: "foo?wms"}}]);
+            l.update();
+            var oldUrl = l.getComponent("c").url
+            layerRecord.getLayer().redraw(true);
+            t.eq(l.getComponent("c").url, oldUrl + "&_OLSALT=" + layerRecord.getLayer().params._OLSALT,
+                 "update adds random parameter to disable caching after forced redraw");
+            layerRecord.set("styles", null);
+
             // tear down
 
             l.destroy()



More information about the Commits mailing list