From 5c9526645ae6a5ef352efe7a19af2cdc23bef881 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@equinox-laptop.chaos-at-home.org>
Date: Thu, 1 Dec 2011 21:24:59 +0100
Subject: added week number calculations


diff --git a/program/views.py b/program/views.py
index 2f5c137..4bad7f8 100644
--- a/program/views.py
+++ b/program/views.py
@@ -110,4 +110,11 @@ def week_schedule(request, year=None, week=None):
     extra_context['saturday_timeslots'] = TimeSlot.objects.get_day_timeslots(saturday)
     extra_context['sunday_timeslots'] = TimeSlot.objects.get_day_timeslots(sunday)
 
+    extra_context['last_w'] = datetime.strftime(monday-timedelta(days=7), '%Y/%W')
+    extra_context['cur_w'] = '%s/%s' % (year, week)
+    extra_context['next_w1'] = datetime.strftime(monday+timedelta(days=7), '%Y/%W')
+    extra_context['next_w2'] = datetime.strftime(monday+timedelta(days=14), '%Y/%W')
+    extra_context['next_w3'] = datetime.strftime(monday+timedelta(days=21), '%Y/%W')
+    extra_context['next_w4'] = datetime.strftime(monday+timedelta(days=28), '%Y/%W')
+
     return simple.direct_to_template(request, template='program/week_schedule.html', extra_context=extra_context)
-- 
cgit v0.10.2


From 161d7a1631d250db6bc52e38ec3c31d2b15f128a Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@equinox-laptop.chaos-at-home.org>
Date: Thu, 1 Dec 2011 21:51:06 +0100
Subject: added multi week navigation to template


diff --git a/templates/program/week_schedule.html b/templates/program/week_schedule.html
index 2006694..f446f1b 100644
--- a/templates/program/week_schedule.html
+++ b/templates/program/week_schedule.html
@@ -34,6 +34,7 @@
         <div style="height: 60px;">05:00</div>
     </div>
     <div id="monday" class="weekday weekday-first">
+        <div class="week-navigation"><a href="/program/{{ last_w }}">&lt;--</a></div>
         <h2>{{ monday|date:"l d.m.Y" }}</h2>
         {% for timeslot in monday_timeslots %}
             {% include "program/week_schedule_timeslot.html" %}
@@ -41,6 +42,7 @@
     </div>
 
     <div id="tuesday" class="weekday">
+        <div class="week-navigation">{{ cur_w }}</div>
         <h2>{{ tuesday|date:"l d.m.Y" }}</h2>
         {% for timeslot in tuesday_timeslots %}
             {% include "program/week_schedule_timeslot.html" %}
@@ -48,6 +50,7 @@
     </div>
 
     <div id="wednesday" class="weekday">
+        <div class="week-navigation"><a href="/program/{{ next_w1 }}">{{ next_w1 }}</a></div>
         <h2>{{ wednesday|date:"l d.m.Y" }}</h2>
         {% for timeslot in wednesday_timeslots %}
             {% include "program/week_schedule_timeslot.html" %}
@@ -55,6 +58,7 @@
     </div>
 
     <div id="thursday" class="weekday">
+        <div class="week-navigation"><a href="/program/{{ next_w2 }}">{{ next_w2 }}</a></div>
         <h2>{{ thursday|date:"l d.m.Y" }}</h2>
         {% for timeslot in thursday_timeslots %}
             {% include "program/week_schedule_timeslot.html" %}
@@ -62,6 +66,7 @@
     </div>
 
     <div id="friday" class="weekday">
+        <div class="week-navigation"><a href="/program/{{ next_w3 }}">{{ next_w3 }}</a></div>
         <h2>{{ friday|date:"l d.m.Y" }}</h2>
         {% for timeslot in friday_timeslots %}
             {% include "program/week_schedule_timeslot.html" %}
@@ -69,6 +74,7 @@
     </div>
 
     <div id="saturday" class="weekday">
+        <div class="week-navigation"><a href="/program/{{ next_w4 }}">{{ next_w4 }}</a></div>
         <h2>{{ saturday|date:"l d.m.Y" }}</h2>
         {% for timeslot in saturday_timeslots %}
             {% include "program/week_schedule_timeslot.html" %}
@@ -76,6 +82,7 @@
     </div>
 
     <div id="sunday" class="weekday weekday-last">
+        <div class="week-navigation"><a href="/program/{{ next_w1 }}">--&gt;</a></div>
         <h2>{{ sunday|date:"l d.m.Y" }}</h2>
         {% for timeslot in sunday_timeslots %}
             {% include "program/week_schedule_timeslot.html" %}
-- 
cgit v0.10.2