',
- self.title(d)[:-6], # On enlève
- parent and wikiutil.link_tag(self.request,
- parent.page_name,
- u'') or u'',
- u''
- u'
',
]
return u'\n'.join(html)
+ editorheader = header
def footer(self, d, **keywords):
""" Assemble wiki footer
"""
html = [
# End of page
- u'',
self.pageinfo(d['page']),
self.endPage(),
- self.columnone(d),
- u'',
- u'
',
- u'
',
- u""
+ u'
', # fin du div main-content
+ self.rightcolumn(d),
+ u'' # fin du div globalWrapper
]
return u'\n'.join(html)
- def columnone(self, d):
+ def rightcolumn(self, d):
""" assemble all the navigation aids for the page
"""
+ _ = self.request.getText
page = d['page']
html = [
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',
- u'format&mimetype=text/latex',
- u'format&mimetype=text/plain',
- 'refresh',
- 'AttachFile',
- 'SpellCheck',
- 'LikePages',
- 'LocalSiteMap',
- 'RenamePage',
- 'DeletePage',
- ]
-
- titles = {
- 'raw': _('Show Raw Text', formatted=False),
- 'print': _('Show Print View', formatted=False),
- u'format&mimetype=text/latex': _('Obtenir le code latex', formatted=False),
- u'format&mimetype=text/plain': _('Version texte (en test)', 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 = [ 'Voir la page web' % page.page_name ]
-
- # 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'
Personnel
',
- 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'