changeset 1684:aadc8b0e11cf

change classic theme to propagate rev, too
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 20 Nov 2006 00:15:24 +0100
parents 964fa7d0de32
children 8078e7b39a2b
files MoinMoin/config/multiconfig.py MoinMoin/theme/__init__.py MoinMoin/theme/classic.py
diffstat 3 files changed, 27 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Sun Nov 19 22:38:41 2006 +0100
+++ b/MoinMoin/config/multiconfig.py	Mon Nov 20 00:15:24 2006 +0100
@@ -350,23 +350,20 @@
     # These icons will show in this order in the iconbar, unless they
     # are not relevant, e.g email icon when the wiki is not configured
     # for email.
-    page_iconbar = ["up", "edit", "view", "diff", "info", "subscribe", "raw", "print", ]
+    page_iconbar = ["edit", "view", "diff", "info", "subscribe", "raw", "print", ]
 
     # Standard buttons in the iconbar
     page_icons_table = {
-        # key           last part of url, title, icon-key
-        'help':        ("%(q_page_help_contents)s", "%(page_help_contents)s", "help"),
-        'find':        ("%(q_page_find_page)s?value=%(q_page_name)s", "%(page_find_page)s", "find"),
-        'diff':        ("%(q_page_name)s?action=diff", _("Diffs"), "diff"),
-        'info':        ("%(q_page_name)s?action=info", _("Info"), "info"),
-        'edit':        ("%(q_page_name)s?action=edit", _("Edit"), "edit"),
-        'unsubscribe': ("%(q_page_name)s?action=subscribe", _("UnSubscribe"), "unsubscribe"),
-        'subscribe':   ("%(q_page_name)s?action=subscribe", _("Subscribe"), "subscribe"),
-        'raw':         ("%(q_page_name)s?action=raw", _("Raw"), "raw"),
-        'xml':         ("%(q_page_name)s?action=show&amp;mimetype=text/xml", _("XML"), "xml"),
-        'print':       ("%(q_page_name)s?action=print", _("Print"), "print"),
-        'view':        ("%(q_page_name)s", _("View"), "view"),
-        'up':          ("%(q_page_parent_page)s", _("Up"), "up"),
+        # key           querystr dict, title, icon-key
+        'diff':        ({'action': 'diff'}, _("Diffs"), "diff"),
+        'info':        ({'action': 'info'}, _("Info"), "info"),
+        'edit':        ({'action': 'edit'}, _("Edit"), "edit"),
+        'unsubscribe': ({'action': 'subscribe'}, _("UnSubscribe"), "unsubscribe"),
+        'subscribe':   ({'action': 'subscribe'}, _("Subscribe"), "subscribe"),
+        'raw':         ({'action': 'raw'}, _("Raw"), "raw"),
+        'xml':         ({'action': 'show', 'mimetype': 'text/xml'}, _("XML"), "xml"),
+        'print':       ({'action': 'print'}, _("Print"), "print"),
+        'view':        ({}, _("View"), "view"),
         }
 
     refresh = None # (minimum_delay, type), e.g.: (2, 'internal')
--- a/MoinMoin/theme/__init__.py	Sun Nov 19 22:38:41 2006 +0100
+++ b/MoinMoin/theme/__init__.py	Mon Nov 20 00:15:24 2006 +0100
@@ -514,11 +514,16 @@
         @rtype: string
         @return: html link tag
         """
-        page_params, title, icon = self.cfg.page_icons_table[which]
+        querystr, title, icon = self.cfg.page_icons_table[which]
         d['title'] = title % d
         d['i18ntitle'] = self.request.getText(d['title'], formatted=False)
         img_src = self.make_icon(icon, d)
-        return wikiutil.link_tag(self.request, page_params % d, img_src, title="%(i18ntitle)s" % d)
+        rev = d['rev']
+        if rev and which in ['raw', 'print', ]:
+            querystr['rev'] = str(rev)
+        attrs = {'rel': 'nofollow', 'title': d['i18ntitle'], }
+        page = d['page']
+        return page.link_to_raw(self.request, text=img_src, querystr=querystr, **attrs)
 
     def msg(self, d):
         """ Assemble the msg display
@@ -1395,6 +1400,7 @@
         """
         request = self.request
         _ = request.getText
+        rev = request.rev
 
         if keywords.has_key('page'):
             page = keywords['page']
@@ -1560,6 +1566,7 @@
                 'title_text': text,
                 'page': page,
                 'page_name': pagename or '',
+                'rev': rev,
             }
             request.themedict = d
             output.append(self.startPage())
@@ -1576,6 +1583,7 @@
                 'logo_string': request.cfg.logo_string,
                 'site_name': request.cfg.sitename,
                 'page': page,
+                'rev': rev,
                 'pagesize': pagename and page.size() or 0,
                 'last_edit_info': pagename and page.lastEditInfo() or '',
                 'page_name': pagename or '',
--- a/MoinMoin/theme/classic.py	Sun Nov 19 22:38:41 2006 +0100
+++ b/MoinMoin/theme/classic.py	Mon Nov 20 00:15:24 2006 +0100
@@ -182,11 +182,12 @@
         """
         request = self.request
         _ = request.getText
+        rev = d['rev']
         html = []
         page = d['page']
         available = request.getAvailableActions(page)
         if available:
-            available = available.keys()
+            available = list(available)
             available.sort()
             for action in available:
                 # Always add spaces: AttachFile -> Attach File 
@@ -194,7 +195,10 @@
                 title = Page(request, action).split_title(request, force=1)
                 # Use translated version if available
                 title = _(title, formatted=False)
-                link = page.link_to(request, text=title, querystr={'action': action}, rel='nofollow')
+                querystr = {'action': action}
+                if rev:
+                    querystr['rev'] = str(rev)
+                link = page.link_to(request, text=title, querystr=querystr, rel='nofollow')
                 html.append(link)
 
         title = _("DeleteCache", formatted=False)