From fc369a6e30faef1cd759688536a2029fd2ec2d34 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Tue, 5 Mar 2013 22:46:16 +0000 Subject: [PATCH] Provide html agendas with local and UTC timezone indications. - Legacy-Id: 5484 --- ietf/meeting/models.py | 19 ++++++++++++------- ietf/meeting/urls.py | 1 + ietf/meeting/views.py | 19 ++++++++++++++++--- ietf/templates/meeting/agenda.html | 6 ++++-- ietf/templates/meeting/agenda_utc.html | 6 ++++++ static/css/base2.css | 1 + 6 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 ietf/templates/meeting/agenda_utc.html diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py index 52b15b692..98f4af722 100644 --- a/ietf/meeting/models.py +++ b/ietf/meeting/models.py @@ -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.""" diff --git a/ietf/meeting/urls.py b/ietf/meeting/urls.py index 2b7bc160d..1d891b58e 100644 --- a/ietf/meeting/urls.py +++ b/ietf/meeting/urls.py @@ -9,6 +9,7 @@ urlpatterns = patterns('', (r'^(?P\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), diff --git a/ietf/meeting/views.py b/ietf/meeting/views.py index eb82bd72a..1295b587c 100644 --- a/ietf/meeting/views.py +++ b/ietf/meeting/views.py @@ -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) diff --git a/ietf/templates/meeting/agenda.html b/ietf/templates/meeting/agenda.html index e88461200..e3e60d6d8 100644 --- a/ietf/templates/meeting/agenda.html +++ b/ietf/templates/meeting/agenda.html @@ -291,7 +291,7 @@ img.hidden { display: none; }

{{ meeting.city }}, {{ meeting.date|date:"F j" }} – {% ifnotequal meeting.date.month meeting.end_date.month %}{{ meeting.end_date|date:"F " }}{% endifnotequal %}{{ meeting.end_date|date:"j, Y" }}
Updated {{ modified|date:"Y-m-d H:i:s T" }}

-(There's also a plaintext agenda and a tools-style agenda available)
+(There's also a agenda with UTC times, a plaintext agenda and a tools-style agenda available)

IETF agendas are subject to change, up to and during the meeting.

@@ -357,7 +357,9 @@ You can customize the agenda below to show only selected working group sessions. {% ifchanged %} - {{slot.time|date:"Hi"}}-{{slot.end_time|date:"Hi"}} + {% block slottime %} + {{slot.time|date:"Hi"}}-{{slot.end_time|date:"Hi"}} {{slot.tzname}} + {% endblock %} {% if slot.type.name == 'Session' %}{{ slot.time|date:"l"}}{% endif %} diff --git a/ietf/templates/meeting/agenda_utc.html b/ietf/templates/meeting/agenda_utc.html new file mode 100644 index 000000000..2b72a010d --- /dev/null +++ b/ietf/templates/meeting/agenda_utc.html @@ -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"}} UTC +{% endblock %} + diff --git a/static/css/base2.css b/static/css/base2.css index 76d51ae4c..3eb10e1f2 100644 --- a/static/css/base2.css +++ b/static/css/base2.css @@ -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; }