# -*- coding: iso-8859-1 -*- """ MoinMoin monobook theme. Uses the css sheet from http://wikipedia.org, adapting the moin output to fit it. Adapted by Jim Clark Adapted for CR@NS by Nicolas Salles @license: GNU GPL, see COPYING for details. """ import datetime from MoinMoin.theme import ThemeBase from MoinMoin import wikiutil, i18n from MoinMoin.Page import Page class ThemeCrans(ThemeBase): name = "crans" # Standard set of style sheets stylesheets = ( # media basename ('all', 'common'), ('screen', 'crans'), ('print', 'print'), ('projection', 'projection'), ) # Standard set of scripts scripts = ( 'crans', ) # Public functions ##################################################### def header(self, d, **kw): """ Assemble wiki header Here we don't add any menu bars, search bars, etc - instead wait until the footer. This keeps the HTML cleaner and more accessible, making sure the main content arrives first. """ if datetime.date.today().month == 10: extra_style = " class=\"halloween\"" elif (datetime.date.today().month == 12) and (datetime.date.today().day <= 24): extra_style = " class=\"noel\"" else: extra_style = "" parent = d['page'].getParentPage() html = [ u'
' % extra_style, u'
', u'
', '

', self.title(d), u'

', u'
', self.msg(d), self.startPage(), ] return u'\n'.join(html) editorheader = header def footer(self, d, **keywords): """ Assemble wiki footer """ html = [ # End of page self.pageinfo(d['page']), self.endPage(), u'
', # fin du div main-content self.rightcolumn(d), u'
' # fin du div globalWrapper ] return u'\n'.join(html) def rightcolumn(self, d): """ assemble all the navigation aids for the page """ _ = self.request.getText page = d['page'] html = [ u'
', u"
Personnel
", self.username(d), u"
Navigation
", self.navibar(d), # hack : c1 and V1 or v2 c'est comme le code C : c1? v1 : V2 # (si c1 est vrai alors prends la valeur V1 sinon prend la valeur c2 self.shouldShowEditbar(d['page']) and u"
%s
" % _("Page") or u" ", self.editbar(d), u"
%s
" % _('Search'), self.searchform(d), #self.actionmenu(d), #self.pageinfo(page), self.credits(d), ] return u'\n'.join(html) def html_head(self, d): """ add opensearch description to html head """ # common prefix for static content prefix = self.cfg.url_prefix open_search_desc = '\n' % {'page':d['page'].request.script_name, 'sitename':d['sitename']} classic_head = ThemeBase.html_head(self, d) return classic_head + open_search_desc def headscript(self, d): # Check mode if d.get('print_mode'): link = "" else: # Create stylesheets links link = '' prefix = self.cfg.url_prefix csshref = '%s/%s/js' % (prefix, self.name) html = [] for basename in self.scripts: href = '%s/%s.js' % (csshref, basename) html.append(link % href ) return ThemeBase.headscript(self, d) + u"\n".join(html) class Theme(ThemeCrans): name = "crans" # Standard set of style sheets stylesheets = ( # media basename ('all', 'common'), ('screen', 'layout'), ('screen', 'crans'), ('print', 'print'), ('projection', 'projection'), ) def execute(request): """ Generate and return a theme object @param request: the request object @rtype: MoinTheme @return: Theme object """ return Theme(request)