changeset 430:78a2962bf192

Fixed displaying results for multiple wikis(wiki farm) Fixes #15.
author Michael Mayorov <marchael@kb.csu.ru>
date Wed, 10 Aug 2011 20:12:05 +0000
parents e818c98d3790
children 6800ab9dd159
files MoinMoin/apps/frontend/views.py MoinMoin/templates/search_results.html wikiconfig.py
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Wed Aug 10 15:22:45 2011 +0000
+++ b/MoinMoin/apps/frontend/views.py	Wed Aug 10 20:12:05 2011 +0000
@@ -147,7 +147,7 @@
                                results=results,
                                query=query,
                                medium_search_form=search_form,
-                               item_name=item_name
+                               item_name=item_name,
                               )
 
 
--- a/MoinMoin/templates/search_results.html	Wed Aug 10 15:22:45 2011 +0000
+++ b/MoinMoin/templates/search_results.html	Wed Aug 10 20:12:05 2011 +0000
@@ -25,8 +25,12 @@
         <table>
             {% for result in results %}
             <tr>
-                <td class="moin-wordbreak">{{ result.pos + 1 }}.
-                <a href="{{ url_for_item(item_name=result['name'], wiki_name=result['wikiname'], rev=result['rev_no']) }}"><b>{{ result['name'] }}</b></a>
+                <td class="moin-wordbreak">{{ result.pos + 1 }}
+                {% if result['wikiname'] == cfg.interwikiname %}
+                    <a href="{{ url_for_item(item_name=result['name'], wiki_name='Self', rev=result['rev_no']) }}"><b>{{ result['name'] }}</b></a>
+                {% else %}
+                    <a class="moin-interwiki" href="{{ url_for_item(item_name=result['name'], wiki_name=result['wikiname'], rev=result['rev_no']) }}"><b>{{ "%s:%s" % (result['wikiname'], result['name']) }}</b></a>
+                {% endif %}
                 </td>
             </tr>
             <tr>
--- a/wikiconfig.py	Wed Aug 10 15:22:45 2011 +0000
+++ b/wikiconfig.py	Wed Aug 10 20:12:05 2011 +0000
@@ -12,7 +12,7 @@
     # vvv DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO vvv
     # Directory containing THIS wikiconfig:
     wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
-
+    interwikiname = u'MoinMoin2'
     # We assume this structure for a simple "unpack and run" scenario:
     # wikiconfig.py
     # wiki/