annotate MoinMoin/theme/modernized.py @ 3811:e22cd9105e37

Modernized theme: fix spacing in teh image table to pass pep8 tests
author Radomir Dopieralski <moindev@sheep.art.pl>
date Wed, 02 Jul 2008 01:03:44 +0200
parents 668a7f2f1775
children 6af8509c5917
rev   line source
3796
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
2 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
3 MoinMoin - modern theme
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
4
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
5 @copyright: 2003-2005 Nir Soffer, Thomas Waldmann
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
7 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
8
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
9 from MoinMoin.theme import ThemeBase
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
10 from MoinMoin import wikiutil
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
11 from MoinMoin.Page import Page
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
12
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
13 class Theme(ThemeBase):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
14
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
15 name = "modernized"
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
16
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
17 _ = lambda x: x # We don't have gettext at this moment, so we fake it
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
18 icons = {
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
19 # key alt icon filename w h
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
20 # FileAttach
3811
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
21 'attach': ("%(attach_count)s", "moin-attach.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
22 'info': ("[INFO]", "moin-info.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
23 'attachimg': (_("[ATTACH]"), "attach.png", 32, 32),
3796
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
24 # RecentChanges
3811
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
25 'rss': (_("[RSS]"), "moin-rss.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
26 'deleted': (_("[DELETED]"), "moin-deleted.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
27 'updated': (_("[UPDATED]"), "moin-updated.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
28 'renamed': (_("[RENAMED]"), "moin-renamed.png", 16, 16),
3796
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
29 'conflict': (_("[CONFLICT]"), "moin-conflict.png", 16, 16),
3811
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
30 'new': (_("[NEW]"), "moin-new.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
31 'diffrc': (_("[DIFF]"), "moin-diff.png", 16, 16),
3796
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
32 # General
3811
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
33 'bottom': (_("[BOTTOM]"), "moin-bottom.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
34 'top': (_("[TOP]"), "moin-top.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
35 'www': ("[WWW]", "moin-www.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
36 'mailto': ("[MAILTO]", "moin-email.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
37 'news': ("[NEWS]", "moin-news.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
38 'telnet': ("[TELNET]", "moin-telnet.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
39 'ftp': ("[FTP]", "moin-ftp.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
40 'file': ("[FILE]", "moin-ftp.png", 16, 16),
3796
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
41 # search forms
3811
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
42 'searchbutton': ("[?]", "moin-search.png", 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
43 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16),
3796
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
44
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
45 # smileys (this is CONTENT, but good looking smileys depend on looking
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
46 # adapted to the theme background color and theme style in general)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
47 #vvv == vvv this must be the same for GUI editor converter
3811
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
48 'X-(': ("X-(", 'angry.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
49 ':D': (":D", 'biggrin.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
50 '<:(': ("<:(", 'frown.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
51 ':o': (":o", 'redface.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
52 ':(': (":(", 'sad.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
53 ':)': (":)", 'smile.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
54 'B)': ("B)", 'smile2.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
55 ':))': (":))", 'smile3.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
56 ';)': (";)", 'smile4.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
57 '/!\\': ("/!\\", 'alert.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
58 '<!>': ("<!>", 'attention.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
59 '(!)': ("(!)", 'idea.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
60 ':-?': (":-?", 'tongue.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
61 ':\\': (":\\", 'ohwell.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
62 '>:>': (">:>", 'devil.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
63 '|)': ("|)", 'tired.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
64 ':-(': (":-(", 'sad.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
65 ':-)': (":-)", 'smile.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
66 'B-)': ("B-)", 'smile2.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
67 ':-))': (":-))", 'smile3.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
68 ';-)': (";-)", 'smile4.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
69 '|-)': ("|-)", 'tired.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
70 '(./)': ("(./)", 'checkmark.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
71 '{OK}': ("{OK}", 'thumbs-up.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
72 '{X}': ("{X}", 'icon-error.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
73 '{i}': ("{i}", 'icon-info.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
74 '{1}': ("{1}", 'prio1.png', 15, 13),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
75 '{2}': ("{2}", 'prio2.png', 15, 13),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
76 '{3}': ("{3}", 'prio3.png', 15, 13),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
77 '{*}': ("{*}", 'star_on.png', 16, 16),
e22cd9105e37 Modernized theme: fix spacing in teh image table to pass pep8 tests
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 3796
diff changeset
78 '{o}': ("{o}", 'star_off.png', 16, 16),
3796
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
79 }
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
80 del _
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
81 def header(self, d, **kw):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
82 """ Assemble wiki header
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
83
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
84 @param d: parameter dictionary
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
85 @rtype: unicode
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
86 @return: page header html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
87 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
88 html = [
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
89 # Pre header custom html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
90 self.emit_custom_html(self.cfg.page_header1),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
91
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
92 # Header
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
93 u'<div id="header">',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
94 self.searchform(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
95 self.logo(),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
96 self.username(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
97 u'<h1 id="locationline">',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
98 self.interwiki(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
99 self.title(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
100 u'</h1>',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
101 self.trail(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
102 self.navibar(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
103 #u'<hr id="pageline">',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
104 u'<div id="pageline"><hr style="display:none;"></div>',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
105 self.msg(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
106 self.editbar(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
107 u'</div>',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
108
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
109 # Post header custom html (not recommended)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
110 self.emit_custom_html(self.cfg.page_header2),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
111
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
112 # Start of page
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
113 self.startPage(),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
114 ]
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
115 return u'\n'.join(html)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
116
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
117 def editorheader(self, d, **kw):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
118 """ Assemble wiki header for editor
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
119
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
120 @param d: parameter dictionary
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
121 @rtype: unicode
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
122 @return: page header html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
123 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
124 html = [
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
125 # Pre header custom html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
126 self.emit_custom_html(self.cfg.page_header1),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
127
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
128 # Header
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
129 u'<div id="header">',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
130 u'<h1 id="locationline">',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
131 self.title(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
132 u'</h1>',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
133 self.msg(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
134 u'</div>',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
135
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
136 # Post header custom html (not recommended)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
137 self.emit_custom_html(self.cfg.page_header2),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
138
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
139 # Start of page
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
140 self.startPage(),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
141 ]
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
142 return u'\n'.join(html)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
143
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
144 def footer(self, d, **keywords):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
145 """ Assemble wiki footer
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
146
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
147 @param d: parameter dictionary
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
148 @keyword ...:...
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
149 @rtype: unicode
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
150 @return: page footer html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
151 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
152 page = d['page']
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
153 html = [
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
154 # End of page
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
155 self.pageinfo(page),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
156 self.endPage(),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
157
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
158 # Pre footer custom html (not recommended!)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
159 self.emit_custom_html(self.cfg.page_footer1),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
160
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
161 # Footer
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
162 u'<div id="footer">',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
163 self.editbar(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
164 self.credits(d),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
165 self.showversion(d, **keywords),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
166 u'</div>',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
167
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
168 # Post footer custom html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
169 self.emit_custom_html(self.cfg.page_footer2),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
170 ]
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
171 return u'\n'.join(html)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
172
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
173 def title(self, d):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
174 """ Assemble the title (now using breadcrumbs)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
175
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
176 @param d: parameter dictionary
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
177 @rtype: string
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
178 @return: title html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
179 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
180 _ = self.request.getText
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
181 content = []
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
182 if d['title_text'] == d['page'].split_title(): # just showing a page, no action
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
183 curpage = ''
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
184 segments = d['page_name'].split('/') # was: title_text
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
185 for s in segments[:-1]:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
186 curpage += s
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
187 content.append(Page(self.request, curpage).link_to(self.request, s))
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
188 curpage += '/'
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
189 link_text = segments[-1]
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
190 link_title = _('Click to do a full-text search for this title')
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
191 link_query = {
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
192 'action': 'fullsearch',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
193 'value': 'linkto:"%s"' % d['page_name'],
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
194 'context': '180',
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
195 }
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
196 # we dont use d['title_link'] any more, but make it ourselves:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
197 link = d['page'].link_to(self.request, link_text, querystr=link_query, title=link_title, css_class='backlink', rel='nofollow')
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
198 content.append(link)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
199 else:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
200 content.append(wikiutil.escape(d['title_text']))
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
201
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
202 location_html = u'<span class="sep">/</span>'.join(content)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
203 html = u'<span id="pagelocation">%s</span>' % location_html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
204 return html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
205
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
206 def username(self, d):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
207 """ Assemble the username / userprefs link
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
208
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
209 @param d: parameter dictionary
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
210 @rtype: unicode
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
211 @return: username html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
212 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
213 request = self.request
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
214 _ = request.getText
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
215
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
216 userlinks = []
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
217 # Add username/homepage link for registered users. We don't care
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
218 # if it exists, the user can create it.
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
219 if request.user.valid and request.user.name:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
220 interwiki = wikiutil.getInterwikiHomePage(request)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
221 name = request.user.name
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
222 aliasname = request.user.aliasname
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
223 if not aliasname:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
224 aliasname = name
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
225 title = "%s @ %s" % (aliasname, interwiki[0])
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
226 # link to (interwiki) user homepage
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
227 homelink = (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki) +
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
228 request.formatter.text(name) +
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
229 request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
230 userlinks.append(homelink)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
231 # link to userprefs action
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
232 if 'userprefs' not in self.request.cfg.actions_excluded:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
233 userlinks.append(d['page'].link_to(request, text=_('Settings'),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
234 querystr={'action': 'userprefs'}, id='userprefs', rel='nofollow'))
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
235
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
236 if request.user.valid:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
237 if request.user.auth_method in request.cfg.auth_can_logout:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
238 userlinks.append(d['page'].link_to(request, text=_('Logout'),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
239 querystr={'action': 'logout', 'logout': 'logout'}, id='logout', rel='nofollow'))
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
240 else:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
241 query = {'action': 'login'}
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
242 # special direct-login link if the auth methods want no input
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
243 if request.cfg.auth_login_inputs == ['special_no_input']:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
244 query['login'] = '1'
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
245 if request.cfg.auth_have_login:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
246 userlinks.append(d['page'].link_to(request, text=_("Login"),
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
247 querystr=query, id='login', rel='nofollow'))
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
248
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
249 userlinks_html = u'<span class="sep"> | </span>'.join(userlinks)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
250 html = u'<div id="username">%s</div>' % userlinks_html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
251 return html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
252
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
253 def trail(self, d):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
254 """ Assemble page trail
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
255
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
256 @param d: parameter dictionary
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
257 @rtype: unicode
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
258 @return: trail html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
259 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
260 request = self.request
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
261 user = request.user
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
262 html = ''
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
263 if not user.valid or user.show_page_trail:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
264 trail = user.getTrail()
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
265 if trail:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
266 items = []
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
267 for pagename in trail:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
268 try:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
269 interwiki, page = wikiutil.split_interwiki(pagename)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
270 if interwiki != request.cfg.interwikiname and interwiki != 'Self':
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
271 link = (self.request.formatter.interwikilink(True, interwiki, page) +
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
272 self.shortenPagename(page) +
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
273 self.request.formatter.interwikilink(False, interwiki, page))
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
274 items.append(link)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
275 continue
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
276 else:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
277 pagename = page
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
278
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
279 except ValueError:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
280 pass
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
281 page = Page(request, pagename)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
282 title = page.split_title()
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
283 title = self.shortenPagename(title)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
284 link = page.link_to(request, title)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
285 items.append(link)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
286 html = u'<div id="pagetrail">%s</div>' % u'<span class="sep"> &raquo; </span>'.join(items)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
287 return html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
288
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
289 def interwiki(self, d):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
290 """ Assemble the interwiki name display, linking to page_front_page
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
291
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
292 @param d: parameter dictionary
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
293 @rtype: string
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
294 @return: interwiki html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
295 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
296 if self.request.cfg.show_interwiki:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
297 page = wikiutil.getFrontPage(self.request)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
298 text = self.request.cfg.interwikiname or 'Self'
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
299 link = page.link_to(self.request, text=text, rel='nofollow')
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
300 html = u'<span id="interwiki">%s<span class="sep">: </span></span>' % link
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
301 else:
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
302 html = u''
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
303 return html
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
304
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
305 def execute(request):
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
306 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
307 Generate and return a theme object
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
308
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
309 @param request: the request object
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
310 @rtype: MoinTheme
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
311 @return: Theme object
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
312 """
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
313 return Theme(request)
668a7f2f1775 Introducing a remake of the default theme: Modernized
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
diff changeset
314