Skip to content

Commit fc369a6

Browse files
committed
Provide html agendas with local and UTC timezone indications.
- Legacy-Id: 5484
1 parent 69e7373 commit fc369a6

6 files changed

Lines changed: 40 additions & 12 deletions

File tree

ietf/meeting/models.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,15 @@ class TimeSlot(models.Model):
104104
show_location = models.BooleanField(default=True, help_text="Show location in agenda")
105105
session = models.ForeignKey('Session', null=True, blank=True, help_text=u"Scheduled session, if any")
106106
modified = models.DateTimeField(default=datetime.datetime.now)
107-
107+
#
108108
def __unicode__(self):
109109
location = self.get_location()
110110
if not location:
111111
location = "(no location)"
112112

113113
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)
114-
115114
def end_time(self):
116115
return self.time + self.duration
117-
118116
def get_location(self):
119117
location = self.location
120118
if location:
@@ -123,14 +121,21 @@ def get_location(self):
123121
location = self.meeting.reg_area
124122
elif self.type_id == "break":
125123
location = self.meeting.break_area
126-
127124
if not self.show_location:
128125
location = ""
129-
130126
return location
127+
@property
128+
def tz(self):
129+
return pytz.timezone(self.meeting.time_zone)
130+
def tzname(self):
131+
return self.tz.tzname(self.time)
132+
def utc_start_time(self):
133+
local_start_time = self.tz.localize(self.time)
134+
return local_start_time.astimezone(pytz.utc)
135+
def utc_end_time(self):
136+
local_end_time = self.tz.localize(self.end_time())
137+
return local_end_time.astimezone(pytz.utc)
131138

132-
133-
134139
class Constraint(models.Model):
135140
"""Specifies a constraint on the scheduling between source and
136141
target, e.g. some kind of conflict."""

ietf/meeting/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
(r'^(?P<meeting_num>\d+)/materials.html$', views.show_html_materials),
1010
(r'^agenda/$', views.html_agenda),
1111
(r'^agenda(?:.html)?$', views.html_agenda),
12+
(r'^agenda-utc(?:.html)?$', views.html_agenda_utc),
1213
(r'^requests.html$', redirect_to, {"url": '/meeting/requests', "permanent": True}),
1314
(r'^requests$', views.meeting_requests),
1415
(r'^agenda.txt$', views.text_agenda),

ietf/meeting/views.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def agenda_infoREDESIGN(num=None):
141141
if g.state_id == "active":
142142
ads.extend(IESGHistory().from_role(x, meeting_time) for x in g.role_set.filter(name="ad").select_related('group', 'person'))
143143

144-
active_agenda = State.objects.get(type='agenda', slug='active')
144+
active_agenda = State.objects.get(used=True, type='agenda', slug='active')
145145
plenary_agendas = Document.objects.filter(session__meeting=meeting, session__timeslot__type="plenary", type="agenda", ).distinct()
146146
plenaryw_agenda = plenaryt_agenda = "The Plenary has not been scheduled"
147147
for agenda in plenary_agendas:
@@ -166,8 +166,7 @@ def agenda_infoREDESIGN(num=None):
166166
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
167167
agenda_info = agenda_infoREDESIGN
168168

169-
@decorator_from_middleware(GZipMiddleware)
170-
def html_agenda(request, num=None):
169+
def get_agenda_info(request, num=None):
171170
if settings.SERVER_MODE != 'production' and '_testiphone' in request.REQUEST:
172171
user_agent = "iPhone"
173172
elif 'user_agent' in request.REQUEST:
@@ -189,12 +188,26 @@ def html_agenda(request, num=None):
189188

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

191+
return timeslots, modified, meeting, area_list, wg_list
192+
193+
@decorator_from_middleware(GZipMiddleware)
194+
def html_agenda(request, num=None):
195+
timeslots, modified, meeting, area_list, wg_list = get_agenda_info(request, num)
192196
return HttpResponse(render_to_string("meeting/agenda.html",
193197
{"timeslots":timeslots, "modified": modified, "meeting":meeting,
194198
"area_list": area_list, "wg_list": wg_list ,
195199
"show_inline": set(["txt","htm","html"]) },
196200
RequestContext(request)), mimetype="text/html")
197201

202+
@decorator_from_middleware(GZipMiddleware)
203+
def html_agenda_utc(request, num=None):
204+
timeslots, modified, meeting, area_list, wg_list = get_agenda_info(request, num)
205+
return HttpResponse(render_to_string("meeting/agenda_utc.html",
206+
{"timeslots":timeslots, "modified": modified, "meeting":meeting,
207+
"area_list": area_list, "wg_list": wg_list ,
208+
"show_inline": set(["txt","htm","html"]) },
209+
RequestContext(request)), mimetype="text/html")
210+
198211
def iphone_agenda(request, num):
199212
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)
200213

ietf/templates/meeting/agenda.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ <h1>IETF {{ meeting.number }} Meeting Agenda</h1>
291291
<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 />
292292
Updated {{ modified|date:"Y-m-d H:i:s T" }}</p>
293293
<div class="noprint">
294-
(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>
294+
(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>
295295

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

@@ -357,7 +357,9 @@ <h2 class="ietf-divider">{{ slot.time|date:"l"|upper }}, {{ slot.time|date:"F j,
357357
{% ifchanged %}
358358
<tr class="time-title">
359359
<td colspan="1" class="timecolumn">
360-
{{slot.time|date:"Hi"}}-{{slot.end_time|date:"Hi"}}
360+
{% block slottime %}
361+
{{slot.time|date:"Hi"}}-{{slot.end_time|date:"Hi"}}&nbsp;<span class="ietf-tiny">{{slot.tzname}}</span>
362+
{% endblock %}
361363
</td>
362364
<td colspan="5">
363365
{% if slot.type.name == 'Session' %}{{ slot.time|date:"l"}}{% endif %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{# Copyright The IETF Trust 2012, All Rights Reserved #}
2+
{% extends "meeting/agenda.html" %}
3+
{% block slottime %}
4+
{{slot.utc_start_time|date:"Hi"}}-{{slot.utc_end_time|date:"Hi"}}&nbsp;<span class="ietf-tiny">UTC</span>
5+
{% endblock %}
6+

static/css/base2.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ table.ballot_icon td { border: 1px solid black; height: 7px; width: 6px; padding
125125
table.ballot_icon td.my { border: 3px outset black;}
126126

127127
.ietf-small { font-size:85%; }
128+
.ietf-tiny { font-size:70%; }
128129
.ietf-highlight-y { padding:0 2px;background:yellow;}
129130
.ietf-highlight-r { padding:0 2px;background:#ffa0a0;}
130131
.ietf-divider { background: #2647a0; color: white; font-size:116%; padding:0.5em 1em; }

0 commit comments

Comments
 (0)