{% extends "base.html" %}
{# Copyright The IETF Trust 2007, All Rights Reserved #}
{% load humanize %}
{% block title %}IETF {{ meeting.num }} Meeting Agenda{% endblock %}

{% block morecss %}
table#agenda { border: 0; border-collapse:collapse; }
#agenda td { padding-right:2em; }
#agenda tr.meeting-date td { padding-top:1em; padding-right:0;}

table#wg-selector { border:1px solid black; border-collapse:collapse; }
#wg-selector td,#wg-selector th { border:1px solid black; padding: 2px}
#wg-selector div.selected { background-color: #D0D0FF; cursor: pointer; }
#wg-selector div.unselected { background-color: #FFFFFF; cursor: pointer; }
#wg-selector td.inactive div { background-color: #EEEEEE; color: #808080; cursor:default;}
#wg-selector.hidden { display: none; }
#wg-selector-toggle-text { text-decoration: underline; cursor: pointer; }
#wg-selector-triangle-right { vertical-align: text-top; }
#wg-selector-triangle-down { vertical-align: text-top; }

#weekview.hidden { display: none; }
#weekview { border: none; margin: 0 0 0 0;}
#ical-link.hidden { display: none; }
#ical-link { margin: 10px 0 0 0; padding: 10px; text-align: center; background-color: #2647a0; color: #FFFFFF }
#ical-link A:link { color: #FFFFFF; }
#ical-link A:visited { color: #FFFFFF; }
#ical-link A:active { color: #FF00FF; }
#ical-link A:hover { color: #FF0000; }

img.hidden { display: none; }

.ietf-agenda-palette { border-collapse:collapse; border:2px solid black; background:white; overflow:hidden; }
.ietf-agenda-palette td { border:1px solid black; }
.ietf-agenda-palette td { padding: 4px; text-align:center;}
.ietf-agenda-palette td a { text-decoration:none; }
.bgnone {}
.bgaqua, .bgaqua a { background-color: aqua; color: black; }
.bgblue, .bgblue a { background-color: blue; color: black; }
.bgfuchsia, .bgfuchsia a { background-color: fuchsia; color: black; }
.bggray, .bggray a { background-color: gray; color: white; }
.bggreen, .bggreen a { background-color: green; color: white; }
.bglime, .bglime a { background-color: lime; color: black; }
.bgmaroon, .bgmaroon a { background-color: maroon; color: white; }
.bgnavy, .bgnavy a { background-color: navy; color: white; }
.bgolive, .bgolive a { background-color: olive; color: white; }
.bgpurple, .bgpurple a { background-color: purple; color: white; }
.bgred, .bgred a { background-color: red; color: black; }
.bgsilver, .bgsilver a { background-color: silver; color: black; }
.bgteal, .bgteal a { background-color: teal; color: white; }
.bgwhite, .bgwhite a { background-color: white; color: black; }
.bgyellow, .bgyellow a { background-color: yellow; color: black; }
.bgblack, .bgblack a { background-color: black; color: white; }
.groupagenda { display:none; }

{% endblock morecss %}

{% block pagehead %}
<script type="text/javascript" src='/js/agenda2.js'></script>
<script type="text/javascript">

  var lastfrag;

  function setGroupState()
  {
    var frag = window.location.hash.replace("#",'');
    window.setTimeout("setGroupState()",1000);
    if (frag == lastfrag) { return; }

    var weekview = document.getElementById('weekview');
    var ical_link = document.getElementById('ical-link');
    var ical_href = document.getElementById('ical-href');

    lastfrag = frag;

    var fragment = frag.split(',');

    if (frag.length)
    {
      weekview.setAttribute("src","week-view.html#"+frag);
      weekview.className = '';
      ical_href.setAttribute("href","agenda.ics?"+frag);
      ical_link.className = '';
    }
    else
    {
      weekview.className = 'hidden';
      ical_link.className = 'hidden';
    }

    var selectors = document.getElementsByTagName('div');
    var re = RegExp("^selector-");
    var re2 = RegExp("^selector-(" + fragment.join('|') + ")$");

    for (var i=0 ; i<selectors.length; i++)
    {
      if (re.test(selectors[i].id))
      {
        var wg = selectors[i].textContent?selectors[i].textContent:selectors[i].text;
        var area_groups = document.getElementById(wg + "-groups");
        if (re2.test(selectors[i].id))
        {
          selectors[i].className="selected";
          if (area_groups)
          {
            area_groups.className = 'inactive';
          }
        }
        else
        {
          selectors[i].className="unselected";
          if (area_groups)
          {
            area_groups.className = '';
          }
        }
      }
    }
    var rows = document.getElementsByTagName('tr');
    var hidenone = false;
    if (frag.length == 0) { hidenone=true; }

    var re = RegExp("-(" + fragment.join('|') + ")($|-)");

    for (var i = 0; i < rows.length; i++)
    {
      if (rows[i].className == 'groupagenda' || rows[i].className == 'grouprow')
      {
        if (re.test(rows[i].id) || (hidenone && rows[i].className == 'grouprow'))
        {
          rows[i].style.display="table-row";
          if (rows[i].className == 'groupagenda')
          {
            var iframe = rows[i].firstElementChild.nextElementSibling.firstElementChild;
            if (iframe.getAttribute("xsrc") != iframe.getAttribute("src"))
            {
              iframe.setAttribute("src",iframe.getAttribute("xsrc"));
            }
            r(iframe);
          }
        }
        else
        {
          rows[i].style.display="none";
        }
      }
    }


  }

  /* Resizes an IFRAME to fit its contents */
  function r(obj)
  {
    try
    {
      docHeight = obj.contentWindow.document.body.scrollHeight;
      obj.height = docHeight;
    }
    catch (e) {}
  }

  function toggle(selection)
  {
    var active = selection.className;
    var wg = selection.textContent?selection.textContent:selection.text;

    if (active == "selected")
    {
      var re = new RegExp('(^|#|,)' + wg + "(,|$)");
      window.location.hash = window.location.hash.replace(re,"$2")

    }
    else
    {
      if (window.location.hash.replace("#","").length == 0)
      {
        window.location.hash = wg;
      }
      else
      {
        window.location.hash += "," + wg;
      }

    }
    window.location.hash = window.location.hash.replace(/^#?,/,'');
    setGroupState();
  }

  function toggle_wg_selector ()
  {
    var wg_selector = document.getElementById('wg-selector');
    var triangle_right = document.getElementById('wg-selector-triangle-right');
    var triangle_down = document.getElementById('wg-selector-triangle-down');
    if (wg_selector.className == 'hidden')
    {
      wg_selector.className = '';
      triangle_right.className = 'hidden';
      triangle_down.className = '';
    }
    else
    {
      wg_selector.className = 'hidden';
      triangle_right.className = '';
      triangle_down.className = 'hidden';
    }
  }
</script>

{% endblock pagehead %}
{% block bodyAttrs %}onload='setGroupState();updateAgendaColors()'{% endblock %}
{% block content %}
<h1>IETF {{ meeting.num }} Meeting Agenda</h1>
<p>{{ meeting.city }}, {{ meeting.start_date|date:"F j" }}-{% ifnotequal meeting.start_date.month meeting.end_date.month %}{{ meeting.end_date|date:"F " }}{% endifnotequal %}{{ meeting.end_date|date:"j, Y" }}<br />
Updated {{ update.updated|date:"Y-m-d H:i:s T" }}</p>
<div class="noprint">
(There's also a <a href="/meeting/{{meeting.num}}/agenda.txt">plaintext agenda</a> and a <a href="http://tools.ietf.org/agenda/{{meeting.num}}/">tools-style agenda</a> available)</div>

<p><strong>IETF agendas are subject to change, up to and during the meeting.</strong></p>

{# cache this part for 15 minutes -- it takes 3-6 seconds to generate #}
{% load cache %}
{% cache 900 ietf_meeting_agenda meeting.num %}

You can customize the agenda below to show only selected working group sessions.  To be able to return to the customized view later, bookmark the resulting URL:
<div class="noprint" onclick="toggle_wg_selector()">
   <img id="wg-selector-triangle-right" src="/images/triangle-right.png" />
   <img id="wg-selector-triangle-down" src="/images/triangle-down.png" class="hidden" />
   <span id="wg-selector-toggle-text">Select working group sessions</span>
</div>
<table id="wg-selector" width="100%" class="hidden">
  <tr>
    {% for area in area_list %}
      <th><div id='selector-{{area.area_acronym|upper}}' class="unselected" onclick="toggle(this)">{{area.area_acronym|upper}}</div></th>
    {% endfor %}
    <th><div id='selector-IRTF' class="unselected" onclick="toggle(this)">IRTF</div></th>
  </tr>

  <tr>
    {% for area in area_list %}
      <td valign="top" id="{{area.area_acronym|upper}}-groups">
      {% for wg in wg_list %}
        {% ifequal wg.area.area.area_acronym area.area_acronym %}
          <div id='selector-{{wg}}' class="unselected" onclick="toggle(this)">{{wg}}</div>
        {% endifequal %}
      {% endfor %}
      </td>
    {% endfor %}

      <td valign="top" id="IRTF-groups">
      {% for rg in rg_list %}
        <div id='selector-{{rg|lower}}' class="unselected" onclick="toggle(this)">{{rg|lower}}</div>
      {% endfor %}
      </td>

  </tr>
</table>

<div id="ical-link" class="hidden"><span style="font-size:150%">Week View</span><br/><a id="ical-href" href="agenda.ics"><em>Download as an ical file</em></a></div>

<iframe id="weekview" class="hidden" width="100%" height="600px" src="about:blank"></iframe>

<table id="agenda" width="100%">
{% for slot in timeslots %}
   {% ifchanged  %}
      <tr class="meeting-date">
	 <td colspan="4">
	   <h2 class="ietf-divider">{{ slot.meeting_date|date:"l"|upper }}, {{ slot.meeting_date|date:"F j, Y" }}</h2>
	 </td>
      </tr>
      {% if slot.reg_info %}
      <tr>
	 <td colspan="4">
	    {{ slot.registration.time_desc  }}  {{ slot.registration.name  }}
	    {% if venue.reg_area_name %} - <a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{ venue.reg_area_name|slugify }}">{{ venue.reg_area_name|escape }}</a>{% endif %}
	 </td>
      </tr>
      {% endif %}
   {% endifchanged %}
   {% if slot.session_name %}
      {% if slot.break_info %}
      <tr>
	 <td colspan="4">
	    <br />
	    {{ slot.break_info.time_desc }}  {{ slot.break_info.name }}
	    {% if venue.break_area_name and slot.break_info.show_break_location %} - <a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{ venue.break_area_name|slugify }}">{{ venue.break_area_name|escape }}</a>{% endif %}
	 </td>
      </tr>
      {% endif %}
      <tr>
	 <td colspan="4">
	    <b>{{ slot.time_desc               }}  {{ slot.session_name }}</b>
	    {% ifequal slot.sessions.0.acronym "plenaryw" %}
	       <b>- <a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{ slot.sessions.0.room_id.room_name|slugify }}">{{ slot.sessions.0.room_id.room_name }}</a></b><br/>
	       <pre>{{ plenaryw_agenda|escape }}</pre>
	    {% endifequal %}
	    {% ifequal slot.sessions.0.acronym "plenaryt" %}
	       <b>- <a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{ slot.sessions.0.room_id.room_name|slugify }}">{{ slot.sessions.0.room_id.room_name }}</a></b><br/>
	       <pre>{{ plenaryt_agenda|escape }}</pre>
	    {% endifequal %}
	 </td>
      </tr>
      {% if not slot.is_plenary %}
      {% for session in slot.sessions_by_area|dictsort:"area" %}
      <tr id="{{meeting.num}}-{{slot.meeting_date|date:"D"|lower}}-{{slot.time_desc|slice:":4"}}-{{session.info.area|upper}}-{{session.info.acronym|lower}}" class="grouprow">
	 <td><a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{session.info.room_id.room_name|slugify}}" title="room map">{{ session.info.room_id.room_name}}</a></td>
	 {% if session.info.area %}
	 <td>{{ session.info.area|upper}}</td>
	 <td>{% if session.info.isWG %}<a href="/wg/{{ session.info.acronym|lower }}/">{{ session.info.acronym|lower }}</a>{% else %}{{ session.info.acronym|lower }}{% endif %}</td>
	 <td>
            <table width="100%"><tr><td>
            <img src="/images/color-palette-4x4.gif" alt="" onclick="pickAgendaColor('{{meeting.num}}-{{slot.meeting_date|date:"D"|lower}}-{{slot.time_desc|slice:":4"}}-{{session.info.area|upper}}-{{session.info.acronym|lower}}',this);" title="color tag this line"/ class="noprint">
	    {% if session.info.agenda_file %}<a href="http://www.ietf.org/proceedings/{{ session.info.agenda_file }}" title="session agenda">{{ session.info.acronym_name|escape }} {{ session.info.group_type_str }}</a>{% else %}{{ session.info.acronym_name|escape }} {{ session.info.group_type_str }}{% endif %}
	    {% if session.info.special_agenda_note %}<br/> - {{ session.info.special_agenda_note }}{% endif %}
           </td><td align="right">drafts:&nbsp;<a href="/meeting/{{ meeting.num }}/agenda/{{session.info.acronym}}-drafts.tgz">tar</a>|<a href="/meeting/{{ meeting.num }}/agenda/{{session.info.acronym}}-drafts.pdf">pdf</a></td></tr></table>
	 </td>
	 {% endif %}
      </tr>
      <tr id="agenda-{{meeting.num}}-{{slot.meeting_date|date:"D"|lower}}-{{slot.time_desc|slice:":4"}}-{{session.info.area|upper}}-{{session.info.acronym|lower}}" class="groupagenda">
        <td></td>
        <td colspan="3">
	  {% if session.info.agenda_file %}
          <iframe width="100%" height="400px" src="about:blank" xsrc="/meeting/{{ meeting.num }}/agenda/{{ session.info.acronym }}-agenda/" onload="r(this)"></iframe>
	  {% else %}
	  <b>No Agenda Submitted</b>
	  {% endif %}
        </td>
      </tr>
      {% endfor %}
      {% endif %}
   {% else %}
      {% for session in slot.sessions %}
      <tr>
	 <td colspan="4">
	    {{ slot.time_desc }}  {{ session.acronym_name|escape }} - <a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{session.room_id.room_name|slugify}}">{{ session.room_id.room_name}}</a>
	 </td>
      </tr>
      {% endfor %}
   {% endif %}
{% endfor %}
</table>

{% endcache %}

{% endblock %}
