Attachment 'Subscribers-1.6.0.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - Subscribers action
4
5 Displays all users subcribed to the page the actions was called from
6
7 @copyright: 2003 by Daniela Nicklas
8
9 @copyright: 2007 by Oliver Siemoneit
10 @license: GNU GPL, see COPYING for details.
11
12 """
13
14 from MoinMoin.Page import Page
15
16 def execute(pagename, request):
17 _ = request.getText
18 request.emit_http_headers()
19 request.theme.send_title(_("Subscribers for %s") % pagename, pagename=pagename)
20
21 # show subscribers
22 request.write('<strong>', _('The following users subscribed to this page:'), '</strong><ul>')
23 page = Page(request, pagename)
24 users = page.getSubscribers(request, include_self=1, return_users=1)
25 if users:
26 for lang in users.keys():
27 for user in users[lang]:
28 request.write('<li>[%s] ' % lang)
29 userhomepage = Page(request, user.name)
30 if userhomepage.exists():
31 request.write(userhomepage.link_to(request))
32 else:
33 request.write(user.name)
34 mail = '%s%s%s' % (request.formatter.url(1, 'mailto:%s?subject=%s'%(user.email, pagename), css='mailto', do_escape=0),
35 request.formatter.text(user.email),
36 request.formatter.url(0))
37 request.write(', %s ' % mail)
38
39 request.write('</ul>')
40
41 # generate "mail to all" - link
42 subscribers = page.getSubscribers(request, include_self=1, return_users=0)
43 allsubs = ''
44 if subscribers:
45 for subscriber in subscribers.values():
46 for email in subscriber:
47 allsubs += '%s, '%email
48
49 if allsubs:
50 mailtoall = '%s%s%s' % (request.formatter.url(1, 'mailto:%s?subject=%s'%(allsubs, pagename), css='mailto', do_escape=0),
51 request.formatter.text(_('Mail to all')),
52 request.formatter.url(0))
53 request.write(mailtoall)
54 else:
55 request.write(_('[No subscriptions yet]') + '</ul>')
56
57 request.theme.send_footer(pagename)
58 return
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.