<form class="plain" method="POST" tal:attributes="action request/URL"
      i18n:domain="schooltool">

  <div class="status"  tal:condition="view/error">
    <div class="summary ui-state-error ui-corner-all">
      <span class="ui-icon ui-icon-alert">icon</span>
      <tal:block content="view/error">
        [error message]
      </tal:block>
    </div>
  </div>

  <fieldset>
    <legend><span tal:content="view/label">[title]</span></legend>

    <div class="row">
      <p tal:condition="view/description"
         tal:content="view/description">[informative text]</p>
    </div>

    <div class="timetable-table">
  <table class="timetable">
    <thead>
    <tr>
      <th tal:repeat="day view/days" tal:content="day" />
    </tr>
    </thead>
    <tbody>
    <tr tal:repeat="slotnr python: range(max(numslots))"
        tal:define="numslots view/numSlots">
      <td tal:define="slot python:view.periods()[slotnr]"
          tal:repeat="day view/days">
        <select tal:define="daynr repeat/day/index;
                            name string:period_${daynr}_${slotnr}"
                tal:attributes="name name"
                tal:condition="python: slotnr &lt; numslots[daynr]">
          <option tal:repeat="period view/periods"
                  tal:attributes="selected
                          python:(period == request.get(name, slot)) or None"
                  tal:content="period" />
        </select>
      </td>
    </tr>
    </tbody>
  </table>
  </div>

  </fieldset>

  <div class="buttons">
    <input type="submit" class="button-cancel" name="STEP_BACK" value="Back"
           i18n:attributes="value" />
    <input type="submit" class="button-ok" name="NEXT" value="Next"
           i18n:attributes="value" />
    <input type="hidden" name="viewstate"
           tal:attributes="value json: view/view/json_state" />
  </div>

</form>
