deadfoxjunction: Use custom formatting for recentchangens entries.
[matthijs/projects/wipi.git] / plugin / theme / deadfoxjunction.py
1 """
2     MoinMoin - Dead fox junction website theme.
3
4     @copyright: 2010+ Matthijs Kooijman
5     @license: GNU GPL, see COPYING for details.
6 """
7
8 from site import SiteTheme
9
10 class Theme(SiteTheme):
11     name = "deadfoxjunction"
12
13     # Add an extra #window div that will be visible content area, framed
14     # by a wooden "window". We can't just use #content here, since
15     # #messages is besides #content in editing mode.
16     def startPage(self, d):
17         html = SiteTheme.startPage(self, d)
18         html += u'<div id="window">\n'
19         return html
20
21     def endPage(self, d):
22         html = SiteTheme.endPage(self, d)
23         html += u'</div><!-- #window -->\n'
24         return html
25
26     def recentchanges_entry(self, d):
27         """
28         Assemble a single recentchanges entry (table row)
29
30         Based on the same function from ThemeBase, but with the comment
31         on a second table row, since the available horizontal space in
32         this theme is fairly limited.
33
34         @param d: parameter dictionary
35         @rtype: string
36         @return: recentchanges entry html
37         """
38         _ = self.request.getText
39         html = []
40         html.append('<tr>\n')
41
42         html.append('<td class="rcicon1">%(icon_html)s</td>\n' % d)
43
44         html.append('<td class="rcpagelink">%(pagelink_html)s</td>\n' % d)
45
46         html.append('<td class="rctime">')
47         if d['time_html']:
48             html.append("%(time_html)s" % d)
49         html.append('</td>\n')
50
51         html.append('<td class="rcicon2">%(info_html)s</td>\n' % d)
52
53         html.append('<td class="rceditor">')
54         if d['editors']:
55             html.append('<br>'.join(d['editors']))
56         html.append('</td>\n')
57         html.append('</tr>\n')
58         html.append('<tr>\n')
59
60         html.append('<td colspan="5" class="rccomment">')
61         if d['comments']:
62             if d['changecount'] > 1:
63                 notfirst = 0
64                 for comment in d['comments']:
65                     html.append('%s<tt>#%02d</tt>&nbsp;%s' % (
66                         notfirst and '<br>' or '', comment[0], comment[1]))
67                     notfirst = 1
68             else:
69                 comment = d['comments'][0]
70                 html.append('%s' % comment[1])
71         html.append('</td>\n')
72
73         html.append('</tr>\n')
74
75         return ''.join(html)