annotate MoinMoin/theme/__init__.py @ 1782:6b9eefc1d67f

split_title: remove some more call's request param (see cs 1776)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 18 Feb 2007 22:57:15 +0100
parents c08e0c98a0cd
children 2668d470091f
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
1683
964fa7d0de32 action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1634
diff changeset
5 @copyright: 2003-2006 by 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
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
9 from MoinMoin import i18n, wikiutil, config, version
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10 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
11 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
12
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13 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
14
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
15 # Check whether we can emit a RSS feed (code stolen from wikitest.py).
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
16 # Currently RSS is broken on plain Python, and works only when installing PyXML.
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
17 import xml
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
18 rss_supported = '_xmlplus' in xml.__file__
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
19
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
20
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
21 class ThemeBase:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
22 """ Base class for themes
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
23
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
24 This class supply all the standard template that sub classes can
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
25 use without rewriting the same code. If you want to change certain
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
26 elements, override them.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
27 """
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
28
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
29 name = 'base'
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
30
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
31 # 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
32 _ = lambda x: x
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
33
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
34 # 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
35 icons = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
36 # 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
37 # ------------------------------------------------------------------
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
38 # navibar
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
39 'help': ("%(page_help_contents)s", "moin-help.png", 12, 11),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
40 'find': ("%(page_find_page)s", "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
41 'diff': (_("Diffs"), "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
42 'info': (_("Info"), "moin-info.png", 12, 11),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
43 'edit': (_("Edit"), "moin-edit.png", 12, 12),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
44 'unsubscribe':(_("Unsubscribe"), "moin-unsubscribe.png", 14, 10),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
45 'subscribe': (_("Subscribe"), "moin-subscribe.png",14, 10),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
46 'raw': (_("Raw"), "moin-raw.png", 12, 13),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
47 'xml': (_("XML"), "moin-xml.png", 20, 13),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
48 'print': (_("Print"), "moin-print.png", 16, 14),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
49 'view': (_("View"), "moin-show.png", 12, 13),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
50 'home': (_("Home"), "moin-home.png", 13, 12),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
51 'up': (_("Up"), "moin-parent.png", 15, 13),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
52 # FileAttach
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
53 'attach': ("%(attach_count)s", "moin-attach.png", 7, 15),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
54 # RecentChanges
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
55 'rss': (_("[RSS]"), "moin-rss.png", 36, 14),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
56 'deleted': (_("[DELETED]"), "moin-deleted.png",60, 12),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
57 'updated': (_("[UPDATED]"), "moin-updated.png",60, 12),
1746
1aa9dfd0ad34 added conflict and rename icon
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1735
diff changeset
58 'renamed': (_("[RENAMED]"), "moin-renamed.png",60, 12),
1aa9dfd0ad34 added conflict and rename icon
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1735
diff changeset
59 '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
60 '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
61 '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
62 # General
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
63 '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
64 '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
65 '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
66 '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
67 '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
68 '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
69 '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
70 '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
71 # search forms
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
72 '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
73 '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
74
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
75 # 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
76 # 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
77 #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
78 '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
79 ':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
80 '<:(': ("<:(", '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
81 ':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
82 ':(': (":(", '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
83 ':)': (":)", '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
84 '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
85 ':))': (":))", '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
86 ';)': (";)", '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
87 '/!\\': ("/!\\", '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
88 '<!>': ("<!>", '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
89 '(!)': ("(!)", '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
90
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 # 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
92 ':-?': (":-?", '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
93 ':\\': (":\\", '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
94 '>:>': (">:>", '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
95 '|)': ("|)", '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
96
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
97 # 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
98 ':-(': (":-(", '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
99 ':-)': (":-)", '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
100 '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
101 ':-))': (":-))", '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
102 ';-)': (";-)", '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
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 # 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
106 '(./)': ("(./)", '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
107 '{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
108 '{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
109 '{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
110 '{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
111 '{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
112 '{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
113
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 # 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
115 # 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
116 '{*}': ("{*}", '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
117 '{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
118 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
119 del _
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
120
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
121 # 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
122 # 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
123
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
124 # 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
125 stylesheets = (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
126 # media basename
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
127 ('all', 'common'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
128 ('screen', 'screen'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
129 ('print', 'print'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
130 ('projection', 'projection'),
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
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
133 # 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
134 stylesheets_print = (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
135 # media basename
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
136 ('all', 'common'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
137 ('all', 'print'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
138 )
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 # 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
141 stylesheets_projection = (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
142 # media basename
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
143 ('all', 'common'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
144 ('all', 'projection'),
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
145 )
0
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 stylesheetsCharset = 'utf-8'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
148
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
149 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
150 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
151 Initialize the theme object.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
152
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
153 @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
154 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
155 self.request = request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
156 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
157 self._cache = {} # Used to cache elements that may be used several times
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 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
160 """ 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
161
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
162 @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
163 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
164 @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
165 """
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
166 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
167
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
168 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
169 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
170 generate custom HTML code in `html`
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 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
173 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
174 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
175 @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
176 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
177 if html:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
178 if callable(html): html = html(self.request)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
179 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
180
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
181 def logo(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
182 """ 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
183
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
184 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
185 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
186 a div with id="logo".
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
187
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
188 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
189 @return: logo html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
190 """
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
191 html = u''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
192 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
193 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
194 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
195 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
196 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
197
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
198 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
199 """ Assemble the interwiki name display, linking to page_front_page
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
200
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
201 @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
202 @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
203 @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
204 """
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
205 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
206 page = wikiutil.getFrontPage(self.request)
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
207 text = self.request.cfg.interwikiname or 'Self'
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
208 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
209 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
210 else:
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
211 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
212 return html
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
213
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
214 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
215 """ Assemble the title (now using breadcrumbs)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
216
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
217 @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
218 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
219 @return: title html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
220 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
221 _ = self.request.getText
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
222 content = []
1354
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
223 if d['title_text'] == d['page_name']: # 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
224 curpage = ''
182
10e033440008 fixed theme title for 'Add spaces to displayed wiki names' setting
Thomas Waldmann <tw@waldmann-edv.de>
parents: 174
diff changeset
225 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
226 for s in segments[:-1]:
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
227 curpage += s
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
228 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
229 curpage += '/'
1354
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
230 link_text = segments[-1]
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
231 link_title = _('Click to do a full-text search for this title')
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
232 link_query = {
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
233 'action': 'fullsearch',
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
234 'value': 'linkto:"%s"' % d['page_name'],
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
235 'context': '180',
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
236 }
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
237 # we dont use d['title_link'] any more, but make it ourselves:
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
238 link = d['page'].link_to(self.request, link_text, querystr=link_query, title=link_title, css_class='backlink', rel='nofollow')
26949e36ca0b move code for title_link to theme, better escape warning
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1347
diff changeset
239 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
240 else:
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
241 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
242
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
243 html = '''
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
244 <ul id="pagelocation">
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
245 %s
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
246 </ul>
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
247 ''' % "".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
248 return html
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
249
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
250 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
251 """ Assemble the username / userprefs link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
252
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
253 @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
254 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
255 @return: username html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
256 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
257 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
258 _ = request.getText
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
259
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
260 userlinks = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
261 # 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
262 # 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
263 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
264 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
265 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
266 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
267 if not aliasname:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
268 aliasname = name
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
269 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
270 # 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
271 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
272 request.formatter.text(name) +
569
6c572f52899f fixed missing </a> formatter bug
Thomas Waldmann <tw@waldmann-edv.de>
parents: 515
diff changeset
273 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
274 userlinks.append(homelink)
511
8ee8ced7dded moved UserPreferences back to header, add Cancel button
Thomas Waldmann <tw@waldmann-edv.de>
parents: 493
diff changeset
275 # link to userprefs action
512
3ede5fa7001a shorter name for User Preferences, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents: 511
diff changeset
276 userlinks.append(d['page'].link_to(request, text=_('Preferences'),
869
0152984f76ee use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 826
diff changeset
277 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
278
297
fe57f191672e make login/logout showing configurable, update CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 296
diff changeset
279 if request.cfg.show_login:
296
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
280 if request.user.valid:
483
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents: 471
diff changeset
281 userlinks.append(d['page'].link_to(request, text=_('Logout', formatted=False),
869
0152984f76ee use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 826
diff changeset
282 querystr={'action': 'logout', 'logout': 'logout'}, id='logout', rel='nofollow'))
296
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
283 else:
483
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents: 471
diff changeset
284 userlinks.append(d['page'].link_to(request, text=_("Login", formatted=False),
869
0152984f76ee use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 826
diff changeset
285 querystr={'action': 'login'}, id='login', rel='nofollow'))
296
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
286
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
287 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
288 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
289 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
290
237
ccfa707e7064 added builtin support for linking irc:// URLs
Thomas Waldmann <tw@waldmann-edv.de>
parents: 221
diff changeset
291 # Schemas supported in toolbar links, using [url label] format
1692
73f12c0dda0d support for ircs: URLs (thanks to Thilo Pfennig)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1684
diff changeset
292 linkSchemas = [r'http://', r'https://', r'ftp://', 'mailto:', r'irc://', r'ircs://', ] + \
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
293 [x + ':' for x in config.url_schemas]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
294
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
295 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
296 """ 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
297
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
298 Admin or user might want to use shorter navibar items by using
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
299 the [page title] or [url title] syntax. In this case, we don't
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
300 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
301 the localized version of page.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
302
1630
9a8fdd5a03d3 theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1560
diff changeset
303 TODO: refactor/cleanup!
9a8fdd5a03d3 theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1560
diff changeset
304 * the ItemCache is seeing 3 requests for a normal navi_bar entry
9a8fdd5a03d3 theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1560
diff changeset
305 * for user quicklinks stuff, ItemCache is seeing a 1st request for
9a8fdd5a03d3 theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1560
diff changeset
306 WikiName:PageName, then a 2nd (correct) one for PageName
9a8fdd5a03d3 theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1560
diff changeset
307 * page object gets recreated at the end, although we already have
9a8fdd5a03d3 theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1560
diff changeset
308 one for some cases
9a8fdd5a03d3 theme code: add comment for refactoring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1560
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 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
311 @rtype: tuple
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
312 @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
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
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
315
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
316 # Handle [pagename title] or [url title] formats
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
317 if text.startswith('[') and text.endswith(']'):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
318 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
319 pagename, title = text[1:-1].strip().split(' ', 1)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
320 title = title.strip()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
321 localize = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
322 except (ValueError, TypeError):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
323 # Just use the text as is.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
324 pagename = title = text
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
325
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
326 # Handle regular pagename like "FrontPage"
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
327 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
328 # Use localized pages for the current user
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
329 if localize:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
330 page = wikiutil.getSysPage(request, text)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
331 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
332 page = Page(request, text)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
333 pagename = page.page_name
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
334 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
335 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
336 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
337
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
338
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
339 from MoinMoin import config
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
340 for scheme in self.linkSchemas:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
341 if pagename.startswith(scheme):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
342 title = wikiutil.escape(title)
1382
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
343 link = self.request.formatter.url(1, pagename) + \
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
344 self.request.formatter.text(title) +\
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
345 self.request.formatter.url(0)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
346 return pagename, link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
347
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
348 # 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
349 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
350 pagename = pagename[5:]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
351
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
352 # 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
353 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
354 interwiki, page = pagename.split(':', 1)
22
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
355 thiswiki = request.cfg.interwikiname
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
356 if interwiki == thiswiki:
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
357 pagename = page
23
aee8b13fbb0b quicklinks: only use pagename as title, if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 22
diff changeset
358 title = page
22
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
359 else:
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
360 return (pagename,
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
361 self.request.formatter.interwikilink(True, interwiki, page) +
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
362 page +
569
6c572f52899f fixed missing </a> formatter bug
Thomas Waldmann <tw@waldmann-edv.de>
parents: 515
diff changeset
363 self.request.formatter.interwikilink(False, interwiki, page)
22
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
364 )
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
365
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
366 except ValueError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
367 pass
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
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 pagename = request.normalizePagename(pagename)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
370 link = Page(request, pagename).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
371
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
372 return pagename, link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
373
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
374 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
375 """ Shorten page names
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
376
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
377 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
378 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
379 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
380
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
381 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
382 different algorithm, override this method.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
383
490
ca35d9e6d63e eypdoc comments: fixed some warnings/errors
Thomas Waldmann <tw@waldmann-edv.de>
parents: 483
diff changeset
384 @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
385 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
386 @return: shortened version.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
387 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
388 maxLength = self.maxPagenameLength()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
389 # 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
390 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
391 name = name.split('/')[-1]
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
392 # 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
393 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
394 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
395 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
396 return name
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
397
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
398 def maxPagenameLength(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
399 """ 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
400 return 25
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
401
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
402 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
403 """ Assemble the navibar
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
404
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
405 @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
406 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
407 @return: navibar html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
408 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
409 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
410 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
411 items = [] # navibar items
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
412 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
413 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
414
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
415 # 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
416 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
417 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
418 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
419 if pagename == current:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
420 cls = 'wikilink current'
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
421 else:
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
422 cls = 'wikilink'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
423 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
424 found[pagename] = 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
425
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
426 # 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
427 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
428 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
429 # 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
430 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
431 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
432 if pagename == current:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
433 cls = 'userlink current'
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
434 else:
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
435 cls = 'userlink'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
436 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
437 found[pagename] = 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
438
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
439 # Add current page at end
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
440 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
441 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
442 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
443 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
444 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
445 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
446
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
447 # 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
448 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
449 html = u'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
450 <ul id="navibar">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
451 %s
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
452 </ul>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
453 ''' % items
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
454 return html
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
455
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
456 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
457 """ 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
458
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
459 If called from [[Icon(file)]] we have a filename, not a
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
460 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
461 behavior.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
462
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
463 @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
464 @rtype: tuple
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
465 @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
466 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
467 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
468 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
469 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
470 # 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
471 # 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
472 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
473 d = {}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
474 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
475 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
476 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
477
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
478 # 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
479 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
480 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
481 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
482 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
483
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
484 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
485
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
486 def make_icon(self, icon, vars=None):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
487 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
488 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
489 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
490 handled here.
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
491
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
492 @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
493 @param vars: ...
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
494 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
495 @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
496 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
497 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
498 vars = {}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
499 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
500 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
501 alt = alt % vars
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
502 except KeyError, err:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
503 alt = 'KeyError: %s' % str(err)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
504 if self.request:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
505 alt = self.request.getText(alt, formatted=False)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
506 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
507 tag = self.request.formatter.image(src=img, alt=alt, width=w, height=h)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
508 except AttributeError: # XXX FIXME if we have no formatter or no request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
509 tag = '<img src="%s" alt="%s" width="%s" height="%s">' % (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
510 img, alt, w, h)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
511 import warnings
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
512 warnings.warn("calling themes without correct request", DeprecationWarning)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
513 return tag
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
514
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
515 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
516 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
517 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
518
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
519 @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
520 @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
521 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
522 @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
523 """
1684
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1683
diff changeset
524 querystr, title, icon = self.cfg.page_icons_table[which]
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
525 d['title'] = title % d
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
526 d['i18ntitle'] = self.request.getText(d['title'], formatted=False)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
527 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
528 rev = d['rev']
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1683
diff changeset
529 if rev and which in ['raw', 'print', ]:
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1683
diff changeset
530 querystr['rev'] = str(rev)
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1683
diff changeset
531 attrs = {'rel': 'nofollow', 'title': d['i18ntitle'], }
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1683
diff changeset
532 page = d['page']
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1683
diff changeset
533 return page.link_to_raw(self.request, text=img_src, querystr=querystr, **attrs)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
534
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
535 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
536 """ 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
537
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
538 Display a message with a widget or simple strings with a clear message link.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
539
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
540 @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
541 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
542 @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
543 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
544 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
545 msg = d['msg']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
546 if not msg:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
547 return u''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
548
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
549 if isinstance(msg, (str, unicode)):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
550 # Render simple strings with a close link
1339
544b931cd965 new setting url_prefix_action, cleanup page.url/link_to, wikiutil.link_tag
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1318
diff changeset
551 close = d['page'].link_to(self.request, text=_('Clear message'))
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
552 html = u'<p>%s</p>\n<div class="buttons">%s</div>\n' % (msg, close)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
553 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
554 # msg is a widget
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
555 html = msg.render()
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 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
558
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
559 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
560 """ Assemble page trail
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
561
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
562 @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
563 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
564 @return: trail html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
565 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
566 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
567 user = request.user
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
568 html = ''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
569 if user.valid and user.show_page_trail:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
570 trail = user.getTrail()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
571 if trail:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
572 items = []
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
573 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
574 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
575 interwiki, page = pagename.split(":", 1)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
576 if request.cfg.interwikiname != interwiki:
569
6c572f52899f fixed missing </a> formatter bug
Thomas Waldmann <tw@waldmann-edv.de>
parents: 515
diff changeset
577 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
578 self.shortenPagename(page) +
569
6c572f52899f fixed missing </a> formatter bug
Thomas Waldmann <tw@waldmann-edv.de>
parents: 515
diff changeset
579 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
580 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
581 continue
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
582 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
583 pagename = page
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
584
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
585 except ValueError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
586 pass
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
587 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
588 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
589 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
590 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
591 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
592 html = '''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
593 <ul id="pagetrail">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
594 %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
595 </ul>''' % ''.join(items)
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
596 return html
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
597
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
598 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
599 """ Assemble html head stylesheet links
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
600
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
601 @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
602 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
603 @return: stylesheets links
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
604 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
605 link = '<link rel="stylesheet" type="text/css" charset="%s" media="%s" href="%s">'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
606
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
607 # Check mode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
608 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
609 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
610 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
611 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
612 stylesheets = self.stylesheets
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
613 usercss = self.request.user.valid and self.request.user.css_url
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
614
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
615 # Create stylesheets links
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
616 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
617 prefix = self.cfg.url_prefix_static
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
618 csshref = '%s/%s/css' % (prefix, self.name)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
619 for media, basename in stylesheets:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
620 href = '%s/%s.css' % (csshref, basename)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
621 html.append(link % (self.stylesheetsCharset, media, href))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
622
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
623 # Don't add user css url if it matches one of ours
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
624 if usercss and usercss == href:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
625 usercss = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
626
221
b1d744e2fd29 cfg.stylesheets for admin configurable additional style sheets
Thomas Waldmann <tw@waldmann-edv.de>
parents: 182
diff changeset
627 # admin configurable additional css (farm or wiki level)
b1d744e2fd29 cfg.stylesheets for admin configurable additional style sheets
Thomas Waldmann <tw@waldmann-edv.de>
parents: 182
diff changeset
628 for media, csshref in self.request.cfg.stylesheets:
b1d744e2fd29 cfg.stylesheets for admin configurable additional style sheets
Thomas Waldmann <tw@waldmann-edv.de>
parents: 182
diff changeset
629 html.append(link % (self.stylesheetsCharset, media, csshref))
b1d744e2fd29 cfg.stylesheets for admin configurable additional style sheets
Thomas Waldmann <tw@waldmann-edv.de>
parents: 182
diff changeset
630
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
631
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
632 # tribute to the most sucking browser: MS IE6
1010
2e7a3dd04833 don't use IE7 hack when editing (IE7+FCKeditor -> IE crash)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1008
diff changeset
633 if self.cfg.hacks.get('ie7', False) and self.request.action != 'edit':
2e7a3dd04833 don't use IE7 hack when editing (IE7+FCKeditor -> IE crash)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1008
diff changeset
634 # using FCKeditor and IE7 at the same time makes nices crashes in IE
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
635 html.append("""
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
636 <!-- compliance patch for microsoft browsers -->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
637 <!--[if lt IE 7]>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
638 <script src="%s/common/ie7/ie7-standard-p.js" type="text/javascript"></script>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
639 <![endif]-->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
640 """ % prefix)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
641
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
642 csshref = '%s/%s/css/msie.css' % (prefix, self.name)
2161d292e1af move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1630
diff changeset
643 html.append("""
2161d292e1af move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1630
diff changeset
644 <!-- css only for MSIE browsers -->
2161d292e1af move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1630
diff changeset
645 <!--[if IE]>
2161d292e1af move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1630
diff changeset
646 %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
647 <![endif]-->
2161d292e1af move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1630
diff changeset
648 """ % link % (self.stylesheetsCharset, 'all', csshref))
2161d292e1af move IE hacks to msie.css and include it if IE
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1630
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 # Add user css url (assuming that user css uses same charset)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
651 if usercss and usercss.lower() != "none":
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
652 html.append(link % (self.stylesheetsCharset, 'all', usercss))
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
653
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
654 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
655
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
656 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
657 """ 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
658
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
659 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
660 name and page.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
661
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
662 @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
663 @rtype: bool
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
664 @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
665 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
666 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
667 # These actions show the page content.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
668 # TODO: on new action, page info will not show. A better
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
669 # solution will be if the action itself answer the question:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
670 # showPageInfo().
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
671 contentActions = [u'', u'show', u'refresh', u'preview', u'diff',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
672 u'subscribe', u'RenamePage', u'DeletePage',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
673 u'SpellCheck', u'print']
1008
43279823cf24 use request.action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1003
diff changeset
674 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
675 return False
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
676
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
677 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
678 """ 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
679
393
f25101c236bb optimized footer display and print view, removed some ancient code
Thomas Waldmann <tw@waldmann-edv.de>
parents: 338
diff changeset
680 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
681 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
682 translated text using page direction looks worse.
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
683
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
684 @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
685 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
686 @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
687 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
688 _ = self.request.getText
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
689 html = ''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
690 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
691 info = page.lastEditInfo()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
692 if info:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
693 if info['editor']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
694 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
695 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
696 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
697 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
698 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
699 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
700 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
701 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
702 '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
703 'info': info
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
704 }
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
705 return html
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
706
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
707 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
708 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
709 assemble HTML code for the search forms
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
710
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: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
713 @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
714 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
715 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
716 form = self.request.form
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
717 updates = {
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
718 'search_label': _('Search:'),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
719 'search_value': wikiutil.escape(form.get('value', [''])[0], 1),
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
720 'search_full_label': _('Text', formatted=False),
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
721 'search_title_label': _('Titles', formatted=False),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
722 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
723 d.update(updates)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
724
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
725 html = u'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
726 <form id="searchform" method="get" action="">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
727 <div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
728 <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
729 <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
730 <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
731 <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
732 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
733 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
734 <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
735 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
736 <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
737 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
738 </div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
739 </form>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
740 <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
741 <!--// Initialize search form
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
742 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
743 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
744 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
745 searchChange(e);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
746 searchBlur(e);
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 </script>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
749 ''' % d
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
750 return html
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 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
753 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
754 assemble HTML code for copyright and version display
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
755
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
756 @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
757 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
758 @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
759 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
760 html = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
761 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
762 html = (u'<div id="version">MoinMoin Release %s [Revision %s], '
e3b84c7488e8 show_version shows version info similar to SystemInfo now
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 622
diff changeset
763 'Copyright 2000-2006 by Juergen Hermann</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
764 return html
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
765
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
766 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
767 """ 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
768
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
769 @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
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: 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
772 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
773 # Don't add script for print view
1008
43279823cf24 use request.action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1003
diff changeset
774 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
775 return u''
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
776
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
777 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
778 script = u"""
1425
b1c380a4cdb0 move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1419
diff changeset
779 <script type="text/javascript">
b1c380a4cdb0 move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1419
diff changeset
780 <!--
b1c380a4cdb0 move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1419
diff changeset
781 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
782 //-->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
783 </script>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
784 """ % {
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
785 'search_hint': _('Search', formatted=False),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
786 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
787 return script
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
788
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
789 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
790 """ 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
791 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
792
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
793 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
794 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
795 """
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
796 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
797 return False
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
798 return page.page_name == u'RecentChanges' or \
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
799 page.page_name == self.request.getText(u'RecentChanges', formatted=False)
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
800
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
801 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
802 """ Create rss href, used for rss button and head link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
803
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
804 @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
805 @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
806 """
1382
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
807 request = self.request
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
808 url = Page(request, 'RecentChanges').url(request, querystr={
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
809 'action':'rss_rc', 'ddiffs': '1', 'unique': '1', }, escape=0, relative=False)
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
810 return url
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
811
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
812 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
813 """ 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
814
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
815 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
816 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
817
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
818 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
819 @return: html head
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
820 """
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
821 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
822 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
823 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
824 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
825 u'href="%s" type="application/rss+xml">') % (
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
826 self.cfg.sitename,
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
827 self.rsshref(page) )
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
828 return link
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
829
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
830 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
831 """ Assemble html head
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
832
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
833 @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
834 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
835 @return: html head
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
836 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
837 html = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
838 u'<title>%(title)s - %(sitename)s</title>' % d,
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
839 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
840 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
841 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
842 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
843 self.rsslink(d),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
844 ]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
845 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
846
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
847 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
848 """ 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
849 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
850 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
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 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
853 """ 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
854 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
855 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
856 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
857 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
858 # 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
859 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
860 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
861
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
862 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
863 """ Create actions menu list and items data dict
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
864
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
865 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
866 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
867 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
868
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
869 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
870 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
871 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
872
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
873 TODO: Move actionsMenuInit() into body onload. This require
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
874 that the theme will render body, its currently done on
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
875 wikiutil/page.
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
876
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
877 @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
878 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
879 @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
880 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
881 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
882 _ = request.getText
1683
964fa7d0de32 action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1634
diff changeset
883 rev = request.rev
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
884
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
885 menu = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
886 'raw',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
887 'print',
493
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
888 'RenderAsDocbook',
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
889 'refresh',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
890 '__separator__',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
891 'SpellCheck',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
892 'LikePages',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
893 'LocalSiteMap',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
894 '__separator__',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
895 'RenamePage',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
896 'DeletePage',
493
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
897 '__separator__',
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
898 'MyPages',
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
899 'SubscribeUser',
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
900 '__separator__',
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
901 'Despam',
1683
964fa7d0de32 action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1634
diff changeset
902 'revert',
493
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
903 'PackagePages',
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
904 ]
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 titles = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
907 # action: menu title
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
908 '__title__': _("More Actions:", formatted=False),
64
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
909 # Translation may need longer or shorter separator
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
910 '__separator__': _('------------', formatted=False),
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
911 'raw': _('Raw Text', formatted=False),
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
912 'print': _('Print View', formatted=False),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
913 'refresh': _('Delete Cache', formatted=False),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
914 'SpellCheck': _('Check Spelling', formatted=False), # rename action!
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
915 'RenamePage': _('Rename Page', formatted=False),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
916 'DeletePage': _('Delete Page', formatted=False),
64
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
917 'LikePages': _('Like Pages', formatted=False),
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
918 'LocalSiteMap': _('Local Site Map', formatted=False),
493
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
919 'MyPages': _('My Pages', formatted=False),
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
920 'SubscribeUser': _('Subscribe User', formatted=False),
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
921 'Despam': _('Remove Spam', formatted=False),
1683
964fa7d0de32 action menu propagates rev parameter, simplify revision display
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1634
diff changeset
922 'revert': _('Revert to this revision', formatted=False),
493
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
923 'PackagePages': _('Package Pages', formatted=False),
993d53631fee make some action menu entries translatable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 490
diff changeset
924 'RenderAsDocbook': _('Render as Docbook', formatted=False),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
925 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
926
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
927 options = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
928 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
929 # 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
930 # "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
931 # 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
932 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
933
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
934 # Format standard actions
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
935 available = request.getAvailableActions(page)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
936 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
937 data = {'action': action, 'disabled': '', 'title': titles[action]}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
938
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
939 # 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
940 if action == 'refresh':
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
941 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
942 data['action'] = 'show'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
943 data['disabled'] = disabled
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
944
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
945 # 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
946 # just return to the page.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
947 elif action.startswith('__'):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
948 data['action'] = 'show'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
949
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
950 # 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
951 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
952 (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
953 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
954
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
955 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
956
453
493972205fac removed duplicate AttachFile entry in actions menu
Thomas Waldmann <tw@waldmann-edv.de>
parents: 393
diff changeset
957 # 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
958 # some actions like AttachFile (we have them on top level)
493972205fac removed duplicate AttachFile entry in actions menu
Thomas Waldmann <tw@waldmann-edv.de>
parents: 393
diff changeset
959 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
960 more.sort()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
961 if more:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
962 # Add separator
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
963 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
964 'title': titles['__separator__']}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
965 options.append(separator)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
966 # 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
967 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
968 data = {'action': action, 'disabled': ''}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
969 # Always add spaces: AttachFile -> Attach File
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
970 # XXX TODO do not create page just for using split_title
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
971 title = Page(request, action).split_title(force=1)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
972 # Use translated version if available
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
973 data['title'] = _(title, formatted=False)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
974 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
975
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
976 data = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
977 'label': titles['__title__'],
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
978 '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
979 'rev_field': rev and '<input type="hidden" name="rev" value="%d">' % rev or '',
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
980 'do_button': _("Do")
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
981 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
982 html = '''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
983 <form class="actionsmenu" method="get" action="">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
984 <div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
985 <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
986 <select name="action"
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
987 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
988 (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
989 this.form.submit();
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
990 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
991 this.selectedIndex = 0;">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
992 %(options)s
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
993 </select>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
994 <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
995 %(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
996 </div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
997 <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
998 <!--// Init menu
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
999 actionsMenuInit('%(label)s');
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1000 //-->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1001 </script>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1002 </form>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1003 ''' % data
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1004
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1005 return html
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1006
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1007 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
1008 """ 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
1009
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1010 Create html on first call, then return cached html.
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1011
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1012 @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
1013 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1014 @return: iconbar html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1015 """
622
8fba6d15a2f5 make request.(html_)formatter available early and use it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 620
diff changeset
1016 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
1017 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
1018 return ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1019
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1020 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
1021 if html is None:
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1022 # Remove empty items and format as list
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
1023 items = ''.join(['<li>%s</li>' % item
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
1024 for item in self.editbarItems(page) if item])
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
1025 html = u'<ul class="editbar">%s</ul>\n' % items
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1026 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
1027
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1028 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1029
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1030 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
1031 """ 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
1032
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1033 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
1034 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
1035 checking here.
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1036
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1037 @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
1038 @rtype: bool
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1039 @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
1040 """
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1041 # 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
1042 # 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
1043 # 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
1044 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
1045 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
1046 form = self.request.form
1008
43279823cf24 use request.action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1003
diff changeset
1047 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
1048 # 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
1049 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
1050 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
1051 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
1052 return False
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1053
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1054 def editbarItems(self, page):
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1055 """ 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
1056
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1057 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
1058 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
1059 """
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
1060 _ = 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
1061 editbar_actions = []
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1062 for editbar_item in self.request.cfg.edit_bar:
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1063 if editbar_item == 'Discussion':
1745
58a70ba872d6 theme/__init__: minor optimizations
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1742
diff changeset
1064 if not self.request.cfg.supplementation_page and self.request.getPragma('supplementation-page', 1) in ('on', '1'):
58a70ba872d6 theme/__init__: minor optimizations
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1742
diff changeset
1065 editbar_actions.append(self.supplementation_page_nameLink(page))
58a70ba872d6 theme/__init__: minor optimizations
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1742
diff changeset
1066 elif self.request.cfg.supplementation_page and not self.request.getPragma('supplementation-page', 1) in ('off', '0'):
58a70ba872d6 theme/__init__: minor optimizations
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1742
diff changeset
1067 editbar_actions.append(self.supplementation_page_nameLink(page))
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
1068 elif editbar_item == 'Comments':
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
1069 # we just use <a> to get same style as other links:
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
1070 editbar_actions.append('<a id="toggleCommentsButton" onClick="toggleComments();">%s</a>' % _('Comments'))
1742
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1071 elif editbar_item == 'Edit':
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
1072 editbar_actions.append(self.editorLink(page))
1742
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1073 elif editbar_item == 'Info':
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
1074 editbar_actions.append(self.infoLink(page))
1742
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1075 elif editbar_item == 'Subscribe':
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
1076 editbar_actions.append(self.subscribeLink(page))
1742
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1077 elif editbar_item == 'Quicklink':
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
1078 editbar_actions.append(self.quicklinkLink(page))
1742
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1079 elif editbar_item == 'Attachments':
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
1080 editbar_actions.append(self.attachmentsLink(page))
1742
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1081 elif editbar_item == 'ActionsMenu':
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1082 editbar_actions.append(self.actionsMenu(page))
7b419bd3b2cf theme/__init__.py: edit_bar dependend on config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1735
diff changeset
1083 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
1084
7487f00da9bc theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1715
diff changeset
1085 def supplementation_page_nameLink(self, page):
7487f00da9bc theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1715
diff changeset
1086 """ discussion for page """
7487f00da9bc theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1715
diff changeset
1087 _ = self.request.getText
7487f00da9bc theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1715
diff changeset
1088 return page.link_to(self.request,
7487f00da9bc theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1715
diff changeset
1089 text=_(self.request.cfg.supplementation_page_name, formatted=False),
7487f00da9bc theme/__init__.py: setup for a supplementation page in editbar_items
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1715
diff changeset
1090 querystr={'action': 'supplementation'}, id='supplementation', 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
1091
286
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1092 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
1093 """ 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
1094
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1095 The GUI editor currently only works for wiki format.
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1096 """
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1097 return page.pi_format == 'wiki'
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1098
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
1099 def editorLink(self, page):
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1100 """ Return a link to the editor
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1101
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1102 If the user can't edit, return a disabled edit link.
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1103
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1104 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
1105 (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
1106 """
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1107 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
1108 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
1109 return self.disabledEdit()
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1110
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1111 _ = 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
1112 querystr = {'action': 'edit'}
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1113
286
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1114 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
1115 if self.showBothEditLinks() and guiworks:
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
1116 text = _('Edit (Text)', formatted=False)
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1117 querystr['editor'] = 'text'
869
0152984f76ee use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 826
diff changeset
1118 attrs = {'name': 'texteditlink', 'rel': 'nofollow', }
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
1119 else:
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1120 text = _('Edit', formatted=False)
286
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1121 if guiworks:
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1122 # 'textonly' will be upgraded dynamically to 'guipossible' by JS
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1123 querystr['editor'] = 'textonly'
869
0152984f76ee use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 826
diff changeset
1124 attrs = {'name': 'editlink', 'rel': 'nofollow', }
286
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1125 else:
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1126 querystr['editor'] = 'text'
869
0152984f76ee use rel nofollow for action links
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 826
diff changeset
1127 attrs = {'name': 'texteditlink', 'rel': 'nofollow', }
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1128
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1129 return page.link_to(self.request, text=text, querystr=querystr, **attrs)
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
1130
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1131 def showBothEditLinks(self):
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1132 """ Return True if both edit links should be displayed """
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1133 editor = self.request.user.editor_ui
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1134 if editor == '<default>':
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1135 editor = self.request.cfg.editor_ui
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
1136 return editor == 'freechoice'
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1137
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
1138 def guiEditorScript(self, d):
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1139 """ Return a script that set the gui editor link variables
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1140
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1141 The link will be created only when javascript is enabled and
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1142 the browser is compatible with the editor.
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1143 """
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1144 page = d['page']
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1145 if not (page.isWritable() and
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1146 self.request.user.may.write(page.page_name) and
286
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1147 self.showBothEditLinks() and
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1148 self.guiworks(page)):
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
1149 return ''
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1150
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1151 _ = self.request.getText
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1152 return """\
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1153 <script type="text/javascript">
1425
b1c380a4cdb0 move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1419
diff changeset
1154 <!-- // GUI edit link and i18n
1341
f4558797325a new page.link_to_raw function, use more page.link_to(_raw) instead of lowlevel wikiutil.link_tag, use more query dicts instead of strs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1339
diff changeset
1155 var gui_editor_link_href = "%(url)s";
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
1156 var gui_editor_link_text = "%(text)s";
1425
b1c380a4cdb0 move some js to common.js
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1419
diff changeset
1157 //-->
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
1158 </script>
1735
5e870f4e5d2e theme/__init__.py: bug fixed MoinMoinBugs/1.6GuiEditorLinkBroken patch from JohannesBerg
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1730
diff changeset
1159 """ % {'url': page.url(self.request, querystr={'action': 'edit', 'editor': 'gui', }, escape=0, relative=False),
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1160 'text': _('Edit (GUI)', formatted=False),
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1161 }
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1162
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1163 def disabledEdit(self):
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1164 """ Return a disabled edit link """
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1165 _ = self.request.getText
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1166 return ('<span class="disabled">%s</span>'
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1167 % _('Immutable Page', formatted=False))
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1168
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1169 def infoLink(self, page):
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1170 """ Return link to page information """
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1171 _ = self.request.getText
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1172 return page.link_to(self.request,
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1173 text=_('Info', formatted=False),
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1174 querystr={'action': 'info'}, id='info', rel='nofollow')
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1175
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1176 def subscribeLink(self, page):
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1177 """ Return subscribe/unsubscribe link to valid users
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1178
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1179 @rtype: unicode
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1180 @return: subscribe or unsubscribe link
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1181 """
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1182 if not (self.cfg.mail_enabled and self.request.user.valid):
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1183 return ''
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1184
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1185 _ = self.request.getText
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1186 if self.request.user.isSubscribedTo([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
1187 text = _("Unsubscribe", formatted=False)
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1188 else:
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1189 text = _("Subscribe", formatted=False)
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1190 return page.link_to(self.request, text=text, querystr={'action': 'subscribe'}, id='subscribe', rel='nofollow')
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1191
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1192 def quicklinkLink(self, page):
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1193 """ Return add/remove quicklink link
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1194
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1195 @rtype: unicode
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1196 @return: link to add or remove a quicklink
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1197 """
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1198 if not self.request.user.valid:
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1199 return ''
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1200
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1201 _ = self.request.getText
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1202 if self.request.user.isQuickLinkedTo([page.page_name]):
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1203 text = _("Remove Link", formatted=False)
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1204 else:
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1205 text = _("Add Link", formatted=False)
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1206 return page.link_to(self.request, text=text, querystr={'action': 'quicklink'}, id='quicklink', rel='nofollow')
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1207
92
92a508340932 move "Attachments" to the edit bar, its too important to hide in the menu
Nir Soffer <nirs@freeshell.org>
parents: 91
diff changeset
1208 def attachmentsLink(self, page):
92a508340932 move "Attachments" to the edit bar, its too important to hide in the menu
Nir Soffer <nirs@freeshell.org>
parents: 91
diff changeset
1209 """ Return link to page attachments """
92a508340932 move "Attachments" to the edit bar, its too important to hide in the menu
Nir Soffer <nirs@freeshell.org>
parents: 91
diff changeset
1210 _ = self.request.getText
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1211 return page.link_to(self.request,
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1212 text=_('Attachments', formatted=False),
1015
e527eea93da5 make more use of page.link_to in theme code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1010
diff changeset
1213 querystr={'action': 'AttachFile'}, id='attachments', rel='nofollow')
92
92a508340932 move "Attachments" to the edit bar, its too important to hide in the menu
Nir Soffer <nirs@freeshell.org>
parents: 91
diff changeset
1214
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1215 def startPage(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1216 """ Start page div with page language and direction
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1217
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1218 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1219 @return: page div with language and direction attribtues
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1220 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1221 return u'<div id="page"%s>\n' % self.content_lang_attr()
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1222
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1223 def endPage(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1224 """ End page div
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1225
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1226 Add an empty page bottom div to prevent floating elements to
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1227 float out of the page bottom over the footer.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1228 """
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1229 return '<div id="pagebottom"></div>\n</div>\n'
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1230
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1231 # Public functions #####################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1232
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1233 def header(self, d, **kw):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1234 """ Assemble page header
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1235
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1236 Default behavior is to start a page div. Sub class and add
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1237 footer items.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1238
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1239 @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
1240 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1241 @return: page header html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1242 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1243 return self.startPage()
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1244
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1245 editorheader = header
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1246
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1247 def footer(self, d, **keywords):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1248 """ Assemble page footer
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1249
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1250 Default behavior is to end page div. Sub class and add
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1251 footer items.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1252
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1253 @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
1254 @keyword ...:...
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1255 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1256 @return: page footer html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1257 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1258 return self.endPage()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1259
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1260 # RecentChanges ######################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1261
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1262 def recentchanges_entry(self, d):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1263 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1264 Assemble a single recentchanges entry (table row)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1265
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1266 @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
1267 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1268 @return: recentchanges entry html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1269 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1270 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1271 html = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1272 html.append('<tr>\n')
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1273
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1274 html.append('<td class="rcicon1">%(icon_html)s</td>\n' % d)
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1275
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1276 html.append('<td class="rcpagelink">%(pagelink_html)s</td>\n' % d)
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1277
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1278 html.append('<td class="rctime">')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1279 if d['time_html']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1280 html.append("%(time_html)s" % d)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1281 html.append('</td>\n')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1282
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1283 html.append('<td class="rcicon2">%(info_html)s</td>\n' % d)
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1284
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1285 html.append('<td class="rceditor">')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1286 if d['editors']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1287 html.append('<br>'.join(d['editors']))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1288 html.append('</td>\n')
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1289
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1290 html.append('<td class="rccomment">')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1291 if d['comments']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1292 if d['changecount'] > 1:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1293 notfirst = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1294 for comment in d['comments']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1295 html.append('%s<tt>#%02d</tt>&nbsp;%s' % (
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1296 notfirst and '<br>' or '', comment[0], comment[1]))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1297 notfirst = 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1298 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1299 comment = d['comments'][0]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1300 html.append('%s' % comment[1])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1301 html.append('</td>\n')
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1302
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1303 html.append('</tr>\n')
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1304
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1305 return ''.join(html)
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1306
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1307 def recentchanges_daybreak(self, d):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1308 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1309 Assemble a rc daybreak indication (table row)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1310
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1311 @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
1312 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1313 @return: recentchanges daybreak html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1314 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1315 if d['bookmark_link_html']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1316 set_bm = '&nbsp; %(bookmark_link_html)s' % d
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1317 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1318 set_bm = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1319 return ('<tr class="rcdaybreak"><td colspan="%d">'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1320 '<strong>%s</strong>'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1321 '%s'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1322 '</td></tr>\n') % (6, d['date'], set_bm)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1323
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1324 def recentchanges_header(self, d):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1325 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1326 Assemble the recentchanges header (intro + open table)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1327
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1328 @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
1329 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1330 @return: recentchanges header html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1331 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1332 _ = self.request.getText
1003
e8aef4cb2b34 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 992
diff changeset
1333
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1334 # Should use user interface language and direction
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1335 html = '<div class="recentchanges"%s>\n' % 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
1336 html += '<div>\n'
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
1337 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
1338 if self.shouldUseRSS(page):
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1339 link = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1340 u'<div class="rcrss">',
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
1341 self.request.formatter.url(1, self.rsshref(page)),
1382
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
1342 self.request.formatter.rawHTML(self.make_icon("rss")),
c3c8ff25e979 make more use of formatter / link_to for link rendering
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1354
diff changeset
1343 self.request.formatter.url(0),