Provide html agendas with local and UTC timezone indications.

- Legacy-Id: 5484
This commit is contained in:
Henrik Levkowetz 2013-03-05 22:46:16 +00:00
parent 69e7373758
commit fc369a6e30
6 changed files with 40 additions and 12 deletions

View file

@ -104,17 +104,15 @@ class TimeSlot(models.Model):
show_location = models.BooleanField(default=True, help_text="Show location in agenda")
session = models.ForeignKey('Session', null=True, blank=True, help_text=u"Scheduled session, if any")
modified = models.DateTimeField(default=datetime.datetime.now)
#
def __unicode__(self):
location = self.get_location()
if not location:
location = "(no location)"
return u"%s: %s-%s %s, %s" % (self.meeting.number, self.time.strftime("%m-%d %H:%M"), (self.time + self.duration).strftime("%H:%M"), self.name, location)
def end_time(self):
return self.time + self.duration
def get_location(self):
location = self.location
if location:
@ -123,14 +121,21 @@ class TimeSlot(models.Model):
location = self.meeting.reg_area
elif self.type_id == "break":
location = self.meeting.break_area
if not self.show_location:
location = ""
return location
@property
def tz(self):
return pytz.timezone(self.meeting.time_zone)
def tzname(self):
return self.tz.tzname(self.time)
def utc_start_time(self):
local_start_time = self.tz.localize(self.time)
return local_start_time.astimezone(pytz.utc)
def utc_end_time(self):
local_end_time = self.tz.localize(self.end_time())
return local_end_time.astimezone(pytz.utc)
class Constraint(models.Model):
"""Specifies a constraint on the scheduling between source and
target, e.g. some kind of conflict."""

View file

@ -9,6 +9,7 @@ urlpatterns = patterns('',
(r'^(?P<meeting_num>\d+)/materials.html$', views.show_html_materials),
(r'^agenda/$', views.html_agenda),
(r'^agenda(?:.html)?$', views.html_agenda),
(r'^agenda-utc(?:.html)?$', views.html_agenda_utc),
(r'^requests.html$', redirect_to, {"url": '/meeting/requests', "permanent": True}),
(r'^requests$', views.meeting_requests),
(r'^agenda.txt$', views.text_agenda),

View file

@ -141,7 +141,7 @@ def agenda_infoREDESIGN(num=None):
if g.state_id == "active":
ads.extend(IESGHistory().from_role(x, meeting_time) for x in g.role_set.filter(name="ad").select_related('group', 'person'))
active_agenda = State.objects.get(type='agenda', slug='active')
active_agenda = State.objects.get(used=True, type='agenda', slug='active')
plenary_agendas = Document.objects.filter(session__meeting=meeting, session__timeslot__type="plenary", type="agenda", ).distinct()
plenaryw_agenda = plenaryt_agenda = "The Plenary has not been scheduled"
for agenda in plenary_agendas:
@ -166,8 +166,7 @@ def agenda_infoREDESIGN(num=None):
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
agenda_info = agenda_infoREDESIGN
@decorator_from_middleware(GZipMiddleware)
def html_agenda(request, num=None):
def get_agenda_info(request, num=None):
if settings.SERVER_MODE != 'production' and '_testiphone' in request.REQUEST:
user_agent = "iPhone"
elif 'user_agent' in request.REQUEST:
@ -189,12 +188,26 @@ def html_agenda(request, num=None):
wg_list = Group.objects.filter(acronym__in = set(wg_name_list)).order_by('parent__acronym','acronym')
return timeslots, modified, meeting, area_list, wg_list
@decorator_from_middleware(GZipMiddleware)
def html_agenda(request, num=None):
timeslots, modified, meeting, area_list, wg_list = get_agenda_info(request, num)
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")
@decorator_from_middleware(GZipMiddleware)
def html_agenda_utc(request, num=None):
timeslots, modified, meeting, area_list, wg_list = get_agenda_info(request, num)
return HttpResponse(render_to_string("meeting/agenda_utc.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 iphone_agenda(request, num):
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)

View file

@ -291,7 +291,7 @@ img.hidden { display: none; }
<p>{{ meeting.city }}, {{ meeting.date|date:"F j" }} &#8211; {% ifnotequal meeting.date.month meeting.end_date.month %}{{ meeting.end_date|date:"F " }}{% endifnotequal %}{{ meeting.end_date|date:"j, Y" }}<br />
Updated {{ modified|date:"Y-m-d H:i:s T" }}</p>
<div class="noprint">
(There's also a <a href="/meeting/{{meeting.number}}/agenda.txt">plaintext agenda</a> and a <a href="http://tools.ietf.org/agenda/{{meeting.number}}/">tools-style agenda</a> available)</div>
(There's also a <a href="agenda-utc">agenda with UTC times</a>, a <a href="/meeting/{{meeting.number}}/agenda.txt">plaintext agenda</a> and a <a href="http://tools.ietf.org/agenda/{{meeting.number}}/">tools-style agenda</a> available)</div>
<p><strong>IETF agendas are subject to change, up to and during the meeting.</strong></p>
@ -357,7 +357,9 @@ You can customize the agenda below to show only selected working group sessions.
{% ifchanged %}
<tr class="time-title">
<td colspan="1" class="timecolumn">
{{slot.time|date:"Hi"}}-{{slot.end_time|date:"Hi"}}
{% block slottime %}
{{slot.time|date:"Hi"}}-{{slot.end_time|date:"Hi"}}&nbsp;<span class="ietf-tiny">{{slot.tzname}}</span>
{% endblock %}
</td>
<td colspan="5">
{% if slot.type.name == 'Session' %}{{ slot.time|date:"l"}}{% endif %}

View file

@ -0,0 +1,6 @@
{# Copyright The IETF Trust 2012, All Rights Reserved #}
{% extends "meeting/agenda.html" %}
{% block slottime %}
{{slot.utc_start_time|date:"Hi"}}-{{slot.utc_end_time|date:"Hi"}}&nbsp;<span class="ietf-tiny">UTC</span>
{% endblock %}

View file

@ -125,6 +125,7 @@ table.ballot_icon td { border: 1px solid black; height: 7px; width: 6px; padding
table.ballot_icon td.my { border: 3px outset black;}
.ietf-small { font-size:85%; }
.ietf-tiny { font-size:70%; }
.ietf-highlight-y { padding:0 2px;background:yellow;}
.ietf-highlight-r { padding:0 2px;background:#ffa0a0;}
.ietf-divider { background: #2647a0; color: white; font-size:116%; padding:0.5em 1em; }