--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk/irclogs/templates/channel_calendar.tmpl Sun Sep 13 20:08:16 2009 +0300
@@ -0,0 +1,69 @@
+<%inherit file="channel.tmpl" />
+
+<%def name="month_table(month, is_center=True)">
+## 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 ''}>
+ % if is_center :
+ <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>
+ <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>
+
+ <form action="${urls.channel_calendar.build(req, channel=channel)}" method="GET">
+ <select name="month">
+ ${h.select_options(((month_num, name) for month_num, name in h.months), month.month)}
+ </select>
+ <select name="year">
+ ${h.select_options(((None, 2006), (None, 2007), (None, 2008), (None, 2009)), month.year)}
+ </select>
+ <input type="submit" value="Go »" />
+ </form>
+ % else :
+ <span id="month-name">${h.fmt_month(month)}</span>
+ % endif
+ </th>
+ </tr>
+## month header - weekday names
+ <tr class="week-header">
+ % for weekday in h.calendar.iterweekdays() :
+ <th>${h.fmt_weekday(weekday)}</th>
+ % endfor
+ </tr>
+## iterate over the weeks
+% for week in h.calendar.monthdays2calendar(month.year, month.month) :
+ <tr>
+ ## iterate over the week's days
+ % for day, weekday in week :
+ ## is it an empty cell?
+ % if not day :
+ <td> </td>
+ % else :
+ ## build date
+ <% date = h.build_date(month, day) %>\
+ ## render cell
+ <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date.date() not in log_dates else ''}>\
+ ## link to logs for this day?
+ % if date.date() in log_dates :
+<a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\
+ % else :
+${day}\
+ % endif
+</td>
+ % endif
+ % endfor
+ </tr>
+% endfor
+</table>
+</%def>
+
+<div id="title">${channel.title} :: Calendar for ${h.fmt_month(month)}</div>
+
+<div class="calendar-list">
+## three months
+${month_table(h.prev_month(month), is_center=False )}
+${month_table(month, is_center=True )}
+${month_table(h.next_month(month), is_center=False )}
+</div>