<DIV>
<DIV>
<DIV>
<DIV>Ok,</DIV>
<DIV> </DIV>
<DIV>Here is the solution (joined in jstreeview.rtf)</DIV>
<DIV>I have a treeview legend with expand/collapsed groups.</DIV>
<DIV>For this to work, In the map file, i have for instance for a layer</DIV>
<DIV> </DIV>
<DIV> METADATA<BR> "GROUP" "Hydrologie"<BR> "DESCRIPTION" "Mer"<BR> SHOWINLEGEND "0"<BR> LAYER_INDEX "0"<BR> END<BR></DIV>
<DIV>SHOWINLEGEND allows me to add a layer on the map without showing it in legend !!! ; i could put SHOWINLEGEND "1" in other layers or nothing.</DIV>
<DIV> </DIV>
<DIV>I also used JSAPI in my template in order to leave a group expanded when the users does it after refreshing the map (for Zoomin Zoom out etc...)</DIV>
<DIV><cwc2 type="cwcjsapi" debug="false"/><BR><cwc2 type="SharedResource" name="CWCJSAPI"/><BR>but an Update reload the page so I loose the environnement !</DIV>
<DIV>As I'm a basic user of javascript, i cannot go further !!</DIV>
<DIV> </DIV>
<DIV>I also noticed that the Scale widget <cwc2 type="Scale" /> don't work properly in this mode, it cannot write the scale ; it writes (undefined);</DIV>
<DIV>I checked sample_enhanced_jsapi.html and it's the same error !!!</DIV>
<DIV> </DIV>
<DIV>Hopping it could help someone !</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV> </DIV>
<DIV>Edith</DIV>
<DIV><BR><B><I>Paul Spencer <pspencer@dmsolutions.ca></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">cool!<BR><BR>You should post your whole solution :)<BR><BR>Paul<BR><BR>Edith TAKI wrote:<BR>> Hi Paul,<BR>> <BR>> It works !!!<BR>> <BR>> I needed to create a metadata for each layer to retrieve group name<BR>> and i changed the checkbox for the layer like this<BR>> id="layer-[metadata name=group]-[metadata name=layer_index]"<BR>> <BR>> Thank you !!!<BR>> <BR>> */Paul Spencer <PSPENCER@DMSOLUTIONS.CA>/* wrote:<BR>> <BR>> Edith,<BR>> <BR>> I would tackle this by doing the following:<BR>> <BR>> 1. add metadata to each of your layers called layer_index and make it<BR>> sequential 0 - nLayers<BR>> <BR>> 2. build your legend template file like this:<BR>> <BR>> [leg_group_html]<BR>> [leg_group_name]<BR>> <BR>> [/leg_group_html]<BR>> [leg_layer_html]<BR>> <BR>> onclick='toggleLayer( this
)'>[leg_layer_name]<BR>> <BR>> [/leg_layer_html]<BR>> <BR>> <BR>> 3. add a couple of javascript functions to your template<BR>> <BR>> function toggleGroup( obj )<BR>> {<BR>> var nLayers = 20; //set to number of layers in map file<BR>> for(i=0; i<BR>> {<BR>> var layer_cb = document.getElementById( 'layer_'+obj.name+'_'+i );<BR>> if (layer_cb)<BR>> layer_cb.! checked = obj.checked;<BR>> }<BR>> }<BR>> <BR>> function toggleLayer( obj )<BR>> {<BR>> var group = (obj.id.split( "_" ))[1];<BR>> var group_cb = document.getElementById( group );<BR>> //case 1: unchecked layer, can uncheck the group<BR>> if (group_cb)<BR>> {<BR>> if (!obj.checked)<BR>> {<BR>> group_cb.checked = false;<BR>> return;<BR>> }<BR>> else // now have to check all the layers in this group<BR>> {<BR>> var nLayers = 20; //set to number of layers in map file<BR>> for(i=0; i<BR>> {<BR>> layer_cb =
document.getElementById( 'layer_'group+'_'+i );<BR>> if (cb && !cb.checked) //stop if any are unchecked<BR>> {<BR>> group_cb.checked = false;<BR>> return;<BR>> }<BR>> }<BR>> group_cb.checked = true; //all checked, can turn on group<BR>> }<BR>> }<BR>> }<BR>> <BR>> Note this code is extremely rough and completely untested. Good Luck!!!<BR>> <BR>> Cheers<BR>> <BR>> Paul<BR>> <BR>> Edith TAKI wrote:<BR>> > Hi,<BR>> ><BR>> > Thank you Ferencik for your solution but you don"t need to<BR>> > select/unselect layers in a group for your soluti! on ...<BR>> ><BR>> > My legend is generated dynamicaly with mapfile and<BR>> legend_template and<BR>> > look like that<BR>> ><BR>> ><BR>> > Group 1<BR>> ><BR>> > * layer 1<BR>> > * layer 2<BR>> > * layer 3<BR>> ><BR>> > Group 2<BR>> ><BR>> > * layer1<BR>> > * layer2<BR>>
><BR>> ><BR>> > and i have a checkbox for each line ; those for layers are coded<BR>> like that :<BR>> ><BR>> ><BR>> > value="[leg_layer_name]"<BR>> > [if name=layer_status oper=eq value=1]CHECKED[/if]<BR>> > [if name=layer_status oper=eq value=2]CHECKED[/if]><BR>> ><BR>> ><BR>> ><BR>> > what i need now is to code the group so that a click on a group<BR>> could<BR>> > check ou uncheck the layers depending.<BR>> ><BR>> > For map refreshing, I used CWCJSAPI and i just solve the problem of<BR>> > navigation buttons like zoomin zoomout, they no longer refresh<BR>> all the page;<BR>> > Only Update button need now to reload the page b! ut I have no<BR>> idea for<BR>> > Javascript so it'll be difficult !!<BR>> ><BR>> > Thank you for your help<BR>> ><BR>> > */Jano Ferencik /* wrote:<BR>> ><BR>> > Hi Edith<BR>> ><BR>> > the
situation is like this..I created a javascript treemenu wich I<BR>> > am attaching<BR>> > to this email as a zip archive....you can modify and use it<BR>> > ....but....there are<BR>> > 2 things..<BR>> > 1 as long as The update Map widget refreshes the page You can do<BR>> > nothing about<BR>> > it... the menu will allways refresh and appear like on first<BR>> > load...you could<BR>> > solve this by creating some javascript handling some events...wich<BR>> > will keep the<BR>> > opened group open after refreshing....the script should use the<BR>> :active<BR>> > pseudoclass of group(wich in this case must be links)...(this is<BR>> > only an advice<BR>> > )...I though one tome to do it but could take me a loomng time as my<BR>> > javascript<BR>> > skills ! are only basic<BR>> ><BR>> > In my case I have another problem...I fave a huge number of layers<BR>> > in
may<BR>> > Chameleon application(about 50) and I created a legend on multiple<BR>> > levels...it<BR>> > is refreshing i! tself on Update Map and second I think that the<BR>> > number of layers<BR>> > conducted to decreasing of speed when loading the map....<BR>> > A possibble solution could be the new Ka-Map project from DM<BR>> > solutions(ie. the<BR>> > map doesn't refresh itslelf on the basic actions like panning or<BR>> > zooming or<BR>> > layer controls).....but you will have to wait for the application<BR>> > Ka-map to be<BR>> > released....i think it will happen soon(ask Paul Spencer about<BR>> this) :))<BR>> ><BR>> > Regards<BR>> ><BR>> ><BR>> > > Hi list,<BR>> > ><BR>> > > I have a problem similar to jstreeview ; I developped<BR>> > legendTemplate to show<BR>> > at page load only groups so the user could developp a group by<BR>> >
clicki! ng its id<BR>> > to show the layers in the group ; I have two problems :<BR>> > > 1 - using Javascript to hide / show layers for each group.<BR>> > > I think Jano Ferencik (who first posted about Jstreeview) succeed<BR>> > doing<BR>> > > this ; could you help me ?<BR>> > > 2 - I have the same problem after Update, the page looks like on<BR>> > the fisrt<BR>> > > l! oading and user loose his environnment, only groups are visible.<BR>> > ><BR>> > > can somebody have any suggestions ?<BR>> > ><BR>> > > Thanks<BR>> > ><BR>> > ><BR>> > ><BR>> > ><BR>> > > ---------------------------------<BR>> > > Post your free ad now! Yahoo! Canada Personals<BR>> > ><BR>> ><BR>> ><BR>> ><BR>> ><BR>> ><BR>> > ___________________________<BR>> > Cv-ul tau ia 500 euro/luna!<BR>> >
http://500.myjob.ro<BR>> ><BR>> ><BR>> ><BR>> ------------------------------------------------------------------------<BR>> > Post your free ad no! w! *Yahoo! Canada Personals*<BR>> ><BR>> ><BR>> ><BR>> ><BR>> ------------------------------------------------------------------------<BR>> ><BR>> ><BR>> ><BR>> > [leg_group_html]<BR>> > <BR>> <BR>> <BR>> ><BR>> <BR>> ><BR>> ><BR>> <BR>> ><BR>> ><BR>> > value="[leg_group_name]"<BR>> > [if name=layer_status oper=eq value=1]CHECKED[/if]<BR>> > [if name=layer_status oper=eq value=2]CHECKED[/if]<BR>> > onclick="checkAll();"><BR>> ><BR>> > [leg_group_name] <?xml:namespace prefix = javascript /><javascript:void(0);><BR>> ><BR>> <BR>> ><BR>> ><BR>> <BR>> ><BR>> <BR>> > [/leg_group_html]<BR>> ><BR>> > [leg_layer_html order=ascending
opt_flag=15]<BR>> ><BR>> ><BR>> <BR>> > [if name=SHOWINLEGEND oper=isnull]<BR>> ><BR>>><BR>>> value="[leg_layer_name]"<BR>>> [if name=layer_status oper=eq value=1]CHECKED[/if]<BR>>> [if name=layer_status oper=eq value=2]CHECKED[/if]><BR>>><BR>>><BR>> ><BR>> ><BR>>><BR>>><BR>> ><BR>> ><BR>> > [if name=wms_title oper=isnull]<BR>> > [leg_layer_name]<BR>> > [/if]<BR>> ><BR>> > [if name=wms_title oper=isset]<BR>> > [metadata name=WMS_TITLE]<BR>> > [/if]<BR>> ><BR>> ><BR>> > [/if]<BR>> ><BR>> > [if name=SHOWINLEGEND oper=isset]<BR>> ><BR>> > [/if]<BR>> ><BR>> <BR>> > [/leg_layer_html]<BR>> ><BR>> ><BR>> ><BR>> ><BR>> > ------------------------------------------------------------------------<BR>> ><BR>> >
_______________________________________________<BR>> > Chameleon mailing list<BR>> > Chameleon@lists.maptools.org<BR>> > http://lists.maptools.org/mailman/listinfo/chameleon<BR>> <BR>> -- <BR>> +-----------------------------------------------------------------+<BR>> |Paul Spencer pspencer@dmsolutions.ca |<BR>> +-----------------------------------------------------------------+<BR>> |Applications & Software Development |<BR>> |DM Solutions Group Inc http://www.dmsolutions.ca/|<BR>> +-----------------------------------------------------------------+<BR>> <BR>> <BR>> ------------------------------------------------------------------------<BR>> Post your free ad now! *Yahoo! Canada Personals* <BR>> <HTTP: ca.personals.yahoo.com /><BR>> <BR>> <BR>> ------------------------------------------------------------------------<BR>> <BR>> _______________________________________________<BR>> Chameleon mailing
list<BR>> Chameleon@lists.maptools.org<BR>> http://lists.maptools.org/mailman/listinfo/chameleon<BR><BR>-- <BR>+-----------------------------------------------------------------+<BR>|Paul Spencer pspencer@dmsolutions.ca |<BR>+-----------------------------------------------------------------+<BR>|Applications & Software Development |<BR>|DM Solutions Group Inc http://www.dmsolutions.ca/|<BR>+-----------------------------------------------------------------+<BR></BLOCKQUOTE></javascript:void(0);></DIV></DIV></DIV><p><br><hr size=1>Post your free ad now! <a href="http://ca.personals.yahoo.com/"><b>Yahoo! Canada Personals</b></a><br>