1.1 --- a/themes/minimalmoin/minimalmoin.py Sun Jan 31 02:45:07 2010 +0100
1.2 +++ b/themes/minimalmoin/minimalmoin.py Sun Jan 31 22:43:09 2010 +0100
1.3 @@ -109,6 +109,7 @@
1.4
1.5 html.append(self.title(d))
1.6 html.append(self.about(d))
1.7 + html.append(self.mainpages(d))
1.8
1.9 html.append(fmt.div(on=0))
1.10
1.11 @@ -140,6 +141,7 @@
1.12 request = self.request
1.13 fmt = request.formatter
1.14 _ = request.getText
1.15 + page = d["page"]
1.16 html = []
1.17
1.18 # NOTE: Some pages cause section numbers to be enabled, affecting the
1.19 @@ -156,32 +158,10 @@
1.20
1.21 html.append(fmt.div(on=1, attr={"id" : "footer"}))
1.22
1.23 - html.append(fmt.div(on=1, attr={"class" : "editing"}))
1.24 - html.append(fmt.span(on=1, attr={"class" : "menutitleholder"}))
1.25 - html.append(fmt.span(on=1, attr={"class" : "menutitle"}))
1.26 - html.append(fmt.text(_("Editing options")))
1.27 - html.append(fmt.span(on=0))
1.28 - html.append(self.editbar(d))
1.29 - html.append(fmt.span(on=0))
1.30 - html.append(fmt.div(on=0))
1.31 -
1.32 - html.append(fmt.div(on=1, attr={"id" : "navigation"}))
1.33 - html.append(fmt.span(on=1, attr={"class" : "menutitleholder"}))
1.34 - html.append(fmt.span(on=1, attr={"class" : "menutitle"}))
1.35 - html.append(fmt.text(_("Useful pages")))
1.36 - html.append(fmt.span(on=0))
1.37 - html.append(self.navibar(d))
1.38 - html.append(fmt.span(on=0))
1.39 - html.append(fmt.div(on=0))
1.40 -
1.41 - html.append(fmt.div(on=1, attr={"id" : "identity"}))
1.42 - html.append(fmt.span(on=1, attr={"class" : "menutitleholder"}))
1.43 - html.append(fmt.span(on=1, attr={"class" : "menutitle"}))
1.44 - html.append(fmt.text(_("User information")))
1.45 - html.append(fmt.span(on=0))
1.46 - html.append(self.username(d))
1.47 - html.append(fmt.span(on=0))
1.48 - html.append(fmt.div(on=0))
1.49 + if self.shouldShowEditbar(page):
1.50 + html.append(self.menuholder(d, {"class" : "editing"}, _("Editing options"), self.editbar))
1.51 + html.append(self.menuholder(d, {"id" : "navigation"}, _("Useful pages"), self.navibar))
1.52 + html.append(self.menuholder(d, {"id" : "identity"}, _("User information"), self.username))
1.53
1.54 #html.append(self.trail(d))
1.55
1.56 @@ -194,6 +174,29 @@
1.57
1.58 return u''.join(html)
1.59
1.60 + def mainpages(self, d, **kw):
1.61 + """ Link to the front page and potentially other pages.
1.62 +
1.63 + @param d: parameter dictionary
1.64 + @rtype: unicode
1.65 + @return: front page link html
1.66 + """
1.67 +
1.68 + request = self.request
1.69 + fmt = request.formatter
1.70 + _ = request.getText
1.71 + html = []
1.72 +
1.73 + page = wikiutil.getFrontPage(self.request)
1.74 +
1.75 + html.append(fmt.bullet_list(on=1, attr={"id" : "mainpages"}))
1.76 + html.append(fmt.listitem(on=1))
1.77 + html.append(page.link_to(request, text=_("Front page"), rel='nofollow'))
1.78 + html.append(fmt.listitem(on=0))
1.79 + html.append(fmt.bullet_list(on=0))
1.80 +
1.81 + return u''.join(html)
1.82 +
1.83 def about(self, d, **kw):
1.84 """ Link to the controls in the footer.
1.85
1.86 @@ -219,6 +222,32 @@
1.87
1.88 return u''.join(html)
1.89
1.90 + def menuholder(self, d, menu_attr, menu_title, menu_fn):
1.91 + """ Wrap controls in a menu container.
1.92 +
1.93 + @param d: parameter dictionary
1.94 + @param menu_attr: menu container element attributes
1.95 + @param menu_title: the menu label text
1.96 + @param menu_fn: the function or method producing the controls
1.97 + @rtype: unicode
1.98 + @return: menu container html
1.99 + """
1.100 +
1.101 + request = self.request
1.102 + fmt = request.formatter
1.103 + html = []
1.104 +
1.105 + html.append(fmt.div(on=1, attr=menu_attr))
1.106 + html.append(fmt.span(on=1, attr={"class" : "menutitleholder"}))
1.107 + html.append(fmt.span(on=1, attr={"class" : "menutitle"}))
1.108 + html.append(fmt.text(menu_title))
1.109 + html.append(fmt.span(on=0))
1.110 + html.append(menu_fn(d))
1.111 + html.append(fmt.span(on=0))
1.112 + html.append(fmt.div(on=0))
1.113 +
1.114 + return u''.join(html)
1.115 +
1.116 # Theme instantiation.
1.117
1.118 def execute(request):