diff MoinMoin/theme/__init__.py @ 1354:26949e36ca0b

move code for title_link to theme, better escape warning
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 20 Aug 2006 19:08:49 +0200
parents b65614f8a393
children c3c8ff25e979
line wrap: on
line diff
--- a/MoinMoin/theme/__init__.py	Sun Aug 20 17:00:17 2006 +0200
+++ b/MoinMoin/theme/__init__.py	Sun Aug 20 19:08:49 2006 +0200
@@ -213,19 +213,23 @@
         """
         _ = self.request.getText
         content = []
-        if d['title_link']: # having a link means we have a (linked) pagename ONLY as title, not a message title
-                            # XXX this method is rather ugly and should be improved
+        if d['title_text'] == d['page_name']: # just showing a page, no action
             curpage = ''
             segments = d['page_name'].split('/') # was: title_text
             for s in segments[:-1]:
                 curpage += s
                 content.append("<li>%s</li>" % Page(self.request, curpage).link_to(self.request, s))
                 curpage += '/'
-            content.append(('<li><a class="backlink" title="%(title)s" rel="nofollow" href="%(href)s">%(text)s</a></li>') % {
-                'title': _('Click to do a full-text search for this title'),
-                'href': d['title_link'],
-                'text': wikiutil.escape(segments[-1]),
-                })
+            link_text = segments[-1]
+            link_title = _('Click to do a full-text search for this title')
+            link_query = {
+                'action': 'fullsearch',
+                'value': 'linkto:"%s"' % d['page_name'],
+                'context': '180',
+            }
+            # we dont use d['title_link'] any more, but make it ourselves:
+            link = d['page'].link_to(self.request, link_text, querystr=link_query, title=link_title, css_class='backlink', rel='nofollow')
+            content.append(('<li>%s</li>') % link)
         else:
             content.append('<li>%s</li>' % wikiutil.escape(d['title_text']))
 
@@ -1421,7 +1425,6 @@
         current page being rendered.
         
         @param text: the title text
-        @keyword link: URL for the title
         @keyword msg: additional message (after saving)
         @keyword pagename: 'PageName'
         @keyword page: the page instance that called us.
@@ -1596,7 +1599,7 @@
 
         # If in print mode, start page div and emit the title
         if keywords.get('print_mode', 0):
-            d = {'title_text': text, 'title_link': None, 'page': page, }
+            d = {'title_text': text, 'page': page, }
             request.themedict = d
             output.append(self.startPage())
             output.append(self.interwiki(d))
@@ -1609,7 +1612,6 @@
                 'theme': self.name,
                 'script_name': scriptname,
                 'title_text': text,
-                'title_link': keywords.get('link', ''),
                 'logo_string': request.cfg.logo_string,
                 'site_name': request.cfg.sitename,
                 'page': page,