<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      py:strip="True">

<form class="mod" id="modcomp" method="post">
<fieldset>
  <legend id="main-legend">${_('Backlog')} $backlog.name</legend>
  <div class="field">
    <label>${_('Name')}:<br />
      <span style="font-weight:bold;">${backlog.name}</span>
    </label>
  </div>
  <div class="field">
    <label>${_('Description')}:<br />
      <textarea cols="68" rows="10" class="wikitext" name="description" py:content="backlog.description"></textarea>
    </label>
  </div>
  <div class="field">
    <label>${_('Scope')}:</label>
    <select id="scope" name="scope">
      <option py:for="value, label in backlog_types.items()" selected="${backlog.b_type==value or None}" value="$value">$label</option>
    </select>
    <input type="submit" value="Update fields" name="preview" class="preview" />
    <div class="help">${_('Defines which is the "scope" of this Backlog')}:
      <ul>
        <li><code>global</code> means that it will include all the tickets in the DB</li>
        <li><code>milestone</code> means it will include only the tickets assigned to a certain milestone,</li>
        <li><code>sprint</code> means it will include only the tickets planned for a specific sprint.</li>
      </ul>
      All the linked tickets will be included as well, according to the defined hierarchy.
    </div>
  </div>
  <div class="field" id="strict_field">
    <label>Strict:</label>
    <input type="checkbox" name="strict" id="strict" value="true" checked="${backlog.b_strict or None}" />
    <div class="help scope_0" style="${backlog.b_type>0 and 'display:none;' or None}">
      ${_('Shows only the tickets that are not planned for a sprint or a milestone')}.
    </div>
    <div class="help scope_1 scope_2" style="${backlog.b_type==0 and 'display:none;' or None}">
      Restrict the tickets only to the ones explicitly assigned to a scope.
      For example only the Tasks associated to a Sprint, even if the originating
      User Story has other tasks linked to it. Or only the Requirements explicitly planned for a Release.
    </div>
  </div>
  <div class="field">
    <label>${_('Available Charts')}:<br />
      <select id="backlog_charts" name="backlog_charts" multiple="multiple" size="5">
        <option py:for="chart, scope in available_charts" 
                style="${str(backlog.b_type) not in scope and 'display:none;' or None}" 
                class="$scope" 
                selected="${chart in backlog_charts or None}">$chart</option>
      </select>
    </label>
  </div>
  <div class="field">
    <label>${_('Ticket types')}:<br />
      <select id="ticket_types" name="ticket_types" multiple="multiple" size="5">
        <option py:for="t_type, selected, t_alias in t_types" 
                selected="${selected or None}"
                value="$t_type">$t_alias</option>
      </select>
      <input type="submit" value="Update fields" name="preview" class="preview" />
    </label>
  </div>
 </fieldset>
 <fieldset>
  <legend>${_('Columns Preferences')}</legend>
  <div class="field">
    <table id="column_table">
      <thead>
        <tr>
          <th>${_('Property')}</th>
          <th>${_('Show?')}</th>
          <th>${_('Editable?')}</th>
          <th>${_('Alternative')}</th>
          <th>${_('Sorting')}</th>
          <th>${_('Order')}</th>
        </tr>
      </thead>
      <tbody>
        <tr py:for="field in fields" id="${field['name']}" style="${field.get('disabled') and 'display:none;' or None}">
          <td>$field.label</td>
          <td><input type="checkbox" id="show_${field['name']}" name="show_${field['name']}" disabled="${field.get('disabled') and 'disabled' or None}" value="${True}" checked="${field['show'] or None}" /></td>
          <td><input type="checkbox" id="edit_${field['name']}" name="edit_${field['name']}" disabled="${field.get('disabled') and 'disabled' or None}" value="${True}" checked="${field['editable'] or None}" /></td>
          <td><select name="alternative_${field['name']}" disabled="${field.get('disabled') and 'disabled' or None}">
            <option></option>
            <option py:for="alt in fields" py:if="field['name'] != alt['name']" selected="${alt['name'] == field['alternative'] or None}" value="${alt['name']}">${alt['label']}</option>
          </select></td>
          <td>
            <py:with vars="name=field['name']; sel=sorting_keys.get(name) or None;">
              <input type="radio" name="sort_${name}" id="sort_${name}" value="False" checked="checked" disabled="${field.get('disabled') and 'disabled' or None}" />${_('no')}
              <input type="radio" name="sort_${name}" id="sort_${name}" value="True" checked="${sel}" disabled="${field.get('disabled') and 'disabled' or None}" />${_('yes')}
              <select name="sorting_key_${name}" disabled="${field.get('disabled') and 'disabled' or None}" >
                <option py:for="value, label in sort_values" selected="${sorting_keys.get(name) == value or None}" value="$value">$label</option>
              </select>
            </py:with>
          </td>
          <td><select name="order_${field['name']}" disabled="${field.get('disabled') and 'disabled' or None}" >
            <option></option>
            <option py:for="i in range(len(fields))" selected="${field['order'] == i or None}">$i</option>
          </select></td>
        </tr>
      </tbody>
    </table>
  </div>
</fieldset>
<div class="buttons">
  <input type="submit" name="cancel" value="${_('Cancel')}" />
  <input type="submit" name="save" value="${_('Save')}" />
</div>
</form>

</html>