[Chameleon] zoom clears legend

Paul Spencer pagameba at magma.ca
Thu Aug 5 13:09:30 EDT 2004


Ken,

there is a specific thing you must do in the file called 
vtm_legend_template.html which is to name the checkboxes used as inputs 
to turn layers on and off.  And in particular, you must name them all 
the same, and the name must be:

legendlayername[]

The square brackets are very important, it tells PHP to interpret the 
checkboxes as an array of values.  If they are not included, PHP only 
reports the first value and it is substantially more difficult to get 
the other values.

The other thing you must do is to give each checkbox a value of the 
layer name, in particular:

[leg_layer_name]

Again, this is important, in this case, the MapServer legend template 
processor replaces this with the actual name of each layer (see the 
mapserver documentation on legend templates).

The samples all use the following to build checkboxes for layer 
visibility control ...

<input type="checkbox" name="legendlayername[]"
value="[leg_layer_name]"
     [if name=layer_status oper=eq  value=1]CHECKED[/if]
     [if name=layer_status oper=eq value=2]CHECKED[/if]>

If this is not the problem, please send your vtm_legend_template.html 
file along so I can take a look at it.

Ken-ichi wrote:

> Hi folks.  I just started using Chameleon 1.99b2 and I'm very very 
> excited about it.  I've been trying to adapt the very minimal tutorial 
> in the documentation section of the web site, adding a few widgets to 
> see how they work.  However, when I add the legendtemplate widget and I 
> zoom in, all the layers get turned off, resulting in a blank map.  
> Everything is fine when you first load the page, but when you zoom in or 
> zoom out or update the map, the layers get cleared.  Can anyone explain 
> this behavior?  This does not happen with any of the samples 
> applications in the samples/ directory.  I found that if I set the 
> legendtemplate_reset parameter in the URL to 0 the legend returns to 
> normal with all the layers turned on (it's normally blank).  I've 
> included my template file below if it'll be of any help.
> 
> Thanks in advance!
> 
> <html>
> <head>
>   <title>Widgets</title>
>   <link href="cwc2.css" rel="stylesheet" type="text/css">
> </head>
> 
> <body onload="CWC2OnLoadFunction()">
> 
> <form>
> 
>   <table>
>   <tr>
>       <td width="100">
>           <table><cwc2 type="LegendTemplate" visible="true" 
> embedded="true" template="vtm_legend_template.html" 
> popupstyleresource="TextButtons" popupwidth="500" popupheight="400" 
> status="false" menubar="false"/></table><br/>
>           <cwc2 type="UpdateMap" visible="true" 
> image="images/icon_update.gif" imagetip="update map" label="Update" 
> imagewidth="24" imageheight="24">
>               <image state="normal"/>
>               <image state="selected"/>
>               <image state="hover"/>
>           </cwc2>
>       </td>
>       <td colspan="3" align="center">
>           <CWC2 TYPE="MapDHTMLWidget" VISIBLE="true" width="400" 
> height="300" AllowResize="true" MarqueeColor="#FF3333" MarqueeWidth="2" 
> minscale="1"/>
>       </td>
>       <td valign="top">
>           <CWC2 TYPE="ZoomIn" visible="true" 
> Image="images/tool_zoomin_off.gif" 
> ImageSelected="images/tool_zoomin_on.gif" 
> ImageHover="images/tool_zoomin_over.gif" ImageTip="Zoom In" 
> ImageWidth="24" ImageHeight="24" ToolSet="Navigation"/><br/>
>            <CWC2 TYPE="ZoomOut" Visible="true" 
> Image="images/tool_zoomout_off.gif" 
> ImageSelected="images/tool_zoomout_on.gif" 
> ImageHover="images/tool_zoomout_over.gif" ImageTip="Zoom Out" 
> ImageWidth="24" ImageHeight="24" ToolSet="Navigation"/><br/>
>            <CWC2 TYPE="PanMap" Visible="true" 
> Image="images/tool_pan_off.gif" ImageSelected="images/tool_pan_on.gif" 
> ImageHover="images/tool_pan_over.gif" ImageTip="Pan" ImageWidth="24" 
> ImageHeight="24" ToolSet="Navigation"/>
>   </tr>
>   </table>
> 
> </form>
> 
> </body>
> 
> </html>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           pspencer at dmsolutions.ca   |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------



More information about the Chameleon mailing list