A Plain Theme for MoinMoin
MoinMoin is great as a wiki engine, but all of the wiki look and feel can be a bit confusing for someone who is simply visiting the site but who will never edit the site. For those users, it would be optimal to have the pages display as if they were pure HTML, and didn't have any content management system or larger framework behind them.
The following setup provides an incredibly bare-bones and plain experience for anyone who visits the site.
- It does not display the wiki's logo.
- It does not display the search form.
- It does not display the login link. The wiki administrators need to know the direct login URL, which still works.
- It does not display the page title, or the wiki navigation bar.
It does not display any of the standard MoinMoin edit toolbars.
It does not display anything that is in a standard MoinMoin footer.
Basically, all you get is the body of the wiki page, and none of the surrounding widgets or graphics.
Because this theme removes everything that makes MoinMoin look and feel like a wiki, the administrators will want to specifically configure their user accounts to use one of the built-in themes.
Basic Configuration
What follows is the relevant code, both for setting up the plain theme and for drastically limiting the pages that an anonymous visitor can see.
$WIKIROOT/wikiconfig.py
acl_rights_before = u"AdminGroup:read,write,delete,revert,admin"
acl_rights_default = u""
navi_bar = [
# If you want to show your page_front_page here:
#u'%(page_front_page)s',
#u'RecentChanges',
#u'SiteNavigation',
#u'HelpContents',
]
theme_default = 'plain'
Granting Read Access on a Per-Page Basis
Any page on your wiki that you want to allow anonymous visitors to view should begin with this line:
#acl All:read
Installing the Plain Theme
$WIKIROOT/data/plugin/theme/plain.py
from MoinMoin.theme import modern
class Theme(modern.Theme):
name = "modern"
def header(self, d, **kw):
""" Assemble wiki header
@param d: parameter dictionary
@rtype: unicode
@return: page header html
"""
html = [
# Pre header custom html
self.emit_custom_html(self.cfg.page_header1),
# Header
#u'<div id="header">',
#self.logo(),
#self.searchform(d),
#self.username(d),
#u'<div id="locationline">',
#self.interwiki(d),
#self.title(d),
#u'</div>',
#self.trail(d),
#self.navibar(d),
#u'<hr id="pageline">',
#u'<div id="pageline"><hr style="display:none;"></div>',
#self.msg(d),
#self.editbar(d),
#u'</div>',
# Post header custom html (not recommended)
self.emit_custom_html(self.cfg.page_header2),
# Start of page
self.startPage(),
]
return u'\n'.join(html)
def editorheader(self, d, **kw):
""" Assemble wiki header for editor
@param d: parameter dictionary
@rtype: unicode
@return: page header html
"""
html = [
# Pre header custom html
self.emit_custom_html(self.cfg.page_header1),
# Header
u'<div id="header">',
self.title(d),
self.msg(d),
u'</div>',
# Post header custom html (not recommended)
self.emit_custom_html(self.cfg.page_header2),
# Start of page
self.startPage(),
]
return u'\n'.join(html)
def footer(self, d, **keywords):
""" Assemble wiki footer
@param d: parameter dictionary
@keyword ...:...
@rtype: unicode
@return: page footer html
"""
page = d['page']
html = [
# End of page
#self.pageinfo(page),
self.endPage(),
# Pre footer custom html (not recommended!)
self.emit_custom_html(self.cfg.page_footer1),
# Footer
u'<div id="footer">',
#self.editbar(d),
#self.credits(d),
self.showversion(d, **keywords),
u'</div>',
# Post footer custom html
self.emit_custom_html(self.cfg.page_footer2),
]
return u'\n'.join(html)
def execute(request):
"""
Generate and return a theme object
@param request: the request object
@rtype: MoinTheme
@return: Theme object
"""
return Theme(request)
