Skip to content

Commit

Permalink
Migrated HTML agenda to new data model. This has several improvements…
Browse files Browse the repository at this point in the history
…, as well, such as clearer marking of BOFs.

 - Legacy-Id: 4265
  • Loading branch information
adamroach committed Apr 5, 2012
1 parent 740487d commit c113bd0
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 114 deletions.
4 changes: 4 additions & 0 deletions ietf/doc/models.py
Expand Up @@ -60,6 +60,10 @@ class DocumentInfo(models.Model):
note = models.TextField(blank=True)
internal_comments = models.TextField(blank=True)

def file_extension(self):
_,ext = os.path.splitext(self.external_url)
return ext.lstrip(".").lower()

def get_file_path(self):
if self.type_id == "draft":
return settings.INTERNET_DRAFT_PATH
Expand Down
63 changes: 49 additions & 14 deletions ietf/meeting/views.py
Expand Up @@ -33,7 +33,7 @@

# New models
from ietf.meeting.models import Meeting, Room, TimeSlot, Constraint, Session
from ietf.group.models import Group
from ietf.group.models import Group, GroupManager


@decorator_from_middleware(GZipMiddleware)
Expand Down Expand Up @@ -197,6 +197,34 @@ def agenda_infoREDESIGN(num=None):

@decorator_from_middleware(GZipMiddleware)
def html_agenda(request, num=None):
if settings.SERVER_MODE != 'production' and '_testiphone' in request.REQUEST:
user_agent = "iPhone"
elif 'user_agent' in request.REQUEST:
user_agent = request.REQUEST['user_agent']
elif 'HTTP_USER_AGENT' in request.META:
user_agent = request.META["HTTP_USER_AGENT"]
else:
user_agent = ""
if "iPhone" in user_agent:
return iphone_agenda(request, num)

meeting = get_meeting(num)
timeslots = TimeSlot.objects.filter(Q(meeting = meeting.number)).order_by('time','name')
modified = timeslots.aggregate(Max('modified'))['modified__max']

area_list = timeslots.filter(type = 'Session', session__group__parent__isnull = False).order_by('session__group__parent__acronym').distinct('session__group__parent__acronym').values_list('session__group__parent__acronym',flat=True)

wg_name_list = timeslots.filter(type = 'Session', session__group__isnull = False, session__group__parent__isnull = False).order_by('session__group__acronym').distinct('session__group').values_list('session__group__acronym',flat=True)

wg_list = Group.objects.filter(acronym__in = set(wg_name_list)).order_by('parent__acronym','acronym')

return HttpResponse(render_to_string("meeting/agenda.html",
{"timeslots":timeslots, "modified": modified, "meeting":meeting,
"area_list": area_list, "wg_list": wg_list ,
"show_inline": set(["txt","htm","html"]) },
RequestContext(request)), mimetype="text/html")

def deprecated_PLEASE_REMOVE_ME(request, num=None):
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)

groups_meeting = [];
Expand All @@ -209,26 +237,33 @@ def html_agenda(request, num=None):
rgs = IRTF.objects.all().filter(acronym__in = groups_meeting).order_by('acronym')
areas = Area.objects.filter(status=Area.ACTIVE).order_by('area_acronym__acronym')

if settings.SERVER_MODE != 'production' and '_testiphone' in request.REQUEST:
user_agent = "iPhone"
elif 'user_agent' in request.REQUEST:
user_agent = request.REQUEST['user_agent']
elif 'HTTP_USER_AGENT' in request.META:
user_agent = request.META["HTTP_USER_AGENT"]
else:
user_agent = ""
#print user_agent
if "iPhone" in user_agent:
template = "meeting/m_agenda.html"
else:
template = "meeting/agenda.html"
template = "meeting/agenda.html"
return render_to_response(template,
{"timeslots":timeslots, "update":update, "meeting":meeting, "venue":venue, "ads":ads,
"plenaryw_agenda":plenaryw_agenda, "plenaryt_agenda":plenaryt_agenda,
"wg_list" : wgs, "rg_list" : rgs, "area_list" : areas},
context_instance=RequestContext(request))

def iphone_agenda(request, num):
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)

