Attachment 'accesskey.patch'
Download 1 * looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-665 to compare with
2 * comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-665
3 M MoinMoin/theme/__init__.py
4
5 * modified files
6
7 --- orig/MoinMoin/theme/__init__.py
8 +++ mod/MoinMoin/theme/__init__.py
9 @@ -185,7 +185,10 @@
10 if request.user.valid:
11 homepage = Page(request, request.user.name)
12 title = homepage.split_title(request)
13 - homelink = homepage.link_to(request, text=title)
14 + accesskey = _("H")
15 + tip = _("Visit your home page (%s)") % accesskey
16 + attrs = 'accesskey="%s" title="%s"' % (accesskey, tip)
17 + homelink = homepage.link_to(request, text=title, attrs=attrs)
18 userlinks.append(homelink)
19
20 # Set pref page to localized Preferences page
21 @@ -204,7 +207,7 @@
22 linkSchemas = [r'http://', r'https://', r'ftp://', 'mailto:'] + \
23 [x + ':' for x in config.url_schemas]
24
25 - def splitNavilink(self, text, localize=1):
26 + def splitNavilink(self, text, localize=1, accesskey=''):
27 """ Split navibar links into pagename, link to page
28
29 Admin or user might want to use shorter navibar items by using
30 @@ -213,11 +216,14 @@
31 the localized version of page.
32
33 @param text: the text used in config or user preferences
34 + @param localized: link should be localized
35 + @param accesskey: link will use specified accesskey
36 @rtype: tuple
37 @return: pagename or url, link to page or url
38 """
39 request = self.request
40 -
41 + _ = request.getText
42 +
43 # Handle [pagename title] or [url title] formats
44 if text.startswith('[') and text.endswith(']'):
45 try:
46 @@ -232,7 +238,11 @@
47 for scheme in self.linkSchemas:
48 if pagename.startswith(scheme):
49 title = wikiutil.escape(title)
50 - link = '<a href="%s">%s</a>' % (pagename, title)
51 + tip = _("Visit %s at %s") % (title, pagename)
52 + if accesskey:
53 + tip += ' (%s)' % accesskey
54 + link = '<a href="%s" accesskey="%s" title="%s">%s</a>' % (
55 + pagename, accesskey, tip, title)
56 break
57
58 # Handle [pagename title] format
59 @@ -242,7 +252,11 @@
60 # [name_with_spaces label] we must save the underscores
61 # until this point.
62 pagename = request.normalizePagename(pagename)
63 - link = Page(request, pagename).link_to(request, title)
64 + tip = _("Visit %s") % pagename
65 + if accesskey:
66 + tip += ' (%s)' % accesskey
67 + attrs = 'accesskey="%s" title="%s"' % (accesskey, tip)
68 + link = Page(request, pagename).link_to(request, title, attrs=attrs)
69
70 # Handle regular pagename like "FrontPage"
71 else:
72 @@ -254,8 +268,11 @@
73 pagename = page.page_name
74 title = page.split_title(request)
75 title = self.shortenPagename(title)
76 - link = page.link_to(request, title)
77 -
78 + tip = _("Visit %s") % pagename
79 + if accesskey:
80 + tip += ' (%s)' % accesskey
81 + attrs = 'accesskey="%s" title="%s"' % (accesskey, tip)
82 + link = page.link_to(request, title, attrs=attrs)
83 return pagename, link
84
85 def shortenPagename(self, name):
86 @@ -296,9 +313,16 @@
87 current = d['page_name']
88
89 # Process config navi_bar
90 + # Items 0-9 will have access keys
91 if request.cfg.navi_bar:
92 + i = 0
93 for text in request.cfg.navi_bar:
94 - pagename, link = self.splitNavilink(text)
95 + if i <= 9:
96 + accesskey = str(i)
97 + i += 1
98 + else:
99 + accesskey = ''
100 + pagename, link = self.splitNavilink(text, accesskey=accesskey)
101 cls = 'wikilink'
102 if pagename == current:
103 cls = 'wikilink current'
104 @@ -555,11 +579,14 @@
105 """
106 _ = self.request.getText
107 form = self.request.form
108 + accesskey = _('F')
109 updates = {
110 'search_label' : _('Search:'),
111 'search_value': wikiutil.escape(form.get('value', [''])[0], 1),
112 'search_full_label' : _('Text', formatted=False),
113 'search_title_label' : _('Titles', formatted=False),
114 + 'search_accesskey': accesskey,
115 + 'search_title': _("Search titles or text in this wiki (%s)") % accesskey,
116 }
117 d.update(updates)
118
119 @@ -570,6 +597,7 @@
120 <input type="hidden" name="context" value="180">
121 <label for="searchinput">%(search_label)s</label>
122 <input id="searchinput" type="text" name="value" value="%(search_value)s" size="20"
123 + accesskey="%(search_accesskey)s" title="%(search_title)s"
124 onfocus="searchFocus(this)" onblur="searchBlur(this)"
125 onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search">
126 <input id="titlesearch" name="titlesearch" type="submit"
127 @@ -969,14 +997,25 @@
128
129 # Page actions
130 if page.isWritable() and request.user.may.write(page.page_name):
131 - add(link(request, quotedname + '?action=edit', _('Edit')))
132 + accesskey = _('E')
133 + title = _("Edit this page (%s)") % accesskey
134 + add(link(request, quotedname + '?action=edit', _('Edit'),
135 + attrs='accesskey="%s" title="%s"' % (accesskey, title)))
136 else:
137 add(_('Immutable Page', formatted=False))
138 -
139 +
140 + accesskey = _('D')
141 + title = _("Show differences from last revision (%s)") % accesskey
142 add(link(request, quotedname + '?action=diff',
143 - _('Show Changes', formatted=False)))
144 + _('Show Changes', formatted=False),
145 + attrs='accesskey="%s" title="%s"' % (accesskey, title)))
146 +
147 + accesskey = _('I')
148 + title = _("Show page information (%s)") % accesskey
149 add(link(request, quotedname + '?action=info',
150 - _('Get Info', formatted=False)))
151 + _('Get Info', formatted=False),
152 + attrs='accesskey="%s" title="%s"' % (accesskey, title)))
153 +
154 add(self.subscribeLink(page))
155 add(self.actionsMenu(page))
156
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.