Attachment 'SendAccountMail-1.6-dev-2.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - SendAccountMail form
   4     
   5     Syntax:
   6        [[SendAccountMail]]
   7 
   8     @copyright: 2006 by Reimar Bauer, Oliver Siemoneit
   9     @license: GNU GPL, see COPYING for details.
  10 """
  11 
  12 from MoinMoin.widget import html
  13 
  14 
  15 def make_row(table, label, cell, **kw):
  16     """ Create a row in the form table.
  17     """
  18     table.append(html.TR().extend([
  19         html.TD(**kw).extend([html.B().append(label), '   ']),
  20         html.TD().extend(cell),
  21     ]))
  22     return table
  23 
  24 def execute(macro, args):
  25     request = macro.request
  26     _ = request.getText
  27     formatter = macro.formatter
  28 
  29     sn = request.getScriptname()
  30     pi = request.getPathinfo()
  31     action = u"%s%s" % (sn, pi)
  32     form = html.FORM(action=action)
  33     table = html.TABLE(border="0")
  34 
  35     if not request.cfg.mail_enabled:
  36         return _("This wiki is not enabled for mail processing.\nContact the owner of the wiki, who can enable email.")
  37     else:
  38         buttons = []
  39         action = u"%s%s" % (sn, pi)
  40         form = html.FORM(action=action)
  41         table = html.TABLE(border="0")
  42 
  43         # Add form fields
  44         for key, label, type, length, textafter in request.cfg.user_form_fields:
  45             if key == 'email':
  46                 table = make_row(table, _(label),
  47                                  [html.INPUT(type=type, size=length, name=key,
  48                                  value=''), ' ', ])
  49         # Add buttons
  50         buttons.append(("account_sendmail", _('Mail me my account data')))
  51         button_cell = []
  52         for name, label in buttons:
  53             if not name in request.cfg.user_form_remove:
  54                 button_cell.extend([
  55                      html.INPUT(type="submit", name=name, value=label),
  56                      ' ',
  57                 ])
  58         make_row(table, '', button_cell)
  59 
  60         # Use the user interface language and direction
  61         lang_attr = request.theme.ui_lang_attr()
  62         form.append(html.Raw('<div class="userprefs"%s>' % lang_attr))
  63         form.append(html.INPUT(type="hidden", name="action", value="userform"))
  64         form.append(table)
  65         form.append(html.Raw("</div>"))
  66 
  67         return unicode(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.
  • [get | view] (2006-08-19 11:27:51, 0.6 KB) [[attachment:SendAccountMail-1.5.py]]
  • [get | view] (2007-01-06 18:28:35, 2.1 KB) [[attachment:SendAccountMail-1.6-dev-2.py]]
  • [get | view] (2006-12-10 19:56:44, 1.8 KB) [[attachment:SendAccountMail1-6-dev-1.py]]
  • [get | view] (2006-12-10 17:18:39, 0.7 KB) [[attachment:SendMyPassword.txt]]
  • [get | view] (2006-08-19 11:27:36, 0.9 KB) [[attachment:userform.patch.txt]]
  • [get | view] (2006-12-10 17:18:16, 0.9 KB) [[attachment:userform1-6-dev.diff]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.