Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin.theme.rightsidebar.Theme Class Reference
Inheritance diagram for MoinMoin.theme.rightsidebar.Theme:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.theme.rightsidebar.Theme:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def wikipanel
def pagepanel
def userpanel
def header
def editorheader
def footer
def img_url
def emit_custom_html
def logo
def interwiki
def title
def title_with_separators
def username
def splitNavilink
def shortenPagename
def maxPagenameLength
def navibar
def get_icon
def make_icon
def make_iconlink
def msg
def trail
def html_stylesheets
def shouldShowPageinfo
def pageinfo
def searchform
def showversion
def headscript
def shouldUseRSS
def rsshref
def rsslink
def html_head
def externalScript
def universal_edit_button
def credits
def actionsMenu
def editbar
def shouldShowEditbar
def editbarItems
def supplementation_page_nameLink
def guiworks
def editorLink
def showBothEditLinks
def guiEditorScript
def disabledEdit
def infoLink
def subscribeLink
def quicklinkLink
def attachmentsLink
def startPage
def endPage
def header
def recentchanges_entry
def recentchanges_daybreak
def recentchanges_header
def recentchanges_footer
def ui_lang_attr
def content_lang_attr
def add_msg
def send_title
def send_footer
def send_closing_html
def sidebar

Public Attributes

 request
 cfg

Static Public Attributes

string name = "rightsidebar"
dictionary icons
tuple stylesheets
tuple stylesheets_print
tuple stylesheets_projection
string stylesheetsCharset = 'utf-8'
 editorheader = header

Detailed Description

Definition at line 14 of file rightsidebar.py.


Member Function Documentation

def MoinMoin.theme.ThemeBase.actionsMenu (   self,
  page 
) [inherited]
Create actions menu list and items data dict

The menu will contain the same items always, but items that are
not available will be disabled (some broken browsers will let
you select disabled options though).

The menu should give best user experience for javascript
enabled browsers, and acceptable behavior for those who prefer
not to use Javascript.

TODO: Move actionsMenuInit() into body onload - requires that the theme will render body,
      it is currently done in wikiutil/page.

@param page: current page, Page object
@rtype: unicode
@return: actions menu html fragment

Definition at line 952 of file __init__.py.

00952 
00953     def actionsMenu(self, page):
00954         """ Create actions menu list and items data dict
00955 
00956         The menu will contain the same items always, but items that are
00957         not available will be disabled (some broken browsers will let
00958         you select disabled options though).
00959 
00960         The menu should give best user experience for javascript
00961         enabled browsers, and acceptable behavior for those who prefer
00962         not to use Javascript.
00963 
00964         TODO: Move actionsMenuInit() into body onload - requires that the theme will render body,
00965               it is currently done in wikiutil/page.
00966 
00967         @param page: current page, Page object
00968         @rtype: unicode
00969         @return: actions menu html fragment
00970         """
00971         request = self.request
00972         _ = request.getText
00973         rev = request.rev
00974 
00975         menu = [
00976             'raw',
00977             'print',
00978             'RenderAsDocbook',
00979             'refresh',
00980             '__separator__',
00981             'SpellCheck',
00982             'LikePages',
00983             'LocalSiteMap',
00984             '__separator__',
00985             'RenamePage',
00986             'CopyPage',
00987             'DeletePage',
00988             '__separator__',
00989             'MyPages',
00990             'SubscribeUser',
00991             '__separator__',
00992             'Despam',
00993             'revert',
00994             'PackagePages',
00995             'SyncPages',
00996             ]
00997 
00998         titles = {
00999             # action: menu title
01000             '__title__': _("More Actions:"),
01001             # Translation may need longer or shorter separator
01002             '__separator__': _('------------------------'),
01003             'raw': _('Raw Text'),
01004             'print': _('Print View'),
01005             'refresh': _('Delete Cache'),
01006             'SpellCheck': _('Check Spelling'), # rename action!
01007             'RenamePage': _('Rename Page'),
01008             'CopyPage': _('Copy Page'),
01009             'DeletePage': _('Delete Page'),
01010             'LikePages': _('Like Pages'),
01011             'LocalSiteMap': _('Local Site Map'),
01012             'MyPages': _('My Pages'),
01013             'SubscribeUser': _('Subscribe User'),
01014             'Despam': _('Remove Spam'),
01015             'revert': _('Revert to this revision'),
01016             'PackagePages': _('Package Pages'),
01017             'RenderAsDocbook': _('Render as Docbook'),
01018             'SyncPages': _('Sync Pages'),
01019             }
01020 
01021         options = []
01022         option = '<option value="%(action)s"%(disabled)s>%(title)s</option>'
01023         # class="disabled" is a workaround for browsers that ignore
01024         # "disabled", e.g IE, Safari
01025         # for XHTML: data['disabled'] = ' disabled="disabled"'
01026         disabled = ' disabled class="disabled"'
01027 
01028         # Format standard actions
01029         available = get_available_actions(request.cfg, page, request.user)
01030         for action in menu:
01031             data = {'action': action, 'disabled': '', 'title': titles[action]}
01032             # removes excluded actions from the more actions menu
01033             if action in request.cfg.actions_excluded:
01034                 continue
01035 
01036             # Enable delete cache only if page can use caching
01037             if action == 'refresh':
01038                 if not page.canUseCache():
01039                     data['action'] = 'show'
01040                     data['disabled'] = disabled
01041 
01042             # revert action enabled only if user can revert
01043             if action == 'revert' and not request.user.may.revert(page.page_name):
01044                 data['action'] = 'show'
01045                 data['disabled'] = disabled
01046 
01047             # SubscribeUser action enabled only if user has admin rights
01048             if action == 'SubscribeUser' and not request.user.may.admin(page.page_name):
01049                 data['action'] = 'show'
01050                 data['disabled'] = disabled
01051 
01052             # Despam action enabled only for superusers
01053             if action == 'Despam' and not request.user.isSuperUser():
01054                 data['action'] = 'show'
01055                 data['disabled'] = disabled
01056 
01057             # Special menu items. Without javascript, executing will
01058             # just return to the page.
01059             if action.startswith('__'):
01060                 data['action'] = 'show'
01061 
01062             # Actions which are not available for this wiki, user or page
01063             if (action == '__separator__' or
01064                 (action[0].isupper() and not action in available)):
01065                 data['disabled'] = disabled
01066 
01067             options.append(option % data)
01068 
01069         # Add custom actions not in the standard menu, except for
01070         # some actions like AttachFile (we have them on top level)
01071         more = [item for item in available if not item in titles and not item in ('AttachFile', )]
01072         more.sort()
01073         if more:
01074             # Add separator
01075             separator = option % {'action': 'show', 'disabled': disabled,
01076                                   'title': titles['__separator__']}
01077             options.append(separator)
01078             # Add more actions (all enabled)
01079             for action in more:
01080                 data = {'action': action, 'disabled': ''}
01081                 # Always add spaces: AttachFile -> Attach File
01082                 # XXX do not create page just for using split_title -
01083                 # creating pages for non-existent does 2 storage lookups
01084                 #title = Page(request, action).split_title(force=1)
01085                 title = action
01086                 # Use translated version if available
01087                 data['title'] = _(title)
01088                 options.append(option % data)
01089 
01090         data = {
01091             'label': titles['__title__'],
01092             'options': '\n'.join(options),
01093             'rev_field': rev and '<input type="hidden" name="rev" value="%d">' % rev or '',
01094             'do_button': _("Do"),
01095             'url': self.request.href(page.page_name)
01096             }
01097         html = '''
01098 <form class="actionsmenu" method="GET" action="%(url)s">
01099 <div>
01100     <label>%(label)s</label>
01101     <select name="action"
01102         onchange="if ((this.selectedIndex != 0) &&
01103                       (this.options[this.selectedIndex].disabled == false)) {
01104                 this.form.submit();
01105             }
01106             this.selectedIndex = 0;">
01107         %(options)s
01108     </select>
01109     <input type="submit" value="%(do_button)s">
01110     %(rev_field)s
01111 </div>
01112 <script type="text/javascript">
01113 <!--// Init menu
01114 actionsMenuInit('%(label)s');
01115 //-->
01116 </script>
01117 </form>
01118 ''' % data
01119 
01120         return html

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.add_msg (   self,
  msg,
  msg_class = None 
) [inherited]
Adds a message to a list which will be used to generate status
information.

@param msg: additional message
@param msg_class: html class for the div of the additional message.

Definition at line 1563 of file __init__.py.

01563 
01564     def add_msg(self, msg, msg_class=None):
01565         """ Adds a message to a list which will be used to generate status
01566         information.
01567 
01568         @param msg: additional message
01569         @param msg_class: html class for the div of the additional message.
01570         """
01571         if not msg_class:
01572             msg_class = 'dialog'
01573         if self._send_title_called:
01574             raise Exception("You cannot call add_msg() after send_title()")
01575         self._status.append((msg, msg_class))

def MoinMoin.theme.ThemeBase.attachmentsLink (   self,
  page 
) [inherited]
Return link to page attachments 

Definition at line 1356 of file __init__.py.

01356 
01357     def attachmentsLink(self, page):
01358         """ Return link to page attachments """
01359         if 'AttachFile' in self.request.cfg.actions_excluded:
01360             return ""
01361 
01362         _ = self.request.getText
01363         return page.link_to(self.request,
01364                             text=_('Attachments'),
01365                             querystr={'action': 'AttachFile'}, css_class='nbattachments', rel='nofollow')

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.content_lang_attr (   self) [inherited]
Generate language attributes for wiki page content

Page content uses the page language or the wiki default language.

@rtype: string
@return: lang and dir html attributes

Definition at line 1552 of file __init__.py.

01552 
01553     def content_lang_attr(self):
01554         """Generate language attributes for wiki page content
01555 
01556         Page content uses the page language or the wiki default language.
01557 
01558         @rtype: string
01559         @return: lang and dir html attributes
01560         """
01561         lang = self.request.content_lang
01562         return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang))

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.credits (   self,
  d,
  keywords 
) [inherited]
Create credits html from credits list 

Definition at line 942 of file __init__.py.

00942 
00943     def credits(self, d, **keywords):
00944         """ Create credits html from credits list """
00945         if isinstance(self.cfg.page_credits, (list, tuple)):
00946             items = ['<li>%s</li>' % i for i in self.cfg.page_credits]
00947             html = '<ul id="credits">\n%s\n</ul>\n' % ''.join(items)
00948         else:
00949             # Old config using string, output as is
00950             html = self.cfg.page_credits
00951         return html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.disabledEdit (   self) [inherited]
Return a disabled edit link 

