[Chameleon] Widget Update and JSAPI
Julien-Samuel Lacroix
jlacroix at mapgears.com
Wed Jul 16 10:09:27 EDT 2008
Hi,
You can remove your update map button and simply add the following at
the end of your ChangeLayerStatus function:
goCWCJSAPI.RefreshMap();
Julien
Fernando Sánchez García wrote:
> Hello list, I'm a user of Mapserver and Chameleon and I have a little
> problem with the Widget Update on the mode JSAPI which has already been
> mentioned in the Community, but it can not operate. The problem is that
> when you update the map on JSAPI mode on Internet Explorer 6 or 7 and
> refresh the entire screen and should only refresh the map. In Firefox or
> Opera this does not happen. I have the Mapserver 4 Windows 2.2.7 and
> Chameleon 2.6RC1. We ask for help fix it. Thank you very much.
>
> My file is legend_template.html:
>
>
> [leg_layer_html order=ascending opt_flag=15]
> <tr bgcolor="#F7D481">
> <!-- <td><input type="radio" name="my_legend"
> onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected
> value=1] CHECKED[/if]
>
> </td> -->
>
> <td align="center"><input type="checkbox" name="legendlayername[]"
> value="[leg_layer_name]" onclick="ChangeLayerStatus('[leg_layer_name]')"
> [if name=layer_status oper=eq value=1]CHECKED[/if]
> [if name=layer_status oper=eq value=2]CHECKED[/if]></td>
> <td align="center"><img src="[leg_icon width=20 height=18]" width="20"
> height="18"></td>
> [if name=wms_name oper=isnull]
> <td><a href="#"
> onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span
> class="label">[leg_layer_name]</span></a></td>
> </tr>
> [/if]
> [if name=wms_name oper=isset]
> <td><a href="#"
> onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span
> class="label">[metadata name=WMS_TITLE]</span></a></td>
> </tr>
> [/if]
> [/leg_layer_html]
>
>
> My template iss:
>
> <body onload="CWC2OnLoadFunction()">
>
> .....
>
> <cwc2 type="cwcjsapi" debug="false"/>
> <cwc2 type="SharedResource" name="CWCJSAPI"/>
>
> ....
>
> <div id="LegendLayer" name="LegendLayer">
> <table border="0" bgcolor="#FDF6DA">
> <tr>
> <td colspan="4" align="center">
> <cwc2 type="LegendTemplate" visible="true"
> embedded="true" template="legend_template.html"
> popupstyleresource="TextButtons"
> popupwidth="500" popupheight="400" status="false" menubar="false"
> controlvisibility="true"/>
> </cwc2>
> </td>
> </tr>
>
> <tr>
> <td colspan="4" align="center">
> <cwc2 type="UpdateMap" styleresource="TextButtons" visible="true"
> image="icons/icon_update.png" imagetip="Actualizar Mapa"
> label="Actualizar Mapa">
> <image state="normal"/>
> <image state="selected"/>
> <image state="hover"/>
> </cwc2>
> </td>
> </tr>
>
>
>
> <!-- include the javascript code that manages the DHTML layers -->
> <script language="JavaScript" src="sample.js" type="text/javascript">
> </script>
>
>
> .....
>
> And mi file sample.js is:
>
>
> function ChangeLayerStatus(szLayerName)
> {
>
> if(typeof goCWCJSAPI == "undefined")
> {
> return false;
> }
>
> szStatus = goCWCJSAPI.oMap.GetLayerByName(szLayerName).GetStatus();
> //alert('status='+szStatus)
>
> if(szStatus == "ON")
> {
> szNewStatus = "OFF";
> }
> else
> {
> szNewStatus = "ON";
> }
>
> goCWCJSAPI.oMap.GetLayerByName(szLayerName).SetStatus(szNewStatus);
>
> }
>
>
>
> Fernando Sánchez García
> SIG-UCO Universidad de Córdoba
> Dept. Ingeniería Gráfica E Ingeniería Y Sist. Información Cartográfica
> Edificio Gregor Mendel C5 - 3ª Pta.
> Campus Universitario de Rabanales. Ctra. N-IV a km. 396
> 14071 CÓRDOBA (España).
>
>
>
>
> ------------------------------------------------------------------------
> ¡El Mundo Messenger te espera! Entra ya en "I love Messenger" y descubre
> las últimas novedades, trucos, emoticonos… Entra ya en "I love
> Messenger" <http://www.vivelive.com/ilovemessenger/>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
--
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/
More information about the Chameleon
mailing list