[Cartoweb-users] cw3.1: bug in toolbar.tpl
Pierre GIRAUD
pierre.giraud at camptocamp.com
Fri Feb 24 08:47:22 EST 2006
It seems like we didn't test this case.
Thanks for the tip.
But, it should probably be better to have a new parameter toolsList
fetched in the php code with an implode function that would give the
comma separated list. Moreover, the smarty template would be lighter.
Pierre
Emmanuel Belo wrote:
> 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>
> {/if}
> {/if}
> {/foreach}
>
> best regards,
>
> Emmanuel Belo
>
>_______________________________________________
>Cartoweb-users mailing list
>Cartoweb-users at lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/cartoweb-users
>
>
--
_________________________________________________________
Pierre GIRAUD
Géomaticien, Analyste
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com
http://www.camptocamp.com
More information about the Cartoweb-users
mailing list