templates/channel_calendar.tmpl
changeset 112 090192b64d7e
parent 85 0521cf830eb9
child 113 9fc0eb751b6a
--- a/templates/channel_calendar.tmpl	Wed Feb 11 22:24:55 2009 +0200
+++ b/templates/channel_calendar.tmpl	Wed Feb 11 22:56:43 2009 +0200
@@ -1,23 +1,26 @@
 <%inherit file="channel.tmpl" />
 
-<%def name="month_table(cal, month, dates)">
+<%def name="month_table(month)">
+## the set of available days
+<% log_dates = h.set(channel.source.get_month_days(month)) %>
+## the calendar table
 <table class="calendar">
 ## table header - month name
     <tr class="month-header">
         <th colspan="7"${' class="this-month"' if h.is_this_month(month) else ''}>
-            <a href="${urls.channel_calendar.build(req, channel=channel, year=h.next_month_year(month), month=h.next_month(month))}" class="next-month">&raquo;</a>
-            <a href="${urls.channel_calendar.build(req, channel=channel, year=h.prev_month_year(month), month=h.prev_month(month))}" class="prev-month">&laquo;</a>
+            <a href="${urls.channel_calendar.build(req, channel=channel, year=h.next_month(month).year, month=h.next_month(month).month)}" class="next-month">&raquo;</a>
+            <a href="${urls.channel_calendar.build(req, channel=channel, year=h.prev_month(month).year, month=h.prev_month(month).month)}" class="prev-month">&laquo;</a>
             <span id="month-name">${h.fmt_month(month)}</span>
         </th>
     </tr>
 ## month header - weekday names    
     <tr class="week-header">
-    % for weekday in cal.iterweekdays() :
+    % for weekday in h.calendar.iterweekdays() :
         <th>${h.fmt_weekday(weekday)}</th>
     % endfor
     </tr>
 ## iterate over the weeks
-% for week in cal.monthdays2calendar(month.year, month.month) :
+% for week in h.calendar.monthdays2calendar(month.year, month.month) :
     <tr>
     ## iterate over the week's days
     % for day, weekday in week :
@@ -28,9 +31,9 @@
         ## build date
         <% date = h.build_date(month, day) %>\
         ## render cell
-        <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in dates else ''}>\
+        <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in log_dates else ''}>\
         ## link to logs for this day?
-        % if date in dates :
+        % if date in log_dates :
 <a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\
         % else :
 ${day}\
@@ -43,5 +46,8 @@
 </table>
 </%def>
 
-${month_table(calendar, month, days)}
+## three months
+${month_table(h.prev_month(month))}
+${month_table(month              )}
+${month_table(h.next_month(month))}