changeset 1730:7487f00da9bc

theme/__init__.py: setup for a supplementation page in editbar_items
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 09 Jan 2007 21:46:06 +0100
parents fe83672bd165
children d4a424079d50
files MoinMoin/theme/__init__.py
diffstat 1 files changed, 34 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/theme/__init__.py	Tue Jan 09 21:18:37 2007 +0100
+++ b/MoinMoin/theme/__init__.py	Tue Jan 09 21:46:06 2007 +0100
@@ -1053,13 +1053,40 @@
         This is separate method to make it easy to customize the
         edtibar in sub classes.
         """
-        return [self.editorLink(page),
-                self.infoLink(page),
-                self.subscribeLink(page),
-                self.quicklinkLink(page),
-                self.attachmentsLink(page),
-                self.actionsMenu(page),
-               ]
+
+        editbar_items = {'Edit': self.editorLink(page),
+                          self.request.cfg.supplementation_page_name:
+                          self.supplementation_page_nameLink(page),
+                          'Info': self.infoLink(page),
+                          'Subscribe': self.subscribeLink(page),
+                          'Quicklink': self.quicklinkLink(page),
+                          'Attachments': self.attachmentsLink(page),
+                          'ActionsMenu': self.actionsMenu(page)
+                          }
+        edit_bar = [u'Edit', u'Info', u'Subscribe', u'Quicklink', u'Attachments', u'ActionsMenu', ]
+        if self.request.cfg.supplementation_page is True:
+            if self.request.getPragma('supplementation-page', 1) == 'off':
+                edit_bar = edit_bar
+            else:
+                edit_bar.insert(1, self.request.cfg.supplementation_page_name)
+        else:
+            if self.request.getPragma('supplementation-page', 1) == 'on':
+                edit_bar.insert(1, self.request.cfg.supplementation_page_name)
+            else:
+                edit_bar = edit_bar
+
+
+        allowed_action = []
+        for action in edit_bar:
+            allowed_action.append(editbar_items[action])
+        return allowed_action
+
+    def supplementation_page_nameLink(self, page):
+        """  discussion for page """
+        _ = self.request.getText
+        return page.link_to(self.request,
+                            text=_(self.request.cfg.supplementation_page_name, formatted=False),
+                            querystr={'action': 'supplementation'}, id='supplementation', rel='nofollow')
 
     def guiworks(self, page):
         """ Return whether the gui editor / converter can work for that page.