Attachment 'Subscribers.py'
Download 1 """
2 MoinMoin - Subscribers - Action
3 Displays the subscribed users of a page
4
5 Author: Daniela Nicklas <nicklas@informatik.uni-stuttgart.de>
6 (c) 2003, all rights reserved
7
8 Designed for MoinMoin 1.1
9
10 """
11
12 from MoinMoin import wikiutil, webapi
13 from MoinMoin.formatter.text_html import Formatter
14
15 from MoinMoin.Page import Page
16 from MoinMoin.i18n import _
17
18 def execute(pagename, request):
19
20 # send http headers
21 webapi.http_headers(request)
22
23 # send title
24 p = Page(pagename)
25 wikiutil.send_title(request, _("Subscribers for %s"%pagename))
26
27 # get subscribers
28 page = Page(pagename)
29
30 # show subscribers
31 users = page.getSubscribers(request, include_self=1, return_users=1)
32 if users:
33 request.write('<b>', _('The following users subscribed to this page:'), '</b><ul>')
34 for lang in users.keys():
35 request.write('<li>[%s] ' % lang)
36 for user in users[lang]:
37 # do NOT disclose email addr, only WikiName
38 userhomepage = Page(user.name)
39 if userhomepage.exists():
40 request.write(userhomepage.link_to() + ' ')
41 else:
42 request.write(user.name + ' ')
43 request.write('</ul>')
44
45 # generate "mail to all" - link
46 subscribers = page.getSubscribers(request, include_self=1, return_users=0)
47 allsubs = ''
48 if subscribers:
49 form = Formatter(request)
50 for subscriber in subscribers.values():
51 for email in subscriber:
52 allsubs += '%s, '%email
53 if allsubs:
54 mailtoall = form.url('mailto:%s?subject=%s'%(allsubs,pagename),_('Mail to all'))
55 request.write(mailtoall)
56
57 # send footer
58 wikiutil.send_footer(request, pagename, editable=0, showactions=1, form=request.form)
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.