1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/themes/minimalmoin/minimalmoin.py Sun Jan 31 02:29:49 2010 +0100
1.3 @@ -0,0 +1,234 @@
1.4 +# -*- coding: iso-8859-1 -*-
1.5 +
1.6 +"""
1.7 + MoinMoin - MinimalMoin theme
1.8 + @copyright: 2009, 2010 Paul Boddie <paul@boddie.org.uk>
1.9 + @copyright: (portions) 2003-2008 MoinMoin:ThomasWaldmann, 2003-2005 Nir Soffer
1.10 + @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.11 +"""
1.12 +
1.13 +from MoinMoin.theme import ThemeBase
1.14 +from MoinMoin import i18n
1.15 +from MoinMoin import wikiutil
1.16 +from MoinMoin import version
1.17 +from MoinMoin.Page import Page
1.18 +import re
1.19 +
1.20 +class Theme(ThemeBase):
1.21 +
1.22 + name = "minimalmoin"
1.23 +
1.24 + # Icon definitions from the modernized theme...
1.25 +
1.26 + _ = lambda x: x # We don't have gettext at this moment, so we fake it
1.27 + icons = {
1.28 + # key alt icon filename w h
1.29 + # FileAttach
1.30 + 'attach': ("%(attach_count)s", "moin-attach.png", 16, 16),
1.31 + 'info': ("[INFO]", "moin-info.png", 16, 16),
1.32 + 'attachimg': (_("[ATTACH]"), "attach.png", 32, 32),
1.33 + # RecentChanges
1.34 + 'rss': (_("[RSS]"), "moin-rss.png", 16, 16),
1.35 + 'deleted': (_("[DELETED]"), "moin-deleted.png", 16, 16),
1.36 + 'updated': (_("[UPDATED]"), "moin-updated.png", 16, 16),
1.37 + 'renamed': (_("[RENAMED]"), "moin-renamed.png", 16, 16),
1.38 + 'conflict': (_("[CONFLICT]"), "moin-conflict.png", 16, 16),
1.39 + 'new': (_("[NEW]"), "moin-new.png", 16, 16),
1.40 + 'diffrc': (_("[DIFF]"), "moin-diff.png", 16, 16),
1.41 + # General
1.42 + 'bottom': (_("[BOTTOM]"), "moin-bottom.png", 16, 16),
1.43 + 'top': (_("[TOP]"), "moin-top.png", 16, 16),
1.44 + 'www': ("[WWW]", "moin-www.png", 16, 16),
1.45 + 'mailto': ("[MAILTO]", "moin-email.png", 16, 16),
1.46 + 'news': ("[NEWS]", "moin-news.png", 16, 16),
1.47 + 'telnet': ("[TELNET]", "moin-telnet.png", 16, 16),
1.48 + 'ftp': ("[FTP]", "moin-ftp.png", 16, 16),
1.49 + 'file': ("[FILE]", "moin-ftp.png", 16, 16),
1.50 + # search forms
1.51 + 'searchbutton': ("[?]", "moin-search.png", 16, 16),
1.52 + 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16),
1.53 +
1.54 + # smileys (this is CONTENT, but good looking smileys depend on looking
1.55 + # adapted to the theme background color and theme style in general)
1.56 + #vvv == vvv this must be the same for GUI editor converter
1.57 + 'X-(': ("X-(", 'angry.png', 16, 16),
1.58 + ':D': (":D", 'biggrin.png', 16, 16),
1.59 + '<:(': ("<:(", 'frown.png', 16, 16),
1.60 + ':o': (":o", 'redface.png', 16, 16),
1.61 + ':(': (":(", 'sad.png', 16, 16),
1.62 + ':)': (":)", 'smile.png', 16, 16),
1.63 + 'B)': ("B)", 'smile2.png', 16, 16),
1.64 + ':))': (":))", 'smile3.png', 16, 16),
1.65 + ';)': (";)", 'smile4.png', 16, 16),
1.66 + '/!\\': ("/!\\", 'alert.png', 16, 16),
1.67 + '<!>': ("<!>", 'attention.png', 16, 16),
1.68 + '(!)': ("(!)", 'idea.png', 16, 16),
1.69 + ':-?': (":-?", 'tongue.png', 16, 16),
1.70 + ':\\': (":\\", 'ohwell.png', 16, 16),
1.71 + '>:>': (">:>", 'devil.png', 16, 16),
1.72 + '|)': ("|)", 'tired.png', 16, 16),
1.73 + ':-(': (":-(", 'sad.png', 16, 16),
1.74 + ':-)': (":-)", 'smile.png', 16, 16),
1.75 + 'B-)': ("B-)", 'smile2.png', 16, 16),
1.76 + ':-))': (":-))", 'smile3.png', 16, 16),
1.77 + ';-)': (";-)", 'smile4.png', 16, 16),
1.78 + '|-)': ("|-)", 'tired.png', 16, 16),
1.79 + '(./)': ("(./)", 'checkmark.png', 16, 16),
1.80 + '{OK}': ("{OK}", 'thumbs-up.png', 16, 16),
1.81 + '{X}': ("{X}", 'icon-error.png', 16, 16),
1.82 + '{i}': ("{i}", 'icon-info.png', 16, 16),
1.83 + '{1}': ("{1}", 'prio1.png', 15, 13),
1.84 + '{2}': ("{2}", 'prio2.png', 15, 13),
1.85 + '{3}': ("{3}", 'prio3.png', 15, 13),
1.86 + '{*}': ("{*}", 'star_on.png', 16, 16),
1.87 + '{o}': ("{o}", 'star_off.png', 16, 16),
1.88 + }
1.89 + del _
1.90 +
1.91 + def header(self, d, **kw):
1.92 + """ Assemble page header
1.93 +
1.94 + @param d: parameter dictionary
1.95 + @rtype: unicode
1.96 + @return: page header html
1.97 + """
1.98 +
1.99 + request = self.request
1.100 + fmt = request.formatter
1.101 + html = []
1.102 +
1.103 + # NOTE: Some pages cause section numbers to be enabled, affecting the
1.104 + # NOTE: theme.
1.105 +
1.106 + show_section_numbers = fmt._show_section_numbers
1.107 + fmt._show_section_numbers = 0
1.108 +
1.109 + # The header section.
1.110 +
1.111 + html.append(fmt.div(on=1, attr={"id" : "header"}))
1.112 +
1.113 + html.append(self.title(d))
1.114 + html.append(self.about(d))
1.115 +
1.116 + html.append(fmt.div(on=0))
1.117 +
1.118 + # Show any pertinent message.
1.119 +
1.120 + html.append(self.msg(d))
1.121 +
1.122 + # Complete the header.
1.123 +
1.124 + html.append(self.startPage())
1.125 +
1.126 + # NOTE: Some pages cause section numbers to be enabled, affecting the
1.127 + # NOTE: theme.
1.128 +
1.129 + fmt._show_section_numbers = show_section_numbers
1.130 +
1.131 + return u''.join(html)
1.132 +
1.133 + editorheader = header
1.134 +
1.135 + def footer(self, d, **kw):
1.136 + """ Assemble page footer
1.137 +
1.138 + @param d: parameter dictionary
1.139 + @rtype: unicode
1.140 + @return: page footer html
1.141 + """
1.142 +
1.143 + request = self.request
1.144 + fmt = request.formatter
1.145 + _ = request.getText
1.146 + html = []
1.147 +
1.148 + # NOTE: Some pages cause section numbers to be enabled, affecting the
1.149 + # NOTE: theme.
1.150 +
1.151 + show_section_numbers = fmt._show_section_numbers
1.152 + fmt._show_section_numbers = 0
1.153 +
1.154 + # End the page.
1.155 +
1.156 + html.append(self.endPage())
1.157 +
1.158 + # The footer section.
1.159 +
1.160 + html.append(fmt.div(on=1, attr={"id" : "footer"}))
1.161 +
1.162 + html.append(fmt.div(on=1, attr={"class" : "editing"}))
1.163 + html.append(fmt.span(on=1, attr={"class" : "menutitleholder"}))
1.164 + html.append(fmt.span(on=1, attr={"class" : "menutitle"}))
1.165 + html.append(fmt.text(_("Editing options")))
1.166 + html.append(fmt.span(on=0))
1.167 + html.append(self.editbar(d))
1.168 + html.append(fmt.span(on=0))
1.169 + html.append(fmt.div(on=0))
1.170 +
1.171 + html.append(fmt.div(on=1, attr={"id" : "navigation"}))
1.172 + html.append(fmt.span(on=1, attr={"class" : "menutitleholder"}))
1.173 + html.append(fmt.span(on=1, attr={"class" : "menutitle"}))
1.174 + html.append(fmt.text(_("Useful pages")))
1.175 + html.append(fmt.span(on=0))
1.176 + html.append(self.navibar(d))
1.177 + html.append(fmt.span(on=0))
1.178 + html.append(fmt.div(on=0))
1.179 +
1.180 + html.append(fmt.div(on=1, attr={"id" : "identity"}))
1.181 + html.append(fmt.span(on=1, attr={"class" : "menutitleholder"}))
1.182 + html.append(fmt.span(on=1, attr={"class" : "menutitle"}))
1.183 + html.append(fmt.text(_("User information")))
1.184 + html.append(fmt.span(on=0))
1.185 + html.append(self.username(d))
1.186 + html.append(fmt.span(on=0))
1.187 + html.append(fmt.div(on=0))
1.188 +
1.189 + #html.append(self.trail(d))
1.190 +
1.191 + html.append(fmt.div(on=0))
1.192 +
1.193 + # NOTE: Some pages cause section numbers to be enabled, affecting the
1.194 + # NOTE: theme.
1.195 +
1.196 + fmt._show_section_numbers = show_section_numbers
1.197 +
1.198 + return u''.join(html)
1.199 +
1.200 + def about(self, d, **kw):
1.201 + """ Link to the controls in the footer.
1.202 +
1.203 + @param d: parameter dictionary
1.204 + @rtype: unicode
1.205 + @return: about link html
1.206 + """
1.207 +
1.208 + request = self.request
1.209 + fmt = request.formatter
1.210 + _ = request.getText
1.211 + html = []
1.212 +
1.213 + html.append(fmt.bullet_list(on=1, attr={"id" : "pageabout"}))
1.214 + html.append(fmt.listitem(on=1))
1.215 +
1.216 + html.append(fmt.anchorlink(on=1, name="footer"))
1.217 + html.append(fmt.text(_("About this page")))
1.218 + html.append(fmt.anchorlink(on=0))
1.219 +
1.220 + html.append(fmt.listitem(on=0))
1.221 + html.append(fmt.bullet_list(on=0))
1.222 +
1.223 + return u''.join(html)
1.224 +
1.225 +# Theme instantiation.
1.226 +
1.227 +def execute(request):
1.228 + """
1.229 + Generate and return a theme object
1.230 +
1.231 + @param request: the request object
1.232 + @rtype: MoinTheme
1.233 + @return: Theme object
1.234 + """
1.235 + return Theme(request)
1.236 +
1.237 +# vim: tabstop=4 expandtab shiftwidth=4