|
1 <%inherit file="channel.tmpl" /> |
|
2 |
|
3 <%def name="month_table(month, is_center=True)"> |
|
4 ## the set of available days |
|
5 <% log_dates = h.set(channel.source.get_month_days(month)) %> |
|
6 ## the calendar table |
|
7 <table class="calendar"> |
|
8 ## table header - month name |
|
9 <tr class="month-header"> |
|
10 <th colspan="7"${' class="this-month"' if h.is_this_month(month) else ''}> |
|
11 % if is_center : |
|
12 <a href="${urls.channel_calendar.build(req, channel=channel, year=h.next_month(month).year, month=h.next_month(month).month)}" class="next-month" title="Next month">»</a> |
|
13 <a href="${urls.channel_calendar.build(req, channel=channel, year=h.prev_month(month).year, month=h.prev_month(month).month)}" class="prev-month" title="Previous month">«</a> |
|
14 |
|
15 <form action="${urls.channel_calendar.build(req, channel=channel)}" method="GET"> |
|
16 <select name="month"> |
|
17 ${h.select_options(((month_num, name) for month_num, name in h.months), month.month)} |
|
18 </select> |
|
19 <select name="year"> |
|
20 ${h.select_options(((None, 2006), (None, 2007), (None, 2008), (None, 2009)), month.year)} |
|
21 </select> |
|
22 <input type="submit" value="Go »" /> |
|
23 </form> |
|
24 % else : |
|
25 <span id="month-name">${h.fmt_month(month)}</span> |
|
26 % endif |
|
27 </th> |
|
28 </tr> |
|
29 ## month header - weekday names |
|
30 <tr class="week-header"> |
|
31 % for weekday in h.calendar.iterweekdays() : |
|
32 <th>${h.fmt_weekday(weekday)}</th> |
|
33 % endfor |
|
34 </tr> |
|
35 ## iterate over the weeks |
|
36 % for week in h.calendar.monthdays2calendar(month.year, month.month) : |
|
37 <tr> |
|
38 ## iterate over the week's days |
|
39 % for day, weekday in week : |
|
40 ## is it an empty cell? |
|
41 % if not day : |
|
42 <td> </td> |
|
43 % else : |
|
44 ## build date |
|
45 <% date = h.build_date(month, day) %>\ |
|
46 ## render cell |
|
47 <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date.date() not in log_dates else ''}>\ |
|
48 ## link to logs for this day? |
|
49 % if date.date() in log_dates : |
|
50 <a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\ |
|
51 % else : |
|
52 ${day}\ |
|
53 % endif |
|
54 </td> |
|
55 % endif |
|
56 % endfor |
|
57 </tr> |
|
58 % endfor |
|
59 </table> |
|
60 </%def> |
|
61 |
|
62 <div id="title">${channel.title} :: Calendar for ${h.fmt_month(month)}</div> |
|
63 |
|
64 <div class="calendar-list"> |
|
65 ## three months |
|
66 ${month_table(h.prev_month(month), is_center=False )} |
|
67 ${month_table(month, is_center=True )} |
|
68 ${month_table(h.next_month(month), is_center=False )} |
|
69 </div> |