[Chameleon] Chameleon 2.6 beta1 release

Normand Savard nsavard at mapgears.com
Mon Aug 13 13:54:42 EDT 2007


vinodvijaykumar wrote:

>Hi all
>
>There is no action when i click update widget. i am using chameleon 2.6.0.
>and any one has the windows dll for phpmapscript4.10.dll. can any one help
>out to solve this problem. I came to know that JSAPI is added to Update
>widget but no action happends when i click.
>
>  
>
Vinod,

You have to add your JavaScript code to handle the change layer status.  
First in the legend template you have to add a call for your JavaScript 
function that will change the layer status.  Supposed your 
legendtemplate widget is set like this:

<cwc2 type="LegendTemplate" visible="true" embedded="true" 
template="legend_template.html" popupstyleresource="TextButtons" 
popupwidth="500" popupheight="400" status="false" menubar="false"/>

then in the legend_template you will have:

    <td align="center" width=20><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>
 
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);

}

Then when you'll click the UpdateMap button the new layer will 
added/removed.

Norm


More information about the Chameleon mailing list