changeset 3470:e69146342ed8

action.diff: respects revert right for showing revert button
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 05 Apr 2008 10:52:26 +0200
parents 94a6f5fbf8b7
children a98d9f52813e
files MoinMoin/action/diff.py
diffstat 1 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/diff.py	Fri Apr 04 23:48:41 2008 +0200
+++ b/MoinMoin/action/diff.py	Sat Apr 05 10:52:26 2008 +0200
@@ -122,6 +122,20 @@
 
     page_url = wikiutil.escape(currentpage.url(request), True)
 
+    revert_html = ""
+    if request.user.may.revert(pagename):
+        revert_html = """
+ <td style="border:0">
+  <span style="text-align:center">
+   <form action="%s" method="get">
+    <input name="action" value="revert" type="hidden">
+    <input name="rev" value="%d" type="hidden">
+    <input value="%s" type="submit"%s>
+   </form>
+  </span>
+ </td>
+ """ % (page_url, rev2, _("Revert to this revision"), u'')
+
     navigation_html = """
 <span class="diff-header">%s</span>
 <table class="diff">
@@ -136,15 +150,7 @@
    </form>
   </span>
  </td>
- <td style="border:0">
-  <span style="text-align:center">
-   <form action="%s" method="get">
-    <input name="action" value="revert" type="hidden">
-    <input name="rev" value="%d" type="hidden">
-    <input value="%s" type="submit"%s>
-   </form>
-  </span>
- </td>
+ %s
  <td style="border:0">
   <span style="text-align:right">
    <form action="%s" method="get">
@@ -159,7 +165,7 @@
 </table>
 """ % (title,
        page_url, oldrev - 1, oldrev, _("Previous change"), disable_prev,
-       page_url, rev2, _("Revert to this revision"), u'',
+       revert_html,
        page_url, newrev, newrev + 1, _("Next change"), disable_next, )
 
     request.write(f.rawHTML(navigation_html))