diff options
| author | tkikuchi | 2005-08-28 05:31:27 +0000 |
|---|---|---|
| committer | tkikuchi | 2005-08-28 05:31:27 +0000 |
| commit | 067dc15b2432bb285ab5e4a3eac6f4dddd67ed19 (patch) | |
| tree | ceac72251ee33742bfff7626c99dde163d3da946 /Mailman/Cgi/admin.py | |
| parent | bc1dad4f90a26ade7c4dd6d2863de88856e8b4b6 (diff) | |
| download | mailman-067dc15b2432bb285ab5e4a3eac6f4dddd67ed19.tar.gz mailman-067dc15b2432bb285ab5e4a3eac6f4dddd67ed19.tar.zst mailman-067dc15b2432bb285ab5e4a3eac6f4dddd67ed19.zip | |
Diffstat (limited to 'Mailman/Cgi/admin.py')
| -rw-r--r-- | Mailman/Cgi/admin.py | 98 |
1 files changed, 84 insertions, 14 deletions
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py index 94ed8bda1..eb63e0081 100644 --- a/Mailman/Cgi/admin.py +++ b/Mailman/Cgi/admin.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2003 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2004 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -14,9 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -"""Process and produce the list-administration options forms. - -""" +"""Process and produce the list-administration options forms.""" # For Python 2.1.x compatibility from __future__ import nested_scopes @@ -51,6 +49,12 @@ i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) NL = '\n' OPTCOLUMNS = 11 +try: + True, False +except NameError: + True = 1 + False = 0 + def main(): @@ -232,8 +236,9 @@ def admin_overview(msg=''): # List is for different identity of this host - skip it. continue else: - advertised.append(mlist) - + advertised.append((mlist.GetScriptURL('admin'), + mlist.real_name, + mlist.description)) # Greeting depends on whether there was an error or not if msg: greeting = FontAttr(msg, color="ff5060", size="+1") @@ -283,10 +288,10 @@ def admin_overview(msg=''): Bold(FontAttr(_('Description'), size='+2')) ]) highlight = 1 - for mlist in advertised: + for url, real_name, description in advertised: table.AddRow( - [Link(mlist.GetScriptURL('admin'), Bold(mlist.real_name)), - mlist.description or Italic(_('[no description available]'))]) + [Link(url, Bold(real_name)), + description or Italic(_('[no description available]'))]) if highlight and mm_cfg.WEB_HIGHLIGHT_COLOR: table.AddRowInfo(table.GetCurrentRowIndex(), bgcolor=mm_cfg.WEB_HIGHLIGHT_COLOR) @@ -406,7 +411,7 @@ def show_results(mlist, doc, category, subcat, cgidata): otherlinks.AddItem(Link(mlist.GetScriptURL('listinfo'), _('Go to the general list information page'))) otherlinks.AddItem(Link(mlist.GetScriptURL('edithtml'), - _('Edit the public HTML pages'))) + _('Edit the public HTML pages and text files'))) otherlinks.AddItem(Link(mlist.GetBaseArchiveURL(), _('Go to list archives')).Format() + '<br> <br>') @@ -678,7 +683,7 @@ def get_item_gui_value(mlist, category, kind, varname, params, extra): # and a delete button. Yeesh! params are ignored. table = Table(border=0) # This adds the html for the entry widget - def makebox(i, name, pattern, desc, empty=0, table=table): + def makebox(i, name, pattern, desc, empty=False, table=table): deltag = 'topic_delete_%02d' % i boxtag = 'topic_box_%02d' % i reboxtag = 'topic_rebox_%02d' % i @@ -718,7 +723,71 @@ def get_item_gui_value(mlist, category, kind, varname, params, extra): # Add one more non-deleteable widget as the first blank entry, but # only if there are no real entries. if i == 1: - makebox(i, '', '', '', empty=1) + makebox(i, '', '', '', empty=True) + return table + elif kind == mm_cfg.HeaderFilter: + # A complex and specialized widget type that allows for setting of a + # spam filter rule including, a mark button, a regexp text box, an + # "add after mark", up and down buttons, and a delete button. Yeesh! + # params are ignored. + table = Table(border=0) + # This adds the html for the entry widget + def makebox(i, pattern, action, empty=False, table=table): + deltag = 'hdrfilter_delete_%02d' % i + reboxtag = 'hdrfilter_rebox_%02d' % i + actiontag = 'hdrfilter_action_%02d' % i + wheretag = 'hdrfilter_where_%02d' % i + addtag = 'hdrfilter_add_%02d' % i + newtag = 'hdrfilter_new_%02d' % i + uptag = 'hdrfilter_up_%02d' % i + downtag = 'hdrfilter_down_%02d' % i + if empty: + table.AddRow([Center(Bold(_('Spam Filter Rule %(i)d'))), + Hidden(newtag)]) + else: + table.AddRow([Center(Bold(_('Spam Filter Rule %(i)d'))), + SubmitButton(deltag, _('Delete'))]) + table.AddRow([Label(_('Spam Filter Regexp:')), + TextArea(reboxtag, text=pattern, + rows=4, cols=30, wrap='off')]) + values = [mm_cfg.DEFER, mm_cfg.HOLD, mm_cfg.REJECT, + mm_cfg.DISCARD, mm_cfg.ACCEPT] + try: + checked = values.index(action) + except ValueError: + checked = 0 + radio = RadioButtonArray( + actiontag, + (_('Defer'), _('Hold'), _('Reject'), + _('Discard'), _('Accept')), + values=values, + checked=checked).Format() + table.AddRow([Label(_('Action:')), radio]) + if not empty: + table.AddRow([SubmitButton(addtag, _('Add new item...')), + SelectOptions(wheretag, ('before', 'after'), + (_('...before this one.'), + _('...after this one.')), + selected=1), + ]) + # BAW: IWBNI we could disable the up and down buttons for the + # first and last item respectively, but it's not easy to know + # which is the last item, so let's not worry about that for + # now. + table.AddRow([SubmitButton(uptag, _('Move rule up')), + SubmitButton(downtag, _('Move rule down'))]) + table.AddRow(['<hr>']) + table.AddCellInfo(table.GetCurrentRowIndex(), 0, colspan=2) + # Now for each element in the existing data, create a widget + i = 1 + data = getattr(mlist, varname) + for pattern, action, empty in data: + makebox(i, pattern, action, empty) + i += 1 + # Add one more non-deleteable widget as the first blank entry, but + # only if there are no real entries. + if i == 1: + makebox(i, '', mm_cfg.DEFER, empty=True) return table elif kind == mm_cfg.Checkbox: return CheckBoxArray(varname, *params) @@ -1262,7 +1331,8 @@ def change_options(mlist, category, subcat, cgidata, doc): mlist.InviteNewMember(userdesc, invitation) else: mlist.ApprovedAddMember(userdesc, send_welcome_msg, - send_admin_notif, invitation) + send_admin_notif, invitation, + whence='admin mass sub') except Errors.MMAlreadyAMember: subscribe_errors.append((entry, _('Already a member'))) except Errors.MMBadEmailError: @@ -1353,7 +1423,7 @@ def change_options(mlist, category, subcat, cgidata, doc): for user in users: if cgidata.has_key('%s_unsub' % user): try: - mlist.ApprovedDeleteMember(user) + mlist.ApprovedDeleteMember(user, whence='member mgt page') removes.append(user) except Errors.NotAMemberError: errors.append((user, _('Not subscribed'))) |
