[Cartoweb-users] cw3.1: bug in toolbar.tpl

Emmanuel Belo emmanuel.belo at microgis.ch
Fri Feb 24 06:28:20 EST 2006


Hi,

there is a small bug in this template. In the case you have only one 
tool activated, the array with the tool has a comma at the end and isn't 
closed by a parenthesis:

I think we should modify the template like this:


<script type="text/javascript">
{strip}
{foreach from=$tools item=tool name=tool}



+++  {if $smarty.foreach.tool.first and 
$smarty.foreach.tool.last}cw3_tools = new Array("{$tool->id}")
+++  {elseif $smarty.foreach.tool.first}cw3_tools = new Array("{$tool->id}",
--- {if $smarty.foreach.tool.first}cw3_tools = new Array("{$tool->id}",



  {elseif $smarty.foreach.tool.last}"{$tool->id}");
   {else}"{$tool->id}",
   {/if}
{/foreach}
{/strip}
cw3_initial_selected_tool = "mainmap.{$selected_tool}('map');";
{if $toolbar_rendering != 'radio'}
cw3_initial_selected_tool += "setActiveToolButton('{$selected_tool}');";
{/if}
</script>
{if $toolbar_rendering != 'radio'}
   <input type="hidden" name="tool" id="tool" value="{$selected_tool}"/>
{/if}
{counter start=-1 print=false name=tindex}
   {foreach from=$tools item=tool}
   {if !$group || $group == $tool->group}
     {if $toolbar_rendering == 'radio'}
       <label for="{$tool->id}" 
onclick="checkRadio(this.htmlFor);mainmap.{$tool->id}('map');" >
       <input type="radio" id="{$tool->id}" name="tool" value="{$tool->id}"
       {if $selected_tool == $tool->id}checked="checked"{/if} />
     {/if}
     {if $tool->hasIcon}
       <img id="{$tool->id}_icon" alt="{$tool->id}" 
title="{t}{$tool->id}{/t}"
         src="{r type=gfx plugin=$tool->plugin}{$tool->id}.gif{/r}"
         {if $toolbar_rendering != 'radio'}
         class="toolbar_off"
 
onclick="mainmap.{$tool->id}('map');setActiveToolButton('{$tool->id}');"
         {/if}
         />
     {else}
        <span>{t}{$tool->id}{/t}</span>
     {/if}
     {if $toolbar_rendering == 'radio'}
     </label>&nbsp;
     {/if}
   {/if}
   {/foreach}

best regards,

Emmanuel Belo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emmanuel.belo.vcf
Type: text/x-vcard
Size: 337 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060224/f55f89d2/emmanuel.belo.vcf


More information about the Cartoweb-users mailing list