Definition at line 1304 of file __init__.py.

01304 
01305     def disabledEdit(self):
01306         """ Return a disabled edit link """
01307         _ = self.request.getText
01308         return ('<span class="disabled">%s</span>'
01309                 % _('Immutable Page'))

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.editbar (   self,
  d 
) [inherited]
Assemble the page edit bar.

Create html on first call, then return cached html.

@param d: parameter dictionary
@rtype: unicode
@return: iconbar html

Definition at line 1121 of file __init__.py.

01121 
01122     def editbar(self, d):
01123         """ Assemble the page edit bar.
01124 
01125         Create html on first call, then return cached html.
01126 
01127         @param d: parameter dictionary
01128         @rtype: unicode
01129         @return: iconbar html
01130         """
01131         page = d['page']
01132         if not self.shouldShowEditbar(page):
01133             return ''
01134 
01135         html = self._cache.get('editbar')
01136         if html is None:
01137             # Remove empty items and format as list. The item for showing inline comments
01138             # is hidden by default. It gets activated through javascript only if inline
01139             # comments exist on the page.
01140             items = []
01141             for item in self.editbarItems(page):
01142                 if item:
01143                     if 'nbcomment' in item:
01144                         # hiding the complete list item is cosmetically better than just
01145                         # hiding the contents (e.g. for sidebar themes).
01146                         items.append('<li class="toggleCommentsButton" style="display:none;">%s</li>' % item)
01147                     else:
01148                         items.append('<li>%s</li>' % item)
01149             html = u'<ul class="editbar">%s</ul>\n' % ''.join(items)
01150             self._cache['editbar'] = html
01151 
01152         return html

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.editbarItems (   self,
  page 
) [inherited]
Return list of items to show on the editbar

This is separate method to make it easy to customize the
edtibar in sub classes.

Definition at line 1177 of file __init__.py.

01177 
01178     def editbarItems(self, page):
01179         """ Return list of items to show on the editbar
01180 
01181         This is separate method to make it easy to customize the
01182         edtibar in sub classes.
01183         """
01184         _ = self.request.getText
01185         editbar_actions = []
01186         for editbar_item in self.request.cfg.edit_bar:
01187             if (editbar_item == 'Discussion' and
01188                (self.request.getPragma('supplementation-page', self.request.cfg.supplementation_page)
01189                                                    in (True, 1, 'on', '1'))):
01190                     editbar_actions.append(self.supplementation_page_nameLink(page))
01191             elif editbar_item == 'Comments':
01192                 # we just use <a> to get same style as other links, but we add some dummy
01193                 # link target to get correct mouseover pointer appearance. return false
01194                 # keeps the browser away from jumping to the link target::
01195                 editbar_actions.append('<a href="#" class="nbcomment" onClick="toggleComments();return false;">%s</a>' % _('Comments'))
01196             elif editbar_item == 'Edit':
01197                 editbar_actions.append(self.editorLink(page))
01198             elif editbar_item == 'Info':
01199                 editbar_actions.append(self.infoLink(page))
01200             elif editbar_item == 'Subscribe':
01201                 editbar_actions.append(self.subscribeLink(page))
01202             elif editbar_item == 'Quicklink':
01203                 editbar_actions.append(self.quicklinkLink(page))
01204             elif editbar_item == 'Attachments':
01205                 editbar_actions.append(self.attachmentsLink(page))
01206             elif editbar_item == 'ActionsMenu':
01207                 editbar_actions.append(self.actionsMenu(page))
01208         return editbar_actions

Here is the call graph for this function:

Here is the caller graph for this function:

Assemble page header for editor

@param d: parameter dictionary
@rtype: string
@return: page header html

Definition at line 96 of file rightsidebar.py.

00096 
00097     def editorheader(self, d):
00098         """
00099         Assemble page header for editor
00100 
00101         @param d: parameter dictionary
00102         @rtype: string
00103         @return: page header html
00104         """
00105         _ = self.request.getText
00106 
00107         html = [
00108             # Custom html above header
00109             self.emit_custom_html(self.cfg.page_header1),
00110 
00111             # Header
00112             #u'<div id="header">',
00113             #self.searchform(d),
00114             #self.logo(),
00115             #u'</div>',
00116 
00117             # Custom html below header (not recomended!)
00118             self.emit_custom_html(self.cfg.page_header2),
00119 
00120             # Sidebar
00121             u'<div id="sidebar">',
00122             self.wikipanel(d),
00123             self.pagepanel(d),
00124             self.userpanel(d),
00125             u'</div>',
00126 
00127             self.msg(d),
00128 
00129             # Page
00130             self.startPage(),
00131             #self.title(d),
00132             ]
00133         return u'\n'.join(html)

Here is the call graph for this function:

def MoinMoin.theme.ThemeBase.editorLink (   self,
  page 
) [inherited]
Return a link to the editor

If the user can't edit, return a disabled edit link.

If the user want to show both editors, it will display "Edit
(Text)", otherwise as "Edit".

Definition at line 1237 of file __init__.py.

01237 
01238     def editorLink(self, page):
01239         """ Return a link to the editor
01240 
01241         If the user can't edit, return a disabled edit link.
01242 
01243         If the user want to show both editors, it will display "Edit
01244         (Text)", otherwise as "Edit".
01245         """
01246         if 'edit' in self.request.cfg.actions_excluded:
01247             return ""
01248 
01249         if not (page.isWritable() and
01250                 self.request.user.may.write(page.page_name)):
01251             return self.disabledEdit()
01252 
01253         _ = self.request.getText
01254         querystr = {'action': 'edit'}
01255 
01256         guiworks = self.guiworks(page)
01257         if self.showBothEditLinks() and guiworks:
01258             text = _('Edit (Text)')
01259             querystr['editor'] = 'text'
01260             attrs = {'name': 'texteditlink', 'rel': 'nofollow', }
01261         else:
01262             text = _('Edit')
01263             if guiworks:
01264                 # 'textonly' will be upgraded dynamically to 'guipossible' by JS
01265                 querystr['editor'] = 'textonly'
01266                 attrs = {'name': 'editlink', 'rel': 'nofollow', }
01267             else:
01268                 querystr['editor'] = 'text'
01269                 attrs = {'name': 'texteditlink', 'rel': 'nofollow', }
01270 
01271         return page.link_to(self.request, text=text, querystr=querystr, **attrs)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.emit_custom_html (   self,
  html 
) [inherited]
generate custom HTML code in `html`

@param html: a string or a callable object, in which case
     it is called and its return value is used
@rtype: string
@return: string with html

Definition at line 175 of file __init__.py.

00175 
00176     def emit_custom_html(self, html):
00177         """
00178         generate custom HTML code in `html`
00179 
00180         @param html: a string or a callable object, in which case
00181                      it is called and its return value is used
00182         @rtype: string
00183         @return: string with html
00184         """
00185         if html:
00186             if callable(html):
00187                 html = html(self.request)
00188         return html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.endPage (   self) [inherited]
End page div

Add an empty page bottom div to prevent floating elements to
float out of the page bottom over the footer.

Definition at line 1374 of file __init__.py.

01374 
01375     def endPage(self):
01376         """ End page div
01377 
01378         Add an empty page bottom div to prevent floating elements to
01379         float out of the page bottom over the footer.
01380         """
01381         return '<div id="pagebottom"></div>\n</div>\n'

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.externalScript (   self,
  name 
) [inherited]
Format external script html 

Definition at line 922 of file __init__.py.

00922 
00923     def externalScript(self, name):
00924         """ Format external script html """
00925         src = '%s/common/js/%s.js' % (self.request.cfg.url_prefix_static, name)
00926         return '<script type="text/javascript" src="%s"></script>' % src

Here is the caller graph for this function:

def MoinMoin.theme.rightsidebar.Theme.footer (   self,
  d,
  keywords 
)
Assemble wiki footer

@param d: parameter dictionary
@keyword ...:...
@rtype: unicode
@return: page footer html

Reimplemented from MoinMoin.theme.ThemeBase.

Definition at line 134 of file rightsidebar.py.

00134 
00135     def footer(self, d, **keywords):
00136         """ Assemble wiki footer
00137 
00138         @param d: parameter dictionary
00139         @keyword ...:...
00140         @rtype: unicode
00141         @return: page footer html
00142         """
00143         page = d['page']
00144         html = [
00145             # End of page
00146             self.pageinfo(page),
00147             self.endPage(),
00148 
00149             # Pre footer custom html (not recommended!)
00150             self.emit_custom_html(self.cfg.page_footer1),
00151 
00152             # Footer
00153             u'<div id="footer">',
00154             self.credits(d),
00155             self.showversion(d, **keywords),
00156             u'</div>',
00157 
00158             # Post footer custom html
00159             self.emit_custom_html(self.cfg.page_footer2),
00160             ]
00161         return u'\n'.join(html)
00162 

Here is the call graph for this function:

def MoinMoin.theme.ThemeBase.get_icon (   self,
  icon 
) [inherited]
Return icon data from self.icons

If called from <<Icon(file)>> we have a filename, not a
key. Using filenames is deprecated, but for now, we simulate old
behavior.

@param icon: icon name or file name (string)
@rtype: tuple
@return: alt (unicode), href (string), width, height (int)

Definition at line 520 of file __init__.py.

00520 
00521     def get_icon(self, icon):
00522         """ Return icon data from self.icons
00523 
00524         If called from <<Icon(file)>> we have a filename, not a
00525         key. Using filenames is deprecated, but for now, we simulate old
00526         behavior.
00527 
00528         @param icon: icon name or file name (string)
00529         @rtype: tuple
00530         @return: alt (unicode), href (string), width, height (int)
00531         """
00532         if icon in self.icons:
00533             alt, icon, w, h = self.icons[icon]
00534         else:
00535             # Create filenames to icon data mapping on first call, then
00536             # cache in class for next calls.
00537             if not getattr(self.__class__, 'iconsByFile', None):
00538                 d = {}
00539                 for data in self.icons.values():
00540                     d[data[1]] = data
00541                 self.__class__.iconsByFile = d
00542 
00543             # Try to get icon data by file name
00544             if icon in self.iconsByFile:
00545                 alt, icon, w, h = self.iconsByFile[icon]
00546             else:
00547                 alt, icon, w, h = '', icon, '', ''
00548 
00549         return alt, self.img_url(icon), w, h

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.guiEditorScript (   self,
  d 
) [inherited]
Return a script that set the gui editor link variables

The link will be created only when javascript is enabled and
the browser is compatible with the editor.

Definition at line 1279 of file __init__.py.

