changeset 1233:79ac7ab77ea8

hit info bar for titlesearches, bugfix for getSearchResults
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Tue, 08 Aug 2006 15:50:05 +0200
parents 10099880cf8f
children e38e27967a97
files MoinMoin/search/results.py docs/CHANGES.fpletz wiki/htdocs/modern/css/common.css
diffstat 3 files changed, 33 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/results.py	Tue Aug 08 08:49:47 2006 +0200
+++ b/MoinMoin/search/results.py	Tue Aug 08 15:50:05 2006 +0200
@@ -345,6 +345,7 @@
                     self.formatTitle(page),
                     f.pagelink(0, page.page_name),
                     matchInfo,
+                    self.formatHitInfoBar(page),
                     f.listitem(0),
                     ]
                 write(''.join(item))
@@ -419,17 +420,7 @@
                     f.definition_desc(1),
                     fmt_context,
                     f.definition_desc(0),
-                    f.definition_desc(1, attr={'class': 'searchresinfobar'}),
-                    f.text('%.1fk - ' % (page.page.size()/1024.0)),
-                    f.text('rev: %d %s- ' % (page.page.get_real_rev(),
-                        not page.page.rev and '(%s) ' % _('current') or '')),
-                    f.text('last modified: %(time)s - ' % page.page.lastEditInfo()),
-                    # XXX: proper metadata
-                    #f.text('lang: %s - ' % page.page.language),
-                    f.url(1, href='#'),
-                    f.text(_('Similar pages')),
-                    f.url(0),
-                    f.definition_desc(0),
+                    self.formatHitInfoBar(page),
                     ]
                 write(''.join(item))
             write(f.definition_list(0))
@@ -747,6 +738,24 @@
             f.table(0),
         ])
 
+    def formatHitInfoBar(self, page):
+        f = self.formatter
+        _ = self.request.getText
+        return ''.join([
+            f.paragraph(1, attr={'class': 'searchhitinfobar'}),
+            f.text('%.1fk - ' % (page.page.size()/1024.0)),
+            f.text('rev: %d %s- ' % (page.page.get_real_rev(),
+                not page.page.rev and '(%s) ' % _('current') or '')),
+            f.text('last modified: %(time)s' % page.page.lastEditInfo()),
+            # XXX: proper metadata
+            #f.text('lang: %s - ' % page.page.language),
+            #f.url(1, href='#'),
+            #f.text(_('Similar pages')),
+            #f.url(0),
+            f.paragraph(0),
+        ])
+
+
     def querystring(self, querydict=None):
         """ Return query string, used in the page link """
         if querydict is None:
@@ -797,11 +806,13 @@
     for wikiname, page, attachment, match in hits:
         if wikiname in (request.cfg.interwikiname, 'Self'): # a local match
             if attachment:
-                result_hits.append(FoundAttachment(page.page_name, attachment))
+                result_hits.append(FoundAttachment(page.page_name,
+                    attachment, page=page))
             else:
-                result_hits.append(FoundPage(page.page_name, match))
+                result_hits.append(FoundPage(page.page_name, match, page))
         else:
-            result_hits.append(FoundRemote(wikiname, page, attachment, match))
+            result_hits.append(FoundRemote(wikiname, page.page_name,
+                attachment, match, page))
     elapsed = time.time() - start
     count = request.rootpage.getPageCount()
     return SearchResults(query, result_hits, count, elapsed)
--- a/docs/CHANGES.fpletz	Tue Aug 08 08:49:47 2006 +0200
+++ b/docs/CHANGES.fpletz	Tue Aug 08 15:50:05 2006 +0200
@@ -216,3 +216,8 @@
       we get proper moin gfx
     * index domains of a page (standard, underlay)
 
+2006-08-07
+     * info bar for titlesearches
+     * bugfix for results code: sometimes we never got a page instance
+       in Found{Page,Attachment,...} which yielded strange errors
+
--- a/wiki/htdocs/modern/css/common.css	Tue Aug 08 08:49:47 2006 +0200
+++ b/wiki/htdocs/modern/css/common.css	Tue Aug 08 15:50:05 2006 +0200
@@ -337,13 +337,14 @@
     font-weight: normal;
 }
 
-.searchresults dd {
+.searchresults dd, .searchresults p {
     font-size: 0.85em;
 }
 
-.searchresults dd.searchresinfobar {
+.searchresults .searchhitinfobar {
     color: #008000;
     margin-left: 15px;
+    margin-top: 0;
 }
 
 p.searchstats {