--- a/handlers.py Mon Feb 09 04:39:24 2009 +0200
+++ b/handlers.py Mon Feb 09 05:44:29 2009 +0200
@@ -31,7 +31,7 @@
Redirect to the appropriate channel_view
"""
- return http.Redirect(urls.channel_view.build(request, channel=channel.id))
+ return http.Redirect(urls.channel_view.build(request, channel=channel))
@preferences.handler(prefs.Formatter, prefs.Timezone)
def channel_view (request, channel, count, formatter, timezone) :
--- a/helpers.py Mon Feb 09 04:39:24 2009 +0200
+++ b/helpers.py Mon Feb 09 05:44:29 2009 +0200
@@ -54,4 +54,48 @@
# construct current date
return date == self.ctx['timezone'].localize(datetime.datetime.now()).date()
-
+
+ def prev_month_year (self, month) :
+ """
+ Returns the year of the month before the given one
+ """
+
+ if month.month == 1 :
+ return month.year - 1
+
+ else :
+ return month.year
+
+ def next_month_year (self, month) :
+ """
+ Returns the year of the month after the given one
+ """
+
+ if month.month == 12 :
+ return month.year + 1
+
+ else :
+ return month.year
+
+ def prev_month (self, month) :
+ """
+ Returns the month before the given one
+ """
+
+ if month.month == 1 :
+ return 12
+
+ else :
+ return month.month - 1
+
+ def next_month (self, month) :
+ """
+ Returns the month after the given one
+ """
+
+ if month.month == 12 :
+ return 1
+
+ else :
+ return month.month + 1
+
--- a/log_formatter.py Mon Feb 09 04:39:24 2009 +0200
+++ b/log_formatter.py Mon Feb 09 05:44:29 2009 +0200
@@ -2,7 +2,8 @@
Format LogLines into some other representation
"""
-from qmsk.web import helpers
+# for escape
+import cgi
from log_line import LogTypes
@@ -88,7 +89,7 @@
# format using IrssiTextFormatter
for line in self.format_txt(lines) :
# escape HTML
- yield helpers.escape(line)
+ yield cgi.escape(line)
# close pre
yield "</pre>"
--- a/log_source.py Mon Feb 09 04:39:24 2009 +0200
+++ b/log_source.py Mon Feb 09 05:44:29 2009 +0200
@@ -351,9 +351,12 @@
# open both of them
f_begin = self._get_logfile_date(d_begin)
f_end = self._get_logfile_date(d_end)
-
+
# chain together the two sources
- return itertools.chain(f_begin.read_from(dtz_begin), f_end.read_until(dtz_end))
+ return itertools.chain(
+ f_begin.read_from(dtz_begin),
+ f_end.read_until(dtz_end) if f_end else []
+ )
def get_month_days (self, month) :
"""
--- a/static/irclogs.css Mon Feb 09 04:39:24 2009 +0200
+++ b/static/irclogs.css Mon Feb 09 05:44:29 2009 +0200
@@ -130,7 +130,82 @@
*/
/* Calendar */
+table.calendar {
+
+}
+
+table.calendar th {
+ background-color: #c8c8c8;
+}
+
+table.calendar td {
+ margin: 1px;
+
+
+ text-align: center;
+}
+
+table.calendar tr.month-header th {
+
+}
+
+table.calendar tr.month-header a {
+ display: block;
+
+ color: inherit;
+ text-decoration: none;
+
+ padding: 3px;
+ padding-left: 8px;
+ padding-right: 8px;
+
+ font-size: x-large;
+}
+
+table.calendar tr.month-header a:hover {
+ background-color: #b5b5b5;
+}
+
+table.calendar tr.month-header span {
+ margin-top: 5px;
+}
+
+table.calendar a.prev-month {
+ float: left;
+}
+
+table.calendar a.next-month {
+ float: right;
+}
+
+table.calendar tr.week-header th {
+ width: 14%
+}
+
+table.calendar td {
+ padding: 2px;
+}
+
+table.calendar td a {
+ display: block;
+ padding: 2px;
+
+ background-color: #e0e0e0;
+ text-decoration: none;
+
+ color: inherit;
+}
+
+table.calendar td.empty {
+ color: #d0d0d0;
+}
+
+table.calendar td a:hover {
+ background-color: #d0d0d0;
+}
+
table.calendar td#today {
font-weight: bold;
}
+
--- a/templates/channel.tmpl Mon Feb 09 04:39:24 2009 +0200
+++ b/templates/channel.tmpl Mon Feb 09 05:44:29 2009 +0200
@@ -30,7 +30,7 @@
</form>
</li>
- <li><a href="#">Browse by Date</a></li>
+ <li><a href="${urls.channel_calendar.build(req, channel=channel)}">Browse by Date</a></li>
<li>
<form action="${urls.channel_search.build(req, channel=channel)}" method="GET">
--- a/templates/channel_calendar.tmpl Mon Feb 09 04:39:24 2009 +0200
+++ b/templates/channel_calendar.tmpl Mon Feb 09 05:44:29 2009 +0200
@@ -3,11 +3,15 @@
<%def name="month_table(cal, month, dates)">
<table class="calendar">
## table header - month name
- <tr>
- <th colspan="7">${h.fmt_month(month)}</th>
+ <tr class="month-header">
+ <th colspan="7">
+ <a href="${urls.channel_calendar.build(req, channel=channel, year=h.next_month_year(month), month=h.next_month(month))}" class="next-month">»</a>
+ <a href="${urls.channel_calendar.build(req, channel=channel, year=h.prev_month_year(month), month=h.prev_month(month))}" class="prev-month">«</a>
+ <span id="month-name">${h.fmt_month(month)}</span>
+ </th>
</tr>
## month header - weekday names
- <tr>
+ <tr class="week-header">
% for weekday in cal.iterweekdays() :
<th>${h.fmt_weekday(weekday)}</th>
% endfor
@@ -23,12 +27,8 @@
% else :
## build date
<% date = h.build_date(month, day) %>
- ## is it today?
- % if day and h.is_today(date) :
- <td id="today">\
- % else :
- <td>\
- % endif
+ ## render cell
+ <td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in dates else ''}>\
## link to logs for this day?
% if date in dates :
<a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\