changeset 345:f7fbb404241f

Fix #164; have the calendar display times in the user's time zone. If the user isn't logged in, just use US/Pacific. Default the calendar mode to agenda mode.
author Brian Neal <bgneal@gmail.com>
date Mon, 28 Feb 2011 01:58:38 +0000
parents 7eed448b399c
children efa3b4901777
files gpp/gcalendar/views.py gpp/templates/gcalendar/index.html
diffstat 2 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/gcalendar/views.py	Sun Feb 27 22:58:48 2011 +0000
+++ b/gpp/gcalendar/views.py	Mon Feb 28 01:58:38 2011 +0000
@@ -18,7 +18,15 @@
 
 
 def index(request):
+    user = request.user
+    if user.is_authenticated():
+        profile = user.get_profile()
+        tz = profile.time_zone
+    else:
+        tz = 'US/Pacific'
+
     return render_to_response('gcalendar/index.html', {
+        'tz': tz,
         },
         context_instance = RequestContext(request))
 
--- a/gpp/templates/gcalendar/index.html	Sun Feb 27 22:58:48 2011 +0000
+++ b/gpp/templates/gcalendar/index.html	Mon Feb 28 01:58:38 2011 +0000
@@ -3,11 +3,21 @@
 {% block title %}Event Calendar{% endblock %}
 {% block content %}
 <h2>SurfGuitar101 Event Calendar</h2>
-<p>All times are shown in the US/Central time zone. You can add any event on our calendar to your own 
+<p>Welcome to the SG101 event calendar. You can add any event on our calendar to your own 
 <a href="http://www.google.com/googlecalendar/overview.html">Google calendar</a>. If you do, the event
 will be displayed in your time zone, and you can have Google send you email or text message reminders for
 the events. Click on any event below to see more details or copy it to your calendar.</p>
-<iframe src="//www.google.com/calendar/embed?showTitle=0&amp;showTz=0&amp;height=540&amp;wkst=1&amp;bgcolor=%23DFDFDF&amp;src=i81lu3fkh57sgqqenogefd9v78%40group.calendar.google.com&amp;color=%231B887A&amp;ctz=America%2FChicago" style=" border:solid 1px #777 " width="720" height="540" frameborder="0" scrolling="no"></iframe>
+{% if user.is_authenticated %}
+<p><strong>Please note:</strong> all times shown are in the <strong>{{ tz }}</strong>
+time zone, which is the time zone preference you have set in your
+<a href="{% url 'bio-me' %}">user profile</a>.
+</p>
+{% else %}
+<p><strong>Please note:</strong> all times shown are in the <strong>{{ tz }}</strong> time zone. Please
+<a href="{% url 'accounts-login' %}">login</a> to view the times based on the time zone set in your profile.</p>
+{% endif %}
+
+<iframe src="//www.google.com/calendar/embed?mode=AGENDA&amp;showTitle=0&amp;showTz=0&amp;height=540&amp;wkst=1&amp;bgcolor=%23DFDFDF&amp;src=i81lu3fkh57sgqqenogefd9v78%40group.calendar.google.com&amp;color=%231B887A&amp;ctz={{ tz|urlencode:"" }}" style=" border:solid 1px #777 " width="720" height="540" frameborder="0" scrolling="no"></iframe>
 
 <ul>
 {% if user.is_authenticated %}