Attachment 'ToggleWelcome.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - ToggleWelcome form
4
5 Syntax:
6 [[ToggleWelcome]]
7
8 @copyright: 2007 by Oliver Siemoneit
9 @license: GNU GPL, see COPYING for details.
10 """
11
12 from MoinMoin import wikiutil
13
14 def execute(macro, args):
15 request = macro.request
16 _ = request.getText
17
18 if not request.user.valid:
19 return
20
21 ticket = wikiutil.createTicket(request)
22
23 sn = request.getScriptname()
24 pi = request.getPathinfo()
25 action = u"%s%s" % (sn, pi)
26
27 lang_attr = request.theme.ui_lang_attr()
28 buttontext = _('Save')
29 label = _("Don't show this page again")
30
31 if request.user.show_welcome:
32 checked = ''
33 value = '0'
34 else:
35 checked = 'checked'
36 value = '1'
37
38 return '''
39 <form action="%(action)s" method="POST">
40 <div class="userpref" %(lang_attr)s>
41 <input type="hidden" name="action" value="togglewelcome">
42 <input type="hidden" name="ticket" value="%(ticket)s">
43 <table border="0">
44 <tr>
45 <td><input type="checkbox" name="toggle_welcome" id="chktoggle_welcome" value="%(value)s" %(checked)s></td>
46 <td><label for="chktoggle_welcome">%(label)s</label></td>
47 <td><input type="submit" name="save_toggle" value="%(buttontext)s"></td>
48 </tr>
49 </table>
50 </form>''' % { 'action': action,
51 'lang_attr': lang_attr,
52 'ticket': ticket,
53 'value': value,
54 'checked': checked,
55 'label': label,
56 'buttontext': buttontext, }
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.