[Chameleon] Preserving open/close status between page loading

Mariette mariette.hachey at geonet-tech.com
Fri Jan 13 07:25:11 EST 2006


Greetings,
I have expanding/collapsing Javascript HTML legend and my issue is
preserving its expander status (whether layers are open ”expanded” or closed
“not expanded”) between page loads. 
The following is the code in my HTML document;
The hidden variable
<input type="hidden" name="ExpanderStatus" value="[$ExpanderStatus|$]">
 and the legend 
 <cwc2 type="LegendTemplate" visible="true" embedded="true"
popupstyleresource="TextButtons" template="legend_template.html" 
enabled="true" popupwidth="500" popupheight="400" status="false"
menubar="false">
 <script language="JavaScript" type="text/javascript">
  goExpanderManager.formElement = document.forms[0].ExpanderStatus;
   goExpanderManager.initialize();
 </script></cwc2>
 I am using jsExpander.css and jsExpander.js which can be found at this
posting
http://lists.maptools.org/pipermail/chameleon/2004-October/001458.html
 Here is my Legend Template
 [leg_group_html]
            <div class="cssClickable cssExpander cssGroup"
id="[leg_group_name]" onclick="this.expander.toggle()">
            <script langauge="JavaScript" type="text/javascript">
                        oGroup = new cExpander( CWCDHTML_GetLayer(
'[leg_group_name]', true ));
                        goExpanderManager.add( oGroup );
            </script>
            [leg_group_name]
            <img
src="http://localhost/Lunenburg/skins/default/icons/icon_legend.png"
border="0" style="margin-top: 2px;">
            </div>
[/leg_group_html]
 [leg_layer_html order=ascending opt_flag=15]
            <div class="cssClickable cssExpander cssLayer"
id="[leg_layer_name]" style="display:none">
            <script langauge="JavaScript" type="text/javascript">
                        oLayer = new cExpander( CWCDHTML_GetLayer(
'[leg_layer_name]', true ));
                        oGroup.addElement( oLayer );
            </script>
            <input type="radio" name="my_legend"
onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected value=1]
CHECKED[/if] >
            <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]>
                <img
onclick="document.getElementById('[leg_layer_name]').expander.toggle()"
src="http://localhost/Lunenburg/skins/default/icons/icon_legend.png"
border="0">
                [leg_layer_name]
            </div>
[/leg_layer_html]
 [leg_class_html opt_flag=15]
            <div class="cssExpander cssClass" id="[leg_class_name]"
style='display:none'>
            <script langauge="JavaScript" type="text/javascript">
                        oClass = new cExpander( CWCDHTML_GetLayer(
'[leg_class_name]', true ));
                        oLayer.addElement( oClass );
            </script>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <script langauge="JavaScript" type="text/javascript">
                        var class_name = "[leg_class_name]";
                        var first = class_name.substring(0,1);
                        var last = class_name.substring(1);
                        if (first == "_")
                                    {
                                    document.write ("<b>"+last+"</b>");
                                    }
                           else
                                    {
                                    document.write ('<img src="[leg_icon
width=20 height=18]" width="20" height="18">');
                                    document.write ('&nbsp;');
                                    document.write ('<a
href="javascript:openNewWindow(&#039;[metadata
name=base][leg_class_name]&#039;);" title="Click here for more information
about the [leg_class_name] Class">');
                                    document.write ('[leg_class_name]');
                                    document.write ('</a>');
                                    }
            </script></div>
[/leg_class_html]
 All other aspects of the legend are working properly, I just cant seem to
put my finger on the issue.
Thank You
Mariette Hachey
GIS Technologist
 



More information about the Chameleon mailing list