01279 
01280     def guiEditorScript(self, d):
01281         """ Return a script that set the gui editor link variables
01282 
01283         The link will be created only when javascript is enabled and
01284         the browser is compatible with the editor.
01285         """
01286         page = d['page']
01287         if not (page.isWritable() and
01288                 self.request.user.may.write(page.page_name) and
01289                 self.showBothEditLinks() and
01290                 self.guiworks(page)):
01291             return ''
01292 
01293         _ = self.request.getText
01294         return """\
01295 <script type="text/javascript">
01296 <!-- // GUI edit link and i18n
01297 var gui_editor_link_href = "%(url)s";
01298 var gui_editor_link_text = "%(text)s";
01299 //-->
01300 </script>
01301 """ % {'url': page.url(self.request, querystr={'action': 'edit', 'editor': 'gui', }),
01302        'text': _('Edit (GUI)'),
01303       }

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.guiworks (   self,
  page 
) [inherited]
Return whether the gui editor / converter can work for that page.

    The GUI editor currently only works for wiki format.
    For simplicity, we also tell it does not work if the admin forces the text editor.

Definition at line 1226 of file __init__.py.

01226 
01227     def guiworks(self, page):
01228         """ Return whether the gui editor / converter can work for that page.
01229 
01230             The GUI editor currently only works for wiki format.
01231             For simplicity, we also tell it does not work if the admin forces the text editor.
01232         """
01233         is_wiki = page.pi['format'] == 'wiki'
01234         gui_disallowed = self.cfg.editor_force and self.cfg.editor_default == 'text'
01235         return is_wiki and not gui_disallowed
01236 

Here is the caller graph for this function:

Assemble page header

@param d: parameter dictionary
@rtype: string
@return: page header html

Definition at line 54 of file rightsidebar.py.

00054 
00055     def header(self, d):
00056         """
00057         Assemble page header
00058 
00059         @param d: parameter dictionary
00060         @rtype: string
00061         @return: page header html
00062         """
00063         _ = self.request.getText
00064 
00065         html = [
00066             # Custom html above header
00067             self.emit_custom_html(self.cfg.page_header1),
00068 
00069             # Header
00070             u'<div id="header">',
00071             self.searchform(d),
00072             self.logo(),
00073             u'<div id="locationline">',
00074             self.interwiki(d),
00075             self.title(d),
00076             u'</div>',
00077             self.trail(d),
00078             u'</div>',
00079 
00080             # Custom html below header (not recomended!)
00081             self.emit_custom_html(self.cfg.page_header2),
00082 
00083             # Sidebar
00084             u'<div id="sidebar">',
00085             self.wikipanel(d),
00086             self.pagepanel(d),
00087             self.userpanel(d),
00088             u'</div>',
00089 
00090             self.msg(d),
00091 
00092             # Page
00093             self.startPage(),
00094             ]
00095         return u'\n'.join(html)

Here is the call graph for this function:

def MoinMoin.theme.ThemeBase.header (   self,
  d,
  kw 
) [inherited]
Assemble page header

Default behavior is to start a page div. Sub class and add
footer items.

@param d: parameter dictionary
@rtype: string
@return: page header html

Reimplemented in MoinMoin.theme.modernized.Theme, and MoinMoin.theme.modern.Theme.

Definition at line 1384 of file __init__.py.

01384 
01385     def header(self, d, **kw):
01386         """ Assemble page header
01387 
01388         Default behavior is to start a page div. Sub class and add
01389         footer items.
01390 
01391         @param d: parameter dictionary
01392         @rtype: string
01393         @return: page header html
01394         """
01395         return self.startPage()

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.headscript (   self,
  d 
) [inherited]
Return html head script with common functions

@param d: parameter dictionary
@rtype: unicode
@return: script for html head

Definition at line 837 of file __init__.py.

