{% if not env.xhr %}{% extends env.cfg.general.base_template %}{% endif %}
{% block content %}
{% if not env.xhr %}
  <h1><a href="{{ env.url_for('part', part=env.part.url) }}">{{ env.session.part.title }}</a></h1>
  <h2>{{ env.session.title }}</h2>
  <h3>{{ env.session.begin|date(env) }}, {{ env.session.begin|time(env) }}&ndash;{{ env.session.end|time(env) }}, {{ env.session.location }}</h3>
{% endif %}
{% if showSelection %}
  <p class=showSelection>
    {{ env.lang_str(env.cfg.session.description) }}
    {{ env.session.states.get(env.state.id) and env.lang_str(env.cfg.session.options.get(env.session.states.get(env.state.id).choice, env.cfg.session.choices[0])) or env.lang_str(env.cfg.session.options[env.cfg.session.choices[0]]) }}
  </p>
{% else %}
  <form method="POST" class="ajaxForm" action="{{ env.url_for('session', part=env.part.url, session=env.session.url) }}">
    <p>
      <label for="choice">{{ env.lang_str(env.cfg.session.description) }}</label>
      <select id="choice" name="session">
        {% for option in env.cfg.session.choices %}
          <option value="{{ option }}"{% if env.session.states.get(env.state.id) and env.session.states.get(env.state.id).choice == option %} selected{% endif %}>{{ env.lang_str(env.cfg.session.options[option]) }}</option>
        {% endfor %}
      </select>
      <input type="submit" name="select" value="Auswählen">
      <img src="/static/spacer.gif" width="16" height="16">
    </p>
  </form>
{% endif %}
<table width="100%">
  <tbody>
    {% for paper in env.session.papers %}
      {% if not showSelection or (env.session.states.get(env.state.id) and env.session.states.get(env.state.id).choice != env.cfg.session.choices[1]) or paper.states.get(env.state.id) %}
        <tr>
          <td class="scip"><a href="{{ env.url_for('paper', part=env.part.url, session=env.session.url, paper=paper.url) }}"><img src="/static/plus.gif" height="16" width="16" border="0" class="ajaxTree"></a></td>
          <td class="scip" nowrap>{{ paper.begin|time(env) }}</td>
          <td class="scip" nowrap>{{ paper.name }}</td>
          <td class="scip" width="100%"><a href="{{ env.url_for('paper', part=env.part.url, session=env.session.url, paper=paper.url) }}">{{ paper.html_link|safe }}</a>{{ paper.html_extra|safe }}</td>
        </tr>
        <tr>
          <td class="scip"></td>
          <td class="scip" colspan="3"></td>
        </tr>
      {% endif %}
    {% endfor %}
  </tbody>
</table>
{% endblock %}
