[Chameleon] JSTreeView

Paul Spencer pspencer at dmsolutions.ca
Mon May 30 12:27:02 EDT 2005


Thanks.

Liz, can you get this onto the tiki site please :)

Paul

Edith TAKI wrote:
> Ok,
>  
> Here is the solution (joined in jstreeview.rtf)
> I have a treeview legend with expand/collapsed groups.
> For this to work, In the map file, i have for instance for a layer
>  
>     METADATA
>       "GROUP"      "Hydrologie"
>       "DESCRIPTION"     "Mer"
>        SHOWINLEGEND  "0"
>        LAYER_INDEX   "0"
>     END
> 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.
>  
> 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...)
> <cwc2 type="cwcjsapi" debug="false"/>
> <cwc2 type="SharedResource" name="CWCJSAPI"/>
> but an Update reload the page so I loose the environnement !
> As I'm a basic user of _javascript, i cannot go further !!
>  
> 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);
> I checked sample_enhanced_jsapi.html and it's the same error !!!
>  
> Hopping it could help someone !
>  
> Thanks,
>  
> Edith
> 
> */Paul Spencer <pspencer at dmsolutions.ca>/* wrote:
> 
>     cool!
> 
>     You should post your whole solution :)
> 
>     Paul
> 
> 
> 
> ------------------------------------------------------------------------
> Post your free ad now! *Yahoo! Canada Personals* 
> <http://ca.personals.yahoo.com/>
> {\rtf1\ansi\ansicpg1252\uc1 
> \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 
> 02020603050405020304}Times New 
> Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 
> 020b0604020202020204}Arial;} {\f28\froman\fcharset238\fprq2 Times New 
> Roman CE;}{\f29\froman\fcharset204\fprq2 Times New Roman 
> Cyr;}{\f31\froman\fcharset161\fprq2 Times New Roman 
> Greek;}{\f32\froman\fcharset162\fprq2 Times New Roman Tur;} 
> {\f33\froman\fcharset177\fprq2 Times New Roman 
> (Hebrew);}{\f34\froman\fcharset178\fprq2 Times New Roman 
> (Arabic);}{\f35\froman\fcharset186\fprq2 Times New Roman 
> Baltic;}{\f36\fswiss\fcharset238\fprq2 Arial 
> CE;}{\f37\fswiss\fcharset204\fprq2 Arial Cyr;} 
> {\f39\fswiss\fcharset161\fprq2 Arial 
> Greek;}{\f40\fswiss\fcharset162\fprq2 Arial 
> Tur;}{\f41\fswiss\fcharset177\fprq2 Arial 
> (Hebrew);}{\f42\fswiss\fcharset178\fprq2 Arial 
> (Arabic);}{\f43\fswiss\fcharset186\fprq2 Arial Baltic;}} 
> {\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; 
> \red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql 
> \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 
> \fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \snext0 
> Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\author Edith 
> ASSA}{\operator Edith 
> ASSA}{\creatim\yr2005\mo5\dy30\hr15\min54}{\revtim\yr2005\mo5\dy30\hr15\min54}{\version2} 
> {\edmins0}{\nofpages3}{\nofwords510}{\nofchars2910}{\*\company 
> O.I.Eau}{\nofcharsws3573}{\vern8247}}\margl1417\margr1417\margt1417\margb1417 
> \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120 
> \dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind4\viewscale100\nolnhtadjtbl 
> \fet0\sectd \linex0\sectdefaultcl 
> {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta 
> .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta 
> .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta 
> .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta 
> )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
> )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta 
> )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
> )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
> )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
> )}}\pard\plain \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 
> \fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 
> {\f1\fs20\lang1033\langfe1033\langnp1033 \par 
> -----------------------------------MY LEGEND TEMPLATE FILE 
> --------------------------------- \par 
> ------------------------------------------------------------------------------------------------------------------ 
> \par [leg_group_html] \par \par id="[leg_group_name]"> \par \par 
> class="groupLabel"> \par type="checkbox" id="[leg_group_name]" 
> name="[leg_group_name]" \par onchange="toggleGroup(this);"> \par 
> href="javascript:void(0);" 
> onclick="toggleLayers('[leg_group_name]_layer');">[leg_group_name] \par 
> GroupLabel--> \par \par \par id="[leg_group_name]_layer" 
> style="display:none"> \par [/leg_group_html] \par \par [leg_layer_html 
> order=ascending opt_flag=15] \par \par \par [if name=SHOWINLEGEND 
> oper=isnull] \par class="layerTitle"> \par type="checkbox" 
> id="layer-[metadata name=group]-[metadata name=layer_index]" \par 
> name='legendlayername[]' value="[leg_layer_name]" \par [if 
> name=layer_status oper=eq value=1]CHECKED[/if] \par [if 
> name=layer_status oper=eq value=2]CHECKED[/if] \par 
> onclick="toggleLayer(this);" > \par \par \par \par src=[leg_icon]> \par 
> \par \par \par [if name=wms_title oper=isnull] \par class="layerLabel"> 
> [leg_layer_name] \par [/if] \par \par [if name=wms_title oper=isset] 
> \par class="layerLabel"> [metadata name=WMS_TITLE] \par [/if] \par \par 
> \par [/if] \par \par [if name=SHOWINLEGEND oper=isset] \par 
> type="hidden" name="legendlayername[]" value="[leg_layer_name]"> \par 
> [/if] \par \par [/leg_layer_html] \par \par 
> -----------------------------------INSIDE MY TEMPLATE FILE 
> ------------------------------------------------ \par 
> }{\f1\fs20\lang1036\langfe1033\langnp1036 
> ------------------------------------------------------------------------------------------------------------------------------ 
> \par \par language="javascript"> \par 
> }{\f1\fs20\lang1033\langfe1033\langnp1033 function toggleLayers( szName 
> ) \par \{ \par var layer = CWCDHTML_GetLayer( szName ); \par \par if 
> (layer.display == 'block') \par layer.display = 'none'; \par else \par 
> layer.display = 'block'; \par \} \par function checkLayer( szName,state 
> ) \par \{ \par \par \} \par \par \par language="javascript"> \par \par 
> function toggleLayer( obj) \par \{ \par \par \par var group = 
> (obj.id.split( "-" ))[1]; \par \par \par var group_cb = 
> document.getElementById( group ); \par \par if (group_cb) \par \{ \par 
> if (!obj.checked) \par \{ \par group_cb.checked = false; \par return; 
> \par \} \par else // now have to check all the layers in this group \par 
> \{ \par var nLayers = 5; //set to number of layers in map file \par 
> for(i=0; ii++) \par \{ \par layer_cb = document.getElementById( 
> 'layer-'+group+'-'+i ); \par if (layer_cb && !layer_cb.checked) //stop 
> if any are unchecked \par \{ \par group_cb.checked = false; \par return; 
> \par \} \par \par \} \par group_cb.checked = true; //all checked, can 
> turn on group \par \} \par \par \par \} \par \par \} \par \par \par 
> function toggleGroup( obj) \par \{ \par \par var nLayers = 5; //set to 
> number of layers in map file \par \par for(i=0; ii++) \par \{ \par var 
> layer_cb = document.getElementById( 'layer-'+obj.id+'-'+i ); \par if 
> (layer_cb) \par layer_cb.checked = obj.checked; \par \} \par \par \} 
> \par \par \par \par \par \par }}
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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