author | Tero Marttila <terom@fixme.fi> |
Wed, 11 Feb 2009 23:38:05 +0200 | |
changeset 114 | d4848d807fd1 |
parent 113 | 9fc0eb751b6a |
child 115 | 751e3fcd11d2 |
permissions | -rw-r--r-- |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
<%inherit file="channel.tmpl" /> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
|
113
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
3 |
<%def name="month_table(month, is_center=True)"> |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
4 |
## the set of available days |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
5 |
<% log_dates = h.set(channel.source.get_month_days(month)) %> |
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
6 |
## the calendar table |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
<table class="calendar"> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
## table header - month name |
55 | 9 |
<tr class="month-header"> |
58
ce028d356e1f
special-case current month in calendar
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
10 |
<th colspan="7"${' class="this-month"' if h.is_this_month(month) else ''}> |
113
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
11 |
% if is_center : |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
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> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
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> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
14 |
|
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
15 |
<form action="${urls.channel_calendar.build(req, channel=channel)}" method="GET"> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
16 |
<select name="month"> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
17 |
${h.select_options(((month_num, name) for month_num, name in h.months), month.month)} |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
18 |
</select> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
19 |
<select name="year"> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
20 |
${h.select_options(((None, 2006), (None, 2007), (None, 2008), (None, 2009)), month.year)} |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
21 |
</select> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
22 |
<input type="submit" value="Go »" /> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
23 |
</form> |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
24 |
% else : |
55 | 25 |
<span id="month-name">${h.fmt_month(month)}</span> |
113
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
26 |
% endif |
55 | 27 |
</th> |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
</tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
## month header - weekday names |
55 | 30 |
<tr class="week-header"> |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
31 |
% for weekday in h.calendar.iterweekdays() : |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
<th>${h.fmt_weekday(weekday)}</th> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
% endfor |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
34 |
</tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
35 |
## iterate over the weeks |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
36 |
% for week in h.calendar.monthdays2calendar(month.year, month.month) : |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
37 |
<tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
38 |
## iterate over the week's days |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
39 |
% for day, weekday in week : |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
40 |
## is it an empty cell? |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
41 |
% if not day : |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
42 |
<td> </td> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
43 |
% else : |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
## build date |
85
0521cf830eb9
misc. template clean (hide RSS link, remove extra whitespace from calendar source
Tero Marttila <terom@fixme.fi>
parents:
58
diff
changeset
|
45 |
<% date = h.build_date(month, day) %>\ |
55 | 46 |
## render cell |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
47 |
<td${' id="today"' if h.is_today(date) else ''}${' class="empty"' if date not in log_dates else ''}>\ |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
48 |
## link to logs for this day? |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
49 |
% if date in log_dates : |
85
0521cf830eb9
misc. template clean (hide RSS link, remove extra whitespace from calendar source
Tero Marttila <terom@fixme.fi>
parents:
58
diff
changeset
|
50 |
<a href="${urls.channel_date.build(req, channel=channel, date=date)}">${day}</a>\ |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
51 |
% else : |
85
0521cf830eb9
misc. template clean (hide RSS link, remove extra whitespace from calendar source
Tero Marttila <terom@fixme.fi>
parents:
58
diff
changeset
|
52 |
${day}\ |
54
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
53 |
% endif |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
54 |
</td> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
55 |
% endif |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
56 |
% endfor |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
57 |
</tr> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
58 |
% endfor |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
59 |
</table> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
60 |
</%def> |
b65a95eb9f6b
implement browse-by-date to show a nice calendar
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
61 |
|
114
d4848d807fd1
center calendar list, add prev/next date to channel_link, add view-last-x-lines form to channel_last/channel
Tero Marttila <terom@fixme.fi>
parents:
113
diff
changeset
|
62 |
<div id="title">${channel.title} :: Calendar for ${h.fmt_month(month)}</div> |
d4848d807fd1
center calendar list, add prev/next date to channel_link, add view-last-x-lines form to channel_last/channel
Tero Marttila <terom@fixme.fi>
parents:
113
diff
changeset
|
63 |
|
d4848d807fd1
center calendar list, add prev/next date to channel_link, add view-last-x-lines form to channel_last/channel
Tero Marttila <terom@fixme.fi>
parents:
113
diff
changeset
|
64 |
<div class="calendar-list"> |
112
090192b64d7e
add three calendars to the channel_calendar view
Tero Marttila <terom@fixme.fi>
parents:
85
diff
changeset
|
65 |
## three months |
113
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
66 |
${month_table(h.prev_month(month), is_center=False )} |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
67 |
${month_table(month, is_center=True )} |
9fc0eb751b6a
add <form> for month/year to calendar header
Tero Marttila <terom@fixme.fi>
parents:
112
diff
changeset
|
68 |
${month_table(h.next_month(month), is_center=False )} |
114
d4848d807fd1
center calendar list, add prev/next date to channel_link, add view-last-x-lines form to channel_last/channel
Tero Marttila <terom@fixme.fi>
parents:
113
diff
changeset
|
69 |
</div> |