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
This commit is contained in:
Henrik Levkowetz 2010-07-26 14:18:14 +00:00
parent 161f4a1987
commit faf8eb31b8
4 changed files with 175 additions and 10 deletions
ietf
meeting
templates
static/css

View file

@ -6,6 +6,7 @@ import datetime
import os
from django.shortcuts import render_to_response, get_object_or_404
from ietf.idtracker.models import IETFWG, IRTF, Area
from django.views.generic.list_detail import object_list
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.core.urlresolvers import reverse
@ -95,6 +96,10 @@ def agenda_info(num=None):
@decorator_from_middleware(GZipMiddleware)
def html_agenda(request, num=None):
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)
wgs = IETFWG.objects.filter(status=IETFWG.ACTIVE).order_by('group_acronym__acronym')
rgs = IRTF.objects.all().order_by('acronym')
areas = Area.objects.filter(status=Area.ACTIVE).order_by('area_acronym')
if settings.SERVER_MODE != 'production' and '_testiphone' in request.REQUEST:
user_agent = "iPhone"
elif 'user_agent' in request.REQUEST:
@ -110,7 +115,8 @@ def html_agenda(request, num=None):
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, },
"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):

View file

@ -56,11 +56,11 @@ IETF.user_groups = { {% for group in user.groups.all %}"{{group}}":true{% if not
<link rel="search" href="/js/datatracker-search.xml" type="application/opensearchdescription+xml" title="IETF Datatracker Search" />
</head>
<body class="yui-skin-sam" {% block bodyAttrs %}{%endblock%}>
<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;">
<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">
<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>
</div>
<div id="ietf-login">{% if user.is_authenticated %}
<div id="ietf-login" class="noprint">{% if user.is_authenticated %}
{{ user }}
{% else %}
<a href="/accounts/login/?next={{request.path|urlencode}}" rel="nofollow">Sign In</a>
@ -68,7 +68,7 @@ IETF.user_groups = { {% for group in user.groups.all %}"{{group}}":true{% if not
<table style="margin-left:8px;margin-top:8px;" width="98%;">
<tr valign="top">
<td style="width:130px;padding-right:8px;">
<td style="width:130px;padding-right:8px;" class="noprint">
<div class="ietf-navbar">
{% include "base_leftmenu.html" %}
</div>

View file

@ -8,6 +8,13 @@ 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; }
.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;}
@ -29,17 +36,139 @@ table#agenda { border: 0; border-collapse:collapse; }
.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; }
lastfrag = frag;
var fragment = frag.split(',');
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";
}
else
{
rows[i].style.display="none";
}
}
}
}
/* Resizes an IFRAME to fit its contents */
function r(obj)
{
/* This can't work until we move the agendas into the datatracker.ietf.org
domain -- we can't query the height of a document from another domain. */
/*
docHeight = obj.contentWindow.document.height;
obj.style.height = (docHeight + 20) * 1.05 + "px"
*/
}
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');
if (wg_selector.className == 'hidden')
{
wg_selector.className = '';
}
else
{
wg_selector.className = 'hidden';
}
}
</script>
{% endblock pagehead %}
{% block bodyAttrs %}onload='updateAgendaColors()'{% endblock %}
{% 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" }}<br />
(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>
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>
@ -47,7 +176,29 @@ Updated {{ update.updated|date:"Y-m-d H:i:s T" }}<br />
{% load cache %}
{% cache 900 ietf_meeting_agenda meeting.num %}
<table id="agenda">
<div class="noprint"><button onclick="toggle_wg_selector()" >Select working groups</button></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 %}
</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 %}
</tr>
</table>
<table id="agenda" width="100%">
{% for slot in timeslots %}
{% ifchanged %}
<tr class="meeting-date">
@ -89,18 +240,24 @@ Updated {{ update.updated|date:"Y-m-d H:i:s T" }}<br />
</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.acronym|lower}}">
<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>
<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"/>
<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>
{% 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">
<iframe width="100%" height="400px" src="http://www.ietf.org/proceedings/{{ session.info.agenda_file }}" onload="r(this)"></iframe>
</td>
</tr>
{% endfor %}
{% endif %}
{% else %}

View file

@ -140,3 +140,5 @@ form table .help {
font-style: italic;
font-size: 11px;
}
@media print { .noprint { display: none } }