changeset 1747:b7e0a36a1219

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 18 Jan 2007 10:10:02 +0100
parents 1aa9dfd0ad34 (current diff) 58a70ba872d6 (diff)
children dc0db3897437
files MoinMoin/theme/__init__.py
diffstat 4 files changed, 24 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/PackagePages.py	Thu Jan 18 10:08:26 2007 +0100
+++ b/MoinMoin/action/PackagePages.py	Thu Jan 18 10:10:02 2007 +0100
@@ -113,7 +113,7 @@
             for attname in files:
                 if attname != packagename:
                     cnt += 1
-                    zipname = "%s_attachment" % str(cnt)
+                    zipname = "%d_attachment" % cnt
                     script.append(packLine(["AddAttachment", zipname, attname, page.page_name, user.getUserIdentification(self.request), "Created by the PackagePages action."]))
                     filename = AttachFile.getFilename(self.request, page.page_name, attname)
                     zf.write(filename.encode("cp437"), zipname)
--- a/MoinMoin/action/supplementation.py	Thu Jan 18 10:08:26 2007 +0100
+++ b/MoinMoin/action/supplementation.py	Thu Jan 18 10:10:02 2007 +0100
@@ -1,8 +1,6 @@
 # -*- coding: iso-8859-1 -*-
 """
-    MoinMoin - Action for supplementation pages
-
-    This Action is used to create a supplementation subpage e.g. a Discussion page below a comon page
+    MoinMoin -  This Action is used to create a supplementation subpage e.g. a Discussion page below a comon page
         
     Note:
     derived from the newpage macro by Vito Miliano (vito_moinnewpagewithtemplate@perilith.com) et al
@@ -30,7 +28,6 @@
         if test.exists(): # page is defined -> redirect
             request.http_redirect(url)
         else:  # page will be created from template
-            query = {'action': 'edit', 'backto': newpagename}
-            query['template'] = quoteWikinameURL(sub_page_template)
+            query = {'action': 'edit', 'backto': newpagename, 'template': quoteWikinameURL(sub_page_template)}
             url = Page(request, newpagename).url(request, query, escape=0, relative=False)
             request.http_redirect(url)
--- a/MoinMoin/config/multiconfig.py	Thu Jan 18 10:08:26 2007 +0100
+++ b/MoinMoin/config/multiconfig.py	Thu Jan 18 10:10:02 2007 +0100
@@ -235,6 +235,7 @@
     default_markup = 'wiki'
     docbook_html_dir = r"/usr/share/xml/docbook/stylesheet/nwalsh/html/" # correct for debian sarge
 
+    edit_bar = ['Edit', 'Discussion', 'Info', 'Subscribe', 'Quicklink', 'Attachments', 'ActionsMenu'] 
     editor_default = 'text' # which editor is called when nothing is specified
     editor_ui = 'freechoice' # which editor links are shown on user interface
     editor_force = False
--- a/MoinMoin/theme/__init__.py	Thu Jan 18 10:08:26 2007 +0100
+++ b/MoinMoin/theme/__init__.py	Thu Jan 18 10:10:02 2007 +0100
@@ -1053,33 +1053,26 @@
         This is separate method to make it easy to customize the
         edtibar in sub classes.
         """
-
-        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
+        editbar_actions = []
+        for editbar_item in self.request.cfg.edit_bar:
+             if editbar_item == 'Discussion':
+                 if not self.request.cfg.supplementation_page and self.request.getPragma('supplementation-page', 1) in ('on', '1'):
+                     editbar_actions.append(self.supplementation_page_nameLink(page))
+                 elif self.request.cfg.supplementation_page and not self.request.getPragma('supplementation-page', 1) in ('off', '0'):
+                     editbar_actions.append(self.supplementation_page_nameLink(page))
+             elif editbar_item == 'Edit':
+                  editbar_actions.append(self.editorLink(page))
+             elif editbar_item == 'Info':
+                  editbar_actions.append(self.infoLink(page))
+             elif editbar_item == 'Subscribe':
+                  editbar_actions.append(self.subscribeLink(page))
+             elif editbar_item == 'Quicklink':
+                  editbar_actions.append(self.quicklinkLink(page))
+             elif editbar_item == 'Attachments':
+                  editbar_actions.append(self.attachmentsLink(page))
+             elif editbar_item == 'ActionsMenu':
+                 editbar_actions.append(self.actionsMenu(page))
+        return editbar_actions
 
     def supplementation_page_nameLink(self, page):
         """  discussion for page """