annotate MoinMoin/theme/__init__.py @ 296:4e08178a630c

moving logout to a visible place imported from: moin--main--1.5--patch-300
author Thomas Waldmann <tw@waldmann-edv.de>
date Tue, 06 Dec 2005 22:00:52 +0000
parents 08cd0e9b9369
children fe57f191672e
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
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
5 @copyright: 2003-2005 by Thomas Waldmann (MoinMoin:ThomasWaldmann)
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
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
15
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
16 class ThemeBase:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
17 """ 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
18
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
19 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
20 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
21 elements, override them.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
22 """
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 name = 'base'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
25
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
26 # 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
27 _ = lambda x: x
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
28
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
29 # 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
30 icons = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
31 # 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
32 # ------------------------------------------------------------------
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
33 # navibar
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
34 '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
35 '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
36 '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
37 '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
38 '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
39 '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
40 '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
41 '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
42 '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
43 '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
44 '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
45 '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
46 '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
47 # FileAttach
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
48 '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
49 # RecentChanges
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
50 '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
51 '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
52 'updated': (_("[UPDATED]"), "moin-updated.png",60, 12),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
53 '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
54 '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
55 # General
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
56 '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
57 '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
58 '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
59 '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
60 '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
61 '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
62 '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
63 '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
64 # search forms
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
65 '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
66 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
67 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
68 del _
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
69
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
70 # 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
71 # 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
72
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
73 # 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
74 stylesheets = (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
75 # media basename
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
76 ('all', 'common'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
77 ('screen', 'screen'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
78 ('print', 'print'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
79 ('projection', 'projection'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
80 )
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
81
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
82 # 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
83 stylesheets_print = (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
84 # media basename
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
85 ('all', 'common'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
86 ('all', 'print'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
87 )
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
88
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
89 # 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
90 stylesheets_projection = (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
91 # media basename
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
92 ('all', 'common'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
93 ('all', 'projection'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
94 )
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
95
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
96 stylesheetsCharset = 'utf-8'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
97
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
98 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
99 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
100 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
101
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
102 @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
103 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
104 self.request = request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
105 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
106 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
107
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
108 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
109 """ 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
110
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
111 @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
112 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
113 @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
114 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
115 return "%s/%s/img/%s" % (self.cfg.url_prefix, self.name, img)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
116
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
117 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
118 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
119 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
120
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
121 @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
122 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
123 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
124 @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
125 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
126 if html:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
127 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
128 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
129
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
130 def logo(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
131 """ 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
132
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
133 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
134 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
135 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
136
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
137 @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
138 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
139 @return: logo html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
140 """
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
141 html = u''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
142 if self.cfg.logo_string:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
143 pagename = wikiutil.getFrontPage(self.request).page_name
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
144 pagename = wikiutil.quoteWikinameURL(pagename)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
145 logo = wikiutil.link_tag(self.request, pagename, self.cfg.logo_string)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
146 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
147 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
148
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
149 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
150 """ 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
151
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
152 @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
153 @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
154 @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
155 """
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
156 html = u''
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
157 if self.request.cfg.show_interwiki:
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
158 # Show our interwikiname or Self (and link 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
159 pagename = wikiutil.getFrontPage(self.request).page_name
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
160 pagename = wikiutil.quoteWikinameURL(pagename)
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
161 link = wikiutil.link_tag(self.request, pagename, self.request.cfg.interwikiname or 'Self')
174
51bde0757167 workaround for opera 8.5 brokenness
Thomas Waldmann <tw@waldmann-edv.de>
parents: 161
diff changeset
162 html = u'<div id="interwiki"><span>%s</span></div>' % link
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
163 return html
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
164
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
165 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
166 """ 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
167
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
168 @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
169 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
170 @return: title 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 _ = self.request.getText
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
173 content = []
182
10e033440008 fixed theme title for 'Add spaces to displayed wiki names' setting
Thomas Waldmann <tw@waldmann-edv.de>
parents: 174
diff changeset
174 if d['title_link']: # having a link means we have a (linked) pagename ONLY as title, not a message title
10e033440008 fixed theme title for 'Add spaces to displayed wiki names' setting
Thomas Waldmann <tw@waldmann-edv.de>
parents: 174
diff changeset
175 # XXX this method is rather ugly and should be improved
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
176 curpage = ''
182
10e033440008 fixed theme title for 'Add spaces to displayed wiki names' setting
Thomas Waldmann <tw@waldmann-edv.de>
parents: 174
diff changeset
177 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
178 for s in segments[:-1]:
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
179 curpage += s
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
180 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
181 curpage += '/'
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
182 content.append(('<li><a class="backlink" title="%(title)s" href="%(href)s">%(text)s</a></li>') % {
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
183 'title': _('Click to do a full-text search for this title'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
184 'href': d['title_link'],
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
185 'text': wikiutil.escape(segments[-1]),
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
186 })
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
187 else:
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
188 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
189
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
190 html = '''
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
191 <ul id="pagelocation">
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
192 %s
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
193 </ul>
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
194 ''' % "".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
195 return html
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
196
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
197 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
198 """ 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
199
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
200 @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
201 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
202 @return: username html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
203 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
204 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
205 _ = request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
206 preferencesPage = wikiutil.getSysPage(request, 'UserPreferences')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
207
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
208 userlinks = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
209 # 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
210 # if it exists, the user can create it.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
211 if request.user.valid:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
212 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
213 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
214 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
215 if not aliasname:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
216 aliasname = name
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
217 title = "%s @ %s" % (aliasname, interwiki[0])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
218 homelink = (request.formatter.interwikilink(1, title=title, *interwiki) +
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
219 request.formatter.text(name) +
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
220 request.formatter.interwikilink(0))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
221 userlinks.append(homelink)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
222 # Set pref page to localized Preferences page
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
223 title = preferencesPage.split_title(request)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
224 userlinks.append(preferencesPage.link_to(request, text=title))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
225
296
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
226 if 1: # XXX request.cfg.user_login_show:
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
227 if request.user.valid:
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
228 #loghtml = preferencesPage.link_to(request, text=_("Logout"))
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
229 userlinks.append("""\
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
230 <form action="/" method="POST">
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
231 <input type="hidden" name="action" value="userform">
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
232 <input type="submit" name="logout" value="%(logout)s">
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
233 </form>
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
234 """ % { 'logout': _('Logout') }) # XXX add path instead of /
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
235 else:
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
236 userlinks.append(preferencesPage.link_to(request, text=_("Login")))
4e08178a630c moving logout to a visible place
Thomas Waldmann <tw@waldmann-edv.de>
parents: 286
diff changeset
237
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
238 userlinks = [u'<li>%s</li>\n' % link for link in userlinks]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
239 html = u'<ul id="username">\n%s</ul>' % ''.join(userlinks)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
240 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
241
237
ccfa707e7064 added builtin support for linking irc:// URLs
Thomas Waldmann <tw@waldmann-edv.de>
parents: 221
diff changeset
242 # Schemas supported in toolbar links, using [url label] format
ccfa707e7064 added builtin support for linking irc:// URLs
Thomas Waldmann <tw@waldmann-edv.de>
parents: 221
diff changeset
243 linkSchemas = [r'http://', r'https://', r'ftp://', 'mailto:', r'irc://', ] + \
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
244 [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
245
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
246 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
247 """ 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
248
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
249 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
250 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
251 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
252 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
253
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
254 @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
255 @rtype: tuple
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
256 @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
257 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
258 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
259
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
260 # 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
261 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
262 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
263 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
264 title = title.strip()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
265 localize = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
266 except (ValueError, TypeError):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
267 # 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
268 pagename = title = text
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
269
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
270
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
271 # 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
272 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
273 # 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
274 if localize:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
275 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
276 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
277 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
278 pagename = page.page_name
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
279 title = page.split_title(request)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
280 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
281 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
282
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
283
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
284 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
285 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
286 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
287 title = wikiutil.escape(title)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
288 link = '<a href="%s">%s</a>' % (pagename, title)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
289 return pagename, link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
290
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
291 # 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
292 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
293 pagename = pagename[5:]
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 # 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
296 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
297 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
298 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
299 if interwiki == thiswiki:
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
300 pagename = page
23
aee8b13fbb0b quicklinks: only use pagename as title, if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 22
diff changeset
301 title = page
22
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
302 else:
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
303 return (pagename,
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
304 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
305 page +
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
306 self.request.formatter.interwikilink(False)
a47550d21d2d quicklinks: avoid dupes, dont render as interwiki if wiki == self
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
307 )
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
308
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
309 except ValueError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
310 pass
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
311
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
312 # Normalize page names, replace '_' with ' '. Usually
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
313 # all names use spaces internally, but for
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
314 # [name_with_spaces label] we must save the underscores
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
315 # until this point.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
316 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
317 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
318
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
319 return pagename, link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
320
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
321 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
322 """ Shorten page names
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
323
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
324 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
325 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
326 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
327
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
328 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
329 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
330
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
331 @param text: page name, unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
332 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
333 @return: shortened version.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
334 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
335 maxLength = self.maxPagenameLength()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
336 # 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
337 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
338 name = name.split('/')[-1]
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
339 # 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
340 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
341 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
342 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
343 return name
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
344
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
345 def maxPagenameLength(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
346 """ Return maximum length for shortened page names """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
347 return 25
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
348
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
349 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
350 """ Assemble the navibar
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 @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
353 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
354 @return: navibar html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
355 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
356 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
357 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
358 items = [] # navibar items
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
359 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
360 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
361
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
362 # 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
363 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
364 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
365 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
366 if pagename == current:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
367 cls = 'wikilink current'
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
368 else:
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
369 cls = 'wikilink'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
370 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
371 found[pagename] = 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
372
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
373 # 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
374 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
375 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
376 # 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
377 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
378 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
379 if pagename == current:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
380 cls = 'userlink current'
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
381 else:
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
382 cls = 'userlink'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
383 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
384 found[pagename] = 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
385
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
386 # 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
387 if not current in found:
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
388 title = d['page'].split_title(request)
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
389 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
390 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
391 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
392 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
393
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
394 # Assemble html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
395 items = u'\n'.join(items)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
396 html = u'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
397 <ul id="navibar">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
398 %s
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
399 </ul>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
400 ''' % items
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
401 return html
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
402
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
403 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
404 """ 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
405
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
406 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
407 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
408 behavior.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
409
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
410 @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
411 @rtype: tuple
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
412 @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
413 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
414 if icon in self.icons:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
415 alt, filename, w, h = self.icons[icon]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
416 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
417 # 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
418 # 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
419 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
420 d = {}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
421 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
422 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
423 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
424
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
425 # Try to get icon data by file name
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
426 filename = icon.replace('.gif','.png')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
427 if filename in self.iconsByFile:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
428 alt, filename, w, h = self.iconsByFile[filename]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
429 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
430 alt, filename, w, h = '', icon, '', ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
431
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
432 return alt, self.img_url(filename), w, h
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
433
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
434 def 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
435 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
436 This is the central routine for making <img> tags for icons!
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
437 All icons stuff except the top left logo, smileys and search
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
438 field icons are handled here.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
439
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
440 @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
441 @param vars: ...
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
442 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
443 @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
444 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
445 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
446 vars = {}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
447 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
448 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
449 alt = alt % vars
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
450 except KeyError, err:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
451 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
452 if self.request:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
453 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
454 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
455 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
456 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
457 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
458 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
459 import warnings
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
460 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
461 return tag
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 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
464 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
465 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
466
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
467 @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
468 @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
469 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
470 @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
471 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
472 page_params, title, icon = self.cfg.page_icons_table[which]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
473 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
474 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
475 img_src = self.make_icon(icon, d)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
476 return wikiutil.link_tag(self.request, page_params % d, img_src, attrs='title="%(i18ntitle)s"' % 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 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
479 """ 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
480
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
481 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
482
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
483 @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
484 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
485 @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
486 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
487 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
488 msg = d['msg']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
489 if not msg:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
490 return u''
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 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
493 # Render simple strings with a close link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
494 close = d['page'].link_to(self.request,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
495 text=_('Clear message'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
496 querystr={'action': 'show'})
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
497 html = u'<p>%s</p>\n<div class="buttons">%s</div>\n' % (msg, close)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
498 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
499 # 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
500 html = msg.render()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
501
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
502 return u'<div id="message">\n%s\n</div>\n' % html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
503
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
504 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
505 """ Assemble page trail
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
506
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
507 @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
508 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
509 @return: trail html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
510 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
511 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
512 user = request.user
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
513 html = ''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
514 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
515 trail = user.getTrail()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
516 if trail:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
517 items = []
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 142
diff changeset
518 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
519 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
520 interwiki, page = pagename.split(":", 1)
90
246601c7b298 fix unsubscribe, use always valid interwiki links, more correct error messages, refactror subscribePage, isSubscribedTo
Nir Soffer <nirs@freeshell.org>
parents: 70
diff changeset
521 # Items in trail are saved as valid interwiki
246601c7b298 fix unsubscribe, use always valid interwiki links, more correct error messages, refactror subscribePage, isSubscribedTo
Nir Soffer <nirs@freeshell.org>
parents: 70
diff changeset
522 # links, using _ for spaces.
246601c7b298 fix unsubscribe, use always valid interwiki links, more correct error messages, refactror subscribePage, isSubscribedTo
Nir Soffer <nirs@freeshell.org>
parents: 70
diff changeset
523 page = page.replace('_', ' ')
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
524 if request.cfg.interwikiname != interwiki:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
525 link = (self.request.formatter.interwikilink(
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
526 True, interwiki, page) +
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
527 self.shortenPagename(page) +
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
528 self.request.formatter.interwikilink(False))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
529 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
530 continue
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
531 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
532 pagename = page
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
533
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
534 except ValueError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
535 pass
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
536 page = Page(request, pagename)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
537 title = page.split_title(request)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
538 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
539 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
540 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
541 html = '''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
542 <ul id="pagetrail">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
543 %s
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
544 </ul>''' % '\n'.join(items)
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
545 return html
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
546
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
547 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
548 """ 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
549
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
550 @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
551 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
552 @return: stylesheets links
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
553 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
554 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
555
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
556 # Check mode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
557 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
558 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
559 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
560 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
561 stylesheets = self.stylesheets
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
562 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
563
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
564 # Create stylesheets links
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
565 html = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
566 prefix = self.cfg.url_prefix
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
567 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
568 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
569 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
570 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
571
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
572 # 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
573 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
574 usercss = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
575
221
b1d744e2fd29 cfg.stylesheets for admin configurable additional style sheets
Thomas Waldmann <tw@waldmann-edv.de>
parents: 182
diff changeset
576 # 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
577 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
578 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
579
b1d744e2fd29 cfg.stylesheets for admin configurable additional style sheets
Thomas Waldmann <tw@waldmann-edv.de>
parents: 182
diff changeset
580
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
581 # tribute to the most sucking browser...
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
582 if self.cfg.hacks.get('ie7', False):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
583 html.append("""
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
584 <!-- 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
585 <!--[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
586 <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
587 <![endif]-->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
588 """ % prefix)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
589
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
590 # 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
591 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
592 html.append(link % (self.stylesheetsCharset, 'all', usercss))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
593
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
594 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
595
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
596 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
597 """ 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
598
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
599 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
600 name and page.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
601
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
602 @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
603 @rtype: bool
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
604 @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
605 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
606 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
607 # 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
608 # 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
609 # 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
610 # showPageInfo().
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
611 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
612 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
613 u'SpellCheck', u'print']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
614 action = self.request.form.get('action', [''])[0]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
615 return action in contentActions
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
616 return False
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
617
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
618 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
619 """ 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
620
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
621 Since page information use translated text, it use the ui
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
622 language and direction. It looks strange sometimes, but
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
623 translated text using page direction look worse.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
624
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
625 @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
626 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
627 @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
628 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
629 _ = self.request.getText
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
630 html = ''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
631 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
632 info = page.lastEditInfo()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
633 if info:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
634 if info['editor']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
635 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
636 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
637 info = _("last modified %(time)s") % info
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
638 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
639 '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
640 'info': info
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
641 }
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
642 return html
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
643
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
644 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
645 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
646 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
647
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
648 @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
649 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
650 @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
651 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
652 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
653 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
654 updates = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
655 'search_label' : _('Search:'),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
656 'search_value': wikiutil.escape(form.get('value', [''])[0], 1),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
657 'search_full_label' : _('Text', formatted=False),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
658 'search_title_label' : _('Titles', formatted=False),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
659 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
660 d.update(updates)
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 html = u'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
663 <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
664 <div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
665 <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
666 <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
667 <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
668 <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
669 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
670 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
671 <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
672 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
673 <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
674 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
675 </div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
676 </form>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
677 <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
678 <!--// Initialize search form
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
679 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
680 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
681 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
682 searchChange(e);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
683 searchBlur(e);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
684 //-->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
685 </script>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
686 ''' % d
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
687 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
688
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
689 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
690 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
691 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
692
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
693 @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
694 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
695 @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
696 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
697 html = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
698 if self.cfg.show_version and not keywords.get('print_mode', 0):
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
699 html = (u'<div id="version">MoinMoin %s, Copyright 2000-2005 by '
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
700 'Juergen Hermann</div>') % (version.revision,)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
701 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
702
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
703 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
704 """ 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
705
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
706 TODO: put these on common.js instead, so they can be downloaded
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
707 only once.
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 TODO: actionMenuInit should be called once, from body onload,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
710 but currently body is not written by theme.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
711
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
712 @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
713 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
714 @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
715 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
716 # Don't add script for print view
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
717 if self.request.form.get('action', [''])[0] == 'print':
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
718 return u''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
719
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
720 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
721 script = u"""
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
722 <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
723 <!--// common functions
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 // We keep here the state of the search box
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
726 searchIsDisabled = false;
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
727
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
728 function searchChange(e) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
729 // Update search buttons status according to search box content.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
730 // Ignore empty or whitespace search term.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
731 var value = e.value.replace(/\s+/, '');
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
732 if (value == '' || searchIsDisabled) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
733 searchSetDisabled(true);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
734 } else {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
735 searchSetDisabled(false);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
736 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
737 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
738
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
739 function searchSetDisabled(flag) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
740 // Enable or disable search
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
741 document.getElementById('fullsearch').disabled = flag;
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
742 document.getElementById('titlesearch').disabled = flag;
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
743 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
744
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
745 function searchFocus(e) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
746 // Update search input content on focus
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
747 if (e.value == '%(search_hint)s') {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
748 e.value = '';
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
749 e.className = '';
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
750 searchIsDisabled = false;
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 }
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 function searchBlur(e) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
755 // Update search input content on blur
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
756 if (e.value == '') {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
757 e.value = '%(search_hint)s';
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
758 e.className = 'disabled';
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
759 searchIsDisabled = true;
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
760 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
761 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
762
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
763 function actionsMenuInit(title) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
764 // Initialize action menu
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
765 for (i = 0; i < document.forms.length; i++) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
766 var form = document.forms[i];
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
767 if (form.className == 'actionsmenu') {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
768 // Check if this form needs update
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
769 var div = form.getElementsByTagName('div')[0];
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
770 var label = div.getElementsByTagName('label')[0];
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
771 if (label) {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
772 // This is the first time: remove label and do buton.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
773 div.removeChild(label);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
774 var dobutton = div.getElementsByTagName('input')[0];
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
775 div.removeChild(dobutton);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
776 // and add menu title
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
777 var select = div.getElementsByTagName('select')[0];
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
778 var item = document.createElement('option');
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
779 item.appendChild(document.createTextNode(title));
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
780 item.value = 'show';
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
781 select.insertBefore(item, select.options[0]);
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
782 select.selectedIndex = 0;
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
783 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
784 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
785 }
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 //-->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
788 </script>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
789 """ % {
33
55ff4feb0f59 src cosmetics: remove TODOs, CVS stuff
Thomas Waldmann <tw@waldmann-edv.de>
parents: 30
diff changeset
790 '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
791 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
792 return script
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
793
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
794 def shouldUseRSS(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
795 """ Return True if rss feature is available, or False
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
796
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
797 Currently rss is broken on plain Python, and works only when
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
798 installing PyXML. Return true if PyXML is installed.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
799 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
800 # Stolen from wikitest.py
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
801 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
802 import xml
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
803 return xml.__file__.find('_xmlplus') != -1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
804 except ImportError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
805 # This error reported on Python 2.2
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
806 return False
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
807
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
808 def rsshref(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
809 """ 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
810
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
811 @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
812 @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
813 """
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
814 return (u'%s/RecentChanges?action=rss_rc&amp;ddiffs=1&amp;unique=1'
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
815 % self.request.getScriptname())
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
816
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
817 def rsslink(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
818 """ 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
819
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
820 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
821 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
822
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
823 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
824 @return: html head
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
825 """
70
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
826 link = u''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
827 if self.shouldUseRSS():
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
828 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
829 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
830 self.cfg.sitename,
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
831 self.rsshref() )
36a2541550aa src cosmetic changes, changed (c) to 2005
Thomas Waldmann <tw@waldmann-edv.de>
parents: 64
diff changeset
832 return link
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
833
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
834 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
835 """ Assemble 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 @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
838 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
839 @return: html head
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
840 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
841 html = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
842 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
843 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
844 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
845 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
846 self.html_stylesheets(d),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
847 self.rsslink(),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
848 ]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
849 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
850
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
851 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
852 """ Format external script html """
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
853 src = '%s/common/js/%s.js' % (self.request.cfg.url_prefix, 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
854 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
855
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
856 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
857 """ 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
858 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
859 items = ['<li>%s</li>' % i for i in 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 html = '<ul id="credits">\n%s\n</ul>\n' % '\n'.join(items)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
861 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
862 # 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
863 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
864 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
865
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
866 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
867 """ 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
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 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
870 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
871 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
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 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
874 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
875 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
876
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
877 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
878 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
879 wikiutil/page.
0
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 @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
882 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
883 @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
884 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
885 request = self.request
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
886 _ = request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
887
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
888 menu = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
889 'raw',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
890 'print',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
891 'refresh',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
892 '__separator__',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
893 'SpellCheck',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
894 'LikePages',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
895 'LocalSiteMap',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
896 '__separator__',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
897 'RenamePage',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
898 'DeletePage',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
899 ]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
900
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
901 titles = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
902 # action: menu title
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
903 '__title__': _("More Actions:", formatted=False),
64
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
904 # Translation may need longer or shorter separator
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
905 '__separator__': _('------------', formatted=False),
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
906 'raw': _('Raw Text', formatted=False),
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
907 '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
908 '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
909 '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
910 '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
911 'DeletePage': _('Delete Page', formatted=False),
64
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
912 'LikePages': _('Like Pages', formatted=False),
6483a586208d better wording in the user interface
Nir Soffer <nirs@freeshell.org>
parents: 33
diff changeset
913 'LocalSiteMap': _('Local Site Map', formatted=False),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
914 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
915
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
916 options = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
917 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
918 # 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
919 # "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
920 # 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
921 disabled = ' disabled class="disabled"'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
922
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
923 # Format standard actions
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
924 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
925 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
926 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
927
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
928 # 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
929 if action == 'refresh':
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
930 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
931 data['action'] = 'show'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
932 data['disabled'] = disabled
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
933
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
934 # 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
935 # 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
936 elif action.startswith('__'):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
937 data['action'] = 'show'
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 # 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
940 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
941 (action[0].isupper() and not action in available)):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
942 data['disabled'] = disabled
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
943
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
944 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
945
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
946 # Add custom actions not in the standard menu
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
947 more = [item for item in available if not item in titles]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
948 more.sort()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
949 if more:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
950 # Add separator
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
951 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
952 'title': titles['__separator__']}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
953 options.append(separator)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
954 # 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
955 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
956 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
957 # 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
958 # XXX TODO do not create page just for using split_title
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
959 title = Page(request, action).split_title(request, force=1)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
960 # 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
961 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
962 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
963
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
964 data = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
965 'label': titles['__title__'],
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
966 'options': '\n'.join(options),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
967 'do_button': _("Do")
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
968 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
969
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
970 html = '''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
971 <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
972 <div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
973 <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
974 <select name="action"
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
975 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
976 (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
977 this.form.submit();
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
978 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
979 this.selectedIndex = 0;">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
980 %(options)s
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
981 </select>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
982 <input type="submit" value="%(do_button)s">
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
983 </div>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
984 <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
985 <!--// Init menu
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
986 actionsMenuInit('%(label)s');
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
987 //-->
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
988 </script>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
989 </form>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
990 ''' % data
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
991
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
992 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
993
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
994 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
995 """ 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
996
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
997 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
998
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
999 @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
1000 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1001 @return: iconbar html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1002 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1003 page = d['page']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1004 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
1005 return ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1006
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1007 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
1008 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
1009 # Remove empty items and format as list
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1010 items = '\n'.join(['<li>%s</li>' % item
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1011 for item in self.editbarItems(page) if item])
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1012 html = u'<ul class="editbar">\n%s\n</ul>\n' % items
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1013 self._cache['editbar'] = html
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1014
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1015 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1016
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1017 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
1018 """ 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
1019
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1020 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
1021 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
1022 checking here.
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1023
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1024 @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
1025 @rtype: bool
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1026 @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
1027 """
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1028 # 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
1029 # 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
1030 # 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
1031 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
1032 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
1033 form = self.request.form
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1034 action = form.get('action', [''])[0]
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1035 # 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
1036 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
1037 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
1038 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
1039 return False
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 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
1042 """ 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
1043
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1044 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
1045 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
1046 """
141
ce6cece6875f remove obsolute Parent Page link, replaced by the breadcrumbs title
Nir Soffer <nirs@freeshell.org>
parents: 140
diff changeset
1047 return [self.editorLink(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
1048 self.infoLink(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
1049 self.subscribeLink(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
1050 self.quicklinkLink(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
1051 self.attachmentsLink(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
1052 self.actionsMenu(page),]
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1053
286
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1054 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
1055 """ 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
1056
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1057 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
1058 """
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1059 return page.pi_format == 'wiki'
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1060
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
1061 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
1062 """ 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
1063
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1064 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
1065
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1066 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
1067 (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
1068 """
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1069 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
1070 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
1071 return self.disabledEdit()
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1072
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1073 _ = self.request.getText
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
1074 params = (wikiutil.quoteWikinameURL(page.page_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
1075 '?action=edit&amp;editor=')
286
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1076
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1077 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
1078 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
1079 text = _('Edit (Text)', formatted=False)
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1080 params = params + 'text'
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1081 attrs = 'name="texteditlink"'
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1082 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
1083 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
1084 if guiworks:
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1085 # 'textonly' will be upgraded dynamically to 'guipossible' by JS
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1086 params = params + 'textonly'
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1087 attrs = 'name="editlink"'
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1088 else:
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1089 params = params + 'text'
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1090 attrs = 'name="texteditlink"'
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
1091
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1092 return wikiutil.link_tag(self.request, params, text, attrs=attrs)
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1093
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1094 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
1095 """ 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
1096 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
1097 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
1098 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
1099 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
1100
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
1101 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
1102 """ 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
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 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
1105 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
1106 """
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1107 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
1108 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
1109 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
1110 self.showBothEditLinks() and
08cd0e9b9369 do not show gui editor for non-wiki format pages
Thomas Waldmann <tw@waldmann-edv.de>
parents: 237
diff changeset
1111 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
1112 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
1113
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1114 _ = 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
1115 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
1116 <script type="text/javascript">
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1117 var gui_editor_link_href = "%(url)s?action=edit&editor=gui";
2fba84615be7 create gui editor links by javascript and dom, tested with Safari, Firefox and IE
Nir Soffer <nirs@freeshell.org>
parents: 124
diff changeset
1118 var gui_editor_link_text = "%(text)s";
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 </script>
140
6a19d2b98493 fixed bad url on sub page gui editor link
Nir Soffer <nirs@freeshell.org>
parents: 133
diff changeset
1120 """ % {'url': page.url(self.request),
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
1121 'text': _('Edit (GUI)', formatted=False),}
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1122
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1123 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
1124 """ 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
1125 _ = 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
1126 return ('<span class="disabled">%s</span>'
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1127 % _('Immutable Page', formatted=False))
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1128
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1129 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
1130 """ 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
1131 _ = 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
1132 return page.link_to(self.request,
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1133 text=_('Info', formatted=False),
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1134 querystr='action=info')
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1135
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1136 def subscribeLink(self, page):
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1137 """ Return subscribe/unsubscribe link to valid users
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1138
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1139 @rtype: unicode
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1140 @return: subscribe or unsubscribe link
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1141 """
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1142 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
1143 return ''
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1144
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1145 _ = 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
1146 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
1147 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
1148 else:
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1149 text = _("Subscribe", formatted=False)
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1150 params = wikiutil.quoteWikinameURL(page.page_name) + '?action=subscribe'
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1151 return wikiutil.link_tag(self.request, params, text)
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1152
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1153 def quicklinkLink(self, page):
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1154 """ Return add/remove quicklink link
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1155
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1156 @rtype: unicode
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1157 @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
1158 """
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1159 if not self.request.user.valid:
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1160 return ''
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1161
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1162 _ = self.request.getText
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1163 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
1164 text = _("Remove Link", formatted=False)
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1165 else:
98
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1166 text = _("Add Link", formatted=False)
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1167 params = wikiutil.quoteWikinameURL(page.page_name) + '?action=quicklink'
8375a3795ff8 theme: refactor editabr to make it easier to customize by theme authors
Nir Soffer <nirs@freeshell.org>
parents: 97
diff changeset
1168 return wikiutil.link_tag(self.request, params, text)
97
539cfd9a40b2 theme: moving related edit bar methods toghether
Nir Soffer <nirs@freeshell.org>
parents: 92
diff changeset
1169
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
1170 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
1171 """ 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
1172 _ = 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
1173 return page.link_to(self.request,
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
1174 text=_('Attachments', formatted=False),
92a508340932 move "Attachments" to the edit bar, its too important to hide in the menu
Nir Soffer <nirs@freeshell.org>
parents: 91
diff changeset
1175 querystr='action=AttachFile')
92a508340932 move "Attachments" to the edit bar, its too important to hide in the menu
Nir Soffer <nirs@freeshell.org>
parents: 91
diff changeset
1176
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1177 def startPage(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1178 """ 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
1179
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1180 @rtype: unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1181 @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
1182 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1183 return u'<div id="page"%s>\n' % self.content_lang_attr()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1184
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1185 def endPage(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1186 """ End page div
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1187
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1188 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
1189 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
1190 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1191 return '<div id="pagebottom"></div>\n</div>\n'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1192
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1193 # Public functions #####################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1194
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1195 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
1196 """ Assemble page header
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1197
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1198 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
1199 footer items.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1200
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1201 @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
1202 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1203 @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
1204 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1205 return self.startPage()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1206
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1207 editorheader = header
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1208
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1209 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
1210 """ Assemble page footer
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1211
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1212 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
1213 footer items.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1214
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1215 @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
1216 @keyword ...:...
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1217 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1218 @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
1219 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1220 return self.endPage()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1221
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1222 # RecentChanges ######################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1223
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1224 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
1225 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1226 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
1227
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1228 @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
1229 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1230 @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
1231 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1232 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1233 html = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1234 html.append('<tr>\n')
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 html.append('<td class="rcicon1">%(icon_html)s</td>\n' % d)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1237
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1238 html.append('<td class="rcpagelink">%(pagelink_html)s</td>\n' % d)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1239
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1240 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
1241 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
1242 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
1243 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
1244
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1245 html.append('<td class="rcicon2">%(info_html)s</td>\n' % d)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1246
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1247 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
1248 if d['editors']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1249 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
1250 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
1251
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1252 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
1253 if d['comments']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1254 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
1255 notfirst = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1256 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
1257 html.append('%s<tt>#%02d</tt>&nbsp;%s' % (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1258 notfirst and '<br>' or '' , comment[0], comment[1]))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1259 notfirst = 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1260 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1261 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
1262 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
1263 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
1264
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1265 html.append('</tr>\n')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1266
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1267 return ''.join(html)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1268
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1269 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
1270 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1271 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
1272
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1273 @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
1274 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1275 @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
1276 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1277 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
1278 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
1279 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1280 set_bm = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1281 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
1282 '<strong>%s</strong>'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1283 '%s'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1284 '</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
1285
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1286 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
1287 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1288 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
1289
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1290 @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
1291 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1292 @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
1293 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1294 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1295
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1296 # 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
1297 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
1298 html += '<div>\n'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1299 if self.shouldUseRSS():
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1300 link = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1301 u'<div class="rcrss">',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1302 u'<a href="%s">' % self.rsshref(),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1303 self.make_icon("rss"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1304 u'</a>',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1305 u'</div>',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1306 ]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1307 html += ''.join(link)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1308 html += '<p>'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1309 # Add day selector
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1310 if d['rc_days']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1311 days = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1312 for day in d['rc_days']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1313 if day == d['rc_max_days']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1314 days.append('<strong>%d</strong>' % day)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1315 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1316 days.append(
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1317 wikiutil.link_tag(self.request,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1318 '%s?max_days=%d' % (d['q_page_name'], day),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1319 str(day)))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1320 days = ' | '.join(days)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1321 html += (_("Show %s days.") % (days,))
30
221912bf8efa save some screen space for RC
Thomas Waldmann <tw@waldmann-edv.de>
parents: 23
diff changeset
1322
221912bf8efa save some screen space for RC
Thomas Waldmann <tw@waldmann-edv.de>
parents: 23
diff changeset
1323 if d['rc_update_bookmark']:
221912bf8efa save some screen space for RC
Thomas Waldmann <tw@waldmann-edv.de>
parents: 23
diff changeset
1324 html += " %(rc_update_bookmark)s %(rc_curr_bookmark)s" % d
221912bf8efa save some screen space for RC
Thomas Waldmann <tw@waldmann-edv.de>
parents: 23
diff changeset
1325
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1326 html += '</p>\n</div>\n'
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 html += '<table>\n'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1329 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1330
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1331 def recentchanges_footer(self, d):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1332 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1333 Assemble the recentchanges footer (close table)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1334
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1335 @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
1336 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1337 @return: recentchanges footer html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1338 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1339 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1340 html = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1341 html += '</table>\n'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1342 if d['rc_msg']:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1343 html += "<br>%(rc_msg)s\n" % d
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1344 html += '</div>\n'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1345 return html
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1346
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1347 # Language stuff ####################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1348
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1349 def ui_lang_attr(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1350 """Generate language attributes for user interface elements
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1351
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1352 User interface elements use the user language (if any), kept in
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1353 request.lang.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1354
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1355 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1356 @return: lang and dir html attributes
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1357 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1358 lang = self.request.lang
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1359 return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1360
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1361 def content_lang_attr(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1362 """Generate language attributes for wiki page content
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1363
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1364 Page content uses the page language or the wiki default language.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1365
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1366 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1367 @return: lang and dir html attributes
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1368 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1369 lang = self.request.content_lang
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1370 return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1371