Mercurial > moin > 1.9
annotate MoinMoin/theme/__init__.py @ 5994:50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sat, 08 Jun 2013 19:03:07 +0200 |
parents | 006b3a2ef9d9 |
children | 97a811896f15 51211e70a3a8 |
rev | line source |
---|---|
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1 # -*- coding: iso-8859-1 -*- |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
2 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
3 MoinMoin - Theme Package |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
4 |
3540
7bf83cd8da79
offer the RSS feed not only when we detect PyXML, but also for Python >= 2.5.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3527
diff
changeset
|
5 @copyright: 2003-2008 MoinMoin:ThomasWaldmann |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
6 @license: GNU GPL, see COPYING for details. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
7 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
8 |
5189
3ff40732d217
add the sidebar() method from Mandarin and Gugiel themes to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
4736
diff
changeset
|
9 import StringIO |
3ff40732d217
add the sidebar() method from Mandarin and Gugiel themes to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
4736
diff
changeset
|
10 |
5409
c3822eacfe4a
theme/__init__.py: Exception "Calling add_msg() after send_title(): no message can be added." is replaced with warning and call stack information in log.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5251
diff
changeset
|
11 from MoinMoin import log |
c3822eacfe4a
theme/__init__.py: Exception "Calling add_msg() after send_title(): no message can be added." is replaced with warning and call stack information in log.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5251
diff
changeset
|
12 logging = log.getLogger(__name__) |
c3822eacfe4a
theme/__init__.py: Exception "Calling add_msg() after send_title(): no message can be added." is replaced with warning and call stack information in log.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5251
diff
changeset
|
13 |
1787
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
14 from MoinMoin import i18n, wikiutil, config, version, caching |
4173
051391d5662d
Remove deprecated calls to request.getAvailableActions
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
4170
diff
changeset
|
15 from MoinMoin.action import get_available_actions |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
16 from MoinMoin.Page import Page |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
17 from MoinMoin.util import pysupport |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
18 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
19 modules = pysupport.getPackageModules(__file__) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
20 |
3540
7bf83cd8da79
offer the RSS feed not only when we detect PyXML, but also for Python >= 2.5.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3527
diff
changeset
|
21 # Check whether we can emit a RSS feed. |
4617
8a3c0c726d66
remove some references to py 2.3/2.4 - 2.4 is the minimum now anyway
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4498
diff
changeset
|
22 # RSS is broken on plain Python 2.4.x, and works only when installing PyXML. |
3540
7bf83cd8da79
offer the RSS feed not only when we detect PyXML, but also for Python >= 2.5.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3527
diff
changeset
|
23 # News: A user reported that the RSS is valid when using Python 2.5.1 on Windows. |
7bf83cd8da79
offer the RSS feed not only when we detect PyXML, but also for Python >= 2.5.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3527
diff
changeset
|
24 import sys, xml |
7bf83cd8da79
offer the RSS feed not only when we detect PyXML, but also for Python >= 2.5.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3527
diff
changeset
|
25 rss_supported = sys.version_info[:3] >= (2, 5, 1) or '_xmlplus' in xml.__file__ |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
26 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
27 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
28 class ThemeBase: |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
29 """ Base class for themes |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
30 |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
31 This class supply all the standard template that sub classes can |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
32 use without rewriting the same code. If you want to change certain |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
33 elements, override them. |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
34 """ |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
35 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
36 name = 'base' |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
37 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
38 # fake _ function to get gettext recognize those texts: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
39 _ = lambda x: x |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
40 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
41 # TODO: remove icons that are not used any more. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
42 icons = { |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
43 # key alt icon filename w h |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
44 # ------------------------------------------------------------------ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
45 # navibar |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
46 'help': ("%(page_help_contents)s", "moin-help.png", 12, 11), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
47 'find': ("%(page_find_page)s", "moin-search.png", 12, 12), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
48 'diff': (_("Diffs"), "moin-diff.png", 15, 11), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
49 'info': (_("Info"), "moin-info.png", 12, 11), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
50 'edit': (_("Edit"), "moin-edit.png", 12, 12), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
51 'unsubscribe': (_("Unsubscribe"), "moin-unsubscribe.png", 14, 10), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
52 'subscribe': (_("Subscribe"), "moin-subscribe.png", 14, 10), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
53 'raw': (_("Raw"), "moin-raw.png", 12, 13), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
54 'xml': (_("XML"), "moin-xml.png", 20, 13), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
55 'print': (_("Print"), "moin-print.png", 16, 14), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
56 'view': (_("View"), "moin-show.png", 12, 13), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
57 'home': (_("Home"), "moin-home.png", 13, 12), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
58 'up': (_("Up"), "moin-parent.png", 15, 13), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
59 # FileAttach |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
60 'attach': ("%(attach_count)s", "moin-attach.png", 7, 15), |
3054
d2e9afd64276
get formatters in sync with 1.6 cs 2558:3e3a549b49f0, add attachimg icon (needed by html formatter)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3048
diff
changeset
|
61 'attachimg': ("", "attach.png", 32, 32), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
62 # RecentChanges |
2197
9b404a43e59c
use standard RSS icon
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2009
diff
changeset
|
63 'rss': (_("[RSS]"), "moin-rss.png", 24, 24), |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
64 'deleted': (_("[DELETED]"), "moin-deleted.png", 60, 12), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
65 'updated': (_("[UPDATED]"), "moin-updated.png", 60, 12), |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
66 'renamed': (_("[RENAMED]"), "moin-renamed.png", 60, 12), |
1746
1aa9dfd0ad34
added conflict and rename icon
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1735
diff
changeset
|
67 'conflict': (_("[CONFLICT]"), "moin-conflict.png", 60, 12), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
68 'new': (_("[NEW]"), "moin-new.png", 31, 12), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
69 'diffrc': (_("[DIFF]"), "moin-diff.png", 15, 11), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
70 # General |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
71 'bottom': (_("[BOTTOM]"), "moin-bottom.png", 14, 10), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
72 'top': (_("[TOP]"), "moin-top.png", 14, 10), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
73 'www': ("[WWW]", "moin-www.png", 11, 11), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
74 'mailto': ("[MAILTO]", "moin-email.png", 14, 10), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
75 'news': ("[NEWS]", "moin-news.png", 10, 11), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
76 'telnet': ("[TELNET]", "moin-telnet.png", 10, 11), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
77 'ftp': ("[FTP]", "moin-ftp.png", 11, 11), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
78 'file': ("[FILE]", "moin-ftp.png", 11, 11), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
79 # search forms |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
80 'searchbutton': ("[?]", "moin-search.png", 12, 12), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
81 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16), |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
82 |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
83 # smileys (this is CONTENT, but good looking smileys depend on looking |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
84 # adapted to the theme background color and theme style in general) |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
85 #vvv == vvv this must be the same for GUI editor converter |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
86 'X-(': ("X-(", 'angry.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
87 ':D': (":D", 'biggrin.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
88 '<:(': ("<:(", 'frown.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
89 ':o': (":o", 'redface.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
90 ':(': (":(", 'sad.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
91 ':)': (":)", 'smile.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
92 'B)': ("B)", 'smile2.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
93 ':))': (":))", 'smile3.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
94 ';)': (";)", 'smile4.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
95 '/!\\': ("/!\\", 'alert.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
96 '<!>': ("<!>", 'attention.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
97 '(!)': ("(!)", 'idea.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
98 |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
99 # copied 2001-11-16 from http://pikie.darktech.org/cgi/pikie.py?EmotIcon |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
100 ':-?': (":-?", 'tongue.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
101 ':\\': (":\\", 'ohwell.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
102 '>:>': (">:>", 'devil.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
103 '|)': ("|)", 'tired.png', 15, 15), |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
104 |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
105 # some folks use noses in their emoticons |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
106 ':-(': (":-(", 'sad.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
107 ':-)': (":-)", 'smile.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
108 'B-)': ("B-)", 'smile2.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
109 ':-))': (":-))", 'smile3.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
110 ';-)': (";-)", 'smile4.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
111 '|-)': ("|-)", 'tired.png', 15, 15), |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
112 |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
113 # version 1.0 |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
114 '(./)': ("(./)", 'checkmark.png', 20, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
115 '{OK}': ("{OK}", 'thumbs-up.png', 14, 12), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
116 '{X}': ("{X}", 'icon-error.png', 16, 16), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
117 '{i}': ("{i}", 'icon-info.png', 16, 16), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
118 '{1}': ("{1}", 'prio1.png', 15, 13), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
119 '{2}': ("{2}", 'prio2.png', 15, 13), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
120 '{3}': ("{3}", 'prio3.png', 15, 13), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
121 |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
122 # version 1.3.4 (stars) |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
123 # try {*}{*}{o} |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
124 '{*}': ("{*}", 'star_on.png', 15, 15), |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
125 '{o}': ("{o}", 'star_off.png', 15, 15), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
126 } |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
127 del _ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
128 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
129 # Style sheets - usually there is no need to override this in sub |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
130 # classes. Simply supply the css files in the css directory. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
131 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
132 # Standard set of style sheets |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
133 stylesheets = ( |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
134 # media basename |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
135 ('all', 'common'), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
136 ('screen', 'screen'), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
137 ('print', 'print'), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
138 ('projection', 'projection'), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
139 ) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
140 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
141 # Used in print mode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
142 stylesheets_print = ( |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
143 # media basename |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
144 ('all', 'common'), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
145 ('all', 'print'), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
146 ) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
147 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
148 # Used in slide show mode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
149 stylesheets_projection = ( |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
150 # media basename |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
151 ('all', 'common'), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
152 ('all', 'projection'), |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
153 ) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
154 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
155 stylesheetsCharset = 'utf-8' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
156 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
157 def __init__(self, request): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
158 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
159 Initialize the theme object. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
160 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
161 @param request: the request object |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
162 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
163 self.request = request |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
164 self.cfg = request.cfg |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
165 self._cache = {} # Used to cache elements that may be used several times |
2964
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
166 self._status = [] |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
167 self._send_title_called = False |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
168 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
169 def img_url(self, img): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
170 """ Generate an image href |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
171 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
172 @param img: the image filename |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
173 @rtype: string |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
174 @return: the image href |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
175 """ |
1318
760002b5ffa3
use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1015
diff
changeset
|
176 return "%s/%s/img/%s" % (self.cfg.url_prefix_static, self.name, img) |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
177 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
178 def emit_custom_html(self, html): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
179 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
180 generate custom HTML code in `html` |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
181 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
182 @param html: a string or a callable object, in which case |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
183 it is called and its return value is used |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
184 @rtype: string |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
185 @return: string with html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
186 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
187 if html: |
1988
dbf2b7426385
fixed some pylint warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1959
diff
changeset
|
188 if callable(html): |
dbf2b7426385
fixed some pylint warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1959
diff
changeset
|
189 html = html(self.request) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
190 return html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
191 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
192 def logo(self): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
193 """ Assemble logo with link to front page |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
194 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
195 The logo contain an image and or text or any html markup the |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
196 admin inserted in the config file. Everything it enclosed inside |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
197 a div with id="logo". |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
198 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
199 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
200 @return: logo html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
201 """ |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
202 html = u'' |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
203 if self.cfg.logo_string: |
1347
b65614f8a393
use page.link_to(_raw) more often
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1341
diff
changeset
|
204 page = wikiutil.getFrontPage(self.request) |
b65614f8a393
use page.link_to(_raw) more often
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1341
diff
changeset
|
205 logo = page.link_to_raw(self.request, self.cfg.logo_string) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
206 html = u'''<div id="logo">%s</div>''' % logo |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
207 return html |
161
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
208 |
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
209 def interwiki(self, d): |
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
210 """ Assemble the interwiki name display, linking to page_front_page |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
211 |
161
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
212 @param d: parameter dictionary |
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
213 @rtype: string |
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
214 @return: interwiki html |
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
215 """ |
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
216 if self.request.cfg.show_interwiki: |
1015
e527eea93da5
make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1010
diff
changeset
|
217 page = wikiutil.getFrontPage(self.request) |
4480
af8cea9bfcda
made cfg.interwikiname a unicode object (str only worked for ascii)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
218 text = self.request.cfg.interwikiname or u'Self' |
1015
e527eea93da5
make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1010
diff
changeset
|
219 link = page.link_to(self.request, text=text, rel='nofollow') |
174
51bde0757167
workaround for opera 8.5 brokenness
Thomas Waldmann <tw@waldmann-edv.de>
parents:
161
diff
changeset
|
220 html = u'<div id="interwiki"><span>%s</span></div>' % link |
1015
e527eea93da5
make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1010
diff
changeset
|
221 else: |
e527eea93da5
make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1010
diff
changeset
|
222 html = u'' |
161
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
223 return html |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
224 |
5993
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
225 def backlink(self, page, page_name, link_text): |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
226 """ Create html for the "backlink" part of the title. |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
227 |
5994
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
228 What it will be is determined by calling cfg.backlink_method, |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
229 which can return 'backlink' (render a linkto-fullsearch link), |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
230 'pagelink' (render a link to same page) or 'text' (render just text). |
5993
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
231 |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
232 @param page: page object |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
233 @param page_name: the (full) page name |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
234 @param link_text: the text shown for the link |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
235 @return: html fragment |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
236 """ |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
237 request = self.request |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
238 _ = request.getText |
5994
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
239 method = request.cfg.backlink_method(request) |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
240 if method == 'backlink': |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
241 link_title = _('Click to do a full-text search for this title') |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
242 link_query = dict(action='fullsearch', value='linkto:"%s"' % page_name, context='180') |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
243 link = page.link_to(request, link_text, querystr=link_query, title=link_title, |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
244 css_class='backlink', rel='nofollow') |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
245 elif method == 'pagelink': |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
246 link = page.link_to(request, link_text) |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
247 else: # == 'text' |
50e82729b826
implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5993
diff
changeset
|
248 link = wikiutil.escape(link_text) |
5993
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
249 return link |
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
250 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
251 def title(self, d): |
161
65efc38c4e23
separated interwiki display into an own div and made its display configurable via show_interwiki [1]
Thomas Waldmann <tw@waldmann-edv.de>
parents:
160
diff
changeset
|
252 """ Assemble the title (now using breadcrumbs) |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
253 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
254 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
255 @rtype: string |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
256 @return: title html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
257 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
258 _ = self.request.getText |
153
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
259 content = [] |
2991
82ac2b1b1a05
fix pagename navigation for wikiname_add_spaces == True (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2987
diff
changeset
|
260 if d['title_text'] == d['page'].split_title(): # just showing a page, no action |
153
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
261 curpage = '' |
182
10e033440008
fixed theme title for 'Add spaces to displayed wiki names' setting
Thomas Waldmann <tw@waldmann-edv.de>
parents:
174
diff
changeset
|
262 segments = d['page_name'].split('/') # was: title_text |
153
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
263 for s in segments[:-1]: |
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
264 curpage += s |
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
265 content.append("<li>%s</li>" % Page(self.request, curpage).link_to(self.request, s)) |
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
266 curpage += '/' |
5993
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
267 link = self.backlink(d['page'], d['page_name'], segments[-1]) |
1354
26949e36ca0b
move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1347
diff
changeset
|
268 content.append(('<li>%s</li>') % link) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
269 else: |
153
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
270 content.append('<li>%s</li>' % wikiutil.escape(d['title_text'])) |
133
df2368d50468
added location breadcrumbs
Thomas Waldmann <tw@waldmann-edv.de>
parents:
128
diff
changeset
|
271 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
272 html = ''' |
153
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
273 <ul id="pagelocation"> |
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
274 %s |
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
275 </ul> |
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
276 ''' % "".join(content) |
142
0b1b06737340
separate creaetion of the location (breadcrumbs) from the title for easier theme customization
Nir Soffer <nirs@freeshell.org>
parents:
141
diff
changeset
|
277 return html |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
278 |
5192
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
279 def title_with_separators(self, d): |
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
280 """ Assemble the title using slashes, not <ul> |
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
281 |
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
282 @param d: parameter dictionary |
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
283 @rtype: string |
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
284 @return: title html |
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
285 """ |
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
286 _ = self.request.getText |
5197
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
287 if d['title_text'] == d['page'].split_title(): |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
288 # just showing a page, no action |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
289 segments = d['page_name'].split('/') |
5993
006b3a2ef9d9
move backlink computing code into method backlink(), reduce code duplication
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5982
diff
changeset
|
290 link = self.backlink(d['page'], d['page_name'], segments[-1]) |
5197
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
291 if len(segments) <= 1: |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
292 html = link |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
293 else: |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
294 content = [] |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
295 curpage = '' |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
296 for s in segments[:-1]: |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
297 curpage += s |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
298 content.append(Page(self.request, |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
299 curpage).link_to(self.request, s)) |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
300 curpage += '/' |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
301 path_html = u'<span class="sep">/</span>'.join(content) |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
302 html = u'<span class="pagepath">%s</span><span class="sep">/</span>%s' % (path_html, link) |
5192
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
303 else: |
5197
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
304 html = wikiutil.escape(d['title_text']) |
df9c332ed6a0
Modernized theme: add a span with "pagepath" class to title_with_separators
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5192
diff
changeset
|
305 return u'<span id="pagelocation">%s</span>' % html |
5192
6af8509c5917
move title_with_separators() from Modernized theme to ThemeBase
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
5189
diff
changeset
|
306 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
307 def username(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
308 """ Assemble the username / userprefs link |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
309 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
310 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
311 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
312 @return: username html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
313 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
314 request = self.request |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
315 _ = request.getText |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
316 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
317 userlinks = [] |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
318 # Add username/homepage link for registered users. We don't care |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
319 # if it exists, the user can create it. |
338
bf754e0d6472
don't crash in themecode if username is None
Thomas Waldmann <tw@waldmann-edv.de>
parents:
306
diff
changeset
|
320 if request.user.valid and request.user.name: |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
321 interwiki = wikiutil.getInterwikiHomePage(request) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
322 name = request.user.name |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
323 aliasname = request.user.aliasname |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
324 if not aliasname: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
325 aliasname = name |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
326 title = "%s @ %s" % (aliasname, interwiki[0]) |
511
8ee8ced7dded
moved UserPreferences back to header, add Cancel button
Thomas Waldmann <tw@waldmann-edv.de>
parents:
493
diff
changeset
|
327 # link to (interwiki) user homepage |
1529
76b4d2324d25
MoinMoin should not record the homepage links as pagelinks, fixes MoinMoinBugs/PageLinksIncludeUnrelatedLinks.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
1425
diff
changeset
|
328 homelink = (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki) + |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
329 request.formatter.text(name) + |
569
6c572f52899f
fixed missing </a> formatter bug
Thomas Waldmann <tw@waldmann-edv.de>
parents:
515
diff
changeset
|
330 request.formatter.interwikilink(0, title=title, id="userhome", *interwiki)) |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
331 userlinks.append(homelink) |
511
8ee8ced7dded
moved UserPreferences back to header, add Cancel button
Thomas Waldmann <tw@waldmann-edv.de>
parents:
493
diff
changeset
|
332 # link to userprefs action |
3527
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
333 if 'userprefs' not in self.request.cfg.actions_excluded: |
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
334 userlinks.append(d['page'].link_to(request, text=_('Settings'), |
869
0152984f76ee
use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
826
diff
changeset
|
335 querystr={'action': 'userprefs'}, id='userprefs', rel='nofollow')) |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
336 |
2009
1b14cc05a54a
refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
1988
diff
changeset
|
337 if request.user.valid: |
1b14cc05a54a
refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
1988
diff
changeset
|
338 if request.user.auth_method in request.cfg.auth_can_logout: |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
339 userlinks.append(d['page'].link_to(request, text=_('Logout'), |
869
0152984f76ee
use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
826
diff
changeset
|
340 querystr={'action': 'logout', 'logout': 'logout'}, id='logout', rel='nofollow')) |
2009
1b14cc05a54a
refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
1988
diff
changeset
|
341 else: |
3139
0c0fd7c894a3
allow auth methods that don't need input at all to skip input form
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
3086
diff
changeset
|
342 query = {'action': 'login'} |
0c0fd7c894a3
allow auth methods that don't need input at all to skip input form
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
3086
diff
changeset
|
343 # special direct-login link if the auth methods want no input |
0c0fd7c894a3
allow auth methods that don't need input at all to skip input form
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
3086
diff
changeset
|
344 if request.cfg.auth_login_inputs == ['special_no_input']: |
0c0fd7c894a3
allow auth methods that don't need input at all to skip input form
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
3086
diff
changeset
|
345 query['login'] = '1' |
2009
1b14cc05a54a
refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
1988
diff
changeset
|
346 if request.cfg.auth_have_login: |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
347 userlinks.append(d['page'].link_to(request, text=_("Login"), |
3139
0c0fd7c894a3
allow auth methods that don't need input at all to skip input form
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
3086
diff
changeset
|
348 querystr=query, id='login', rel='nofollow')) |
296
4e08178a630c
moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents:
286
diff
changeset
|
349 |
306
4e5e4fc9f7fa
fixed rendering of modern for IE, Opera, Konqueror (as far as possible). TODO: other themes
Thomas Waldmann <tw@waldmann-edv.de>
parents:
298
diff
changeset
|
350 userlinks = [u'<li>%s</li>' % link for link in userlinks] |
4e5e4fc9f7fa
fixed rendering of modern for IE, Opera, Konqueror (as far as possible). TODO: other themes
Thomas Waldmann <tw@waldmann-edv.de>
parents:
298
diff
changeset
|
351 html = u'<ul id="username">%s</ul>' % ''.join(userlinks) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
352 return html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
353 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
354 def splitNavilink(self, text, localize=1): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
355 """ Split navibar links into pagename, link to page |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
356 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
357 Admin or user might want to use shorter navibar items by using |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
358 the [[page|title]] or [[url|title]] syntax. In this case, we don't |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
359 use localization, and the links goes to page or to the url, not |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
360 the localized version of page. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
361 |
1827
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
362 Supported syntax: |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
363 * PageName |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
364 * WikiName:PageName |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
365 * wiki:WikiName:PageName |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
366 * url |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
367 * all targets as seen above with title: [[target|title]] |
1630
9a8fdd5a03d3
theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1560
diff
changeset
|
368 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
369 @param text: the text used in config or user preferences |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
370 @rtype: tuple |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
371 @return: pagename or url, link to page or url |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
372 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
373 request = self.request |
1827
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
374 fmt = request.formatter |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
375 title = None |
1850
3d38db210672
action CopyPage added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1843
diff
changeset
|
376 |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
377 # Handle [[pagename|title]] or [[url|title]] formats |
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
378 if text.startswith('[[') and text.endswith(']]'): |
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
379 text = text[2:-2] |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
380 try: |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
381 pagename, title = text.split('|', 1) |
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
382 pagename = pagename.strip() |
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
383 title = title.strip() |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
384 localize = 0 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
385 except (ValueError, TypeError): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
386 # Just use the text as is. |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
387 pagename = text.strip() |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
388 else: |
1827
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
389 pagename = text |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
390 |
3251
ecbde828b812
improved wikiutil.is_URL, use it also in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3234
diff
changeset
|
391 if wikiutil.is_URL(pagename): |
ecbde828b812
improved wikiutil.is_URL, use it also in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3234
diff
changeset
|
392 if not title: |
ecbde828b812
improved wikiutil.is_URL, use it also in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3234
diff
changeset
|
393 title = pagename |
ecbde828b812
improved wikiutil.is_URL, use it also in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3234
diff
changeset
|
394 link = fmt.url(1, pagename) + fmt.text(title) + fmt.url(0) |
ecbde828b812
improved wikiutil.is_URL, use it also in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3234
diff
changeset
|
395 return pagename, link |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
396 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
397 # remove wiki: url prefix |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
398 if pagename.startswith("wiki:"): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
399 pagename = pagename[5:] |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
400 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
401 # try handling interwiki links |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
402 try: |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
403 interwiki, page = wikiutil.split_interwiki(pagename) |
22
a47550d21d2d
quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents:
18
diff
changeset
|
404 thiswiki = request.cfg.interwikiname |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
405 if interwiki == thiswiki or interwiki == 'Self': |
22
a47550d21d2d
quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents:
18
diff
changeset
|
406 pagename = page |
a47550d21d2d
quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents:
18
diff
changeset
|
407 else: |
1827
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
408 if not title: |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
409 title = page |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
410 link = fmt.interwikilink(True, interwiki, page) + fmt.text(title) + fmt.interwikilink(False, interwiki, page) |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
411 return pagename, link |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
412 except ValueError: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
413 pass |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
414 |
1827
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
415 # Handle regular pagename like "FrontPage" |
4146
3b36f0cfc656
(Re)moved normalizePagename from Request into wikiutil library
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
3624
diff
changeset
|
416 pagename = wikiutil.normalize_pagename(pagename, request.cfg) |
1827
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
417 |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
418 # Use localized pages for the current user |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
419 if localize: |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
420 page = wikiutil.getLocalizedPage(request, pagename) |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
421 else: |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
422 page = Page(request, pagename) |
1850
3d38db210672
action CopyPage added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1843
diff
changeset
|
423 |
2987
c817a9c0d0e5
navi_bar: highlight correct tab for the current page for i18ned system pages (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2964
diff
changeset
|
424 pagename = page.page_name # can be different, due to i18n |
c817a9c0d0e5
navi_bar: highlight correct tab for the current page for i18ned system pages (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2964
diff
changeset
|
425 |
1827
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
426 if not title: |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
427 title = page.split_title() |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
428 title = self.shortenPagename(title) |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
429 |
6a162bb60560
cleaned up splitNaviLink mess
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1816
diff
changeset
|
430 link = page.link_to(request, title) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
431 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
432 return pagename, link |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
433 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
434 def shortenPagename(self, name): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
435 """ Shorten page names |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
436 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
437 Shorten very long page names that tend to break the user |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
438 interface. The short name is usually fine, unless really stupid |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
439 long names are used (WYGIWYD). |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
440 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
441 If you don't like to do this in your theme, or want to use |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
442 different algorithm, override this method. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
443 |
490
ca35d9e6d63e
eypdoc comments: fixed some warnings/errors
Thomas Waldmann <tw@waldmann-edv.de>
parents:
483
diff
changeset
|
444 @param name: page name, unicode |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
445 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
446 @return: shortened version. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
447 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
448 maxLength = self.maxPagenameLength() |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
449 # First use only the sub page name, that might be enough |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
450 if len(name) > maxLength: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
451 name = name.split('/')[-1] |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
452 # If it's not enough, replace the middle with '...' |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
453 if len(name) > maxLength: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
454 half, left = divmod(maxLength - 3, 2) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
455 name = u'%s...%s' % (name[:half + left], name[-half:]) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
456 return name |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
457 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
458 def maxPagenameLength(self): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
459 """ Return maximum length for shortened page names """ |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
460 return 25 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
461 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
462 def navibar(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
463 """ Assemble the navibar |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
464 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
465 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
466 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
467 @return: navibar html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
468 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
469 request = self.request |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
470 found = {} # pages we found. prevent duplicates |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
471 items = [] # navibar items |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
472 item = u'<li class="%s">%s</li>' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
473 current = d['page_name'] |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
474 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
475 # Process config navi_bar |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
476 if request.cfg.navi_bar: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
477 for text in request.cfg.navi_bar: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
478 pagename, link = self.splitNavilink(text) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
479 if pagename == current: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
480 cls = 'wikilink current' |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
481 else: |
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
482 cls = 'wikilink' |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
483 items.append(item % (cls, link)) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
484 found[pagename] = 1 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
485 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
486 # Add user links to wiki links, eliminating duplicates. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
487 userlinks = request.user.getQuickLinks() |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
488 for text in userlinks: |
22
a47550d21d2d
quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents:
18
diff
changeset
|
489 # Split text without localization, user knows what he wants |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
490 pagename, link = self.splitNavilink(text, localize=0) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
491 if not pagename in found: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
492 if pagename == current: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
493 cls = 'userlink current' |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
494 else: |
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
495 cls = 'userlink' |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
496 items.append(item % (cls, link)) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
497 found[pagename] = 1 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
498 |
1787
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
499 # Add current page at end of local pages |
160
b18ec46a7b1d
we need current page in navibar as long as unknown users have no trail or trail doesnt get updated on actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
153
diff
changeset
|
500 if not current in found: |
1782
6b9eefc1d67f
split_title: remove some more call's request param (see cs 1776)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1780
diff
changeset
|
501 title = d['page'].split_title() |
160
b18ec46a7b1d
we need current page in navibar as long as unknown users have no trail or trail doesnt get updated on actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
153
diff
changeset
|
502 title = self.shortenPagename(title) |
b18ec46a7b1d
we need current page in navibar as long as unknown users have no trail or trail doesnt get updated on actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
153
diff
changeset
|
503 link = d['page'].link_to(request, title) |
b18ec46a7b1d
we need current page in navibar as long as unknown users have no trail or trail doesnt get updated on actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
153
diff
changeset
|
504 cls = 'current' |
b18ec46a7b1d
we need current page in navibar as long as unknown users have no trail or trail doesnt get updated on actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
153
diff
changeset
|
505 items.append(item % (cls, link)) |
b18ec46a7b1d
we need current page in navibar as long as unknown users have no trail or trail doesnt get updated on actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
153
diff
changeset
|
506 |
1787
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
507 # Add sister pages. |
1959
7ccf35e8f674
use a list to have defined order for cfg.sistersites (e.g. in theme output)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1935
diff
changeset
|
508 for sistername, sisterurl in request.cfg.sistersites: |
1787
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
509 if sistername == request.cfg.interwikiname: # it is THIS wiki |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
510 cls = 'sisterwiki current' |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
511 items.append(item % (cls, sistername)) |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
512 else: |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
513 # TODO optimize performance |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
514 cache = caching.CacheEntry(request, 'sisters', sistername, 'farm', use_pickle=True) |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
515 if cache.exists(): |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
516 data = cache.content() |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
517 sisterpages = data['sisterpages'] |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
518 if current in sisterpages: |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
519 cls = 'sisterwiki' |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
520 url = sisterpages[current] |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
521 link = request.formatter.url(1, url) + \ |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
522 request.formatter.text(sistername) +\ |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
523 request.formatter.url(0) |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
524 items.append(item % (cls, link)) |
f4a941fe32f8
added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1784
diff
changeset
|
525 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
526 # Assemble html |
306
4e5e4fc9f7fa
fixed rendering of modern for IE, Opera, Konqueror (as far as possible). TODO: other themes
Thomas Waldmann <tw@waldmann-edv.de>
parents:
298
diff
changeset
|
527 items = u''.join(items) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
528 html = u''' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
529 <ul id="navibar"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
530 %s |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
531 </ul> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
532 ''' % items |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
533 return html |
153
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
534 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
535 def get_icon(self, icon): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
536 """ Return icon data from self.icons |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
537 |
2725
388204baf00f
change [[macro]] to <<macro>> in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2286
diff
changeset
|
538 If called from <<Icon(file)>> we have a filename, not a |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
539 key. Using filenames is deprecated, but for now, we simulate old |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
540 behavior. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
541 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
542 @param icon: icon name or file name (string) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
543 @rtype: tuple |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
544 @return: alt (unicode), href (string), width, height (int) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
545 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
546 if icon in self.icons: |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
547 alt, icon, w, h = self.icons[icon] |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
548 else: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
549 # Create filenames to icon data mapping on first call, then |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
550 # cache in class for next calls. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
551 if not getattr(self.__class__, 'iconsByFile', None): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
552 d = {} |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
553 for data in self.icons.values(): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
554 d[data[1]] = data |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
555 self.__class__.iconsByFile = d |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
556 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
557 # Try to get icon data by file name |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
558 if icon in self.iconsByFile: |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
559 alt, icon, w, h = self.iconsByFile[icon] |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
560 else: |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
561 alt, icon, w, h = '', icon, '', '' |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
562 |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
563 return alt, self.img_url(icon), w, h |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
564 |
2862
8c1d40768df7
gedit formatter/converter: fix links/transclusion (suppressing default alt texts needs more work)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2832
diff
changeset
|
565 def make_icon(self, icon, vars=None, **kw): |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
566 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
567 This is the central routine for making <img> tags for icons! |
734
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
568 All icons stuff except the top left logo and search field icons are |
bf2435e61f97
moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
669
diff
changeset
|
569 handled here. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
570 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
571 @param icon: icon id (dict key) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
572 @param vars: ... |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
573 @rtype: string |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
574 @return: icon html (img tag) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
575 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
576 if vars is None: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
577 vars = {} |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
578 alt, img, w, h = self.get_icon(icon) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
579 try: |
3048
1e9444f35a22
Fix "MakeIconLinkLosesAltTitle", thanks to "bolekk". (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3040
diff
changeset
|
580 alt = vars['icon-alt-text'] # if it is possible we take the alt-text from 'page_icons_table' |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
581 except KeyError, err: |
3048
1e9444f35a22
Fix "MakeIconLinkLosesAltTitle", thanks to "bolekk". (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3040
diff
changeset
|
582 try: |
1e9444f35a22
Fix "MakeIconLinkLosesAltTitle", thanks to "bolekk". (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3040
diff
changeset
|
583 alt = alt % vars # if not we just leave the alt-text from 'icons' |
1e9444f35a22
Fix "MakeIconLinkLosesAltTitle", thanks to "bolekk". (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3040
diff
changeset
|
584 except KeyError, err: |
1e9444f35a22
Fix "MakeIconLinkLosesAltTitle", thanks to "bolekk". (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3040
diff
changeset
|
585 alt = 'KeyError: %s' % str(err) |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
586 alt = self.request.getText(alt) |
2862
8c1d40768df7
gedit formatter/converter: fix links/transclusion (suppressing default alt texts needs more work)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2832
diff
changeset
|
587 tag = self.request.formatter.image(src=img, alt=alt, width=w, height=h, **kw) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
588 return tag |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
589 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
590 def make_iconlink(self, which, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
591 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
592 Make a link with an icon |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
593 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
594 @param which: icon id (dictionary key) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
595 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
596 @rtype: string |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
597 @return: html link tag |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
598 """ |
2996
6a1b18869fe8
fix for icon bar: do not modify cfg.page_icons_table (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2991
diff
changeset
|
599 qs = {} |
3541
8ff53b14fc44
UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3540
diff
changeset
|
600 pagekey, querystr, title, icon = self.cfg.page_icons_table[which] |
2996
6a1b18869fe8
fix for icon bar: do not modify cfg.page_icons_table (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2991
diff
changeset
|
601 qs.update(querystr) # do not modify the querystr dict in the cfg! |
3048
1e9444f35a22
Fix "MakeIconLinkLosesAltTitle", thanks to "bolekk". (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3040
diff
changeset
|
602 d['icon-alt-text'] = d['title'] = title % d |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
603 d['i18ntitle'] = self.request.getText(d['title']) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
604 img_src = self.make_icon(icon, d) |
1684
aadc8b0e11cf
change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1683
diff
changeset
|
605 rev = d['rev'] |
aadc8b0e11cf
change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1683
diff
changeset
|
606 if rev and which in ['raw', 'print', ]: |
2996
6a1b18869fe8
fix for icon bar: do not modify cfg.page_icons_table (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2991
diff
changeset
|
607 qs['rev'] = str(rev) |
1684
aadc8b0e11cf
change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1683
diff
changeset
|
608 attrs = {'rel': 'nofollow', 'title': d['i18ntitle'], } |
3541
8ff53b14fc44
UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3540
diff
changeset
|
609 page = d[pagekey] |
8ff53b14fc44
UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3540
diff
changeset
|
610 if isinstance(page, unicode): |
8ff53b14fc44
UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3540
diff
changeset
|
611 # e.g. d['page_parent_page'] is just the unicode pagename |
8ff53b14fc44
UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3540
diff
changeset
|
612 # while d['page'] will give a page object |
8ff53b14fc44
UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3540
diff
changeset
|
613 page = Page(self.request, page) |
2996
6a1b18869fe8
fix for icon bar: do not modify cfg.page_icons_table (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2991
diff
changeset
|
614 return page.link_to_raw(self.request, text=img_src, querystr=qs, **attrs) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
615 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
616 def msg(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
617 """ Assemble the msg display |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
618 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
619 Display a message with a widget or simple strings with a clear message link. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
620 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
621 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
622 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
623 @return: msg display html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
624 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
625 _ = self.request.getText |
2964
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
626 msgs = d['msg'] |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
627 |
2964
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
628 result = u"" |
3624
2b577967030b
Add a class to the "Clear message" link, make the link text smaller and lower
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3541
diff
changeset
|
629 close = d['page'].link_to(self.request, text=_('Clear message'), css_class="clear-link") |
2964
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
630 for msg, msg_class in msgs: |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
631 try: |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
632 result += u'<p>%s</p>' % msg.render() |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
633 close = '' |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
634 except AttributeError: |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
635 if msg and msg_class: |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
636 result += u'<p><div class="%s">%s</div></p>' % (msg_class, msg) |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
637 elif msg: |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
638 result += u'<p>%s</p>\n' % msg |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
639 if result: |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
640 html = result + close |
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
641 return u'<div id="message">\n%s\n</div>\n' % html |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
642 else: |
2964
49b9e807a51d
Added add_msg to the theme interface (done by Frederico Lorenzi). Should not be backported to 1.6
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2862
diff
changeset
|
643 return u'' |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
644 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
645 return u'<div id="message">\n%s\n</div>\n' % html |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
646 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
647 def trail(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
648 """ Assemble page trail |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
649 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
650 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
651 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
652 @return: trail html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
653 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
654 request = self.request |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
655 user = request.user |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
656 html = '' |
1935
740d9939ffe9
use session object to store page trail (even for anon users, if anon sessions are enabled)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1920
diff
changeset
|
657 if not user.valid or user.show_page_trail: |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
658 trail = user.getTrail() |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
659 if trail: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
660 items = [] |
153
c4c7dc546c65
ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents:
142
diff
changeset
|
661 for pagename in trail: |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
662 try: |
2728
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
663 interwiki, page = wikiutil.split_interwiki(pagename) |
59b3d8b8971f
remove (un)quoteName, new functions split_interwiki() and resolve_interwiki(), cleanup interwiki mess, fix some link markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2725
diff
changeset
|
664 if interwiki != request.cfg.interwikiname and interwiki != 'Self': |
569
6c572f52899f
fixed missing </a> formatter bug
Thomas Waldmann <tw@waldmann-edv.de>
parents:
515
diff
changeset
|
665 link = (self.request.formatter.interwikilink(True, interwiki, page) + |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
666 self.shortenPagename(page) + |
569
6c572f52899f
fixed missing </a> formatter bug
Thomas Waldmann <tw@waldmann-edv.de>
parents:
515
diff
changeset
|
667 self.request.formatter.interwikilink(False, interwiki, page)) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
668 items.append('<li>%s</li>' % link) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
669 continue |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
670 else: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
671 pagename = page |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
672 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
673 except ValueError: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
674 pass |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
675 page = Page(request, pagename) |
1782
6b9eefc1d67f
split_title: remove some more call's request param (see cs 1776)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1780
diff
changeset
|
676 title = page.split_title() |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
677 title = self.shortenPagename(title) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
678 link = page.link_to(request, title) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
679 items.append('<li>%s</li>' % link) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
680 html = ''' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
681 <ul id="pagetrail"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
682 %s |
306
4e5e4fc9f7fa
fixed rendering of modern for IE, Opera, Konqueror (as far as possible). TODO: other themes
Thomas Waldmann <tw@waldmann-edv.de>
parents:
298
diff
changeset
|
683 </ul>''' % ''.join(items) |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
684 return html |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
685 |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
686 def _stylesheet_link(self, theme, media, href, title=None): |
4449
9c1c823f4111
theme:__init__:PEP8 whitespace cleaned
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
4448
diff
changeset
|
687 """ |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
688 Create a link tag for a stylesheet. |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
689 |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
690 @param theme: True: href gives the basename of a theme stylesheet, |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
691 False: href is a full url of a user/admin defined stylesheet. |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
692 @param media: 'all', 'screen', 'print', 'projection', ... |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
693 @param href: see param theme |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
694 @param title: optional title (for alternate stylesheets), see |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
695 http://www.w3.org/Style/Examples/007/alternatives |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
696 @rtype: string |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
697 @return: stylesheet link html |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
698 """ |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
699 if theme: |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
700 href = '%s/%s/css/%s.css' % (self.cfg.url_prefix_static, self.name, href) |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
701 attrs = 'type="text/css" charset="%s" media="%s" href="%s"' % ( |
5899
d0567fba754e
escape user- or admin-defined css url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5850
diff
changeset
|
702 self.stylesheetsCharset, media, wikiutil.escape(href, True), ) |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
703 if title: |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
704 return '<link rel="alternate stylesheet" %s title="%s">' % (attrs, title) |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
705 else: |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
706 return '<link rel="stylesheet" %s>' % attrs |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
707 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
708 def html_stylesheets(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
709 """ Assemble html head stylesheet links |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
710 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
711 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
712 @rtype: string |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
713 @return: stylesheets links |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
714 """ |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
715 request = self.request |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
716 # Check mode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
717 if d.get('print_mode'): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
718 media = d.get('media', 'print') |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
719 stylesheets = getattr(self, 'stylesheets_' + media) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
720 else: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
721 stylesheets = self.stylesheets |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
722 |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
723 theme_css = [self._stylesheet_link(True, *stylesheet) for stylesheet in stylesheets] |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
724 cfg_css = [self._stylesheet_link(False, *stylesheet) for stylesheet in request.cfg.stylesheets] |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
725 |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
726 msie_css = """ |
4719
f976af4e61f1
apply msie.css only for Internet Explorer older than version 8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4481
diff
changeset
|
727 <!-- css only for MS IE6/IE7 browsers --> |
4728
4d2bc24c7723
fix typo in IE conditional comment
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4719
diff
changeset
|
728 <!--[if lt IE 8]> |
1634
2161d292e1af
move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1630
diff
changeset
|
729 %s |
2161d292e1af
move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1630
diff
changeset
|
730 <![endif]--> |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
731 """ % self._stylesheet_link(True, 'all', 'msie') |
1634
2161d292e1af
move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1630
diff
changeset
|
732 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
733 # Add user css url (assuming that user css uses same charset) |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
734 href = request.user.valid and request.user.css_url |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
735 if href and href.lower() != "none": |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
736 user_css = self._stylesheet_link(False, 'all', href) |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
737 else: |
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
738 user_css = '' |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
739 |
4447
2254e666cea3
refactored and extended theme.html_stylesheets() to make alternate stylesheets possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4353
diff
changeset
|
740 return '\n'.join(theme_css + cfg_css + [msie_css, user_css]) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
741 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
742 def shouldShowPageinfo(self, page): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
743 """ Should we show page info? |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
744 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
745 Should be implemented by actions. For now, we check here by action |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
746 name and page. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
747 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
748 @param page: current page |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
749 @rtype: bool |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
750 @return: true if should show page info |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
751 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
752 if page.exists() and self.request.user.may.read(page.page_name): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
753 # These actions show the page content. |
1832
b180f047d918
comments only: cleaned up TODO, XXX, ...
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1827
diff
changeset
|
754 # TODO: on new action, page info will not show. |
b180f047d918
comments only: cleaned up TODO, XXX, ...
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1827
diff
changeset
|
755 # A better solution will be if the action itself answer the question: showPageInfo(). |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
756 contentActions = [u'', u'show', u'refresh', u'preview', u'diff', |
1897
3d2dbe3e8a4c
shouldShowPageinfo: CopyPage added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1892
diff
changeset
|
757 u'subscribe', u'RenamePage', u'CopyPage', u'DeletePage', |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
758 u'SpellCheck', u'print'] |
1008
43279823cf24
use request.action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1003
diff
changeset
|
759 return self.request.action in contentActions |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
760 return False |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
761 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
762 def pageinfo(self, page): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
763 """ Return html fragment with page meta data |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
764 |
393
f25101c236bb
optimized footer display and print view, removed some ancient code
Thomas Waldmann <tw@waldmann-edv.de>
parents:
338
diff
changeset
|
765 Since page information uses translated text, it uses the ui |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
766 language and direction. It looks strange sometimes, but |
393
f25101c236bb
optimized footer display and print view, removed some ancient code
Thomas Waldmann <tw@waldmann-edv.de>
parents:
338
diff
changeset
|
767 translated text using page direction looks worse. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
768 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
769 @param page: current page |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
770 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
771 @return: page last edit information |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
772 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
773 _ = self.request.getText |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
774 html = '' |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
775 if self.shouldShowPageinfo(page): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
776 info = page.lastEditInfo() |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
777 if info: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
778 if info['editor']: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
779 info = _("last edited %(time)s by %(editor)s") % info |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
780 else: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
781 info = _("last modified %(time)s") % info |
393
f25101c236bb
optimized footer display and print view, removed some ancient code
Thomas Waldmann <tw@waldmann-edv.de>
parents:
338
diff
changeset
|
782 pagename = page.page_name |
f25101c236bb
optimized footer display and print view, removed some ancient code
Thomas Waldmann <tw@waldmann-edv.de>
parents:
338
diff
changeset
|
783 if self.request.cfg.show_interwiki: |
f25101c236bb
optimized footer display and print view, removed some ancient code
Thomas Waldmann <tw@waldmann-edv.de>
parents:
338
diff
changeset
|
784 pagename = "%s: %s" % (self.request.cfg.interwikiname, pagename) |
1766
2e640592bfd1
fix some unescaped uses of pagename (ported from 1.5-803/805/806)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1764
diff
changeset
|
785 info = "%s (%s)" % (wikiutil.escape(pagename), info) |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
786 html = '<p id="pageinfo" class="info"%(lang)s>%(info)s</p>\n' % { |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
787 'lang': self.ui_lang_attr(), |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
788 'info': info |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
789 } |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
790 return html |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
791 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
792 def searchform(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
793 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
794 assemble HTML code for the search forms |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
795 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
796 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
797 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
798 @return: search form html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
799 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
800 _ = self.request.getText |
4424
5ad5753ae311
pre-1.9: request.form has qs args and post data, 1.9: .form only post data, .args only qs args, .values both
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4423
diff
changeset
|
801 form = self.request.values |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
802 updates = { |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
803 'search_label': _('Search:'), |
4424
5ad5753ae311
pre-1.9: request.form has qs args and post data, 1.9: .form only post data, .args only qs args, .values both
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4423
diff
changeset
|
804 'search_value': wikiutil.escape(form.get('value', ''), 1), |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
805 'search_full_label': _('Text'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
806 'search_title_label': _('Titles'), |
4235
a6c315ff8d66
Make more use of werkzeugs Href object for URL-generation in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
4212
diff
changeset
|
807 'url': self.request.href(d['page'].page_name) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
808 } |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
809 d.update(updates) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
810 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
811 html = u''' |
4235
a6c315ff8d66
Make more use of werkzeugs Href object for URL-generation in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
4212
diff
changeset
|
812 <form id="searchform" method="get" action="%(url)s"> |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
813 <div> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
814 <input type="hidden" name="action" value="fullsearch"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
815 <input type="hidden" name="context" value="180"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
816 <label for="searchinput">%(search_label)s</label> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
817 <input id="searchinput" type="text" name="value" value="%(search_value)s" size="20" |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
818 onfocus="searchFocus(this)" onblur="searchBlur(this)" |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
819 onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
820 <input id="titlesearch" name="titlesearch" type="submit" |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
821 value="%(search_title_label)s" alt="Search Titles"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
822 <input id="fullsearch" name="fullsearch" type="submit" |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
823 value="%(search_full_label)s" alt="Search Full Text"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
824 </div> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
825 </form> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
826 <script type="text/javascript"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
827 <!--// Initialize search form |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
828 var f = document.getElementById('searchform'); |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
829 f.getElementsByTagName('label')[0].style.display = 'none'; |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
830 var e = document.getElementById('searchinput'); |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
831 searchChange(e); |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
832 searchBlur(e); |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
833 //--> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
834 </script> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
835 ''' % d |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
836 return html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
837 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
838 def showversion(self, d, **keywords): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
839 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
840 assemble HTML code for copyright and version display |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
841 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
842 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
843 @rtype: string |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
844 @return: copyright and version display html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
845 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
846 html = '' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
847 if self.cfg.show_version and not keywords.get('print_mode', 0): |
669
e3b84c7488e8
show_version shows version info similar to SystemInfo now
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
622
diff
changeset
|
848 html = (u'<div id="version">MoinMoin Release %s [Revision %s], ' |
3488
f3c50edd219c
theme showversion: remove year, add 'et al.'
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3473
diff
changeset
|
849 'Copyright by Juergen Hermann et al.</div>') % (version.release, version.revision, ) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
850 return html |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
851 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
852 def headscript(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
853 """ Return html head script with common functions |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
854 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
855 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
856 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
857 @return: script for html head |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
858 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
859 # Don't add script for print view |
1008
43279823cf24
use request.action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1003
diff
changeset
|
860 if self.request.action == 'print': |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
861 return u'' |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
862 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
863 _ = self.request.getText |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
864 script = u""" |
1425
b1c380a4cdb0
move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1419
diff
changeset
|
865 <script type="text/javascript"> |
b1c380a4cdb0
move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1419
diff
changeset
|
866 <!-- |
b1c380a4cdb0
move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1419
diff
changeset
|
867 var search_hint = "%(search_hint)s"; |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
868 //--> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
869 </script> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
870 """ % { |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
871 'search_hint': _('Search'), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
872 } |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
873 return script |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
874 |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
875 def shouldUseRSS(self, page): |
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
876 """ Return True if RSS feature is available and we are on the |
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
877 RecentChanges page, or False. |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
878 |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
879 Currently rss is broken on plain Python, and works only when |
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
880 installing PyXML. Return true if PyXML is installed. |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
881 """ |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
882 if not rss_supported: |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
883 return False |
5849
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
884 return page.page_name in [u'RecentChanges', |
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
885 self.request.getText(u'RecentChanges'), |
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
886 self.request.cfg.page_front_page, |
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
887 self.request.getText(self.request.cfg.page_front_page)] |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
888 |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
889 def rsshref(self, page): |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
890 """ Create rss href, used for rss button and head link |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
891 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
892 @rtype: unicode |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
893 @return: rss href |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
894 """ |
1382
c3c8ff25e979
make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1354
diff
changeset
|
895 request = self.request |
1813
dca96e7c8199
reuse existing page object
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1808
diff
changeset
|
896 url = page.url(request, querystr={ |
3234
a739558ca3dc
Page.url() default changed to relative=False
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3164
diff
changeset
|
897 'action': 'rss_rc', 'ddiffs': '1', 'unique': '1', }, escape=0) |
1382
c3c8ff25e979
make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1354
diff
changeset
|
898 return url |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
899 |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
900 def rsslink(self, d): |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
901 """ Create rss link in head, used by FireFox |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
902 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
903 RSS link for FireFox. This shows an rss link in the bottom of |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
904 the page and let you subscribe to the wiki rss feed. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
905 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
906 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
907 @return: html head |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
908 """ |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
909 link = u'' |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
910 page = d['page'] |
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
911 if self.shouldUseRSS(page): |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
912 link = (u'<link rel="alternate" title="%s Recent Changes" ' |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
913 u'href="%s" type="application/rss+xml">') % ( |
3273
9c6900a92a64
more wikiutil.escape fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3270
diff
changeset
|
914 wikiutil.escape(self.cfg.sitename, True), |
9c6900a92a64
more wikiutil.escape fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3270
diff
changeset
|
915 wikiutil.escape(self.rsshref(page), True) ) |
5850
8b4f02226670
Option which gives ability to turn off addition of page history RSS feed link added.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5849
diff
changeset
|
916 elif rss_supported and self.cfg.rss_show_page_history_link: |
5849
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
917 link = (u'<link rel="alternate" title="%s: %s" ' |
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
918 u'href="%s" type="application/rss+xml">') % ( |
5900
c98ec456e493
fix XSS issue, escape page name in rss link
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5899
diff
changeset
|
919 wikiutil.escape(self.cfg.sitename, True), |
c98ec456e493
fix XSS issue, escape page name in rss link
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
5899
diff
changeset
|
920 wikiutil.escape(page.page_name, True), |
5849
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
921 wikiutil.escape(page.url(self.request, querystr={ |
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
922 'action': 'rss_rc', 'ddiffs': '1', 'unique': '0', |
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
923 'diffs': '1', 'show_att': '1', |
f7a570f3c1cb
theme: added RC RSS link for the front page, added page history RSS link for all other pages.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents:
5707
diff
changeset
|
924 'page': page.page_name }, escape=0), True) ) |
70
36a2541550aa
src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents:
64
diff
changeset
|
925 return link |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
926 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
927 def html_head(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
928 """ Assemble html head |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
929 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
930 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
931 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
932 @return: html head |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
933 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
934 html = [ |
3273
9c6900a92a64
more wikiutil.escape fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3270
diff
changeset
|
935 u'<title>%(title)s - %(sitename)s</title>' % { |
9c6900a92a64
more wikiutil.escape fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3270
diff
changeset
|
936 'title': wikiutil.escape(d['title']), |
9c6900a92a64
more wikiutil.escape fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3270
diff
changeset
|
937 'sitename': wikiutil.escape(d['sitename']), |
9c6900a92a64
more wikiutil.escape fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3270
diff
changeset
|
938 }, |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
939 self.externalScript('common'), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
940 self.headscript(d), # Should move to separate .js file |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
941 self.guiEditorScript(d), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
942 self.html_stylesheets(d), |
1764
885c97f7ba37
RSS feed: do not announce on any page, but only on RC and _(RC) (ported from 1.5-801)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1752
diff
changeset
|
943 self.rsslink(d), |
3723
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
944 self.universal_edit_button(d), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
945 ] |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
946 return '\n'.join(html) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
947 |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
948 def externalScript(self, name): |
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
949 """ Format external script html """ |
1318
760002b5ffa3
use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1015
diff
changeset
|
950 src = '%s/common/js/%s.js' % (self.request.cfg.url_prefix_static, name) |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
951 return '<script type="text/javascript" src="%s"></script>' % src |
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
952 |
3723
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
953 def universal_edit_button(self, d, **keywords): |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
954 """ Generate HTML for an edit link in the header.""" |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
955 page = d['page'] |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
956 if 'edit' in self.request.cfg.actions_excluded: |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
957 return "" |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
958 if not (page.isWritable() and |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
959 self.request.user.may.write(page.page_name)): |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
960 return "" |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
961 _ = self.request.getText |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
962 querystr = {'action': 'edit'} |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
963 text = _(u'Edit') |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
964 url = page.url(self.request, querystr=querystr, escape=0) |
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
965 return (u'<link rel="alternate" type="application/wiki" ' |
4091
087eac1e1497
fix application/wiki link rel to be html4
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3814
diff
changeset
|
966 u'title="%s" href="%s">' % (text, url)) |
3723
7d77145af210
ThemeBase: add a <link> in the <header> for the editor
Radomir Dopieralski <moindev@sheep.art.pl>
parents:
3624
diff
changeset
|
967 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
968 def credits(self, d, **keywords): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
969 """ Create credits html from credits list """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
970 if isinstance(self.cfg.page_credits, (list, tuple)): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
971 items = ['<li>%s</li>' % i for i in self.cfg.page_credits] |
306
4e5e4fc9f7fa
fixed rendering of modern for IE, Opera, Konqueror (as far as possible). TODO: other themes
Thomas Waldmann <tw@waldmann-edv.de>
parents:
298
diff
changeset
|
972 html = '<ul id="credits">\n%s\n</ul>\n' % ''.join(items) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
973 else: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
974 # Old config using string, output as is |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
975 html = self.cfg.page_credits |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
976 return html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
977 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
978 def actionsMenu(self, page): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
979 """ Create actions menu list and items data dict |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
980 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
981 The menu will contain the same items always, but items that are |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
982 not available will be disabled (some broken browsers will let |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
983 you select disabled options though). |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
984 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
985 The menu should give best user experience for javascript |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
986 enabled browsers, and acceptable behavior for those who prefer |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
987 not to use Javascript. |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
988 |
1832
b180f047d918
comments only: cleaned up TODO, XXX, ...
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1827
diff
changeset
|
989 TODO: Move actionsMenuInit() into body onload - requires that the theme will render body, |
b180f047d918
comments only: cleaned up TODO, XXX, ...
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1827
diff
changeset
|
990 it is currently done in wikiutil/page. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
991 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
992 @param page: current page, Page object |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
993 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
994 @return: actions menu html fragment |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
995 """ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
996 request = self.request |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
997 _ = request.getText |
1683
964fa7d0de32
action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1634
diff
changeset
|
998 rev = request.rev |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
999 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1000 menu = [ |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1001 'raw', |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1002 'print', |
493
993d53631fee
make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents:
490
diff
changeset
|
1003 'RenderAsDocbook', |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1004 'refresh', |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1005 '__separator__', |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1006 'SpellCheck', |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1007 'LikePages', |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1008 'LocalSiteMap', |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1009 '__separator__', |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1010 'RenamePage', |
1850
3d38db210672
action CopyPage added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1843
diff
changeset
|
1011 'CopyPage', |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1012 'DeletePage', |
493
993d53631fee
make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents:
490
diff
changeset
|
1013 '__separator__', |
993d53631fee
make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents:
490
diff
changeset
|
1014 'MyPages', |
993d53631fee
make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents:
490
diff
changeset
|
1015 'SubscribeUser', |
993d53631fee
make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents:
490
diff
changeset
|
1016 '__separator__', |
993d53631fee
make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents:
490
diff
changeset
|
1017 'Despam', |
1683
964fa7d0de32
action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1634
diff
changeset
|
1018 'revert', |
493
993d53631fee
make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents:
490
diff
changeset
|
1019 'PackagePages', |
1808
e43e65d90f26
action menu: speed up, add entry for SyncPages, longer separator
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1802
diff
changeset
|
1020 'SyncPages', |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1021 ] |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1022 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1023 titles = { |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1024 # action: menu title |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1025 '__title__': _("More Actions:"), |
64
6483a586208d
better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents:
33
diff
changeset
|
1026 # Translation may need longer or shorter separator |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1027 '__separator__': _('------------------------'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1028 'raw': _('Raw Text'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1029 'print': _('Print View'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1030 'refresh': _('Delete Cache'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1031 'SpellCheck': _('Check Spelling'), # rename action! |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1032 'RenamePage': _('Rename Page'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1033 'CopyPage': _('Copy Page'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1034 'DeletePage': _('Delete Page'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1035 'LikePages': _('Like Pages'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1036 'LocalSiteMap': _('Local Site Map'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1037 'MyPages': _('My Pages'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1038 'SubscribeUser': _('Subscribe User'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1039 'Despam': _('Remove Spam'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1040 'revert': _('Revert to this revision'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1041 'PackagePages': _('Package Pages'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1042 'RenderAsDocbook': _('Render as Docbook'), |
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1043 'SyncPages': _('Sync Pages'), |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1044 } |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1045 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1046 options = [] |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1047 option = '<option value="%(action)s"%(disabled)s>%(title)s</option>' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1048 # class="disabled" is a workaround for browsers that ignore |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1049 # "disabled", e.g IE, Safari |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1050 # for XHTML: data['disabled'] = ' disabled="disabled"' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1051 disabled = ' disabled class="disabled"' |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1052 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1053 # Format standard actions |
4173
051391d5662d
Remove deprecated calls to request.getAvailableActions
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
4170
diff
changeset
|
1054 available = get_available_actions(request.cfg, page, request.user) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1055 for action in menu: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1056 data = {'action': action, 'disabled': '', 'title': titles[action]} |
3527
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
1057 # removes excluded actions from the more actions menu |
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
1058 if action in request.cfg.actions_excluded: |
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
1059 continue |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1060 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1061 # Enable delete cache only if page can use caching |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1062 if action == 'refresh': |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1063 if not page.canUseCache(): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1064 data['action'] = 'show' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1065 data['disabled'] = disabled |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1066 |
3472
4abf8492a665
theme.__init__:revert action enabled only if user can revert
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3428
diff
changeset
|
1067 # revert action enabled only if user can revert |
4abf8492a665
theme.__init__:revert action enabled only if user can revert
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3428
diff
changeset
|
1068 if action == 'revert' and not request.user.may.revert(page.page_name): |
4abf8492a665
theme.__init__:revert action enabled only if user can revert
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3428
diff
changeset
|
1069 data['action'] = 'show' |
4abf8492a665
theme.__init__:revert action enabled only if user can revert
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3428
diff
changeset
|
1070 data['disabled'] = disabled |
4abf8492a665
theme.__init__:revert action enabled only if user can revert
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3428
diff
changeset
|
1071 |
3473
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1072 # SubscribeUser action enabled only if user has admin rights |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1073 if action == 'SubscribeUser' and not request.user.may.admin(page.page_name): |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1074 data['action'] = 'show' |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1075 data['disabled'] = disabled |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1076 |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1077 # Despam action enabled only for superusers |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1078 if action == 'Despam' and not request.user.isSuperUser(): |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1079 data['action'] = 'show' |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1080 data['disabled'] = disabled |
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1081 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1082 # Special menu items. Without javascript, executing will |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1083 # just return to the page. |
3473
59a4005672d3
theme.__init__: action enabled dependent of rights
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3472
diff
changeset
|
1084 if action.startswith('__'): |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1085 data['action'] = 'show' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1086 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1087 # Actions which are not available for this wiki, user or page |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1088 if (action == '__separator__' or |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1089 (action[0].isupper() and not action in available)): |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1090 data['disabled'] = disabled |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1091 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1092 options.append(option % data) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1093 |
453
493972205fac
removed duplicate AttachFile entry in actions menu
Thomas Waldmann <tw@waldmann-edv.de>
parents:
393
diff
changeset
|
1094 # Add custom actions not in the standard menu, except for |
493972205fac
removed duplicate AttachFile entry in actions menu
Thomas Waldmann <tw@waldmann-edv.de>
parents:
393
diff
changeset
|
1095 # some actions like AttachFile (we have them on top level) |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1096 more = [item for item in available if not item in titles and not item in ('AttachFile', )] |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1097 more.sort() |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1098 if more: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1099 # Add separator |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1100 separator = option % {'action': 'show', 'disabled': disabled, |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1101 'title': titles['__separator__']} |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1102 options.append(separator) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1103 # Add more actions (all enabled) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1104 for action in more: |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1105 data = {'action': action, 'disabled': ''} |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1106 # Always add spaces: AttachFile -> Attach File |
1808
e43e65d90f26
action menu: speed up, add entry for SyncPages, longer separator
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1802
diff
changeset
|
1107 # XXX do not create page just for using split_title - |
2775 | 1108 # creating pages for non-existent does 2 storage lookups |
1808
e43e65d90f26
action menu: speed up, add entry for SyncPages, longer separator
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1802
diff
changeset
|
1109 #title = Page(request, action).split_title(force=1) |
e43e65d90f26
action menu: speed up, add entry for SyncPages, longer separator
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1802
diff
changeset
|
1110 title = action |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1111 # Use translated version if available |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1112 data['title'] = _(title) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1113 options.append(option % data) |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1114 |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1115 data = { |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1116 'label': titles['__title__'], |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1117 'options': '\n'.join(options), |
1683
964fa7d0de32
action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1634
diff
changeset
|
1118 'rev_field': rev and '<input type="hidden" name="rev" value="%d">' % rev or '', |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1119 'do_button': _("Do"), |
4235
a6c315ff8d66
Make more use of werkzeugs Href object for URL-generation in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
4212
diff
changeset
|
1120 'url': self.request.href(page.page_name) |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1121 } |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1122 html = ''' |
4235
a6c315ff8d66
Make more use of werkzeugs Href object for URL-generation in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
4212
diff
changeset
|
1123 <form class="actionsmenu" method="GET" action="%(url)s"> |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1124 <div> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1125 <label>%(label)s</label> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1126 <select name="action" |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1127 onchange="if ((this.selectedIndex != 0) && |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1128 (this.options[this.selectedIndex].disabled == false)) { |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1129 this.form.submit(); |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1130 } |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1131 this.selectedIndex = 0;"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1132 %(options)s |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1133 </select> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1134 <input type="submit" value="%(do_button)s"> |
1683
964fa7d0de32
action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1634
diff
changeset
|
1135 %(rev_field)s |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1136 </div> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1137 <script type="text/javascript"> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1138 <!--// Init menu |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1139 actionsMenuInit('%(label)s'); |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1140 //--> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1141 </script> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1142 </form> |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1143 ''' % data |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1144 |
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1145 return html |
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1146 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1147 def editbar(self, d): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1148 """ Assemble the page edit bar. |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1149 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1150 Create html on first call, then return cached html. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1151 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1152 @param d: parameter dictionary |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1153 @rtype: unicode |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1154 @return: iconbar html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1155 """ |
622
8fba6d15a2f5
make request.(html_)formatter available early and use it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
620
diff
changeset
|
1156 page = d['page'] |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1157 if not self.shouldShowEditbar(page): |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1158 return '' |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1159 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1160 html = self._cache.get('editbar') |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1161 if html is None: |
4346
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1162 # Remove empty items and format as list. The item for showing inline comments |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1163 # is hidden by default. It gets activated through javascript only if inline |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1164 # comments exist on the page. |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1165 items = [] |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1166 for item in self.editbarItems(page): |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1167 if item: |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1168 if 'nbcomment' in item: |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1169 # hiding the complete list item is cosmetically better than just |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1170 # hiding the contents (e.g. for sidebar themes). |
4353
df1ba1ddf050
bumped version to 1.8.0beta3, minor PEP8 fix
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4346
diff
changeset
|
1171 items.append('<li class="toggleCommentsButton" style="display:none;">%s</li>' % item) |
4346
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1172 else: |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1173 items.append('<li>%s</li>' % item) |
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1174 html = u'<ul class="editbar">%s</ul>\n' % ''.join(items) |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1175 self._cache['editbar'] = html |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1176 |
0
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1177 return html |
77665d8e2254
tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff
changeset
|
1178 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1179 def shouldShowEditbar(self, page): |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1180 """ Should we show the editbar? |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1181 |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1182 Actions should implement this, because only the action knows if |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1183 the edit bar makes sense. Until it goes into actions, we do the |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1184 checking here. |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1185 |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1186 @param page: current page |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1187 @rtype: bool |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1188 @return: true if editbar should show |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1189 """ |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1190 # Show editbar only for existing pages, including deleted pages, |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1191 # that the user may read. If you may not read, you can't edit, |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1192 # so you don't need editbar. |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1193 if (page.exists(includeDeleted=1) and |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1194 self.request.user.may.read(page.page_name)): |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1195 form = self.request.form |
1008
43279823cf24
use request.action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1003
diff
changeset
|
1196 action = self.request.action |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1197 # Do not show editbar on edit but on save/cancel |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1198 return not (action == 'edit' and |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1199 not form.has_key('button_save') and |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1200 not form.has_key('button_cancel')) |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1201 return False |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1202 |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1203 def editbarItems(self, page): |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1204 """ Return list of items to show on the editbar |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
1205 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1206 This is separate method to make it easy to customize the |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1207 edtibar in sub classes. |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1208 """ |
1752
6f8360e1a4bb
wrapping div support for wiki parser, toggling display of comment divs, show_comments user prefs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1747
diff
changeset
|
1209 _ = self.request.getText |
1742
7b419bd3b2cf
theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1735
diff
changeset
|
1210 editbar_actions = [] |
7b419bd3b2cf
theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1735
diff
changeset
|
1211 for editbar_item in self.request.cfg.edit_bar: |
4448
a0864c9c4752
theme:__init__: fixed and simplified getPragma calls for supplementation
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
4447
diff
changeset
|
1212 if (editbar_item == 'Discussion' and |
a0864c9c4752
theme:__init__: fixed and simplified getPragma calls for supplementation
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
4447
diff
changeset
|
1213 (self.request.getPragma('supplementation-page', self.request.cfg.supplementation_page) |
a0864c9c4752
theme:__init__: fixed and simplified getPragma calls for supplementation
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
4447
diff
changeset
|
1214 in (True, 1, 'on', '1'))): |
1920
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1215 editbar_actions.append(self.supplementation_page_nameLink(page)) |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1216 elif editbar_item == 'Comments': |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1217 # we just use <a> to get same style as other links, but we add some dummy |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1218 # link target to get correct mouseover pointer appearance. return false |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1219 # keeps the browser away from jumping to the link target:: |
4346
dfb09cf670f9
fix editbar hidden comment link cosmetics for sidebar themes (hide the complete list element)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
4091
diff
changeset
|
1220 editbar_actions.append('<a href="#" class="nbcomment" onClick="toggleComments();return false;">%s</a>' % _('Comments')) |
1920
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1221 elif editbar_item == 'Edit': |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1222 editbar_actions.append(self.editorLink(page)) |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1223 elif editbar_item == 'Info': |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1224 editbar_actions.append(self.infoLink(page)) |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1225 elif editbar_item == 'Subscribe': |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1226 editbar_actions.append(self.subscribeLink(page)) |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1227 elif editbar_item == 'Quicklink': |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1228 editbar_actions.append(self.quicklinkLink(page)) |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1229 elif editbar_item == 'Attachments': |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1230 editbar_actions.append(self.attachmentsLink(page)) |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1231 elif editbar_item == 'ActionsMenu': |
b06ef2a53efa
'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1918
diff
changeset
|
1232 editbar_actions.append(self.actionsMenu(page)) |
1742
7b419bd3b2cf
theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1735
diff
changeset
|
1233 return editbar_actions |
1730
7487f00da9bc
theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1715
diff
changeset
|
1234 |
7487f00da9bc
theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1715
diff
changeset
|
1235 def supplementation_page_nameLink(self, page): |
3038
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1236 """Return a link to the discussion page |
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1237 |
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1238 If the discussion page doesn't exist and the user |
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1239 has no right to create it, show a disabled link. |
3070 | 1240 """ |
1730
7487f00da9bc
theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
1715
diff
changeset
|
1241 _ = self.request.getText |
3038
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1242 suppl_name = self.request.cfg.supplementation_page_name |
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1243 suppl_name_full = "%s/%s" % (page.page_name, suppl_name) |
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1244 |
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1245 test = Page(self.request, suppl_name_full) |
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1246 if not test.exists() and not self.request.user.may.write(suppl_name_full): |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1247 return ('<span class="disabled">%s</span>' % _(suppl_name)) |
3038
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1248 else: |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1249 return page.link_to(self.request, text=_(suppl_name), |
3038
07ab9d4b8bb8
bug fix for 1.6.0SupplementationAndAccessRights (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3036
diff
changeset
|
1250 querystr={'action': 'supplementation'}, css_class='nbsupplementation', rel='nofollow') |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1251 |
286
08cd0e9b9369
do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents:
237
diff
changeset
|
1252 def guiworks(self, page): |
08cd0e9b9369
do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents:
237
diff
changeset
|
1253 """ Return whether the gui editor / converter can work for that page. |
08cd0e9b9369
do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents:
237
diff
changeset
|
1254 |
08cd0e9b9369
do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents:
237
diff
changeset
|
1255 The GUI editor currently only works for wiki format. |
3000
344e33587519
do not show 2 editor links in edit_bar if text editor is forced by admin (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2996
diff
changeset
|
1256 For simplicity, we also tell it does not work if the admin forces the text editor. |
286
08cd0e9b9369
do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents:
237
diff
changeset
|
1257 """ |
3000
344e33587519
do not show 2 editor links in edit_bar if text editor is forced by admin (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2996
diff
changeset
|
1258 is_wiki = page.pi['format'] == 'wiki' |
344e33587519
do not show 2 editor links in edit_bar if text editor is forced by admin (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2996
diff
changeset
|
1259 gui_disallowed = self.cfg.editor_force and self.cfg.editor_default == 'text' |
344e33587519
do not show 2 editor links in edit_bar if text editor is forced by admin (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2996
diff
changeset
|
1260 return is_wiki and not gui_disallowed |
344e33587519
do not show 2 editor links in edit_bar if text editor is forced by admin (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2996
diff
changeset
|
1261 |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1262 |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
1263 def editorLink(self, page): |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1264 """ Return a link to the editor |
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1265 |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
1266 If the user can't edit, return a disabled edit link. |
2286
01f05e74aa9c
Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
2197
diff
changeset
|
1267 |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
1268 If the user want to show both editors, it will display "Edit |
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
1269 (Text)", otherwise as "Edit". |
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
1270 """ |
3527
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
1271 if 'edit' in self.request.cfg.actions_excluded: |
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
1272 return "" |
ca50da801291
theme.__init__: removes excluded actions from theme
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
3510
diff
changeset
|
1273 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1274 if not (page.isWritable() and |
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1275 self.request.user.may.write(page.page_name)): |
128
2fba84615be7
create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents:
124
diff
changeset
|
1276 return self.disabledEdit() |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1277 |
98
8375a3795ff8
theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents:
97
diff
changeset
|
1278 _ = self.request.getText |
1015
e527eea93da5
make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
1010
diff
changeset
|
1279 querystr = {'action': 'edit'} |
1003
e8aef4cb2b34
whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
992
diff
changeset
|
1280 |
286
08cd0e9b9369
do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents:
237
diff
changeset
|
1281 guiworks = self.guiworks(page) |
08cd0e9b9369
do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents:
237
diff
changeset
|
1282 if self.showBothEditLinks() and guiworks: |
3164
c25bc6e9ad61
i18n.getText: removing wrong (old) kw arguments from _() calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
3139
diff
changeset
|
1283 text = _('Edit (Text)') |
1015
e527eea93da5
make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: |