Back to index

moin  1.9.0~rc2
rightsidebar.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - rightsidebar theme
00004 
00005     Created by and for crw.
00006     Later it was rewritten by Nir Soffer for MoinMoin release 1.3.
00007 
00008     @copyright: 2005 Nir Soffer
00009     @license: GNU GPL, see COPYING for details.
00010 """
00011 
00012 from MoinMoin.theme import ThemeBase
00013 
00014 class Theme(ThemeBase):
00015 
00016     name = "rightsidebar"
00017 
00018     def wikipanel(self, d):
00019         """ Create wiki panel """
00020         _ = self.request.getText
00021         html = [
00022             u'<div class="sidepanel">',
00023             u'<h1>%s</h1>' % _("Wiki"),
00024             self.navibar(d),
00025             u'</div>',
00026             ]
00027         return u'\n'.join(html)
00028 
00029     def pagepanel(self, d):
00030         """ Create page panel """
00031         _ = self.request.getText
00032         if self.shouldShowEditbar(d['page']):
00033             html = [
00034                 u'<div class="sidepanel">',
00035                 u'<h1>%s</h1>' % _("Page"),
00036                 self.editbar(d),
00037                 u'</div>',
00038                 ]
00039             return u'\n'.join(html)
00040         return ''
00041 
00042     def userpanel(self, d):
00043         """ Create user panel """
00044         _ = self.request.getText
00045 
00046         html = [
00047             u'<div class="sidepanel">',
00048             u'<h1>%s</h1>' % _("User"),
00049             self.username(d),
00050             u'</div>'
00051             ]
00052         return u'\n'.join(html)
00053 
00054     def header(self, d):
00055         """
00056         Assemble page header
00057 
00058         @param d: parameter dictionary
00059         @rtype: string
00060         @return: page header html
00061         """
00062         _ = self.request.getText
00063 
00064         html = [
00065             # Custom html above header
00066             self.emit_custom_html(self.cfg.page_header1),
00067 
00068             # Header
00069             u'<div id="header">',
00070             self.searchform(d),
00071             self.logo(),
00072             u'<div id="locationline">',
00073             self.interwiki(d),
00074             self.title(d),
00075             u'</div>',
00076             self.trail(d),
00077             u'</div>',
00078 
00079             # Custom html below header (not recomended!)
00080             self.emit_custom_html(self.cfg.page_header2),
00081 
00082             # Sidebar
00083             u'<div id="sidebar">',
00084             self.wikipanel(d),
00085             self.pagepanel(d),
00086             self.userpanel(d),
00087             u'</div>',
00088 
00089             self.msg(d),
00090 
00091             # Page
00092             self.startPage(),
00093             ]
00094         return u'\n'.join(html)
00095 
00096     def editorheader(self, d):
00097         """
00098         Assemble page header for editor
00099 
00100         @param d: parameter dictionary
00101         @rtype: string
00102         @return: page header html
00103         """
00104         _ = self.request.getText
00105 
00106         html = [
00107             # Custom html above header
00108             self.emit_custom_html(self.cfg.page_header1),
00109 
00110             # Header
00111             #u'<div id="header">',
00112             #self.searchform(d),
00113             #self.logo(),
00114             #u'</div>',
00115 
00116             # Custom html below header (not recomended!)
00117             self.emit_custom_html(self.cfg.page_header2),
00118 
00119             # Sidebar
00120             u'<div id="sidebar">',
00121             self.wikipanel(d),
00122             self.pagepanel(d),
00123             self.userpanel(d),
00124             u'</div>',
00125 
00126             self.msg(d),
00127 
00128             # Page
00129             self.startPage(),
00130             #self.title(d),
00131             ]
00132         return u'\n'.join(html)
00133 
00134     def footer(self, d, **keywords):
00135         """ Assemble wiki footer
00136 
00137         @param d: parameter dictionary
00138         @keyword ...:...
00139         @rtype: unicode
00140         @return: page footer html
00141         """
00142         page = d['page']
00143         html = [
00144             # End of page
00145             self.pageinfo(page),
00146             self.endPage(),
00147 
00148             # Pre footer custom html (not recommended!)
00149             self.emit_custom_html(self.cfg.page_footer1),
00150 
00151             # Footer
00152             u'<div id="footer">',
00153             self.credits(d),
00154             self.showversion(d, **keywords),
00155             u'</div>',
00156 
00157             # Post footer custom html
00158             self.emit_custom_html(self.cfg.page_footer2),
00159             ]
00160         return u'\n'.join(html)
00161 
00162 
00163 def execute(request):
00164     """ Generate and return a theme object
00165 
00166     @param request: the request object
00167     @rtype: MoinTheme
00168     @return: Theme object
00169     """
00170     return Theme(request)
00171