00837 
00838     def headscript(self, d):
00839         """ Return html head script with common functions
00840 
00841         @param d: parameter dictionary
00842         @rtype: unicode
00843         @return: script for html head
00844         """
00845         # Don't add script for print view
00846         if self.request.action == 'print':
00847             return u''
00848 
00849         _ = self.request.getText
00850         script = u"""
00851 <script type="text/javascript">
00852 <!--
00853 var search_hint = "%(search_hint)s";
00854 //-->
00855 </script>
""" % {

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.html_head (   self,
  d 
) [inherited]
Assemble html head

@param d: parameter dictionary
@rtype: unicode
@return: html head

Definition at line 901 of file __init__.py.

00901 
00902     def html_head(self, d):
00903         """ Assemble html head
00904 
00905         @param d: parameter dictionary
00906         @rtype: unicode
00907         @return: html head
00908         """
00909         html = [
00910             u'<title>%(title)s - %(sitename)s</title>' % {
00911                 'title': wikiutil.escape(d['title']),
00912                 'sitename': wikiutil.escape(d['sitename']),
00913             },
00914             self.externalScript('common'),
00915             self.headscript(d), # Should move to separate .js file
00916             self.guiEditorScript(d),
00917             self.html_stylesheets(d),
00918             self.rsslink(d),
00919             self.universal_edit_button(d),
00920             ]
00921         return '\n'.join(html)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.html_stylesheets (   self,
  d 
) [inherited]
Assemble html head stylesheet links

@param d: parameter dictionary
@rtype: string
@return: stylesheets links

Definition at line 693 of file __init__.py.

00693 
00694     def html_stylesheets(self, d):
00695         """ Assemble html head stylesheet links
00696 
00697         @param d: parameter dictionary
00698         @rtype: string
00699         @return: stylesheets links
00700         """
00701         request = self.request
00702         # Check mode
00703         if d.get('print_mode'):
00704             media = d.get('media', 'print')
00705             stylesheets = getattr(self, 'stylesheets_' + media)
00706         else:
00707             stylesheets = self.stylesheets
00708 
00709         theme_css = [self._stylesheet_link(True, *stylesheet) for stylesheet in stylesheets]
00710         cfg_css = [self._stylesheet_link(False, *stylesheet) for stylesheet in request.cfg.stylesheets]
00711 
00712         msie_css = """
00713 <!-- css only for MS IE6/IE7 browsers -->
00714 <!--[if lt IE 8]>
00715    %s
00716 <![endif]-->
00717 """ % self._stylesheet_link(True, 'all', 'msie')
00718 
00719         # Add user css url (assuming that user css uses same charset)
00720         href = request.user.valid and request.user.css_url
00721         if href and href.lower() != "none":
00722             user_css = self._stylesheet_link(False, 'all', href)
00723         else:
00724             user_css = ''
00725 
00726         return '\n'.join(theme_css + cfg_css + [msie_css, user_css])

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.img_url (   self,
  img 
) [inherited]
Generate an image href

@param img: the image filename
@rtype: string
@return: the image href

Definition at line 166 of file __init__.py.

00166 
00167     def img_url(self, img):
00168         """ Generate an image href
00169 
00170         @param img: the image filename
00171         @rtype: string
00172         @return: the image href
00173         """
00174         return "%s/%s/img/%s" % (self.cfg.url_prefix_static, self.name, img)

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.infoLink (   self,
  page 
) [inherited]
Return link to page information 

Definition at line 1310 of file __init__.py.

01310 
01311     def infoLink(self, page):
01312         """ Return link to page information """
01313         if 'info' in self.request.cfg.actions_excluded:
01314             return ""
01315 
01316         _ = self.request.getText
01317         return page.link_to(self.request,
01318                             text=_('Info'),
01319                             querystr={'action': 'info'}, css_class='nbinfo', rel='nofollow')

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.interwiki (   self,
  d 
) [inherited]
Assemble the interwiki name display, linking to page_front_page

@param d: parameter dictionary
@rtype: string
@return: interwiki html

Reimplemented in MoinMoin.theme.modernized.Theme.

Definition at line 206 of file __init__.py.

00206 
00207     def interwiki(self, d):
00208         """ Assemble the interwiki name display, linking to page_front_page
00209 
00210         @param d: parameter dictionary
00211         @rtype: string
00212         @return: interwiki html
00213         """
00214         if self.request.cfg.show_interwiki:
00215             page = wikiutil.getFrontPage(self.request)
00216             text = self.request.cfg.interwikiname or u'Self'
00217             link = page.link_to(self.request, text=text, rel='nofollow')
00218             html = u'<div id="interwiki"><span>%s</span></div>' % link
00219         else:
00220             html = u''
00221         return html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.logo (   self) [inherited]
Assemble logo with link to front page

The logo contain an image and or text or any html markup the
admin inserted in the config file. Everything it enclosed inside
a div with id="logo".

@rtype: unicode
@return: logo html

Definition at line 189 of file __init__.py.

00189 
00190     def logo(self):
00191         """ Assemble logo with link to front page
00192 
00193         The logo contain an image and or text or any html markup the
00194         admin inserted in the config file. Everything it enclosed inside
00195         a div with id="logo".
00196 
00197         @rtype: unicode
00198         @return: logo html
00199         """
00200         html = u''
00201         if self.cfg.logo_string:
00202             page = wikiutil.getFrontPage(self.request)
00203             logo = page.link_to_raw(self.request, self.cfg.logo_string)
00204             html = u'''<div id="logo">%s</div>''' % logo
00205         return html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.make_icon (   self,
  icon,
  vars = None,
  kw 
) [inherited]
This is the central routine for making <img> tags for icons!
All icons stuff except the top left logo and search field icons are
handled here.

@param icon: icon id (dict key)
@param vars: ...
@rtype: string
@return: icon html (img tag)

Definition at line 550 of file __init__.py.

00550 
00551     def make_icon(self, icon, vars=None, **kw):
00552         """
00553         This is the central routine for making <img> tags for icons!
00554         All icons stuff except the top left logo and search field icons are
00555         handled here.
00556 
00557         @param icon: icon id (dict key)
00558         @param vars: ...
00559         @rtype: string
00560         @return: icon html (img tag)
00561         """
00562         if vars is None:
00563             vars = {}
00564         alt, img, w, h = self.get_icon(icon)
00565         try:
00566             alt = vars['icon-alt-text'] # if it is possible we take the alt-text from 'page_icons_table'
00567         except KeyError, err:
00568             try:
00569                 alt = alt % vars # if not we just leave the  alt-text from 'icons'
00570             except KeyError, err:
00571                 alt = 'KeyError: %s' % str(err)
00572         alt = self.request.getText(alt)
00573         tag = self.request.formatter.image(src=img, alt=alt, width=w, height=h, **kw)
00574         return tag

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.make_iconlink (   self,
  which,
  d 
) [inherited]
Make a link with an icon

@param which: icon id (dictionary key)
@param d: parameter dictionary
@rtype: string
@return: html link tag

Definition at line 575 of file __init__.py.

00575 
00576     def make_iconlink(self, which, d):
00577         """
00578         Make a link with an icon
00579 
00580         @param which: icon id (dictionary key)
00581         @param d: parameter dictionary
00582         @rtype: string
00583         @return: html link tag
00584         """
00585         qs = {}
00586         pagekey, querystr, title, icon = self.cfg.page_icons_table[which]
00587         qs.update(querystr) # do not modify the querystr dict in the cfg!
00588         d['icon-alt-text'] = d['title'] = title % d
00589         d['i18ntitle'] = self.request.getText(d['title'])
00590         img_src = self.make_icon(icon, d)
00591         rev = d['rev']
00592         if rev and which in ['raw', 'print', ]:
00593             qs['rev'] = str(rev)
00594         attrs = {'rel': 'nofollow', 'title': d['i18ntitle'], }
00595         page = d[pagekey]
00596         if isinstance(page, unicode):
00597             # e.g. d['page_parent_page'] is just the unicode pagename
00598             # while d['page'] will give a page object
00599             page = Page(self.request, page)
00600         return page.link_to_raw(self.request, text=img_src, querystr=qs, **attrs)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.maxPagenameLength (   self) [inherited]
Return maximum length for shortened page names 

Definition at line 443 of file __init__.py.

00443 
00444     def maxPagenameLength(self):
00445         """ Return maximum length for shortened page names """
00446         return 25

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.msg (   self,
  d 
) [inherited]
Assemble the msg display

Display a message with a widget or simple strings with a clear message link.

@param d: parameter dictionary
@rtype: unicode
@return: msg display html

Definition at line 601 of file __init__.py.

00601 
00602     def msg(self, d):
00603         """ Assemble the msg display
00604 
00605         Display a message with a widget or simple strings with a clear message link.
00606 
00607         @param d: parameter dictionary
00608         @rtype: unicode
00609         @return: msg display html
00610         """
00611         _ = self.request.getText
00612         msgs = d['msg']
00613 
00614         result = u""
00615         close = d['page'].link_to(self.request, text=_('Clear message'), css_class="clear-link")
00616         for msg, msg_class in msgs:
00617             try:
00618                 result += u'<p>%s</p>' % msg.render()
00619                 close = ''
00620             except AttributeError:
00621                 if msg and msg_class:
00622                     result += u'<p><div class="%s">%s</div></p>' % (msg_class, msg)
00623                 elif msg:
00624                     result += u'<p>%s</p>\n' % msg
00625         if result:
00626             html = result + close
00627             return u'<div id="message">\n%s\n</div>\n' % html
00628         else:
00629             return u''
00630 
00631         return u'<div id="message">\n%s\n</div>\n' % html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.navibar (   self,
  d 
) [inherited]
Assemble the navibar

@param d: parameter dictionary
@rtype: unicode
@return: navibar html

Definition at line 447 of file __init__.py.

00447 
00448     def navibar(self, d):
00449         """ Assemble the navibar
00450 
00451         @param d: parameter dictionary
00452         @rtype: unicode
00453         @return: navibar html
00454         """
00455         request = self.request
00456         found = {} # pages we found. prevent duplicates
00457         items = [] # navibar items
00458         item = u'<li class="%s">%s</li>'
00459         current = d['page_name']
00460 
00461         # Process config navi_bar
00462         if request.cfg.navi_bar:
00463             for text in request.cfg.navi_bar:
00464                 pagename, link = self.splitNavilink(text)
00465                 if pagename == current:
00466                     cls = 'wikilink current'
00467                 else:
00468                     cls = 'wikilink'
00469                 items.append(item % (cls, link))
00470                 found[pagename] = 1
00471 
00472         # Add user links to wiki links, eliminating duplicates.
00473         userlinks = request.user.getQuickLinks()
00474         for text in userlinks:
00475             # Split text without localization, user knows what he wants
00476             pagename, link = self.splitNavilink(text, localize=0)
00477             if not pagename in found:
00478                 if pagename == current:
00479                     cls = 'userlink current'
00480                 else:
00481                     cls = 'userlink'
00482                 items.append(item % (cls, link))
00483                 found[pagename] = 1
00484 
00485         # Add current page at end of local pages
00486         if not current in found:
00487             title = d['page'].split_title()
00488             title = self.shortenPagename(title)
00489             link = d['page'].link_to(request, title)
00490             cls = 'current'
00491             items.append(item % (cls, link))
00492 
00493         # Add sister pages.
00494         for sistername, sisterurl in request.cfg.sistersites:
00495             if sistername == request.cfg.interwikiname: # it is THIS wiki
00496                 cls = 'sisterwiki current'
00497                 items.append(item % (cls, sistername))
00498             else:
00499                 # TODO optimize performance
00500                 cache = caching.CacheEntry(request, 'sisters', sistername, 'farm', use_pickle=True)
00501                 if cache.exists():
00502                     data = cache.content()
00503                     sisterpages = data['sisterpages']
00504                     if current in sisterpages:
00505                         cls = 'sisterwiki'
00506                         url = sisterpages[current]
00507                         link = request.formatter.url(1, url) + \
00508                                request.formatter.text(sistername) +\
00509                                request.formatter.url(0)
00510                         items.append(item % (cls, link))
00511 
00512         # Assemble html
00513         items = u''.join(items)
00514         html = u'''
00515 <ul id="navibar">
00516 %s
00517 </ul>
00518 ''' % items
00519         return html

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.pageinfo (   self,
  page 
) [inherited]
Return html fragment with page meta data

Since page information uses translated text, it uses the ui
language and direction. It looks strange sometimes, but
translated text using page direction looks worse.

@param page: current page
@rtype: unicode
@return: page last edit information

Definition at line 747 of file __init__.py.

00747 
00748     def pageinfo(self, page):
00749         """ Return html fragment with page meta data
00750 
00751         Since page information uses translated text, it uses the ui
00752         language and direction. It looks strange sometimes, but
00753         translated text using page direction looks worse.
00754 
00755         @param page: current page
00756         @rtype: unicode
00757         @return: page last edit information
00758         """
00759         _ = self.request.getText
00760         html = ''
00761         if self.shouldShowPageinfo(page):
00762             info = page.lastEditInfo()
00763             if info:
00764                 if info['editor']:
00765                     info = _("last edited %(time)s by %(editor)s") % info
00766                 else:
00767                     info = _("last modified %(time)s") % info
00768                 pagename = page.page_name
00769                 if self.request.cfg.show_interwiki:
00770                     pagename = "%s: %s" % (self.request.cfg.interwikiname, pagename)
00771                 info = "%s  (%s)" % (wikiutil.escape(pagename), info)
00772                 html = '<p id="pageinfo" class="info"%(lang)s>%(info)s</p>\n' % {
00773                     'lang': self.ui_lang_attr(),
00774                     'info': info
00775                     }
00776         return html

Here is the call graph for this function:

Here is the caller graph for this function:

Create page panel 

Definition at line 29 of file rightsidebar.py.

00029 
00030     def pagepanel(self, d):
00031         """ Create page panel """
00032         _ = self.request.getText
00033         if self.shouldShowEditbar(d['page']):
00034             html = [
00035                 u'<div class="sidepanel">',
00036                 u'<h1>%s</h1>' % _("Page"),
00037                 self.editbar(d),
00038                 u'</div>',
00039                 ]
00040             return u'\n'.join(html)
00041         return ''

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.quicklinkLink (   self,
  page 
) [inherited]
Return add/remove quicklink link

@rtype: unicode
@return: link to add or remove a quicklink

Definition at line 1338 of file __init__.py.

01338 
01339     def quicklinkLink(self, page):
01340         """ Return add/remove quicklink link
01341 
01342         @rtype: unicode
01343         @return: link to add or remove a quicklink
01344         """
01345         if not self.request.user.valid:
01346             return ''
01347 
01348         _ = self.request.getText
01349         if self.request.user.isQuickLinkedTo([page.page_name]):
01350             action, text = 'quickunlink', _("Remove Link")
01351         else:
01352             action, text = 'quicklink', _("Add Link")
01353         if action in self.request.cfg.actions_excluded:
01354             return ""
01355         return page.link_to(self.request, text=text, querystr={'action': action}, css_class='nbquicklink', rel='nofollow')

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.recentchanges_daybreak (   self,
  d 
) [inherited]
Assemble a rc daybreak indication (table row)

@param d: parameter dictionary
@rtype: string
@return: recentchanges daybreak html

Definition at line 1458 of file __init__.py.

01458 
01459     def recentchanges_daybreak(self, d):
01460         """
01461         Assemble a rc daybreak indication (table row)
01462 
01463         @param d: parameter dictionary
01464         @rtype: string
01465         @return: recentchanges daybreak html
01466         """
01467         if d['bookmark_link_html']:
01468             set_bm = '&nbsp; %(bookmark_link_html)s' % d
01469         else:
01470             set_bm = ''
01471         return ('<tr class="rcdaybreak"><td colspan="%d">'
01472                 '<strong>%s</strong>'
01473                 '%s'
01474                 '</td></tr>\n') % (6, d['date'], set_bm)

def MoinMoin.theme.ThemeBase.recentchanges_entry (   self,
  d 
) [inherited]
Assemble a single recentchanges entry (table row)

@param d: parameter dictionary
@rtype: string
@return: recentchanges entry html

Definition at line 1413 of file __init__.py.

01413 
01414     def recentchanges_entry(self, d):
01415         """
01416         Assemble a single recentchanges entry (table row)
01417 
01418         @param d: parameter dictionary
01419         @rtype: string
01420         @return: recentchanges entry html
01421         """
01422         _ = self.request.getText
01423         html = []
01424         html.append('<tr>\n')
01425 
01426         html.append('<td class="rcicon1">%(icon_html)s</td>\n' % d)
01427 
01428         html.append('<td class="rcpagelink">%(pagelink_html)s</td>\n' % d)
01429 
01430         html.append('<td class="rctime">')
01431         if d['time_html']:
01432             html.append("%(time_html)s" % d)
01433         html.append('</td>\n')
01434 
01435         html.append('<td class="rcicon2">%(info_html)s</td>\n' % d)
01436 
01437         html.append('<td class="rceditor">')
01438         if d['editors']:
01439             html.append('<br>'.join(d['editors']))
01440         html.append('</td>\n')
01441 
01442         html.append('<td class="rccomment">')
01443         if d['comments']:
01444             if d['changecount'] > 1:
01445                 notfirst = 0
01446                 for comment in d['comments']:
01447                     html.append('%s<tt>#%02d</tt>&nbsp;%s' % (
01448                         notfirst and '<br>' or '', comment[0], comment[1]))
01449                     notfirst = 1
01450             else:
01451                 comment = d['comments'][0]
01452                 html.append('%s' % comment[1])
01453         html.append('</td>\n')
01454 
01455         html.append('</tr>\n')
01456 
01457         return ''.join(html)

def MoinMoin.theme.ThemeBase.recentchanges_footer (   self,
  d 
) [inherited]
Assemble the recentchanges footer (close table)

@param d: parameter dictionary
@rtype: string
@return: recentchanges footer html

Definition at line 1522 of file __init__.py.

01522 
01523     def recentchanges_footer(self, d):
01524         """
01525         Assemble the recentchanges footer (close table)
01526 
01527         @param d: parameter dictionary
01528         @rtype: string
01529         @return: recentchanges footer html
01530         """
01531         _ = self.request.getText
01532         html = ''
01533         html += '</table>\n'
01534         if d['rc_msg']:
01535             html += "<br>%(rc_msg)s\n" % d
01536         html += '</div>\n'
01537         return html

def MoinMoin.theme.ThemeBase.recentchanges_header (   self,
  d 
) [inherited]
Assemble the recentchanges header (intro + open table)

@param d: parameter dictionary
@rtype: string
@return: recentchanges header html

Definition at line 1475 of file __init__.py.

01475 
01476     def recentchanges_header(self, d):
01477         """
01478         Assemble the recentchanges header (intro + open table)
01479 
01480         @param d: parameter dictionary
01481         @rtype: string
01482         @return: recentchanges header html
01483         """
01484         _ = self.request.getText
01485 
01486         # Should use user interface language and direction
01487         html = '<div class="recentchanges"%s>\n' % self.ui_lang_attr()
01488         html += '<div>\n'
01489         page = d['page']
01490         if self.shouldUseRSS(page):
01491             link = [
01492                 u'<div class="rcrss">',
01493                 self.request.formatter.url(1, self.rsshref(page)),
01494                 self.request.formatter.rawHTML(self.make_icon("rss")),
01495                 self.request.formatter.url(0),
01496                 u'</div>',
01497                 ]
01498             html += ''.join(link)
01499         html += '<p>'
01500         # Add day selector
01501         if d['rc_days']:
01502             days = []
01503             for day in d['rc_days']:
01504                 if day == d['rc_max_days']:
01505                     days.append('<strong>%d</strong>' % day)
01506                 else:
01507                     days.append(
01508                         wikiutil.link_tag(self.request,
01509                             '%s?max_days=%d' % (d['q_page_name'], day),
01510                             str(day),
01511                             self.request.formatter, rel='nofollow'))
01512             days = ' | '.join(days)
01513             html += (_("Show %s days.") % (days, ))
01514 
01515         if d['rc_update_bookmark']:
01516             html += " %(rc_update_bookmark)s %(rc_curr_bookmark)s" % d
01517 
01518         html += '</p>\n</div>\n'
01519 
01520         html += '<table>\n'
01521         return html

Here is the call graph for this function:

def MoinMoin.theme.ThemeBase.rsshref (   self,
  page 
) [inherited]
Create rss href, used for rss button and head link

@rtype: unicode
@return: rss href

Definition at line 872 of file __init__.py.

00872 
00873     def rsshref(self, page):
00874         """ Create rss href, used for rss button and head link
00875 
00876         @rtype: unicode
00877         @return: rss href
00878         """
00879         request = self.request
00880         url = page.url(request, querystr={
00881                 'action': 'rss_rc', 'ddiffs': '1', 'unique': '1', }, escape=0)
00882         return url

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.rsslink (   self,
  d 
) [inherited]
Create rss link in head, used by FireFox

RSS link for FireFox. This shows an rss link in the bottom of
the page and let you subscribe to the wiki rss feed.

@rtype: unicode
@return: html head

Definition at line 883 of file __init__.py.

00883 
00884     def rsslink(self, d):
00885         """ Create rss link in head, used by FireFox
00886 
00887         RSS link for FireFox. This shows an rss link in the bottom of
00888         the page and let you subscribe to the wiki rss feed.
00889 
00890         @rtype: unicode
00891         @return: html head
00892         """
00893         link = u''
00894         page = d['page']
00895         if self.shouldUseRSS(page):
00896             link = (u'<link rel="alternate" title="%s Recent Changes" '
00897                     u'href="%s" type="application/rss+xml">') % (
00898                         wikiutil.escape(self.cfg.sitename, True),
00899                         wikiutil.escape(self.rsshref(page), True) )
00900         return link

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.searchform (   self,
  d 
) [inherited]
assemble HTML code for the search forms

@param d: parameter dictionary
@rtype: unicode
@return: search form html

Definition at line 777 of file __init__.py.

00777 
00778     def searchform(self, d):
00779         """
00780         assemble HTML code for the search forms
00781 
00782         @param d: parameter dictionary
00783         @rtype: unicode
00784         @return: search form html
00785         """
00786         _ = self.request.getText
00787         form = self.request.values
00788         updates = {
00789             'search_label': _('Search:'),
00790             'search_value': wikiutil.escape(form.get('value', ''), 1),
00791             'search_full_label': _('Text'),
00792             'search_title_label': _('Titles'),
00793             'url': self.request.href(d['page'].page_name)
00794             }
00795         d.update(updates)
00796 
00797         html = u'''
00798 <form id="searchform" method="get" action="%(url)s">
00799 <div>
00800 <input type="hidden" name="action" value="fullsearch">
00801 <input type="hidden" name="context" value="180">
00802 <label for="searchinput">%(search_label)s</label>
00803 <input id="searchinput" type="text" name="value" value="%(search_value)s" size="20"
00804     onfocus="searchFocus(this)" onblur="searchBlur(this)"
00805     onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search">
00806 <input id="titlesearch" name="titlesearch" type="submit"
00807     value="%(search_title_label)s" alt="Search Titles">
00808 <input id="fullsearch" name="fullsearch" type="submit"
00809     value="%(search_full_label)s" alt="Search Full Text">
00810 </div>
00811 </form>
00812 <script type="text/javascript">
00813 <!--// Initialize search form
00814 var f = document.getElementById('searchform');
00815 f.getElementsByTagName('label')[0].style.display = 'none';
00816 var e = document.getElementById('searchinput');
00817 searchChange(e);
00818 searchBlur(e);
00819 //-->
00820 </script>
00821 ''' % d
00822         return html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.send_closing_html (   self) [inherited]
generate timing info html and closing html tag,
    everyone calling send_title must call this at the end to close
    the body and html tags.

Definition at line 1840 of file __init__.py.

01840 
01841     def send_closing_html(self):
01842         """ generate timing info html and closing html tag,
01843             everyone calling send_title must call this at the end to close
01844             the body and html tags.
01845         """
01846         request = self.request
01847 
01848         # as this is the last chance to emit some html, we stop the clocks:
01849         request.clock.stop('run')
01850         request.clock.stop('total')
01851 
01852         # Close html code
01853         if request.cfg.show_timings and request.action != 'print':
01854             request.write('<ul id="timings">\n')
01855             for t in request.clock.dump():
01856                 request.write('<li>%s</li>\n' % t)
01857             request.write('</ul>\n')
01858         #request.write('<!-- auth_method == %s -->' % repr(request.user.auth_method))
01859         request.write('</body>\n</html>\n\n')

def MoinMoin.theme.ThemeBase.send_footer (   self,
  pagename,
  keywords 
) [inherited]
Output the page footer.

@param pagename: WikiName of the page
@keyword print_mode: true, when page is displayed in Print mode

Definition at line 1822 of file __init__.py.

01822 
01823     def send_footer(self, pagename, **keywords):
01824         """
01825         Output the page footer.
01826 
01827         @param pagename: WikiName of the page
01828         @keyword print_mode: true, when page is displayed in Print mode
01829         """
01830         request = self.request
01831         d = request.themedict
01832 
01833         # Emit end of page in print mode, or complete footer in standard mode
01834         if keywords.get('print_mode', 0):
01835             request.write(self.pageinfo(d['page']))
01836             request.write(self.endPage())
01837         else:
01838             request.write(self.footer(d, **keywords))

Here is the call graph for this function:

def MoinMoin.theme.ThemeBase.send_title (   self,
  text,
  keywords 
) [inherited]
Output the page header (and title).

@param text: the title text
@keyword page: the page instance that called us - using this is more efficient than using pagename..
@keyword pagename: 'PageName'
@keyword print_mode: 1 (or 0)
@keyword editor_mode: 1 (or 0)
@keyword media: css media type, defaults to 'screen'
@keyword allow_doubleclick: 1 (or 0)
@keyword html_head: additional <head> code
@keyword body_attr: additional <body> attributes
@keyword body_onload: additional "onload" JavaScript code

Definition at line 1577 of file __init__.py.

01577 
01578     def send_title(self, text, **keywords):
01579         """
01580         Output the page header (and title).
01581 
01582         @param text: the title text
01583         @keyword page: the page instance that called us - using this is more efficient than using pagename..
01584         @keyword pagename: 'PageName'
01585         @keyword print_mode: 1 (or 0)
01586         @keyword editor_mode: 1 (or 0)
01587         @keyword media: css media type, defaults to 'screen'
01588         @keyword allow_doubleclick: 1 (or 0)
01589         @keyword html_head: additional <head> code
01590         @keyword body_attr: additional <body> attributes
01591         @keyword body_onload: additional "onload" JavaScript code
01592         """
01593         request = self.request
01594         _ = request.getText
01595         rev = request.rev
01596 
01597         if keywords.has_key('page'):
01598             page = keywords['page']
01599             pagename = page.page_name
01600         else:
01601             pagename = keywords.get('pagename', '')
01602             page = Page(request, pagename)
01603         if keywords.get('msg', ''):
01604             raise DeprecationWarning("Using send_page(msg=) is deprecated! Use theme.add_msg() instead!")
01605         scriptname = request.script_root
01606 
01607         # get name of system pages
01608         page_front_page = wikiutil.getFrontPage(request).page_name
01609         page_help_contents = wikiutil.getLocalizedPage(request, 'HelpContents').page_name
01610         page_title_index = wikiutil.getLocalizedPage(request, 'TitleIndex').page_name
01611         page_site_navigation = wikiutil.getLocalizedPage(request, 'SiteNavigation').page_name
01612         page_word_index = wikiutil.getLocalizedPage(request, 'WordIndex').page_name
01613         page_help_formatting = wikiutil.getLocalizedPage(request, 'HelpOnFormatting').page_name
01614         page_find_page = wikiutil.getLocalizedPage(request, 'FindPage').page_name
01615         home_page = wikiutil.getInterwikiHomePage(request) # sorry theme API change!!! Either None or tuple (wikiname,pagename) now.
01616         page_parent_page = getattr(page.getParentPage(), 'page_name', None)
01617 
01618         # Prepare the HTML <head> element
01619         user_head = [request.cfg.html_head]
01620 
01621         # include charset information - needed for moin_dump or any other case
01622         # when reading the html without a web server
01623         user_head.append('''<meta http-equiv="Content-Type" content="%s;charset=%s">\n''' % (page.output_mimetype, page.output_charset))
01624 
01625         meta_keywords = request.getPragma('keywords')
01626         meta_desc = request.getPragma('description')
01627         if meta_keywords:
01628             user_head.append('<meta name="keywords" content="%s">\n' % wikiutil.escape(meta_keywords, 1))
01629         if meta_desc:
01630             user_head.append('<meta name="description" content="%s">\n' % wikiutil.escape(meta_desc, 1))
01631 
01632         # search engine precautions / optimization:
01633         # if it is an action or edit/search, send query headers (noindex,nofollow):
01634         if request.query_string:
01635             user_head.append(request.cfg.html_head_queries)
01636         elif request.method == 'POST':
01637             user_head.append(request.cfg.html_head_posts)
01638         # we don't want to have BadContent stuff indexed:
01639         elif pagename in ['BadContent', 'LocalBadContent', ]:
01640             user_head.append(request.cfg.html_head_posts)
01641         # if it is a special page, index it and follow the links - we do it
01642         # for the original, English pages as well as for (the possibly
01643         # modified) frontpage:
01644         elif pagename in [page_front_page, request.cfg.page_front_page,
01645                           page_title_index, 'TitleIndex',
01646                           page_find_page, 'FindPage',
01647                           page_site_navigation, 'SiteNavigation',
01648                           'RecentChanges', ]:
01649             user_head.append(request.cfg.html_head_index)
01650         # if it is a normal page, index it, but do not follow the links, because
01651         # there are a lot of illegal links (like actions) or duplicates:
01652         else:
01653             user_head.append(request.cfg.html_head_normal)
01654 
01655         if 'pi_refresh' in keywords and keywords['pi_refresh']:
01656             user_head.append('<meta http-equiv="refresh" content="%d;URL=%s">' % keywords['pi_refresh'])
01657 
01658         # output buffering increases latency but increases throughput as well
01659         output = []
01660         # later: <html xmlns=\"http://www.w3.org/1999/xhtml\">
01661         output.append("""\
01662 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
01663 <html>
01664 <head>
01665 %s
01666 %s
01667 %s
01668 """ % (
01669             ''.join(user_head),
01670             self.html_head({
01671                 'page': page,
01672                 'title': text,
01673                 'sitename': request.cfg.html_pagetitle or request.cfg.sitename,
01674                 'print_mode': keywords.get('print_mode', False),
01675                 'media': keywords.get('media', 'screen'),
01676             }),
01677             keywords.get('html_head', ''),
01678         ))
01679 
01680         # Links
01681         output.append('<link rel="Start" href="%s">\n' % request.href(page_front_page))
01682         if pagename:
01683             output.append('<link rel="Alternate" title="%s" href="%s">\n' % (
01684                     _('Wiki Markup'), request.href(pagename, action='raw')))
01685             output.append('<link rel="Alternate" media="print" title="%s" href="%s">\n' % (
01686                     _('Print View'), request.href(pagename, action='print')))
01687 
01688             # !!! currently disabled due to Mozilla link prefetching, see
01689             # http://www.mozilla.org/projects/netlib/Link_Prefetching_FAQ.html
01690             #~ all_pages = request.getPageList()
01691             #~ if all_pages:
01692             #~     try:
01693             #~         pos = all_pages.index(pagename)
01694             #~     except ValueError:
01695             #~         # this shopuld never happend in theory, but let's be sure
01696             #~         pass
01697             #~     else:
01698             #~         request.write('<link rel="First" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[0]))
01699             #~         if pos > 0:
01700             #~             request.write('<link rel="Previous" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[pos-1])))
01701             #~         if pos+1 < len(all_pages):
01702             #~             request.write('<link rel="Next" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[pos+1])))
01703             #~         request.write('<link rel="Last" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[-1])))
01704 
01705             if page_parent_page:
01706                 output.append('<link rel="Up" href="%s">\n' % request.href(page_parent_page))
01707 
01708         # write buffer because we call AttachFile
01709         request.write(''.join(output))
01710         output = []
01711 
01712         # XXX maybe this should be removed completely. moin emits all attachments as <link rel="Appendix" ...>
01713         # and it is at least questionable if this fits into the original intent of rel="Appendix".
01714         if pagename and request.user.may.read(pagename):
01715             from MoinMoin.action import AttachFile
01716             AttachFile.send_link_rel(request, pagename)
01717 
01718         output.extend([
01719             '<link rel="Search" href="%s">\n' % request.href(page_find_page),
01720             '<link rel="Index" href="%s">\n' % request.href(page_title_index),
01721             '<link rel="Glossary" href="%s">\n' % request.href(page_word_index),
01722             '<link rel="Help" href="%s">\n' % request.href(page_help_formatting),
01723                       ])
01724 
01725         output.append("</head>\n")
01726         request.write(''.join(output))
01727         output = []
01728 
01729         # start the <body>
01730         bodyattr = []
01731         if keywords.has_key('body_attr'):
01732             bodyattr.append(' ')
01733             bodyattr.append(keywords['body_attr'])
01734 
01735         # Add doubleclick edit action
01736         if (pagename and keywords.get('allow_doubleclick', 0) and
01737             not keywords.get('print_mode', 0) and
01738             request.user.edit_on_doubleclick):
01739             if request.user.may.write(pagename): # separating this gains speed
01740                 url = page.url(request, {'action': 'edit'})
01741                 bodyattr.append(''' ondblclick="location.href='%s'" ''' % wikiutil.escape(url, True))
01742 
01743         # Set body to the user interface language and direction
01744         bodyattr.append(' %s' % self.ui_lang_attr())
01745 
01746         body_onload = keywords.get('body_onload', '')
01747         if body_onload:
01748             bodyattr.append(''' onload="%s"''' % body_onload)
01749         output.append('\n<body%s>\n' % ''.join(bodyattr))
01750 
01751         # Output -----------------------------------------------------------
01752 
01753         # If in print mode, start page div and emit the title
01754         if keywords.get('print_mode', 0):
01755             d = {
01756                 'title_text': text,
01757                 'page': page,
01758                 'page_name': pagename or '',
01759                 'rev': rev,
01760             }
01761             request.themedict = d
01762             output.append(self.startPage())
01763             output.append(self.interwiki(d))
01764             output.append(self.title(d))
01765 
01766         # In standard mode, emit theme.header
01767         else:
01768             exists = pagename and page.exists(includeDeleted=True)
01769             # prepare dict for theme code:
01770             d = {
01771                 'theme': self.name,
01772                 'script_name': scriptname,
01773                 'title_text': text,
01774                 'logo_string': request.cfg.logo_string,
01775                 'site_name': request.cfg.sitename,
01776                 'page': page,
01777                 'rev': rev,
01778                 'pagesize': pagename and page.size() or 0,
01779                 # exists checked to avoid creation of empty edit-log for non-existing pages
01780                 'last_edit_info': exists and page.lastEditInfo() or '',
01781                 'page_name': pagename or '',
01782                 'page_find_page': page_find_page,
01783                 'page_front_page': page_front_page,
01784                 'home_page': home_page,
01785                 'page_help_contents': page_help_contents,
01786                 'page_help_formatting': page_help_formatting,
01787                 'page_parent_page': page_parent_page,
01788                 'page_title_index': page_title_index,
01789                 'page_word_index': page_word_index,
01790                 'user_name': request.user.name,
01791                 'user_valid': request.user.valid,
01792                 'msg': self._status,
01793                 'trail': keywords.get('trail', None),
01794                 # Discontinued keys, keep for a while for 3rd party theme developers
01795                 'titlesearch': 'use self.searchform(d)',
01796                 'textsearch': 'use self.searchform(d)',
01797                 'navibar': ['use self.navibar(d)'],
01798                 'available_actions': ['use self.request.availableActions(page)'],
01799             }
01800 
01801             # add quoted versions of pagenames
01802             newdict = {}
01803             for key in d:
01804                 if key.startswith('page_'):
01805                     if not d[key] is None:
01806                         newdict['q_'+key] = wikiutil.quoteWikinameURL(d[key])
01807                     else:
01808                         newdict['q_'+key] = None
01809             d.update(newdict)
01810             request.themedict = d
01811 
01812             # now call the theming code to do the rendering
01813             if keywords.get('editor_mode', 0):
01814                 output.append(self.editorheader(d))
01815             else:
01816                 output.append(self.header(d))
01817 
01818         # emit it
01819         request.write(''.join(output))
01820         output = []
01821         self._send_title_called = True

Here is the call graph for this function:

def MoinMoin.theme.ThemeBase.shortenPagename (   self,
  name 
) [inherited]
Shorten page names

Shorten very long page names that tend to break the user
interface. The short name is usually fine, unless really stupid
long names are used (WYGIWYD).

If you don't like to do this in your theme, or want to use
different algorithm, override this method.

@param name: page name, unicode
@rtype: unicode
@return: shortened version.

Definition at line 419 of file __init__.py.

00419 
00420     def shortenPagename(self, name):
00421         """ Shorten page names
00422 
00423         Shorten very long page names that tend to break the user
00424         interface. The short name is usually fine, unless really stupid
00425         long names are used (WYGIWYD).
00426 
00427         If you don't like to do this in your theme, or want to use
00428         different algorithm, override this method.
00429 
00430         @param name: page name, unicode
00431         @rtype: unicode
00432         @return: shortened version.
00433         """
00434         maxLength = self.maxPagenameLength()
00435         # First use only the sub page name, that might be enough
00436         if len(name) > maxLength:
00437             name = name.split('/')[-1]
00438             # If it's not enough, replace the middle with '...'
00439             if len(name) > maxLength:
00440                 half, left = divmod(maxLength - 3, 2)
00441                 name = u'%s...%s' % (name[:half + left], name[-half:])
00442         return name

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.shouldShowEditbar (   self,
  page 
) [inherited]
Should we show the editbar?

Actions should implement this, because only the action knows if
the edit bar makes sense. Until it goes into actions, we do the
checking here.

@param page: current page
@rtype: bool
@return: true if editbar should show

Definition at line 1153 of file __init__.py.

01153 
01154     def shouldShowEditbar(self, page):
01155         """ Should we show the editbar?
01156 
01157         Actions should implement this, because only the action knows if
01158         the edit bar makes sense. Until it goes into actions, we do the
01159         checking here.
01160 
01161         @param page: current page
01162         @rtype: bool
01163         @return: true if editbar should show
01164         """
01165         # Show editbar only for existing pages, including deleted pages,
01166         # that the user may read. If you may not read, you can't edit,
01167         # so you don't need editbar.
01168         if (page.exists(includeDeleted=1) and
01169             self.request.user.may.read(page.page_name)):
01170             form = self.request.form
01171             action = self.request.action
01172             # Do not show editbar on edit but on save/cancel
01173             return not (action == 'edit' and
01174                         not form.has_key('button_save') and
01175                         not form.has_key('button_cancel'))
01176         return False

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.shouldShowPageinfo (   self,
  page 
) [inherited]
Should we show page info?

Should be implemented by actions. For now, we check here by action
name and page.

@param page: current page
@rtype: bool
@return: true if should show page info

Definition at line 727 of file __init__.py.

00727 
00728     def shouldShowPageinfo(self, page):
00729         """ Should we show page info?
00730 
00731         Should be implemented by actions. For now, we check here by action
00732         name and page.
00733 
00734         @param page: current page
00735         @rtype: bool
00736         @return: true if should show page info
00737         """
00738         if page.exists() and self.request.user.may.read(page.page_name):
00739             # These  actions show the  page content.
00740             # TODO: on new action, page info will not show.
00741             # A better solution will be if the action itself answer the question: showPageInfo().
00742             contentActions = [u'', u'show', u'refresh', u'preview', u'diff',
00743                               u'subscribe', u'RenamePage', u'CopyPage', u'DeletePage',
00744                               u'SpellCheck', u'print']
00745             return self.request.action in contentActions
00746         return False

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.shouldUseRSS (   self,
  page 
) [inherited]
Return True if RSS feature is available and we are on the
    RecentChanges page, or False.

    Currently rss is broken on plain Python, and works only when
    installing PyXML. Return true if PyXML is installed.

Definition at line 860 of file __init__.py.

00860 
00861     def shouldUseRSS(self, page):
00862         """ Return True if RSS feature is available and we are on the
00863             RecentChanges page, or False.
00864 
00865             Currently rss is broken on plain Python, and works only when
00866             installing PyXML. Return true if PyXML is installed.
00867         """
00868         if not rss_supported:
00869             return False
00870         return page.page_name == u'RecentChanges' or \
00871            page.page_name == self.request.getText(u'RecentChanges')

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.showBothEditLinks (   self) [inherited]
Return True if both edit links should be displayed 

Definition at line 1272 of file __init__.py.

01272 
01273     def showBothEditLinks(self):
01274         """ Return True if both edit links should be displayed """
01275         editor = self.request.user.editor_ui
01276         if editor == '<default>':
01277             editor = self.request.cfg.editor_ui
01278         return editor == 'freechoice'

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.showversion (   self,
  d,
  keywords 
) [inherited]
assemble HTML code for copyright and version display

@param d: parameter dictionary
@rtype: string
@return: copyright and version display html

Definition at line 823 of file __init__.py.

00823 
00824     def showversion(self, d, **keywords):
00825         """
00826         assemble HTML code for copyright and version display
00827 
00828         @param d: parameter dictionary
00829         @rtype: string
00830         @return: copyright and version display html
00831         """
00832         html = ''
00833         if self.cfg.show_version and not keywords.get('print_mode', 0):
00834             html = (u'<div id="version">MoinMoin Release %s [Revision %s], '
00835                      'Copyright by Juergen Hermann et al.</div>') % (version.release, version.revision, )
00836         return html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.sidebar (   self,
  d,
  keywords 
) [inherited]
Display page called SideBar as an additional element on every page

@param d: parameter dictionary
@rtype: string
@return: sidebar html

Definition at line 1860 of file __init__.py.

01860 
01861     def sidebar(self, d, **keywords):
01862         """ Display page called SideBar as an additional element on every page
01863 
01864         @param d: parameter dictionary
01865         @rtype: string
01866         @return: sidebar html
01867         """
01868 
01869         # Check which page to display, return nothing if doesn't exist.
01870         sidebar = self.request.getPragma('sidebar', u'SideBar')
01871         page = Page(self.request, sidebar)
01872         if not page.exists():
01873             return u""
01874         # Capture the page's generated HTML in a buffer.
01875         buffer = StringIO.StringIO()
01876         self.request.redirect(buffer)
01877         try:
01878             page.send_page(content_only=1, content_id="sidebar")
01879         finally:
01880             self.request.redirect()
01881         return u'<div class="sidebar">%s</div>' % buffer.getvalue()
01882 

def MoinMoin.theme.ThemeBase.splitNavilink (   self,
  text,
  localize = 1 
) [inherited]
Split navibar links into pagename, link to page

Admin or user might want to use shorter navibar items by using
the [[page|title]] or [[url|title]] syntax. In this case, we don't
use localization, and the links goes to page or to the url, not
the localized version of page.

Supported syntax:
    * PageName
    * WikiName:PageName
    * wiki:WikiName:PageName
    * url
    * all targets as seen above with title: [[target|title]]

@param text: the text used in config or user preferences
@rtype: tuple
@return: pagename or url, link to page or url

Definition at line 339 of file __init__.py.

00339 
00340     def splitNavilink(self, text, localize=1):
00341         """ Split navibar links into pagename, link to page
00342 
00343         Admin or user might want to use shorter navibar items by using
00344         the [[page|title]] or [[url|title]] syntax. In this case, we don't
00345         use localization, and the links goes to page or to the url, not
00346         the localized version of page.
00347 
00348         Supported syntax:
00349             * PageName
00350             * WikiName:PageName
00351             * wiki:WikiName:PageName
00352             * url
00353             * all targets as seen above with title: [[target|title]]
00354 
00355         @param text: the text used in config or user preferences
00356         @rtype: tuple
00357         @return: pagename or url, link to page or url
00358         """
00359         request = self.request
00360         fmt = request.formatter
00361         title = None
00362 
00363         # Handle [[pagename|title]] or [[url|title]] formats
00364         if text.startswith('[[') and text.endswith(']]'):
00365             text = text[2:-2]
00366             try:
00367                 pagename, title = text.split('|', 1)
00368                 pagename = pagename.strip()
00369                 title = title.strip()
00370                 localize = 0
00371             except (ValueError, TypeError):
00372                 # Just use the text as is.
00373                 pagename = text.strip()
00374         else:
00375             pagename = text
00376 
00377         if wikiutil.is_URL(pagename):
00378             if not title:
00379                 title = pagename
00380             link = fmt.url(1, pagename) + fmt.text(title) + fmt.url(0)
00381             return pagename, link
00382 
00383         # remove wiki: url prefix
00384         if pagename.startswith("wiki:"):
00385             pagename = pagename[5:]
00386 
00387         # try handling interwiki links
00388         try:
00389             interwiki, page = wikiutil.split_interwiki(pagename)
00390             thiswiki = request.cfg.interwikiname
00391             if interwiki == thiswiki or interwiki == 'Self':
00392                 pagename = page
00393             else:
00394                 if not title:
00395                     title = page
00396                 link = fmt.interwikilink(True, interwiki, page) + fmt.text(title) + fmt.interwikilink(False, interwiki, page)
00397                 return pagename, link
00398         except ValueError:
00399             pass
00400 
00401         # Handle regular pagename like "FrontPage"
00402         pagename = wikiutil.normalize_pagename(pagename, request.cfg)
00403 
00404         # Use localized pages for the current user
00405         if localize:
00406             page = wikiutil.getLocalizedPage(request, pagename)
00407         else:
00408             page = Page(request, pagename)
00409 
00410         pagename = page.page_name # can be different, due to i18n
00411 
00412         if not title:
00413             title = page.split_title()
00414             title = self.shortenPagename(title)
00415 
00416         link = page.link_to(request, title)
00417 
00418         return pagename, link

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.startPage (   self) [inherited]
Start page div with page language and direction

@rtype: unicode
@return: page div with language and direction attribtues

Definition at line 1366 of file __init__.py.

01366 
01367     def startPage(self):
01368         """ Start page div with page language and direction
01369 
01370         @rtype: unicode
01371         @return: page div with language and direction attribtues
01372         """
01373         return u'<div id="page"%s>\n' % self.content_lang_attr()

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.subscribeLink (   self,
  page 
) [inherited]
Return subscribe/unsubscribe link to valid users

@rtype: unicode
@return: subscribe or unsubscribe link

Definition at line 1320 of file __init__.py.

01320 
01321     def subscribeLink(self, page):
01322         """ Return subscribe/unsubscribe link to valid users
01323 
01324         @rtype: unicode
01325         @return: subscribe or unsubscribe link
01326         """
01327         if not ((self.cfg.mail_enabled or self.cfg.jabber_enabled) and self.request.user.valid):
01328             return ''
01329 
01330         _ = self.request.getText
01331         if self.request.user.isSubscribedTo([page.page_name]):
01332             action, text = 'unsubscribe', _("Unsubscribe")
01333         else:
01334             action, text = 'subscribe', _("Subscribe")
01335         if action in self.request.cfg.actions_excluded:
01336             return ""
01337         return page.link_to(self.request, text=text, querystr={'action': action}, css_class='nbsubscribe', rel='nofollow')

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.supplementation_page_nameLink (   self,
  page 
) [inherited]
Return a link to the discussion page

   If the discussion page doesn't exist and the user
   has no right to create it, show a disabled link.

Definition at line 1209 of file __init__.py.

01209 
01210     def supplementation_page_nameLink(self, page):
01211         """Return a link to the discussion page
01212 
01213            If the discussion page doesn't exist and the user
01214            has no right to create it, show a disabled link.
01215         """
01216         _ = self.request.getText
01217         suppl_name = self.request.cfg.supplementation_page_name
01218         suppl_name_full = "%s/%s" % (page.page_name, suppl_name)
01219 
01220         test = Page(self.request, suppl_name_full)
01221         if not test.exists() and not self.request.user.may.write(suppl_name_full):
01222             return ('<span class="disabled">%s</span>' % _(suppl_name))
01223         else:
01224             return page.link_to(self.request, text=_(suppl_name),
01225                                 querystr={'action': 'supplementation'}, css_class='nbsupplementation', rel='nofollow')

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.title (   self,
  d 
) [inherited]
Assemble the title (now using breadcrumbs)

@param d: parameter dictionary
@rtype: string
@return: title html

Definition at line 222 of file __init__.py.

00222 
00223     def title(self, d):
00224         """ Assemble the title (now using breadcrumbs)
00225 
00226         @param d: parameter dictionary
00227         @rtype: string
00228         @return: title html
00229         """
00230         _ = self.request.getText
00231         content = []
00232         if d['title_text'] == d['page'].split_title(): # just showing a page, no action
00233             curpage = ''
00234             segments = d['page_name'].split('/') # was: title_text
00235             for s in segments[:-1]:
00236                 curpage += s
00237                 content.append("<li>%s</li>" % Page(self.request, curpage).link_to(self.request, s))
00238                 curpage += '/'
00239             link_text = segments[-1]
00240             link_title = _('Click to do a full-text search for this title')
00241             link_query = {
00242                 'action': 'fullsearch',
00243                 'value': 'linkto:"%s"' % d['page_name'],
00244                 'context': '180',
00245             }
00246             # we dont use d['title_link'] any more, but make it ourselves:
00247             link = d['page'].link_to(self.request, link_text, querystr=link_query, title=link_title, css_class='backlink', rel='nofollow')
00248             content.append(('<li>%s</li>') % link)
00249         else:
00250             content.append('<li>%s</li>' % wikiutil.escape(d['title_text']))
00251 
00252         html = '''
00253 <ul id="pagelocation">
00254 %s
00255 </ul>
00256 ''' % "".join(content)
00257         return html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.title_with_separators (   self,
  d 
) [inherited]
Assemble the title using slashes, not <ul>

@param d: parameter dictionary
@rtype: string
@return: title html

Definition at line 258 of file __init__.py.

00258 
00259     def title_with_separators(self, d):
00260         """ Assemble the title using slashes, not <ul>
00261 
00262         @param d: parameter dictionary
00263         @rtype: string
00264         @return: title html
00265         """
00266         _ = self.request.getText
00267         if d['title_text'] == d['page'].split_title():
00268             # just showing a page, no action
00269             segments = d['page_name'].split('/')
00270             link_text = segments[-1]
00271             link_title = _('Click to do a full-text search for this title')
00272             link_query = {'action': 'fullsearch', 'context': '180',
00273                           'value': 'linkto:"%s"' % d['page_name'], }
00274             link = d['page'].link_to(self.request, link_text,
00275                                      querystr=link_query, title=link_title,
00276                                      css_class='backlink', rel='nofollow')
00277             if len(segments) <= 1:
00278                 html = link
00279             else:
00280                 content = []
00281                 curpage = ''
00282                 for s in segments[:-1]:
00283                     curpage += s
00284                     content.append(Page(self.request,
00285                                         curpage).link_to(self.request, s))
00286                     curpage += '/'
00287                 path_html = u'<span class="sep">/</span>'.join(content)
00288                 html = u'<span class="pagepath">%s</span><span class="sep">/</span>%s' % (path_html, link)
00289         else:
00290             html = wikiutil.escape(d['title_text'])
00291         return u'<span id="pagelocation">%s</span>' % html

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.trail (   self,
  d 
) [inherited]
Assemble page trail

@param d: parameter dictionary
@rtype: unicode
@return: trail html

Reimplemented in MoinMoin.theme.modernized.Theme.

Definition at line 632 of file __init__.py.

00632 
00633     def trail(self, d):
00634         """ Assemble page trail
00635 
00636         @param d: parameter dictionary
00637         @rtype: unicode
00638         @return: trail html
00639         """
00640         request = self.request
00641         user = request.user
00642         html = ''
00643         if not user.valid or user.show_page_trail:
00644             trail = user.getTrail()
00645             if trail:
00646                 items = []
00647                 for pagename in trail:
00648                     try:
00649                         interwiki, page = wikiutil.split_interwiki(pagename)
00650                         if interwiki != request.cfg.interwikiname and interwiki != 'Self':
00651                             link = (self.request.formatter.interwikilink(True, interwiki, page) +
00652                                     self.shortenPagename(page) +
00653                                     self.request.formatter.interwikilink(False, interwiki, page))
00654                             items.append('<li>%s</li>' % link)
00655                             continue
00656                         else:
00657                             pagename = page
00658 
00659                     except ValueError:
00660                         pass
00661                     page = Page(request, pagename)
00662                     title = page.split_title()
00663                     title = self.shortenPagename(title)
00664                     link = page.link_to(request, title)
00665                     items.append('<li>%s</li>' % link)
00666                 html = '''
00667 <ul id="pagetrail">
00668 %s
00669 </ul>''' % ''.join(items)
00670         return html

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.ui_lang_attr (   self) [inherited]
Generate language attributes for user interface elements

User interface elements use the user language (if any), kept in
request.lang.

@rtype: string
@return: lang and dir html attributes

Definition at line 1540 of file __init__.py.

01540 
01541     def ui_lang_attr(self):
01542         """Generate language attributes for user interface elements
01543 
01544         User interface elements use the user language (if any), kept in
01545         request.lang.
01546 
01547         @rtype: string
01548         @return: lang and dir html attributes
01549         """
01550         lang = self.request.lang
01551         return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang))

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.universal_edit_button (   self,
  d,
  keywords 
) [inherited]
Generate HTML for an edit link in the header.

Definition at line 927 of file __init__.py.

00927 
00928     def universal_edit_button(self, d, **keywords):
00929         """ Generate HTML for an edit link in the header."""
00930         page = d['page']
00931         if 'edit' in self.request.cfg.actions_excluded:
00932             return ""
00933         if not (page.isWritable() and
00934                 self.request.user.may.write(page.page_name)):
00935             return ""
00936         _ = self.request.getText
00937         querystr = {'action': 'edit'}
00938         text = _(u'Edit')
00939         url = page.url(self.request, querystr=querystr, escape=0)
00940         return (u'<link rel="alternate" type="application/wiki" '
00941                 u'title="%s" href="%s">' % (text, url))

Here is the caller graph for this function:

def MoinMoin.theme.ThemeBase.username (   self,
  d 
) [inherited]
Assemble the username / userprefs link

@param d: parameter dictionary
@rtype: unicode
@return: username html

Reimplemented in MoinMoin.theme.modernized.Theme.

Definition at line 292 of file __init__.py.

00292 
00293     def username(self, d):
00294         """ Assemble the username / userprefs link
00295 
00296         @param d: parameter dictionary
00297         @rtype: unicode
00298         @return: username html
00299         """
00300         request = self.request
00301         _ = request.getText
00302 
00303         userlinks = []
00304         # Add username/homepage link for registered users. We don't care
00305         # if it exists, the user can create it.
00306         if request.user.valid and request.user.name:
00307             interwiki = wikiutil.getInterwikiHomePage(request)
00308             name = request.user.name
00309             aliasname = request.user.aliasname
00310             if not aliasname:
00311                 aliasname = name
00312             title = "%s @ %s" % (aliasname, interwiki[0])
00313             # link to (interwiki) user homepage
00314             homelink = (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki) +
00315                         request.formatter.text(name) +
00316                         request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
00317             userlinks.append(homelink)
00318             # link to userprefs action
00319             if 'userprefs' not in self.request.cfg.actions_excluded:
00320                 userlinks.append(d['page'].link_to(request, text=_('Settings'),
00321                                                querystr={'action': 'userprefs'}, id='userprefs', rel='nofollow'))
00322 
00323         if request.user.valid:
00324             if request.user.auth_method in request.cfg.auth_can_logout:
00325                 userlinks.append(d['page'].link_to(request, text=_('Logout'),
00326                                                    querystr={'action': 'logout', 'logout': 'logout'}, id='logout', rel='nofollow'))
00327         else:
00328             query = {'action': 'login'}
00329             # special direct-login link if the auth methods want no input
00330             if request.cfg.auth_login_inputs == ['special_no_input']:
00331                 query['login'] = '1'
00332             if request.cfg.auth_have_login:
00333                 userlinks.append(d['page'].link_to(request, text=_("Login"),
00334                                                    querystr=query, id='login', rel='nofollow'))
00335 
00336         userlinks = [u'<li>%s</li>' % link for link in userlinks]
00337         html = u'<ul id="username">%s</ul>' % ''.join(userlinks)
00338         return html

