Attachment 'SubscribeUser.py.patch'
Download 1 --- SubscribeUser.py.orig 2006-03-18 16:36:20.000000000 +0100
2 +++ SubscribeUser.py 2006-03-25 21:38:49.552850432 +0100
3 @@ -4,6 +4,7 @@
4
5 @copyright: Daniela Nicklas <nicklas@informatik.uni-stuttgart.de>, 2003
6 @copyright: 2005 MoinMoin:AlexanderSchremmer
7 + @copyright: 2006 ReimarBauer
8
9 @license: GNU GPL, see COPYING for details.
10 """
11 @@ -17,31 +18,52 @@
12
13 def show_form(pagename, request):
14 _ = request.getText
15 +
16 + thispage = Page(request,pagename)
17 +
18 + users = user.getUserList(request)
19 + options = []
20 + for uid in users:
21 + theuser = user.User(request, uid)
22 + if theuser.disabled == False:
23 + name = user.User(request, id=uid).name
24 + if name != request.user.name:
25 + options.append("<option value=%(name)s>%(name)s</option>" % { "name":name})
26 + else:
27 + options.append("<option selected value=%(name)s>%(name)s</option>" % { "name":name})
28 + options.sort()
29 +
30 request.http_headers()
31 - wikiutil.send_title(request, _("Subscribe users to the page %s") % pagename, pagename=pagename)
32 -
33 - request.write("""
34 -<form action="" method="POST" enctype="multipart/form-data">
35 -<input type="hidden" name="action" value="SubscribeUser">
36 -Enter user names (comma separated): <input type="text" name="users" size="50">
37 -<input type="submit" value="Subscribe">
38 -</form>
39 -""")
40 - wikiutil.send_footer(request, pagename)
41 -
42 + formhtml = '''
43 +%(description)s
44 +<form action="" method="POST" enctype="multipart/form-data>"
45 +<select name="users" size="%(len)s" multiple>
46 +%(option)s
47 +</select>
48 +<input type="hidden" name="action" value="%(actname)s">
49 +<input type="submit" name="button" value="%(button)s">
50 +</form>''' % {
51 + 'description': _("Subscribe users to the page %s") % pagename,
52 + 'actname': 'SubscribeUser',
53 + 'option': options,
54 + 'len': min(5,len(users)),
55 + 'button': _('Subscribe')}
56 +
57 + thispage.send_page(request, msg=formhtml)
58 +
59 +
60 def show_result(pagename, request):
61 _ = request.getText
62 - request.http_headers()
63 -
64 - wikiutil.send_title(request, _("Subscribed for %s:") % pagename, pagename=pagename)
65 +
66 + thispage = Page(request,pagename)
67
68 from MoinMoin.formatter.text_html import Formatter
69 formatter = Formatter(request)
70
71 - result = subscribe_users(request, request.form['users'][0].split(","), pagename, formatter)
72 - request.write(result)
73 -
74 - wikiutil.send_footer(request, pagename)
75 + result = subscribe_users(request, request.form['users'], pagename, formatter)
76 +
77 + request.http_headers()
78 + thispage.send_page(request, msg=result)
79
80
81 def subscribe_users(request, usernamelist, pagename, formatter):
82 @@ -123,6 +145,6 @@
83
84 from MoinMoin.formatter.text_plain import Formatter
85 formatter = Formatter(request)
86 -
87 - print subscribe_users(request, usernames.split(","), pagename, formatter)
88 +
89 + print subscribe_users(request, usernames, pagename, formatter)
90
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.