1 # -*- coding: iso-8859-1 -*-
3 Evolution Events, website theme
5 This theme is meant for wiki's that are meant to function as a website,
6 meaning nothing fancy and wiki-ish (at least when you're not logged in).
8 This theme is meant to be subclassed. Subclasses should at least define a
9 name, and possibly override other stuff.
12 from MoinMoin.theme import ThemeBase
13 from MoinMoin.Page import Page
14 from MoinMoin import wikiutil
16 class SiteTheme(ThemeBase):
19 if self.request.user.valid:
20 return ThemeBase.editbar(self, d)
24 def searchform(self, d):
25 if self.request.user.valid:
26 return ThemeBase.searchform(self, d)
31 if self.request.user.valid:
32 return ThemeBase.navibar(self, d)
36 def header(self, d, **kw):
37 """ Assemble wiki header
39 @param d: parameter dictionary
41 @return: page header html
44 # Pre header custom html
45 self.emit_custom_html(self.cfg.page_header1),
52 #u'<div id="locationline">',
57 #u'<hr id="pageline">',
58 #u'<div id="pageline"><hr style="display:none;"></div>',
62 # Post header custom html (not recommended)
63 self.emit_custom_html(self.cfg.page_header2),
71 return u'\n'.join(html)
73 def editorheader(self, d, **kw):
74 """ Assemble wiki header for editor
76 @param d: parameter dictionary
78 @return: page header html
81 # Pre header custom html
82 self.emit_custom_html(self.cfg.page_header1),
90 # Post header custom html (not recommended)
91 self.emit_custom_html(self.cfg.page_header2),
97 return u'\n'.join(html)
99 def footer(self, d, **keywords):
100 """ Assemble wiki footer
102 @param d: parameter dictionary
105 @return: page footer html
112 # Pre footer custom html (not recommended!)
113 self.emit_custom_html(self.cfg.page_footer1),
116 u'<div id="footer">',
122 #self.showversion(d, **keywords),
125 # Post footer custom html
126 self.emit_custom_html(self.cfg.page_footer2),
128 return u'\n'.join(html)
131 """ Assemble a "main" menu
133 @param d: parameter dictionary
137 items = Page(self.request, 'Site/Menu').data.split('\n')
139 html = '<ul id="menubar">'
142 if (not item.startswith("#")):
143 (pagename, link) = self.splitNavilink(item)
144 html = html + ("<li class=\"menulink\">%s</li>" % link)
146 html = html + '</ul>'
150 def theme_script(self, name):
151 """ Format script html from this theme's static dir """
152 src = '%s/%s/js/%s.js' % (self.request.cfg.url_prefix_static, self.name, name)
153 return '<script type="text/javascript" src="%s"></script>' % src
155 def pageinfo(self, page):
156 """ Output page name and "last modified". This overwrites the pageinfo
157 from ThemeBase to hide the username, which is useless and always
158 produces a link to the non-existing homepage of the last editor. """
159 _ = self.request.getText
161 if self.shouldShowPageinfo(page):
162 info = page.lastEditInfo()
164 info = _("last modified %(time)s") % info
165 pagename = page.page_name
166 info = "%s (%s)" % (wikiutil.escape(pagename), info)
167 html = '<p id="pageinfo" class="info"%(lang)s>%(info)s</p>\n' % {
168 'lang': self.ui_lang_attr(),
173 def startPage(self, d):
174 # This opens up #page
175 html = ThemeBase.startPage(self)
176 html += u'<div id="pagetop"></div>\n'
177 html += u'<div id="pagemiddle">\n'
180 def endPage(self, d):
181 html = u'</div><!-- #pagemiddle -->\n'
182 html += ThemeBase.endPage(self)
183 # This adds #pagebottom and closes #page
186 def execute(request):
188 Generate and return a theme object
190 @param request: the request object
192 @return: Theme object
194 return Theme(request)
196 # vim: set sw=4 sts=4 expandtab: