changeset 92:5ff01f07c67c

admin/interwikihelp view (replaces InterWiki macro)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 07 Mar 2011 20:40:19 +0100
parents 2e0766600e8f
children efce6cdc8237
files MoinMoin/apps/admin/templates/interwikihelp.html MoinMoin/apps/admin/views.py MoinMoin/macro/InterWiki.py
diffstat 3 files changed, 20 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/apps/admin/templates/interwikihelp.html	Mon Mar 07 20:40:19 2011 +0100
@@ -0,0 +1,7 @@
+{% import "utils.html" as utils %}
+{% extends theme("layout.html") %}
+{% block content %}
+<h1>{{ _("Known InterWiki names") }}</h1>
+{{ utils.table(headings, rows) }}
+{% endblock %}
+
--- a/MoinMoin/apps/admin/views.py	Mon Mar 07 20:19:03 2011 +0100
+++ b/MoinMoin/apps/admin/views.py	Mon Mar 07 20:40:19 2011 +0100
@@ -1,4 +1,4 @@
-# Copyright: 2008-2011 MoinMoin:ThomasWaldmann
+# Copyright: 2007-2011 MoinMoin:ThomasWaldmann
 # Copyright: 2001-2003 Juergen Hermann <jh@web.de>
 # Copyright: 2008 MoinMoin:JohannesBerg
 # Copyright: 2009 MoinMoin:EugeneSyromyatnikov
@@ -209,3 +209,15 @@
                            headings=headings,
                            rows=rows)
 
+@admin.route('/interwikihelp', methods=['GET', ])
+def interwikihelp():
+    """display a table with list of known interwiki names / urls"""
+    headings = [_('InterWiki name'),
+                _('URL'),
+               ]
+    rows = sorted(app.cfg.interwiki_map.items())
+    return render_template('admin/interwikihelp.html',
+                           item_name="+admin/interwikihelp",
+                           headings=headings,
+                           rows=rows)
+
--- a/MoinMoin/macro/InterWiki.py	Mon Mar 07 20:19:03 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Copyright: 2007-2008,2011 MoinMoin:ThomasWaldmann
-# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
-
-"""
-Outputs the interwiki map.
-"""
-
-
-from flask import current_app as app
-
-from MoinMoin.util.tree import moin_page, xlink
-from MoinMoin.util.interwiki import join_wiki
-from MoinMoin.macro._base import MacroBlockBase
-
-class Macro(MacroBlockBase):
-    def macro(self, content, arguments, page_url, alternative):
-        iwlist = app.cfg.interwiki_map.items()
-        iwlist.sort()
-
-        iw_list = moin_page.list()
-        for tag, url in iwlist:
-            href = join_wiki(url, 'RecentChanges')
-            link = moin_page.a(attrib={xlink.href: href}, children=[tag])
-            label = moin_page.code(children=[link])
-            iw_item_label = moin_page.list_item_label(children=[label])
-            if '$PAGE' not in url:
-                link = moin_page.a(attrib={xlink.href: url}, children=[url])
-            else:
-                link = url
-            body = moin_page.code(children=[link])
-            iw_item_body = moin_page.list_item_body(children=[body])
-            iw_item = moin_page.list_item(children=[iw_item_label, iw_item_body])
-            iw_list.append(iw_item)
-        return iw_list
-