# HG changeset patch
# User ReimarBauer <R.Bauer@fz-juelich.de>
# Node ID c1916929014c18db2ea3ede433f6fbc48d67a5f5
# Parent  b3665210e63e6dd6a4d8f719edbf5631b150dbc0
added the possibility of a configurable discussion page and the german localisation too. editbar_excluded = ['Discussion']  is default

diff -r b3665210e63e -r c1916929014c MoinMoin/config/multiconfig.py
--- a/MoinMoin/config/multiconfig.py	Mon Aug 28 00:28:52 2006 +0200
+++ b/MoinMoin/config/multiconfig.py	Mon Aug 28 01:35:34 2006 +0200
@@ -235,6 +235,8 @@ class DefaultConfig:
 
     default_markup = 'wiki'
     docbook_html_dir = r"/usr/share/xml/docbook/stylesheet/nwalsh/html/" # correct for debian sarge
+
+    editbar_excluded = ['Discussion'] # shows editbar without Discussion link
 
     editor_default = 'text' # which editor is called when nothing is specified
     editor_ui = 'freechoice' # which editor links are shown on user interface
diff -r b3665210e63e -r c1916929014c MoinMoin/i18n/de.MoinMoin.po
--- a/MoinMoin/i18n/de.MoinMoin.po	Mon Aug 28 00:28:52 2006 +0200
+++ b/MoinMoin/i18n/de.MoinMoin.po	Mon Aug 28 01:35:34 2006 +0200
@@ -1935,6 +1935,11 @@ msgstr "%(hits)d Treffer in ungefähr %(
 #, python-format
 msgid "%.2f seconds"
 msgstr "%.2f Sekunden"
+
+msgid "Discussion"
+msgstr "Diskussion"
+
+
 
 #~ msgid "Required attribute \"%(attrname)s\" missing"
 #~ msgstr "Erforderliches Attribut \"%(attrname)s\" fehlt"
diff -r b3665210e63e -r c1916929014c MoinMoin/i18n/en.MoinMoin.po
--- a/MoinMoin/i18n/en.MoinMoin.po	Mon Aug 28 00:28:52 2006 +0200
+++ b/MoinMoin/i18n/en.MoinMoin.po	Mon Aug 28 01:35:34 2006 +0200
@@ -1748,5 +1748,8 @@ msgid "Mail sent OK"
 msgid "Mail sent OK"
 msgstr ""
 
+msgid "Discussion"
+msgstr ""
+
 #~ msgid "Attach File"
 #~ msgstr "Attachments"
diff -r b3665210e63e -r c1916929014c MoinMoin/theme/__init__.py
--- a/MoinMoin/theme/__init__.py	Mon Aug 28 00:28:52 2006 +0200
+++ b/MoinMoin/theme/__init__.py	Mon Aug 28 01:35:34 2006 +0200
@@ -1027,13 +1027,19 @@ actionsMenuInit('%(label)s');
         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),
+                        'Info': self.infoLink(page),
+                        'Subscribe': self.subscribeLink(page),
+                        'Quicklink': self.quicklinkLink(page),
+                        'Attachments': self.attachmentsLink(page),
+                        'Discussion': self.discussionLink(page),
+                        'actions Menu': self.actionsMenu(page)}
+        editbar_keys_ordered = ['Edit', 'Info', 'Subscribe', 'Quicklink', 'Attachments', 'Discussion', 'actions Menu']
+        allowed_action = []
+        for action in editbar_keys_ordered:
+            if action not in self.request.cfg.editbar_excluded:
+                allowed_action.append(editbar_items[action])
+        return allowed_action
 
     def guiworks(self, page):
         """ Return whether the gui editor / converter can work for that page.
@@ -1118,6 +1124,13 @@ var gui_editor_link_text = "%(text)s";
         return page.link_to(self.request,
                             text=_('Info', formatted=False),
                             querystr={'action': 'info'}, id='info', rel='nofollow')
+
+    def discussionLink(self, page):
+        """  discussion for page """
+        _ = self.request.getText
+        return page.link_to(self.request,
+                            text=_('Discussion', formatted=False),
+                            querystr={'action': 'discussion'}, id='discussion', rel='nofollow')
 
     def subscribeLink(self, page):
         """ Return subscribe/unsubscribe link to valid users
diff -r b3665210e63e -r c1916929014c MoinMoin/action/discussion.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/action/discussion.py	Mon Aug 28 01:35:34 2006 +0200
@@ -0,0 +1,48 @@
+"""
+    MoinMoin - Action for Discussion pages
+
+    This Action is used to create a subpage Discussion below a comon page
+
+    Install:
+        put it into the 'action' directory and do create a DiscussionTemplate
+        
+    Note:
+        derived from the newpage macro by Vito Miliano (vito_moinnewpagewithtemplate@perilith.com) et al
+
+    Modification History:
+       2006-08-25 ReimarBauer initial version
+                   
+    License:
+        @license: GNU GPL, see COPYING for details.  
+        
+"""
+from MoinMoin.Page import Page
+
+
+def execute(pagename, request):
+
+    _ = request.getText
+
+    if pagename.find(_('Discussion')) != -1:
+        redir = pagename.split('/')
+        redir = '/'.join(redir[0:-1])
+        query = {'action': 'edit', 'backto': redir}
+        url = Page(request, pagename).url(request, query, escape=0, relative=False)
+        request.http_redirect(url)
+
+    newpagename = "%s/%s" % (pagename, _('Discussion'))
+
+    if request.user.may.read(newpagename) and request.user.may.write(newpagename):
+        query = {'action': 'edit', 'backto': pagename}
+
+        from MoinMoin.wikiutil import quoteWikinameURL
+        query['template'] = quoteWikinameURL('DiscussionTemplate')
+
+        url = Page(request, newpagename).url(request, query, escape=0, relative=False)
+        request.http_redirect(url)
+
+    else:
+        page = Page(request, pagename)
+        error = _('you don''t have access to the discussion page')
+        page.send_page(request, msg=error)
+        return ' '