groups_meeting = [];
for slot in timeslots:
for session in slot.sessions():
groups_meeting.append(session.acronym())
groups_meeting = set(groups_meeting);

wgs = IETFWG.objects.filter(status=IETFWG.ACTIVE).filter(group_acronym__acronym__in = groups_meeting).order_by('group_acronym__acronym')
rgs = IRTF.objects.all().filter(acronym__in = groups_meeting).order_by('acronym')
areas = Area.objects.filter(status=Area.ACTIVE).order_by('area_acronym__acronym')
template = "meeting/m_agenda.html"
return render_to_response(template,
{"timeslots":timeslots, "update":update, "meeting":meeting, "venue":venue, "ads":ads,
"plenaryw_agenda":plenaryw_agenda, "plenaryt_agenda":plenaryt_agenda,
"wg_list" : wgs, "rg_list" : rgs, "area_list" : areas},
context_instance=RequestContext(request))


def text_agenda(request, num=None):
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)
plenaryw_agenda = " "+plenaryw_agenda.strip().replace("\n", "\n ")
Expand Down
199 changes: 100 additions & 99 deletions ietf/templates/meeting/agenda.html
Expand Up @@ -10,8 +10,8 @@

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 div.selected { background-color: #c0c0FF; cursor: pointer; }
#wg-selector div.unselected { 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; }
Expand All @@ -27,6 +27,21 @@
#ical-link A:active { color: #FF00FF; }
#ical-link A:hover { color: #FF0000; }

tr.time-title { font-weight: bold; color:#800000;}
tr.grouprow > td { padding: 4px; }
td.materials { align:right; }
span.note { font-style: italic; color:#ff0000; }

#APP-groups, #selector-APP { color:#008; background-color:#eef }
#GEN-groups, #selector-GEN { color:#080; background-color:#efe }
#INT-groups, #selector-INT { color:#088; background-color:#eff }
#OPS-groups, #selector-OPS { color:#800; background-color:#fee }
#RAI-groups, #selector-RAI { color:#808; background-color:#fef }
#RTG-groups, #selector-RTG { color:#880; background-color:#ffe }
#SEC-groups, #selector-SEC { color:#488; background-color:#dff }
#TSV-groups, #selector-TSV { color:#484; background-color:#dfd }
#IRTF-groups, #selector-IRTF { color:#448; background-color:#ddf }

img.hidden { display: none; }

.ietf-agenda-palette { border-collapse:collapse; border:2px solid black; background:white; overflow:hidden; }
Expand Down Expand Up @@ -135,7 +150,6 @@
{
iframe.setAttribute("src",iframe.getAttribute("xsrc"));
}
r(iframe);
}
}
else
Expand All @@ -148,15 +162,28 @@

}

/* Resizes an IFRAME to fit its contents */
function r(obj)
/* Resizes an IFRAME to fit its contents and attempts to convert to a div */
function r(iframe)
{
try
{
docHeight = obj.contentWindow.document.body.scrollHeight;
obj.height = docHeight;
iframe.height = 1;
docHeight = iframe.contentWindow.document.body.scrollHeight;
iframe.height = docHeight;
}
catch (e) { return; }

if (iframe.contentWindow.document.body.innerHTML)
{
var div = document.createElement("div");
div.style.border = "solid";
div.style.borderWidth = "1px";
div.style.margin = "0";
div.style.padding = "10px";
div.style.overflow = "auto";
div.innerHTML=iframe.contentWindow.document.body.innerHTML;
iframe.parentNode.replaceChild(div,iframe);
}
catch (e) {}
}

