Hi,

as far as I can tell, this issue has already been addressed. This is
the code from current master:

        var params = Ext.apply({}, this.baseParams);
        if (layer.params._OLSALT) {
            // update legend after a forced layer redraw
            params._OLSALT = layer.params._OLSALT;
        }
        url = Ext.urlAppend(url, Ext.urlEncode(params));
        if (url.toLowerCase().indexOf("request=getlegendgraphic") != -1) {
            if (url.toLowerCase().indexOf("format=") == -1) {
                url = Ext.urlAppend(url, "FORMAT=image%2Fgif");
            }
            // add scale parameter - also if we have the url from the record's
            // styles data field and it is actually a GetLegendGraphic request.
            if (this.useScaleParameter === true) {
                var scale = layer.map.getScale();
                url = Ext.urlAppend(url, "SCALE=" + scale);
            }
        }

For the scale though we don't check if the parameter is already there,
because you shouldn't have legend urls with SCALE if you set
useScaleParameter to true.

If you want to have the useScaleParameter behavior changed, it would
be best if you could create a pull request against master on
http://gitub.com/geoext/geoext.

Thanks,

Andreas.

On Mon, May 21, 2012 at 1:15 PM, Andrew Miller <a.j.mil...@bcs.org.uk> wrote:
> I have created a small path for WMSLegend.js.  Currently the FORMAT and
> SCALE parameters are being added to the URL twice if they are specified as
> parameters to the getLegendUrl function.  This patch corrects the code so
> that the default values are not appended if the parameters are already
> present.
>
> Do I need a Trac account to submit this patch?  I have attached the diff
> file below:
>
> Index: WMSLegend.js
> ===================================================================
> --- WMSLegend.js    (revision 725)
> +++ WMSLegend.js    (working copy)
> @@ -144,23 +144,23 @@
>                  TIME: null
>              });
>          }
> +        var params = Ext.apply({}, this.baseParams);
> +        if (layer.params._OLSALT) {
> +            // update legend after a forced layer redraw
> +            params._OLSALT = layer.params._OLSALT;
> +        }
> +        url = Ext.urlAppend(url, Ext.urlEncode(params));
>          if (url.toLowerCase().indexOf("request=getlegendgraphic") != -1) {
>              if (url.toLowerCase().indexOf("format=") == -1) {
>                  url = Ext.urlAppend(url, "FORMAT=image/gif");
>              }
>              // add scale parameter - also if we have the url from the
> record's
>              // styles data field and it is actually a GetLegendGraphic
> request.
> -            if (this.useScaleParameter === true) {
> +            if (this.useScaleParameter === true &&
> url.toLowerCase().indexOf("scale=") == -1) {
>                  var scale = layer.map.getScale();
>                  url = Ext.urlAppend(url, "SCALE=" + scale);
>              }
>          }
> -        var params = Ext.apply({}, this.baseParams);
> -        if (layer.params._OLSALT) {
> -            // update legend after a forced layer redraw
> -            params._OLSALT = layer.params._OLSALT;
> -        }
> -        url = Ext.urlAppend(url, Ext.urlEncode(params));
>
>          return url;
>      },
>
>
> _______________________________________________
> Dev mailing list
> Dev@geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
_______________________________________________
Dev mailing list
Dev@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/dev

Reply via email to