<ul xmlns="http://www.w3.org/1999/xhtml"
    xmlns:py="http://genshi.edgewall.org/" py:strip="True">
  <py:for each="backlog in backlog_list">
    <py:choose>
      <py:when test="backlog.b_type == 0"><!-- global backlog -->
        <li>
          <a href="${href.backlog(backlog.name)}">${_(backlog.name)}</a>
        </li>
      </py:when>
      <py:when test="backlog.b_type == 1"><!-- sprint backlog -->
        <li class="inlinebuttons">
          ${_(backlog.name)} ${_('for sprint')}:
          <form name="sprint_view" action="${href.backlog(backlog.name)}" method="get">
            <select name="bscope" onChange="this.form.submit()">
              <optgroup py:for="optgroup in sprint_list"
                                py:if="optgroup.options"
                                label="${optgroup.label}">
                        <option py:for="option, selected in optgroup.options"
                                selected="${selected or None}"
                                py:content="option"></option>
              </optgroup>
            </select>
            <py:choose>
              <py:when test="sprint_list">
                <input type="submit" name="view" value="${_('View')}" />
              </py:when>
              <py:otherwise>
                <input type="submit" name="view" value="${_('View')}" disabled="disabled" />
              </py:otherwise>
            </py:choose>
          </form>
        </li>
      </py:when>
      <py:when test="backlog.b_type == 2"><!-- milestone backlog -->
        <li class="inlinebuttons">
          ${_(backlog.name)} for milestone:
          <form name="milestone_view" action="${href.backlog(backlog.name)}" method="GET">
            <select name="bscope"  onChange="this.form.submit()">
              <optgroup py:for="optgroup in milestone_list"
                                py:if="optgroup.options"
                                label="${optgroup.label}">
                        <option py:for="option, selected in optgroup.options"
                                selected="${selected or None}"
                                py:content="option"></option>
              </optgroup>
            </select>
            <py:choose>
              <py:when test="milestone_list">
                <input type="submit" name="view" value="${_('View')}" />
              </py:when>
              <py:otherwise>
                <input type="submit" name="view" value="${_('View')}" disabled="disabled" />
              </py:otherwise>
            </py:choose>
          </form>
        </li>
      </py:when>
    </py:choose>
  </py:for>
</ul>