function toggle(selection)
Expand Down Expand Up @@ -211,48 +238,36 @@
{% 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>
Updated {{ modified|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 %}
{% 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>
<th><div id='selector-{{area|upper}}' class="unselected" onclick="toggle(this)">{{area|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>

{% for wg in wg_list %}{% ifchanged wg.parent.acronym %}{% if forloop.counter > 1 %}
</td>{% endif %}
<td valign="top" id="{{wg.parent.acronym|upper}}-groups">{% endifchanged %}
<div id='selector-{{wg.acronym}}' class="unselected" onclick="toggle(this)">{% if wg.state.name = "BOF" %}<i>{{wg.acronym}}</i>{% else %}{{wg.acronym}}{% endif %}</div>{% endfor %}
</td>
</tr>
<tr><td align="center" colspan="{{area_list.count}}"><i>Groups displayed in italics are BOFs</i></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>
Expand All @@ -263,78 +278,64 @@ <h1>IETF {{ meeting.num }} Meeting Agenda</h1>
{% 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>
<td colspan="6">
<h2 class="ietf-divider">{{ slot.time|date:"l"|upper }}, {{ slot.time|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>
{% ifchanged %}
<tr class="time-title">
<td colspan="1">
{{slot.time|date:"Hi"}}-{{slot.end_time|date:"Hi"}}
</td>
<td colspan="5">
{{slot.name}}
{% if slot.type.name != 'Session' %} -
{% if slot.show_location %}<a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{ slot.get_location|slugify }}">{{slot.get_location|escape}}</a>{% endif %}
{% endif %}
</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 %}
{% endifchanged %}
{% if slot.type.name = 'Session' %} {% if slot.session.group %}
<tr id="{{meeting.num}}-{{slot.time|date:"D-Hi"|lower}}-{{slot.session.group.parent.acronym|upper}}-{{slot.session.group.acronym|lower}}" class="grouprow">
<td>
<td>{% if slot.show_location %}<a href="http://tools.ietf.org/agenda/{{meeting.num}}/venue/?room={{ slot.get_location|slugify }}">{{slot.get_location|escape}}</a>{% endif %}</td>
<td>{{slot.session.group.parent.acronym|upper}}</td>
<td>
{% if slot.session.group.charter %}<a href="{{slot.session.group.charter.get_absolute_url}}">{{slot.session.group.acronym}}</a>
{% else %}{{slot.session.group.acronym}}{% endif %}</td>
<td>
<img src="/images/color-palette-4x4.gif" alt="" onclick="pickAgendaColor('{{meeting.num}}-{{slot.time|date:"D-Hi"|lower}}-{{slot.session.group.parent.acronym|upper}}-{{slot.session.group.acronym|lower}}',this);" title="color tag this line"/ class="noprint">
{% if slot.session.agenda %}<a href="/meeting/{{ meeting.num }}/agenda/{{ slot.session.group.acronym }}-agenda/">{{slot.session.group.name}}</a>
{% else %}{{slot.session.group.name}}{% endif %}
{% if slot.session.group.state.name = "BOF" %} BOF {% endif %}
{% if slot.session.agenda_note %}
<br/><span class="note">{{slot.session.agenda_note}}</span>{% endif %}</td>
<td class="materials">{% if slot.session.agenda %}drafts:&nbsp;<a href="/meeting/{{meeting.num}}/agenda/{{slot.session.group.acronym}}-drafts.tgz">tar</a>|<a href="/meeting/{{ meeting.num }}/agenda/{{slot.session.group.acronym}}-drafts.pdf">pdf</a>{%endif%}</td>
</tr>
<tr id="{{meeting.num}}-{{slot.time|date:"D-Hi"|lower}}-{{slot.session.group.parent.acronym|upper}}-{{slot.session.group.acronym|lower}}" class="groupagenda">
<td></td>
<td colspan="5">
{% if slot.session.agenda %}
{% if slot.session.agenda.file_extension in show_inline%}
<iframe width="100%" height="1px" src="about:blank" xsrc="/meeting/{{ meeting.num }}/agenda/{{ slot.session.group.acronym }}-agenda/" onload="r(this)"></iframe>
{% else %}
<b><i>Agenda submitted in {{slot.session.agenda.file_extension|upper}} format</i></b>
{% endif %}
{% else %}
<b><i>No Agenda Submitted</i></b>
{% endif %}
</td>
</tr>

{% endif %} {% endif %}
{% if slot.type.name = 'Plenary' %}
<tr>
<td></td>
<td colspan="5">
<iframe width="100%" height="1px" src="/meeting/{{ meeting.num }}/agenda/{{ slot.session.group.acronym }}-agenda/" onload="r(this)"></iframe>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
Expand Down

0 comments on commit c113bd0

Please sign in to comment.