Skip to content

Commit faf8eb3

Browse files
committed
IETF 78 Sprint code from Adam Roach: Make the IETF agenda page view user-modifiable, providing a custom bookmarkable agenda view for each user.
- Legacy-Id: 2422
1 parent 161f4a1 commit faf8eb3

4 files changed

Lines changed: 175 additions & 10 deletions

File tree

ietf/meeting/views.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77

88
from django.shortcuts import render_to_response, get_object_or_404
9+
from ietf.idtracker.models import IETFWG, IRTF, Area
910
from django.views.generic.list_detail import object_list
1011
from django.http import HttpResponseRedirect, HttpResponse, Http404
1112
from django.core.urlresolvers import reverse
@@ -95,6 +96,10 @@ def agenda_info(num=None):
9596
@decorator_from_middleware(GZipMiddleware)
9697
def html_agenda(request, num=None):
9798
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)
99+
wgs = IETFWG.objects.filter(status=IETFWG.ACTIVE).order_by('group_acronym__acronym')
100+
rgs = IRTF.objects.all().order_by('acronym')
101+
areas = Area.objects.filter(status=Area.ACTIVE).order_by('area_acronym')
102+
98103
if settings.SERVER_MODE != 'production' and '_testiphone' in request.REQUEST:
99104
user_agent = "iPhone"
100105
elif 'user_agent' in request.REQUEST:
@@ -110,7 +115,8 @@ def html_agenda(request, num=None):
110115
template = "meeting/agenda.html"
111116
return render_to_response(template,
112117
{"timeslots":timeslots, "update":update, "meeting":meeting, "venue":venue, "ads":ads,
113-
"plenaryw_agenda":plenaryw_agenda, "plenaryt_agenda":plenaryt_agenda, },
118+
"plenaryw_agenda":plenaryw_agenda, "plenaryt_agenda":plenaryt_agenda,
119+
"wg_list" : wgs, "rg_list" : rgs, "area_list" : areas},
114120
context_instance=RequestContext(request))
115121

116122
def text_agenda(request, num=None):

ietf/templates/base.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@
5656
<link rel="search" href="/js/datatracker-search.xml" type="application/opensearchdescription+xml" title="IETF Datatracker Search" />
5757
</head>
5858
<body class="yui-skin-sam" {% block bodyAttrs %}{%endblock%}>
59-
<div style="background-color:{% if server_mode %}{% ifnotequal server_mode "production" %}#c00000{% else %}#313163{% endifnotequal %}{%else %}#313163{%endif%};color:white;font-size:150%;height:35px;">
59+
<div style="background-color:{% if server_mode %}{% ifnotequal server_mode "production" %}#c00000{% else %}#313163{% endifnotequal %}{%else %}#313163{%endif%};color:white;font-size:150%;height:35px;" class="noprint">
6060
<img src="/images/ietflogo-blue-small.png" width="60" height="34" style="vertical-align:middle;padding-left:8px;" alt=""/><span style="padding-left:15px;font-weight:bold;letter-spacing:0.1em;">datatracker.ietf.org {% if server_mode %}{% ifnotequal server_mode "production" %} - {{ server_mode|upper}} MODE{% endifnotequal %}{% endif %}</span>
6161
</div>
6262

63-
<div id="ietf-login">{% if user.is_authenticated %}
63+
<div id="ietf-login" class="noprint">{% if user.is_authenticated %}
6464
{{ user }}
6565
{% else %}
6666
<a href="/accounts/login/?next={{request.path|urlencode}}" rel="nofollow">Sign In</a>
6767
{% endif %}</div>
6868

6969
<table style="margin-left:8px;margin-top:8px;" width="98%;">
7070
<tr valign="top">
71-
<td style="width:130px;padding-right:8px;">
71+
<td style="width:130px;padding-right:8px;" class="noprint">
7272
<div class="ietf-navbar">
7373
{% include "base_leftmenu.html" %}
7474
</div>

ietf/templates/meeting/agenda.html

Lines changed: 163 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
#agenda td { padding-right:2em; }
99
#agenda tr.meeting-date td { padding-top:1em; padding-right:0;}
1010

