changeset 3723:7d77145af210

ThemeBase: add a <link> in the <header> for the editor
author Radomir Dopieralski <moindev@sheep.art.pl>
date Thu, 19 Jun 2008 00:24:54 +0200
parents 0259bd2d0777
children f42b05d07650
files MoinMoin/theme/__init__.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/theme/__init__.py	Wed Jun 18 18:22:50 2008 +0200
+++ b/MoinMoin/theme/__init__.py	Thu Jun 19 00:24:54 2008 +0200
@@ -870,6 +870,7 @@
             self.guiEditorScript(d),
             self.html_stylesheets(d),
             self.rsslink(d),
+            self.universal_edit_button(d),
             ]
         return '\n'.join(html)
 
@@ -878,6 +879,21 @@
         src = '%s/common/js/%s.js' % (self.request.cfg.url_prefix_static, name)
         return '<script type="text/javascript" src="%s"></script>' % src
 
+    def universal_edit_button(self, d, **keywords):
+        """ Generate HTML for an edit link in the header."""
+        page = d['page']
+        if 'edit' in self.request.cfg.actions_excluded:
+            return ""
+        if not (page.isWritable() and
+                self.request.user.may.write(page.page_name)):
+            return ""
+        _ = self.request.getText
+        querystr = {'action': 'edit'}
+        text = _(u'Edit')
+        url = page.url(self.request, querystr=querystr, escape=0)
+        return (u'<link rel="alternate" type="application/wiki" '
+                u'title="%s" href="%s" />' % (text, url))
+
     def credits(self, d, **keywords):
         """ Create credits html from credits list """
         if isinstance(self.cfg.page_credits, (list, tuple)):