Here is the caller graph for this function:

Create user panel 

Definition at line 42 of file rightsidebar.py.

00042 
00043     def userpanel(self, d):
00044         """ Create user panel """
00045         _ = self.request.getText
00046 
00047         html = [
00048             u'<div class="sidepanel">',
00049             u'<h1>%s</h1>' % _("User"),
00050             self.username(d),
00051             u'</div>'
00052             ]
00053         return u'\n'.join(html)

Here is the call graph for this function:

Here is the caller graph for this function:

Create wiki panel 

Definition at line 18 of file rightsidebar.py.

00018 
00019     def wikipanel(self, d):
00020         """ Create wiki panel """
00021         _ = self.request.getText
00022         html = [
00023             u'<div class="sidepanel">',
00024             u'<h1>%s</h1>' % _("Wiki"),
00025             self.navibar(d),
00026             u'</div>',
00027             ]
00028         return u'\n'.join(html)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 161 of file __init__.py.

Definition at line 1396 of file __init__.py.

dictionary MoinMoin.theme.ThemeBase.icons [static, inherited]

Reimplemented in MoinMoin.theme.modernized.Theme.

Definition at line 39 of file __init__.py.

string MoinMoin.theme.rightsidebar.Theme.name = "rightsidebar" [static]

Reimplemented from MoinMoin.theme.ThemeBase.

Definition at line 16 of file rightsidebar.py.

Definition at line 160 of file __init__.py.

tuple MoinMoin.theme.ThemeBase.stylesheets [static, inherited]
Initial value:
(
        # media         basename
        ('all',         'common'),
        ('screen',      'screen'),
        ('print',       'print'),
        ('projection',  'projection'),
        )

Definition at line 130 of file __init__.py.

tuple MoinMoin.theme.ThemeBase.stylesheets_print [static, inherited]
Initial value:
(
        # media         basename
        ('all',         'common'),
        ('all',         'print'),
        )

Definition at line 139 of file __init__.py.

Initial value:
(
        # media         basename
        ('all',         'common'),
        ('all',         'projection'),
       )

Definition at line 146 of file __init__.py.

string MoinMoin.theme.ThemeBase.stylesheetsCharset = 'utf-8' [static, inherited]

Definition at line 152 of file __init__.py.


The documentation for this class was generated from the following file: