[Cartoweb-dev] [Bug 1311] New: broken toolbar in the case only one tool is activated

bugzilla-daemon at bugzilla.maptools.org bugzilla-daemon at bugzilla.maptools.org
Wed Mar 1 05:22:30 EST 2006


           Summary: broken toolbar in the case only one tool is activated
           Product: CartoWeb
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DHTML Interface
        AssignedTo: cartoweb-dev at lists.maptools.org
        ReportedBy: pierre.giraud at camptocamp.com

--- Reported by Emmanuel Belo :
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">
{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}");
cw3_initial_selected_tool = "mainmap.{$selected_tool}('map');";
{if $toolbar_rendering != 'radio'}
cw3_initial_selected_tool += "setActiveToolButton('{$selected_tool}');";
{if $toolbar_rendering != 'radio'}
  <input type="hidden" name="tool" id="tool" value="{$selected_tool}"/>
{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 $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'}

    {if $toolbar_rendering == 'radio'}

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.

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Please do NOT reply to this email, use the link above instead to 
login to bugzilla and submit your comment. Any email reply to this
address will be lost.

More information about the Cartoweb-dev mailing list