Attachment 'ShowActions.py'
Download 1 # -*- coding: iso-8859-1 -*-
2
3 import re
4 from MoinMoin import config, wikiutil
5 from MoinMoin.Page import Page
6
7 # Ripped from the LikePages action
8 def execute(pagename, request):
9 _ = request.getText
10 from MoinMoin.formatter.text_html import Formatter
11 request.formatter = Formatter(request)
12
13 request.http_headers()
14
15 # This action generate data using the user language
16 request.setContentLanguage(request.lang)
17
18 request.theme.send_title(_('Actions for "%s"') % (pagename),
19 pagename=pagename)
20
21 # Start content - IMPORTANT - without content div, there is no
22 # direction support!
23 request.write(request.formatter.startContent("content"))
24
25 # Just list the actions
26 request.write(availableactions(request))
27
28 # End content and send footer
29 request.write(request.formatter.endContent())
30 request.theme.send_footer(pagename)
31
32 # Rippped from the theme code
33 def availableactions(request):
34 page = request.page
35 _ = request.getText
36 html = ''
37 available = request.getAvailableActions(page)
38 if available:
39 available = list(available)
40 available.sort()
41 links = []
42 for action in available:
43 # Always add spaces: AttachFile -> Attach File
44 # XXX TODO do not make a page object just for split_title
45 title = Page(request, action).split_title(force=1)
46 # Use translated version if available
47 title = _(title, formatted=False)
48 params = '%s?action=%s' % (page.page_name, action)
49 link = wikiutil.link_tag(request, params, title)
50 links.append(u''.join([ u'<li>', link, u'</li>' ]))
51
52 html = u'<ul>%s</ul>' % u''.join(links)
53 return html
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.