Attachment 'accesskeys-by-name.patch'
Download 1 * looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-667 to compare with
2 * comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-667
3 M MoinMoin/formatter/text_html.py
4 M MoinMoin/Page.py
5 M MoinMoin/multiconfig.py
6 M MoinMoin/wikiutil.py
7
8 * modified files
9
10 --- orig/MoinMoin/Page.py
11 +++ mod/MoinMoin/Page.py
12 @@ -61,7 +61,10 @@
13 self._raw_body = None
14 self._raw_body_modified = 0
15 self.hilite_re = None
16 - self.language = None
17 + self.language = None
18 + self.master_page = keywords.get('master_page')
19 + keys = self.cfg.accesskeys
20 + self.accesskey = keys.get(self.master_page, keys.get(page_name))
21
22 self.reset()
23
24 @@ -826,6 +829,10 @@
25 if not self.exists():
26 kw['css_class'] = 'nonexistent'
27
28 + # Add accesskey
29 + if self.accesskey:
30 + kw['accesskey'] = self.accesskey
31 +
32 link = wikiutil.link_tag(request, url, wikiutil.escape(text),
33 formatter=getattr(self, 'formatter', None), **kw)
34
35
36
37 --- orig/MoinMoin/formatter/text_html.py
38 +++ mod/MoinMoin/formatter/text_html.py
39 @@ -257,10 +257,10 @@
40 # unescaped=1 was changed to 0 to make interwiki links with pages with umlauts (or other non-ascii) work
41
42 def url(self, on, url=None, css=None, **kw):
43 - """
44 - Keyword params:
45 - title - title attribute
46 - ... some more (!!! TODO)
47 + """ Render html url link
48 +
49 + @keyword title: html title attribute
50 + @keyword accesskey: html accesskey attribute
51 """
52 if url is not None:
53 url = wikiutil.mapURL(self.request, url)
54 @@ -279,6 +279,11 @@
55 str = '%s class="%s"' % (str, css)
56 if title:
57 str = '%s title="%s"' % (str, title)
58 +
59 + accesskey = kw.get('accesskey')
60 + if accesskey:
61 + str = '%s accesskey="%s"' % (str, accesskey)
62 +
63 str = '%s href="%s">' % (str, wikiutil.escape(url, 1))
64
65 type = kw.get('type', '')
66
67
68 --- orig/MoinMoin/multiconfig.py
69 +++ mod/MoinMoin/multiconfig.py
70 @@ -270,6 +270,20 @@
71
72 SecurityPolicy = None
73
74 + # Accessibility
75 + accesskeys = {
76 + u'FrontPage': '1',
77 + u'RecentChanges': '2',
78 + u'SiteMap': '3',
79 + u'FindPage': '4',
80 + u'FrequentlyAskedQuestions': '5',
81 + u'HelpContents': '6',
82 + u'ComplaintsProcedure': '7',
83 + u'WikiLicense': '8',
84 + u'WikiAdmin': '9',
85 + u'HelpOnAccesskeys': '0',
86 + }
87 +
88 def __init__(self, siteid):
89 """ Init Config instance """
90 self.siteid = siteid
91 @@ -319,11 +333,17 @@
92 if not getattr(self, name, None):
93 setattr(self, name, os.path.join(data_dir, dirname))
94
95 - # post process navibar
96 + # Expand variables in navibar
97 # we replace any string placeholders with config values
98 # e.g u'%(page_front_page)s' % self
99 self.navi_bar = [elem % self for elem in self.navi_bar]
100 -
101 +
102 + # Update accesskey to actual front page
103 + keys = self.accesskeys
104 + if self.page_front_page != u'FrontPage' and u'FrontPage' in keys:
105 + keys[self.page_front_page] = keys[u'FrontPage']
106 + del keys[u'FrontPage']
107 +
108 def _config_check(self):
109 """ Check namespace and warn about unknown names
110
111
112
113 --- orig/MoinMoin/wikiutil.py
114 +++ mod/MoinMoin/wikiutil.py
115 @@ -480,7 +480,7 @@
116 if i18n_page.exists():
117 pageobj = i18n_page
118 else:
119 - i18n_page = Page(request, i18n_name)
120 + i18n_page = Page(request, i18n_name, master_page=pagename)
121 if i18n_page.exists():
122 pageobj = i18n_page
123
124 @@ -871,6 +871,7 @@
125 @param formatter: the formatter object to use
126 @keyword on: opening/closing tag only
127 @keyword attrs: additional attrs (HTMLified string)
128 + @keyword accesskey: html accesskey attribute
129 @rtype: string
130 @return: formatted link tag
131 """
132 @@ -892,6 +893,11 @@
133 attrs += ' ' + kw['attrs']
134 if css_class:
135 attrs += ' class="%s"' % css_class
136 +
137 + accesskey = kw.get('accesskey')
138 + if accesskey:
139 + attrs += ' accesskey="%s"' % accesskey
140 +
141 result = '<a%s href="%s/%s">' % (attrs, request.getScriptname(), params)
142 if on:
143 return result
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.