HTML Legend.
Bob Basques
bob.b at GRITECHNOLOGIES.COM
Fri Sep 22 18:48:56 PDT 2006
All,
Hi all, I've been using the HTML legend for a while now with very good
results, I have a check box system working nicely showing when a layer
is on/off, etc.
I was wondering, has anyone an example of setting it up to grey out a
checkbox if the scale of view is out of range (MINSCALE/MAXSCALE in the
mapfile). I have an idea of how it might be done, but not sure. Just
asking before I go at it from scratch.
Here is my Legend TEMPLATE as it stands now along with a typical MAPFILE
entry, and a sample output on the end:
MAPFILE ENTRY (one of many :c):
METADATA
LEGEND_TITLE "Census Tract Centroids"
LEGEND_META_GROUP "foreground"
LEGEND_DISPLAY_LEVEL "1"
END
LEGEND TEMPLATE:
[leg_header_html]
[/leg_header_html]
[leg_group_html]
[if name=first_foreground_layer oper=isset] <b>Foreground:</b> <br
/> [/if]
[if name=first_background_layer oper=isset] <b>Background:</b> <br
/> [/if]
[if name=legend_display_level oper=isset]
[if name=legend_display_level oper=neq value=-1]
[if name=layer_status oper=neq value=2]
<input alt="[leg_group_name] Control"
[if name=legend_meta_group oper=eq value=foreground] type="checkbox"
[/if]
[if name=legend_meta_group oper=eq value=background] type="radio" [/if]
name="layer" value="[leg_group_name]"
[if name=layer_status oper=neq value=0] checked="checked" [/if] />
[if name=group_maxscale oper=isset]
<input type="hidden" name="[leg_group_name]_Maxscale"
value="[metadata name=group_maxscale]" />
[/if]
[if name=group_minscale oper=isset]
<input type="hidden" name="[leg_group_name]_Minscale"
value="[metadata name=group_minscale]" />
[/if]
<img alt="[leg_group_name] Legend Image"
name="[leg_group_name]LegendImg" src="[leg_icon]" width="21"
height="14" />
[/if]
[if name=metadata_url oper=isset]
<a href='javascript:var temp = window.open("[metadata
name=METADATA_URL]", "meta",
"resizable,scrollbars,location,toolbar,height=300,width=500")'>
[/if]
[if name=legend_title oper=isset]
[metadata name=LEGEND_TITLE]
[/if]
[if name=metadata_url oper=isset]
</a>
[/if]
<br />
[/if]
[/if]
[/leg_group_html]
[leg_layer_html opt_flag=0]
[if name=legend_display_level oper=isset]
[if name=legend_display_level oper=eq value=2]
<img alt="Group Legend Image" src="[leg_icon]" width="21"
height="14" /><br /><span class="small">[leg_layer_name]</span><br />
[/if]
[/if]
[/leg_layer_html]
[leg_class_html opt_flag=0]
[if name=legend_display_level oper=isset]
[if name=legend_display_level oper=eq value=3]
<img alt="Class Legend Image" src="[leg_icon]" width="21"
height="14" /><br /><span class="small">[leg_class_name]</span><br />
[/if]
[/if]
[/leg_class_html]
[leg_footer_html]
[/leg_footer_html]
OUTPUT:
<input alt="bg_mntrct00_point Control"
type="checkbox" name="layer" value="bg_mntrct00_point" />
<img alt="bg_mntrct00_point Legend Image" name="bg_mntrct00_pointLegendImg" src="/tmp/view_27723_1158975512_22_0_20_12.png" width="21" height="14" />
Census Tract Centroids
<br />
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060922/d5158991/attachment.htm>
More information about the MapServer-users
mailing list