Attachment 'SendAccountMail1-6-dev-1.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     # Add form fields
  36     for key, label, type, length, textafter in request.cfg.user_form_fields:
  37         if key == 'email':
  38             table = make_row(table, _(label),
  39                               [html.INPUT(type=type, size=length, name=key,
  40                                           value=''),
  41                                ' ', ])
  42     # Add buttons
  43     buttons = []
  44 
  45     if request.cfg.mail_enabled:
  46         buttons.append(("account_sendmail", _('Mail me my account data')))
  47 
  48     button_cell = []
  49     for name, label in buttons:
  50         if not name in request.cfg.user_form_remove:
  51             button_cell.extend([
  52                 html.INPUT(type="submit", name=name, value=label),
  53                 ' ',
  54             ])
  55     make_row(table,'', button_cell)
  56 
  57 
  58     # Use the user interface language and direction
  59     lang_attr = request.theme.ui_lang_attr()
  60     form.append(html.Raw('<div class="userprefs"%s>' % lang_attr))
  61     form.append(html.INPUT(type="hidden", name="action", value="userform"))
  62     form.append(table)
  63     form.append(html.Raw("</div>"))
  64    
  65     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.