diff --git a/wiki/theme/blackliste.py b/wiki/theme/blackliste.py deleted file mode 100644 index 9fcbc4cf..00000000 --- a/wiki/theme/blackliste.py +++ /dev/null @@ -1,467 +0,0 @@ -# -*- 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. -""" - -from MoinMoin.theme import ThemeBase -from MoinMoin import wikiutil, i18n -from MoinMoin.Page import Page - -class Theme(ThemeBase): - - name = "blackliste" - - # fake _ function to get gettext recognize those texts: - _ = lambda x: x - - icons = { - # key alt icon filename w h - # ------------------------------------------------------------------ - # navibar - 'help': ("%(page_help_contents)s", "moin-help.png", 12, 11), - 'find': ("%(page_find_page)s", "moin-search.png", 12, 12), - 'diff': (_("Diffs"), "moin-diff.png", 22, 22), - 'info': (_("Info"), "moin-info.png", 22, 22), - 'edit': (_("Edit"), "moin-edit.png", 22, 22), - 'unsubscribe':(_("Unsubscribe"), "moin-unsubscribe.png", 22, 22), - 'subscribe': (_("Subscribe"), "moin-subscribe.png",22, 22), - 'raw': (_("Raw"), "moin-raw.png", 12, 13), - 'xml': (_("XML"), "moin-xml.png", 20, 13), - 'print': (_("Print"), "moin-print.png", 16, 14), - 'view': (_("View"), "moin-show.png", 22, 22), - 'home': (_("Home"), "moin-home.png", 13, 12), - 'up': (_("Up"), "moin-parent.png", 15, 13), - # FileAttach - 'attach': ("%(attach_count)s", "moin-attach.png", 7, 15), - # RecentChanges - 'rss': (_("[RSS]"), "moin-rss.png", 36, 14), - 'deleted': (_("[DELETED]"), "moin-deleted.png",60, 12), - 'updated': (_("[UPDATED]"), "moin-updated.png",60, 12), - 'new': (_("[NEW]"), "moin-new.png", 31, 12), - 'diffrc': (_("[DIFF]"), "moin-diff.png", 22, 22), - # General - 'bottom': (_("[BOTTOM]"), "moin-bottom.png", 14, 10), - 'top': (_("[TOP]"), "moin-top.png", 14, 10), - 'www': ("[WWW]", "moin-www.png", 11, 11), - 'mailto': ("[MAILTO]", "moin-email.png", 14, 10), - 'news': ("[NEWS]", "moin-news.png", 10, 11), - 'telnet': ("[TELNET]", "moin-telnet.png", 10, 11), - 'ftp': ("[FTP]", "moin-ftp.png", 11, 11), - 'file': ("[FILE]", "moin-ftp.png", 11, 11), - # search forms - 'searchbutton': ("[?]", "moin-search.png", 12, 12), - 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16), - } - del _ - - # Standard set of style sheets - stylesheets = ( - # media basename - ('all', 'common'), - ('screen', 'blackliste'), - ('print', 'print'), - ('projection', 'projection'), - ) - - -# 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. - """ - html = [ - u'
', - u'
', - self.startPage(), - self.msg(d), - self.title(d), - ] - return u'\n'.join(html) - - def footer(self, d, **keywords): - """ Assemble wiki footer - """ - html = [ - # End of page - u'
', - self.endPage(), - u'
', - self.columnone(d), - u'
' - ] - return u'\n'.join(html) - - def columnone(self, d): - """ assemble all the navigation aids for the page - """ - page = d['page'] - html = [ - u'
', - self.editbar(d), - self.username(d), - u'', - self.navibar(d), - self.searchform(d), - self.actionmenu(d), - u'
', - u'', - u'
' - ] - return u'\n'.join(html) - - def headscript(self, d): - """ Override to not output search/action menu javascript. - (perhaps not a good idea) - """ - return '' - - def extendedAttrs(self, title, accesskey): - """ Helper function for assembling titled access key links - """ - return 'title="%(title)s [alt-%(accesskey)s]" accesskey=%(accesskey)s' % \ - {'accesskey' : accesskey, - 'title' : title} - - def editbar(self, d): - """ Display a list of actions for the page. This list will be turned - into a set of tabbed views on the page by the css. - """ - page = d['page'] - if not self.shouldShowEditbar(page): - return '' - - # Use cached editbar if possible. - cacheKey = 'editbar' - cached = self._cache.get(cacheKey) - if cached: - return cached - - request = self.request - _ = self.request.getText - link = wikiutil.link_tag - quotedname = wikiutil.quoteWikinameURL(page.page_name) - # action, title, description, accesskey - tabs = [('view', 'Article', 'View the page content', 'c'), - ('edit', 'Edit', 'Edit this page', 'e'), - ('diff', 'Show Changes', 'Last page modification', 'd'), - ('info', 'Get Info', 'Page history and information', 'h'), - ('subscribe', 'Subscribe', 'Subscribe to updates to this page', 'w')] - - items = [] - current = self.request.form.get('action', ['view'])[0] - for action, title, description, accesskey in tabs: - if action == current: - cls = 'selected' - else: - cls = 'none' - - if action == "subscribe": - items.append(u'
  • %s
  • \n' % (cls, action, self.make_iconlink( - ["subscribe", "unsubscribe"][self.request.user.isSubscribedTo([d['page_name']])], d))) - else: - items.append(u'
  • %s
  • \n' % (cls, action, self.make_iconlink(action, d))) - - html = [ - u'
    ', - u'
      ', - ''.join(items), - u'
    ', - u'
    ' - ] - html = ''.join(html) - # cache for next call - self._cache[cacheKey] = html - - return html - - - def actionmenu(self, d): - """ different implementation of the actionmenu (aka toolbox) - """ - - page = d['page'] - - # Use cached actionmenu if possible. - cacheKey = 'actionmenu' - cached = self._cache.get(cacheKey) - if cached: - return cached - - request = self.request - _ = request.getText - quotedname = wikiutil.quoteWikinameURL(page.page_name) - - menu = [ - 'raw', - 'print', - 'refresh', - 'AttachFile', - 'SpellCheck', - 'LikePages', - 'LocalSiteMap', - 'RenamePage', - 'DeletePage', - ] - - titles = { - 'raw': _('Show Raw Text', formatted=False), - 'print': _('Show Print View', formatted=False), - 'refresh': _('Delete Cache', formatted=False), - 'AttachFile': _('Attach File', formatted=False), - 'SpellCheck': _('Check Spelling', formatted=False), # rename action! - 'RenamePage': _('Rename Page', formatted=False), - 'DeletePage': _('Delete Page', formatted=False), - 'LikePages': _('Show Like Pages', formatted=False), - 'LocalSiteMap': _('Show Local Site Map', formatted=False), - } - - links = [] - - # Format standard actions - available = request.getAvailableActions(page) - for action in menu: - # Enable delete cache only if page can use caching - if action == 'refresh': - if not page.canUseCache(): - break - # Actions which are not available for this wiki, user or page - if action[0].isupper() and not action in available: - break; - - link = wikiutil.link_tag(self.request, \ - quotedname + '?action=' + action, titles[action]) - links.append(link) - - # Add custom actions not in the standard menu - more = [item for item in available if not item in titles] - more.sort() - if more: - # Add more actions (all enabled) - for action in more: - data = {'action': action, 'disabled': ''} - title = Page(request, action).split_title(request, force=1) - # Use translated version if available - title = _(title, formatted=False) - link = wikiutil.link_tag(self.request, \ - quotedname + '?action=' + action, title) - links.append(link) - - html = [ - u'
    ', - u'
    Toolbox
    ', - u'
    ', - u'
      ', - u'
    • %s
    ' % '\n
  • '.join(links), - u'', - u'
  • ', - u'
    ', - ] - html = ''.join(html) - # cache for next call - self._cache[cacheKey] = html - return html - - - def username(self, d): - """ Assemble the username / userprefs link - Copied from the base class, modified to include hotkeys and link titles - """ - from MoinMoin.Page import Page - request = self.request - _ = request.getText - - userlinks = [] - # Add username/homepage link for registered users. We don't care - # if it exists, the user can create it. - if request.user.valid: - homepage = Page(request, request.user.name) - title = homepage.split_title(request) - attrs = self.extendedAttrs(_('User Page'), '.') - homelink = homepage.link_to(request, text=title, attrs=attrs) - userlinks.append(homelink) - - # Set pref page to localized Preferences page - attrs = self.extendedAttrs(_('My Preferences'), 'u') - prefpage = wikiutil.getSysPage(request, 'UserPreferences') - title = prefpage.split_title(request) - userlinks.append(prefpage.link_to(request, text=title, attrs=attrs)) - - # Add a logout link (not sure this is really necessary - attrs = self.extendedAttrs(_('log out'), 'o') - page = d['page'] - url = wikiutil.quoteWikinameURL(page.page_name) + \ - '?action=userform&logout=1' - link = wikiutil.link_tag(self.request, url, 'log out', attrs=attrs) - userlinks.append(link) - - else: - # Add prefpage links with title: Login - prefpage = wikiutil.getSysPage(request, 'UserPreferences') - attrs = self.extendedAttrs('Logging in is not required, but brings benefits', 'o') - userlinks.append(prefpage.link_to(request, text=_("Login"), attrs=attrs)) - - html = [ - u'
    ', - u'
      ', - u'
    • %s
    ' % '\n
  • '.join(userlinks), - u'', - u'
  • ' - ] - return ''.join(html) - - def searchform(self, d): - """ assemble HTML code for the search form - Tweaks from the bass class to wrap in a 'portlet' class, move the - description to a header tag, add an access key of 'f' and - add SearchButton class for the buttons - """ - _ = self.request.getText - form = self.request.form - updates = { - 'search_label' : _('Search:'), - 'search_value': wikiutil.escape(form.get('value', [''])[0], 1), - 'search_full_label' : _('Text', formatted=False), - 'search_title_label' : _('Titles', formatted=False), - } - d.update(updates) - - html = u''' - -''' % d - return html - - def shouldShowEditbar(self, page): - """ Override to include the editbar on edit/preview pages. - (at the risk that the user may accidentally cancel an edit) - """ - if (page.exists(includeDeleted=1) and - self.request.user.may.read(page.page_name)): - return True - return False - - - def navibar(self, d): - """ Alterations from the base class to include access keys and - descriptions for FrontPage/RecentChanges - """ - request = self.request - found = {} # pages we found. prevent duplicates - links = [] # navibar items - current = d['page_name'] - - # Process config navi_bar - if request.cfg.navi_bar: - for text in request.cfg.navi_bar: - pagename, link = self.splitNavilink(text) - if pagename == d['page_front_page']: - attrs = self.extendedAttrs('Visit the main page', 'z') - elif pagename == 'RecentChanges': - attrs = self.extendedAttrs('List of recent changes in this wiki', 'r') - else: - attrs = '' - - a = wikiutil.link_tag(request, pagename, attrs=attrs) - links.append(a) - found[pagename] = 1 - - # Add user links to wiki links, eliminating duplicates. - userlinks = request.user.getQuickLinks() - for text in userlinks: - # Split text without localization, user know what she wants - pagename, link = self.splitNavilink(text, localize=0) - if not pagename in found: - a = wikiutil.link_tag(request, pagename, attrs=attrs) - links.append(a) - found[pagename] = 1 - - html = [ - u'
    ', - u'
    ', - u'' % '\n
  • '.join(links), - u'', - u'
  • ', - u'
    ', - ] - return ''.join(html) - - def pageinfo(self, page): - """ Simple override from base class. - Remove

    so footer isn't too big - """ - _ = self.request.getText - - if self.shouldShowPageinfo(page): - info = page.lastEditInfo() - if info: - if info['editor']: - info = _("last edited %(time)s by %(editor)s") % info - else: - info = _("last modified %(time)s") % info - return info - return '' - - def rtl_stylesheet(self, d): - """ monobook uses a separate css page for rtl alterations. - Add the rtl stylesheet if the user needs it - """ - link = ('') - html = [] - if i18n.getDirection(self.request.lang) == 'rtl': - prefix = self.cfg.url_prefix - href = '%s/%s/css/%s.css' % (prefix, self.name, 'rtl') - html.append(link % (self.stylesheetsCharset, 'all', href)) - return '\n'.join(html) - - def html_head(self, d): - """ Tweak the sending of the head, to include right-to-left - alterations if necessary - """ - html = [ - u'%(title)s - %(sitename)s' % d, - self.headscript(d), # Should move to separate .js file - self.html_stylesheets(d), - self.rtl_stylesheet(d), - self.rsslink(), - ] - return '\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) diff --git a/wiki/theme/matrix.py b/wiki/theme/matrix.py deleted file mode 100644 index 1495ae47..00000000 --- a/wiki/theme/matrix.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -""" - MoinMoin technical theme - - @copyright: (c) 2003-2004 by Nir Soffer - @license: GNU GPL, see COPYING for details. -""" - -from MoinMoin.theme import modern - - -class Theme(modern.Theme): - - name = "matrix" - - -def execute(request): - """ Generate and return a theme object - - @param request: the request object - @rtype: Theme instance - @return: Theme object - """ - return Theme(request) - diff --git a/wiki/theme/mentalhealth.py b/wiki/theme/mentalhealth.py deleted file mode 100644 index d87e0e7a..00000000 --- a/wiki/theme/mentalhealth.py +++ /dev/null @@ -1,195 +0,0 @@ -# -*- coding: iso-8859-1 -*- -""" - Top Matter: - MentalHealth is a MoinMoin theme - by robin.escalation@ACM.org - dated this 20th of April 2005 - - let's call it version 0.9 - and by golly this is GPLed - - Description: - It may look something like the standard "rightsidebar" theme. - But in reality it is so much better. ;-) - - For example: - * smaller type so more fits - * very nice colours to soothe the soul - * but main page still white background so no clashes - * nice alignment, sizes etc. - * search form integrated with right panel look - * got rid of damn ugly action pulldown menu - * no loss of functionality - - Seems to look good but if you have an issue on a browser then - let me know. - - Accompanying files: - No files changed in folder "img". - Only file changed in folder "css" is "screen.css". - (Though see next.) - - Skinning the theme: - This theme uses four compatible colours, as mentioned in the - header "screen.css". If you like you can search'n'replace for - those more to your liking. I have a couple of alternate versions - of the stylesheet, named screen01.css, screen02.css, etc., just - to show how this works. Rename each in tun to screen.css and - check it out. - - Installation: - * move mentalhealth.py to $python/Lib/site-packages/MoinMoin/theme/ - * move the mentalhealth folder under $python/share/moin/htdocs/ - - And Finally: - "Oh we're in love with beauty, - We're in love with wealth, - We're in love with mental health." - -- Julian Cope - -""" - -from MoinMoin.theme import ThemeBase -from MoinMoin.wikiutil import link_tag as link -from MoinMoin.wikiutil import quoteWikinameURL as quoteURL - -class Theme(ThemeBase): - name = "mentalhealth" - - def editbar(self, d): - """ - Assemble the page edit bar. - - This is rewritten here to get rid of fugly drop-down menu. - (Obviating the need for the actionsMenu() method). - - Also I tried to reduce the number of aliases 'cause I find - that hard to follow. - - @param d: parameter dictionary - @rtype: unicode - @return: iconbar html - """ - # short circuit - if not self.shouldShowEditbar(d['page']): - return '' - - # initialisations & optimisation - _ = self.request.getText - page = d['page'] - cacheKey = 'editbar' - quotedname = quoteURL(page.page_name) - - # use cached copy if possible - cached = self._cache.get(cacheKey) - if cached: - return cached - - # each action in this list is a line on the editbar panel - links = [] - - # parent page - parent = page.getParentPage() - if parent: - links += [parent.link_to(self.request, _("Show Parent", formatted=False))] - - # the rest we will do cleverly :-) - # these are the possible actions and their text labels - choices = [ ['edit', 'edit'], - ['diff', 'show changes'], - ['info', 'get info'], - ['raw', 'show raw text'], - ['print', 'show print view'], - ['refresh', 'delete cache'], - ['AttachFile', 'attach file'], - ['SpellCheck', 'check spelling'], - ['LikePages', 'show like pages'], - ['LocalSiteMap', 'show local site map'], - ['RenamePage', 'rename page'], - ['DeletePage', 'delete page'] - ] - - # determine which actions we can use - available = self.request.getAvailableActions(page) - for action, label in choices: - if action == 'refresh' and not page.canUseCache(): - continue - if action == 'edit' and not (page.isWritable() and self.request.user.may.write(page.page_name)): - continue - - if action[0].isupper() and not action in available: - continue - - links += [link(self.request, '%s?action=%s' % (quotedname, action), - _(label, formatted=False))] - - # we will still delegate this next so I can stop rewriting code - links += [self.subscribeLink(page)] - - # wrap it all up nicely - html = u'

    \n' %\ - '\n'.join(['
  • %s
  • ' % item for item in links if item != '']) - - # cache for next call - self._cache[cacheKey] = html - return html - - def header(self, d, **kw): - """ - Assemble page header, which is to say our right-hand panel. - - @param d: parameter dictionary - @rtype: string - @return: page header html - """ - _ = self.request.getText - - # there are 5 main panels: each one follows this markup - html = u'

    %s

    %s
    ' - - # "search" panel hack so I don't have to rewrite searchform() - searchpanel = self.searchform(d).replace('', - self.emit_custom_html(self.cfg.page_header2), - - u'', - - self.msg(d), - self.startPage(), - self.title(d) - ] - return u'\n'.join(parts) - - def footer(self, d, **kw): - """ - Assemble page footer - - @param d: parameter dictionary - @keyword ...:... - @rtype: string - @return: page footer html - """ - parts = [ u'
    ', - self.pageinfo(d['page']), - self.endPage(), - self.emit_custom_html(self.cfg.page_footer1), - self.emit_custom_html(self.cfg.page_footer2), - ] - return u'\n'.join(parts) - -def execute(request): - """ - Generate and return a theme object. - """ - return Theme(request) diff --git a/wiki/theme/monobook.py b/wiki/theme/monobook.py deleted file mode 100644 index a0e77772..00000000 --- a/wiki/theme/monobook.py +++ /dev/null @@ -1,444 +0,0 @@ -# -*- 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 - @license: GNU GPL, see COPYING for details. -""" - -from MoinMoin.theme import ThemeBase -from MoinMoin import wikiutil, i18n -from MoinMoin.Page import Page - -class Theme(ThemeBase): - - name = "monobook" - - # Standard set of style sheets - stylesheets = ( - # media basename - ('all', 'common'), - ('screen', 'monobook'), - ('screen', 'screen'), - ('print', 'print'), - ('projection', 'projection'), - ) - - -# 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. - """ - html = [ - u'
    ', - u'
    ', - self.startPage(), - self.msg(d), - self.title(d), - ] - return u'\n'.join(html) - - def footer(self, d, **keywords): - """ Assemble wiki footer - """ - html = [ - # End of page - u'
    ', - self.endPage(), - u'
    ', - self.columnone(d), - u'
    ' - ] - return u'\n'.join(html) - - def columnone(self, d): - """ assemble all the navigation aids for the page - """ - page = d['page'] - html = [ - u'
    ', - self.editbar(d), - self.username(d), - u'', - self.navibar(d), - self.searchform(d), - self.actionmenu(d), - u'
    ', - u'', - u'
    ' - ] - return u'\n'.join(html) - - def headscript(self, d): - """ Override to not output search/action menu javascript. - (perhaps not a good idea) - """ - return '' - - def extendedAttrs(self, title, accesskey): - """ Helper function for assembling titled access key links - """ - return 'title="%(title)s [alt-%(accesskey)s]" accesskey=%(accesskey)s' % \ - {'accesskey' : accesskey, - 'title' : title} - - def editbar(self, d): - """ Display a list of actions for the page. This list will be turned - into a set of tabbed views on the page by the css. - """ - page = d['page'] - if not self.shouldShowEditbar(page): - return '' - - # Use cached editbar if possible. - cacheKey = 'editbar' - cached = self._cache.get(cacheKey) - if cached: - return cached - - request = self.request - _ = self.request.getText - link = wikiutil.link_tag - quotedname = wikiutil.quoteWikinameURL(page.page_name) - # action, title, description, accesskey - tabs = [('show', 'Article', 'View the page content', 'c'), - ('edit', 'Edit', 'Edit this page', 'e'), - ('diff', 'Show Changes', 'Last page modification', 'd'), - ('info', 'Get Info', 'Page history and information', 'h'), - ('subscribe', 'Subscribe', 'Subscribe to updates to this page', 'w')] - - items = [] - current = self.request.form.get('action', ['show'])[0] - for action, title, description, accesskey in tabs: - if action == current: - cls = 'selected' - else: - cls = 'none' - - if action == 'edit': - if page.isWritable() and request.user.may.write(page.page_name): - pass - else: - action = 'raw' - title = 'View Source' - description = 'This page is protected. You can view its source' - - if action == 'subscribe': - user = self.request.user - if not self.cfg.mail_smarthost or not user.valid: - break - # Email enabled and user valid, get current page status - if user.isSubscribedTo([page.page_name]): - title = 'Unsubscribe' - description = 'Unsubscribe from updates to this page' - - if action == 'show': - url = quotedname - else: - url = quotedname + '?action=' + action - - attrs = self.extendedAttrs(_(description), accesskey) - link = wikiutil.link_tag(self.request, url, _(title), attrs=attrs) - items.append(u'
  • %s
  • ' % (cls, link)) - - html = [ - u'
    ', - u'
      ', - ''.join(items), - u'
    ', - u'
    ' - ] - html = ''.join(html) - # cache for next call - self._cache[cacheKey] = html - - return html - - - def actionmenu(self, d): - """ different implementation of the actionmenu (aka toolbox) - """ - - page = d['page'] - - # Use cached actionmenu if possible. - cacheKey = 'actionmenu' - cached = self._cache.get(cacheKey) - if cached: - return cached - - request = self.request - _ = request.getText - quotedname = wikiutil.quoteWikinameURL(page.page_name) - - menu = [ - 'raw', - 'print', - 'refresh', - 'AttachFile', - 'SpellCheck', - 'LikePages', - 'LocalSiteMap', - 'RenamePage', - 'DeletePage', - ] - - titles = { - 'raw': _('Show Raw Text', formatted=False), - 'print': _('Show Print View', formatted=False), - 'refresh': _('Delete Cache', formatted=False), - 'AttachFile': _('Attach File', formatted=False), - 'SpellCheck': _('Check Spelling', formatted=False), # rename action! - 'RenamePage': _('Rename Page', formatted=False), - 'DeletePage': _('Delete Page', formatted=False), - 'LikePages': _('Show Like Pages', formatted=False), - 'LocalSiteMap': _('Show Local Site Map', formatted=False), - } - - links = [] - - # Format standard actions - available = request.getAvailableActions(page) - for action in menu: - # Enable delete cache only if page can use caching - if action == 'refresh': - if not page.canUseCache(): - break - # Actions which are not available for this wiki, user or page - if action[0].isupper() and not action in available: - break; - - link = wikiutil.link_tag(self.request, \ - quotedname + '?action=' + action, titles[action]) - links.append(link) - - # Add custom actions not in the standard menu - more = [item for item in available if not item in titles] - more.sort() - if more: - # Add more actions (all enabled) - for action in more: - data = {'action': action, 'disabled': ''} - title = Page(request, action).split_title(request, force=1) - # Use translated version if available - title = _(title, formatted=False) - link = wikiutil.link_tag(self.request, \ - quotedname + '?action=' + action, title) - links.append(link) - - html = [ - u'
    ', - u'
    Toolbox
    ', - u'
    ', - u'
      ', - u'
    • %s
    ' % '\n
  • '.join(links), - u'', - u'
  • ', - u'
    ', - ] - html = ''.join(html) - # cache for next call - self._cache[cacheKey] = html - return html - - - def username(self, d): - """ Assemble the username / userprefs link - Copied from the base class, modified to include hotkeys and link titles - """ - from MoinMoin.Page import Page - request = self.request - _ = request.getText - - userlinks = [] - # Add username/homepage link for registered users. We don't care - # if it exists, the user can create it. - if request.user.valid: - homepage = Page(request, request.user.name) - title = homepage.split_title(request) - attrs = self.extendedAttrs(_('User Page'), '.') - homelink = homepage.link_to(request, text=title, attrs=attrs) - userlinks.append(homelink) - - # Set pref page to localized Preferences page - attrs = self.extendedAttrs(_('My Preferences'), 'u') - prefpage = wikiutil.getSysPage(request, 'UserPreferences') - title = prefpage.split_title(request) - userlinks.append(prefpage.link_to(request, text=title, attrs=attrs)) - - # Add a logout link (not sure this is really necessary - attrs = self.extendedAttrs(_('log out'), 'o') - page = d['page'] - url = wikiutil.quoteWikinameURL(page.page_name) + \ - '?action=userform&logout=1' - link = wikiutil.link_tag(self.request, url, 'log out', attrs=attrs) - userlinks.append(link) - - else: - # Add prefpage links with title: Login - prefpage = wikiutil.getSysPage(request, 'UserPreferences') - attrs = self.extendedAttrs('Logging in is not required, but brings benefits', 'o') - userlinks.append(prefpage.link_to(request, text=_("Login"), attrs=attrs)) - - html = [ - u'
    ', - u'
      ', - u'
    • %s
    ' % '\n
  • '.join(userlinks), - u'', - u'
  • ' - ] - return ''.join(html) - - def searchform(self, d): - """ assemble HTML code for the search form - Tweaks from the bass class to wrap in a 'portlet' class, move the - description to a header tag, add an access key of 'f' and - add SearchButton class for the buttons - """ - _ = self.request.getText - form = self.request.form - updates = { - 'search_label' : _('Search:'), - 'search_value': wikiutil.escape(form.get('value', [''])[0], 1), - 'search_full_label' : _('Text', formatted=False), - 'search_title_label' : _('Titles', formatted=False), - } - d.update(updates) - - html = u''' - -''' % d - return html - - def shouldShowEditbar(self, page): - """ Override to include the editbar on edit/preview pages. - (at the risk that the user may accidentally cancel an edit) - """ - if (page.exists(includeDeleted=1) and - self.request.user.may.read(page.page_name)): - return True - return False - - - def navibar(self, d): - """ Alterations from the base class to include access keys and - descriptions for FrontPage/RecentChanges - """ - request = self.request - found = {} # pages we found. prevent duplicates - links = [] # navibar items - current = d['page_name'] - - # Process config navi_bar - if request.cfg.navi_bar: - for text in request.cfg.navi_bar: - pagename, link = self.splitNavilink(text) - if pagename == d['page_front_page']: - attrs = self.extendedAttrs('Visit the main page', 'z') - elif pagename == 'RecentChanges': - attrs = self.extendedAttrs('List of recent changes in this wiki', 'r') - else: - attrs = '' - - a = wikiutil.link_tag(request, pagename, attrs=attrs) - links.append(a) - found[pagename] = 1 - - # Add user links to wiki links, eliminating duplicates. - userlinks = request.user.getQuickLinks() - for text in userlinks: - # Split text without localization, user know what she wants - pagename, link = self.splitNavilink(text, localize=0) - if not pagename in found: - a = wikiutil.link_tag(request, pagename, attrs=attrs) - links.append(a) - found[pagename] = 1 - - html = [ - u'
    ', - u'
    ', - u'' % '\n
  • '.join(links), - u'', - u'
  • ', - u'
    ', - ] - return ''.join(html) - - def pageinfo(self, page): - """ Simple override from base class. - Remove

    so footer isn't too big - """ - _ = self.request.getText - - if self.shouldShowPageinfo(page): - info = page.lastEditInfo() - if info: - if info['editor']: - info = _("last edited %(time)s by %(editor)s") % info - else: - info = _("last modified %(time)s") % info - return info - return '' - - def rtl_stylesheet(self, d): - """ monobook uses a separate css page for rtl alterations. - Add the rtl stylesheet if the user needs it - """ - link = ('') - html = [] - if i18n.getDirection(self.request.lang) == 'rtl': - prefix = self.cfg.url_prefix - href = '%s/%s/css/%s.css' % (prefix, self.name, 'rtl') - html.append(link % (self.stylesheetsCharset, 'all', href)) - return '\n'.join(html) - - def html_head(self, d): - """ Tweak the sending of the head, to include right-to-left - alterations if necessary - """ - html = [ - u'%(title)s - %(sitename)s' % d, - self.headscript(d), # Should move to separate .js file - self.html_stylesheets(d), - self.rtl_stylesheet(d), - self.rsslink(), - ] - return '\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) diff --git a/wiki/theme/rightsidebarsmaller.py b/wiki/theme/rightsidebarsmaller.py deleted file mode 100644 index 23ebb78e..00000000 --- a/wiki/theme/rightsidebarsmaller.py +++ /dev/null @@ -1,131 +0,0 @@ -# -*- coding: iso-8859-1 -*- -""" - MoinMoin theme by and for crw. -""" - -from MoinMoin import wikiutil -from MoinMoin.Page import Page -from MoinMoin.theme import ThemeBase - -class Theme(ThemeBase): - """ here are the functions generating the html responsible for - the look and feel of your wiki site - """ - - name = "rightsidebarsmaller" - - def wikipanel(self, d): - """ Create wiki panel """ - _ = self.request.getText - html = [ - u'

    ', - u'

    %s

    ' % _("Navigation"), - self.navibar(d), - u'
    ', - ] - return u'\n'.join(html) - - def pagepanel(self, d): - """ Create page panel """ - _ = self.request.getText - if self.shouldShowEditbar(d['page']): - html = [ - u'
    ', - u'

    %s

    ' % _("Page"), - self.editbar(d), - u'
    ', - ] - return u'\n'.join(html) - return '' - - def userpanel(self, d): - """ Create user panel """ - _ = self.request.getText - - trail = self.trail(d) - if trail: - trail = u'

    %s

    \n' % _("Recently viewed pages") + trail - - html = [ - u'
    ', - u'

    %s

    ' % _("User"), - self.username(d), - trail, - u'
    ' - ] - return u'\n'.join(html) - - def header(self, d): - """ - Assemble page header - - @param d: parameter dictionary - @rtype: string - @return: page header html - """ - _ = self.request.getText - - html = [ - # Custom html above header - self.emit_custom_html(self.cfg.page_header1), - - # Hedar - u'', - - # Custom html below header (not recomended!) - self.emit_custom_html(self.cfg.page_header2), - - # Sidebar - u'', - - self.msg(d), - - # Page - self.startPage(), - self.title(d), - ] - return u'\n'.join(html) - - def footer(self, d, **keywords): - """ Assemble page footer - - @param d: parameter dictionary - @keyword ...:... - @rtype: string - @return: page footer html - """ - page = d['page'] - html = [ - # Page end - # Used to extend the page to the bottom of the sidebar - u'
    ', - self.pageinfo(page), - self.endPage(), - - # Custom html above footer - self.emit_custom_html(self.cfg.page_footer1), - - # And bellow - 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) - diff --git a/wiki/theme/sinorca4moin.py b/wiki/theme/sinorca4moin.py deleted file mode 100644 index c6808051..00000000 --- a/wiki/theme/sinorca4moin.py +++ /dev/null @@ -1,230 +0,0 @@ -# -*- coding: iso-8859-1 -*- -"""MoinMoin theme "sinorca4moin" by David Linke. - -Credits to "Haran" who published his sinorca-design at www.oswd.org -""" - -from MoinMoin import wikiutil -from MoinMoin.Page import Page -from MoinMoin.theme import ThemeBase - -class Theme(ThemeBase): - """ here are the functions generating the html responsible for - the look and feel of your wiki site - """ - - name = "sinorca4moin" - - def iconbar(self, d): - """ - Assemble the iconbar - - @param d: parameter dictionary - @rtype: string - @return: iconbar html - """ - iconbar = [] - if self.cfg.page_iconbar and self.request.user.show_toolbar and d['page_name']: - iconbar.append('
      \n') - icons = self.cfg.page_iconbar[:] - for icon in icons: - if icon == "up": - if d['page_parent_page']: - iconbar.append('
    • %s
    • \n' % self.make_iconlink(icon, d)) - elif icon == "subscribe": - iconbar.append('
    • %s
    • \n' % self.make_iconlink( - ["subscribe", "unsubscribe"][self.request.user.isSubscribedTo([d['page_name']])], d)) - elif icon == "home": - if d['page_home_page']: - iconbar.append('
    • %s
    • \n' % self.make_iconlink(icon, d)) - else: - iconbar.append('
    • %s
    • \n' % self.make_iconlink(icon, d)) - iconbar.append('
    \n') - return ''.join(iconbar) - - def editbar(self, d): - """ Assemble the page edit bar. - - Display on existing page. Replace iconbar, showtext, edit text, - refresh cache and available actions. - - @param d: parameter dictionary - @rtype: unicode - @return: iconbar html - """ - page = d['page'] - if not self.shouldShowEditbar(page): - return '' - - # Use cached editbar if possible. - cacheKey = 'editbar' - cached = self._cache.get(cacheKey) - if cached: - return cached - - # Make new edit bar - request = self.request - _ = self.request.getText - link = wikiutil.link_tag - quotedname = wikiutil.quoteWikinameURL(page.page_name) - links = [] - add = links.append - - # Parent page - #parent = page.getParentPage() - #if parent: - # add(parent.link_to(request, _("Show Parent", formatted=False))) - - # Page actions - if page.isWritable() and request.user.may.write(page.page_name): - add(link(request, quotedname + '?action=edit', _('Edit'))) - else: - add(_('Immutable Page', formatted=False)) - - add(link(request, quotedname + '?action=info', - _('Get Info', formatted=False))) - add(self.actionsMenu(page)) - - # Format - items = '\n'.join(['
  • %s
  • ' % item for item in links if item != '']) - html = u'
      \n%s\n
    \n' % items - - # cache for next call - self._cache[cacheKey] = html - return html - - def wikipanel(self, d): - """ Create wiki panel """ - _ = self.request.getText - html = [ - u'
    ', - u'

    %s

    ' % _("Wiki"), - self.navibar(d), - u'
    ', - ] - return u'\n'.join(html) - - def pagepanel(self, d): - """ Create page panel """ - _ = self.request.getText - if self.shouldShowEditbar(d['page']): - html = [ - u'
    ', - u'

    %s

    ' % _("Page"), - self.editbar(d), - u'
    ', - ] - return u'\n'.join(html) - return '' - - def userpanel(self, d): - """ Create user panel """ - _ = self.request.getText - - html = [ - u'
    ', - u'

    %s

    ' % _("User"), - self.username(d), - u'
    ' - ] - return u'\n'.join(html) - - def logo(self): - """ Assemble logo with link to front page - - adds h1-tags for sinorca - """ - if self.cfg.logo_string: - pagename = wikiutil.getFrontPage(self.request).page_name - pagename = wikiutil.quoteWikinameURL(pagename) - logo = wikiutil.link_tag(self.request, pagename, self.cfg.logo_string) - html = u'''''' % logo - return html - return u'' - - def header(self, d): - """ - Assemble page header - - @param d: parameter dictionary - @rtype: string - @return: page header html - """ - _ = self.request.getText - - trail = self.trail(d) - - html = [ - # Header - u'', - - # Iconbar - self.iconbar(d), - - # Sidebar - u'', - u'', - - self.msg(d), - - # Page - self.startPage(), - self.title(d), - ] - return u'\n'.join(html) - - def footer(self, d, **keywords): - """ Assemble page footer - - @param d: parameter dictionary - @keyword ...:... - @rtype: string - @return: page footer html - """ - page = d['page'] - html = [ - # Page end - # Used to extend the page to the bottom of the sidebar - u'
    ', - self.pageinfo(page), - self.endPage(), - - # Custom html above footer - self.emit_custom_html(self.cfg.page_footer1), - - # And bellow - 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) -