<tal:tag condition="view/update" />
<html metal:use-macro="context/@@standard_macros/page"
      i18n:domain="schooltool">
<head>
  <title metal:fill-slot="title" i18n:translate="">
    Gradebook
  </title>
</head>
<body>
<div metal:fill-slot="body">

  <form method="post"
        tal:attributes="action string:${context/@@absolute_url}/final.html">
    <tal:if condition="python:not list(view.getSections(True))">
      <span tal:content="string:Section: ${view/getCurrentSection}" />
    </tal:if>
    <tal:if condition="python:list(view.getSections(True))">
      <label for="currentSection" i18n:translate="">Section</label>
      <select name="currentSection"
              onchange="this.form.submit()">
        <tal:block repeat="section python:view.getSections(True)">
          <option value="1"
              tal:condition="python:section['title'] != view.getCurrentSection()"
              tal:attributes="value section/title"
              tal:content="section/title" />
          <option value="1" selected="selected"
              tal:condition="python:section['title'] == view.getCurrentSection()"
              tal:attributes="value section/title"
              tal:content="section/title" />
        </tal:block>
      </select>
    </tal:if>
    <input type="submit" class="button-ok" name="UPDATE" value="Update">
    <a class="button-ok" title="Return to Gradebook"
       tal:attributes="href string:${context/@@absolute_url}">
       Return to Gradebook
    </a>
    <b tal:condition="view/error_message"
       style="color: red" tal:content="view/error_message" />
    <br /><br />
    <table class="schooltool_gradebook">
      <tr>
       <th>Name</th>
       <th tal:repeat="worksheet context/worksheets"
           tal:content="worksheet/title" />
       <th>Calculated Grade</th>
       <th class="final_grade">Final Grade</th>
       <th>Adjustment</th>
       <th>Reason</th>
      </tr>
      <tr tal:repeat="row view/table">
        <td tal:content="row/student/title" />
        <td tal:repeat="grade row/grades"
            tal:content="grade/value" />
        <td tal:content="row/calculated" />
        <td tal:content="row/final" class="final_grade" />
        <td>
          <input type="text" size="1" maxlength="1"
                 tal:attributes="id row/adjustment/id;
                                 name row/adjustment/id;
                                 value row/adjustment/value" />
        </td>
        <td>
          <input type="text" size="30"
                 tal:attributes="id row/reason/id;
                                 name row/reason/id;
                                 value row/reason/value" />
        </td>
      </tr>
    </table>

  </form>

</div>
</body>
</html>