11+
table#wg-selector { border:1px solid black; border-collapse:collapse; }
12+
#wg-selector td,#wg-selector th { border:1px solid black; padding: 2px}
13+
#wg-selector div.selected { background-color: #D0D0FF; cursor: pointer; }
14+
#wg-selector div.unselected { background-color: #FFFFFF; cursor: pointer; }
15+
#wg-selector td.inactive div { background-color: #EEEEEE; color: #808080; cursor:default;}
16+
#wg-selector.hidden { display: none; }
17+
1118
.ietf-agenda-palette { border-collapse:collapse; border:2px solid black; background:white; overflow:hidden; }
1219
.ietf-agenda-palette td { border:1px solid black; }
1320
.ietf-agenda-palette td { padding: 4px; text-align:center;}
@@ -29,25 +36,169 @@
2936
.bgwhite, .bgwhite a { background-color: white; color: black; }
3037
.bgyellow, .bgyellow a { background-color: yellow; color: black; }
3138
.bgblack, .bgblack a { background-color: black; color: white; }
39+
.groupagenda { display:none; }
40+
3241
{% endblock morecss %}
3342

3443
{% block pagehead %}
3544
<script type="text/javascript" src='/js/agenda2.js'></script>
45+
<script type="text/javascript">
46+
47+
var lastfrag;
48+
49+
function setGroupState()
50+
{
51+
var frag = window.location.hash.replace("#",'');
52+
window.setTimeout("setGroupState()",1000);
53+
if (frag == lastfrag) { return; }
54+
55+
lastfrag = frag;
56+
57+
var fragment = frag.split(',');
58+
59+
var selectors = document.getElementsByTagName('div');
60+
var re = RegExp("^selector-");
61+
var re2 = RegExp("^selector-(" + fragment.join('|') + ")$");
62+
63+
for (var i=0 ; i<selectors.length; i++)
64+
{
65+
if (re.test(selectors[i].id))
66+
{
67+
var wg = selectors[i].textContent?selectors[i].textContent:selectors[i].text;
68+
var area_groups = document.getElementById(wg + "-groups");
69+
if (re2.test(selectors[i].id))
70+
{
71+
selectors[i].className="selected";
72+
if (area_groups)
73+
{
74+
area_groups.className = 'inactive';
75+
}
76+
}
77+
else
78+
{
79+
selectors[i].className="unselected";
80+
if (area_groups)
81+
{
82+
area_groups.className = '';
83+
}
84+
}
85+
}
86+
}
87+
var rows = document.getElementsByTagName('tr');
88+
var hidenone = false;
89+
if (frag.length == 0) { hidenone=true; }
90+
91+
var re = RegExp("-(" + fragment.join('|') + ")($|-)");
92+
93+
for (var i = 0; i < rows.length; i++)
94+
{
95+
if (rows[i].className == 'groupagenda' || rows[i].className == 'grouprow')
96+
{
97+
if (re.test(rows[i].id) || (hidenone && rows[i].className == 'grouprow'))
98+
{
99+
rows[i].style.display="table-row";
100+
}
101+
else
102+
{
103+
rows[i].style.display="none";
104+
}
105+
}
106+
}
107+
108+
109+
}
110+
111+
/* Resizes an IFRAME to fit its contents */
112+
function r(obj)
113+
{
114+
/* This can't work until we move the agendas into the datatracker.ietf.org
115+
domain -- we can't query the height of a document from another domain. */
116+
117+
/*
118+
docHeight = obj.contentWindow.document.height;
119+
obj.style.height = (docHeight + 20) * 1.05 + "px"
120+
*/
121+
}
122+
123+
function toggle(selection)
124+
{
125+
var active = selection.className;
126+
var wg = selection.textContent?selection.textContent:selection.text;
127+
128+
if (active == "selected")
129+
{
130+
var re = new RegExp('(^|#|,)' + wg + "(,|$)");
131+
window.location.hash = window.location.hash.replace(re,"$2")
132+
133+
}
134+
else
135+
{
136+
if (window.location.hash.replace("#","").length == 0)
137+
{
138+
window.location.hash = wg;
139+
}
140+
else
141+
{
142+
window.location.hash += "," + wg;
143+
}
144+
145+
}
146+
window.location.hash = window.location.hash.replace(/^#?,/,'');
147+
setGroupState();
148+
}
149+
150+
function toggle_wg_selector ()
151+
{
152+
var wg_selector = document.getElementById('wg-selector');
153+
if (wg_selector.className == 'hidden')
154+
{
155+
wg_selector.className = '';
156+
}
157+
else
158+
{
159+
wg_selector.className = 'hidden';
160+
}
161+
}
162+
</script>
163+
36164
{% endblock pagehead %}
37-
{% block bodyAttrs %}onload='updateAgendaColors()'{% endblock %}
165+
{% block bodyAttrs %}onload='setGroupState();updateAgendaColors()'{% endblock %}
38166
{% block content %}
39167
<h1>IETF {{ meeting.num }} Meeting Agenda</h1>
40168
<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 />
41-
Updated {{ update.updated|date:"Y-m-d H:i:s T" }}<br />
42-
(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)</p>
169+
Updated {{ update.updated|date:"Y-m-d H:i:s T" }}</p>
170+
<div class="noprint">
171+
(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>
43172

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

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

50-
<table id="agenda">
179+
<div class="noprint"><button onclick="toggle_wg_selector()" >Select working groups</button></div>
180+
<table id="wg-selector" width="100%" class="hidden">
181+
<tr>
182+
{% for area in area_list %}
183+
<th><div id='selector-{{area.area_acronym|upper}}' class="unselected" onclick="toggle(this)">{{area.area_acronym|upper}}</div></th>
184+
{% endfor %}
185+
</tr>
186+
187+
<tr>
188+
{% for area in area_list %}
189+
<td valign="top" id="{{area.area_acronym|upper}}-groups">
190+
{% for wg in wg_list %}
191+
{% ifequal wg.area.area.area_acronym area.area_acronym %}
192+
<div id='selector-{{wg}}' class="unselected" onclick="toggle(this)">{{wg}}</div>
193+
{% endifequal %}
194+
{% endfor %}
195+
</td>
196+
{% endfor %}
197+
</tr>
198+
</table>
199+
200+
201+
<table id="agenda" width="100%">
51202
{% for slot in timeslots %}
52203
{% ifchanged %}
53204
<tr class="meeting-date">
@@ -89,18 +240,24 @@ <h2 class="ietf-divider">{{ slot.meeting_date|date:"l"|upper }}, {{ slot.meeting
89240
</tr>
90241
{% if not slot.is_plenary %}
91242
{% for session in slot.sessions_by_area|dictsort:"area" %}
92-
<tr id="{{meeting.num}}-{{slot.meeting_date|date:"D"|lower}}-{{slot.time_desc|slice:":4"}}-{{session.info.acronym|lower}}">
243+
<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">
93244
<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>
94245
{% if session.info.area %}
95246
<td>{{ session.info.area|upper}}</td>
96247
<td>{% if session.info.isWG %}<a href="/wg/{{ session.info.acronym|lower }}/">{{ session.info.acronym|lower }}</a>{% else %}{{ session.info.acronym|lower }}{% endif %}</td>
97248
<td>
98-
<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.acronym|lower}}',this);" title="color tag this line"/>
249+
<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">
99250
{% 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 %}
100251
{% if session.info.special_agenda_note %}<br/> - {{ session.info.special_agenda_note }}{% endif %}
101252
</td>
102253
{% endif %}
103254
</tr>
255+
<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">
256+
<td></td>
257+
<td colspan="3">
258+
<iframe width="100%" height="400px" src="http://www.ietf.org/proceedings/{{ session.info.agenda_file }}" onload="r(this)"></iframe>
259+
</td>
260+
</tr>
104261
{% endfor %}
105262
{% endif %}
106263
{% else %}

static/css/base2.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,5 @@ form table .help {
140140
font-style: italic;
141141
font-size: 11px;
142142
}
143+
144+
@media print { .noprint { display: none } }

0 commit comments

Comments
 (0)