Merge lp:~stylistica/systers/adminUI into lp:~systers-dev/systers/development

Proposed by Sneha Priscilla
Status: Merged
Merged at revision: 83
Proposed branch: lp:~stylistica/systers/adminUI
Merge into: lp:~systers-dev/systers/development
Diff against target: 506 lines (+501/-0)
1 file modified
Mailman/Gui/General.py (+501/-0)
To merge this branch: bzr merge lp:~stylistica/systers/adminUI
Reviewer Review Type Date Requested Status
Nicki Hutchens (community) Approve
Anna SdG Approve
Robin J Pending
Review via email: mp+114890@code.launchpad.net

This proposal supersedes a proposal from 2012-07-04.

Description of the change

Added admin UI for essays, essay questions and full name .

Made changes to one file from Mailman : ../Mailman/Gui/General.py and added it.
 Changed lines 383-401

To post a comment you must log in.
Revision history for this message
Robin J (robin-jeffries) wrote : Posted in a previous version of this proposal

Looks good

review: Approve
Revision history for this message
Anna SdG (anna-granudd) wrote : Posted in a previous version of this proposal

I agree with Robin but maybe you could add a "." at the end of each sentence of the description text (to match the other fields on the page)? Sorry for being picky... Thanks.

Revision history for this message
Sneha Priscilla (stylistica) wrote : Posted in a previous version of this proposal

That's alright :) I had totally missed that !

On Fri, Jul 6, 2012 at 12:40 AM, Anna SdG <email address hidden> wrote:
> I agree with Robin but maybe you could add a "." at the end of each sentence of the description text (to match the other fields on the page)? Sorry for being picky... Thanks.
> --
> https://code.launchpad.net/~stylistica/systers/adminUI/+merge/113416
> You are the owner of lp:~stylistica/systers/adminUI.

Revision history for this message
Anna SdG (anna-granudd) wrote :

Thanks for adding the dots. :)

review: Approve
Revision history for this message
Nicki Hutchens (nhutchen) wrote :

Thanks for explaining the changes. It looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'Mailman/Gui'
=== added file 'Mailman/Gui/General.py'
--- Mailman/Gui/General.py 1970-01-01 00:00:00 +0000
+++ Mailman/Gui/General.py 2012-07-13 15:35:28 +0000
@@ -0,0 +1,501 @@
1# Copyright (C) 2001-2007 by the Free Software Foundation, Inc.
2#
3# This program is free software; you can redistribute it and/or
4# modify it under the terms of the GNU General Public License
5# as published by the Free Software Foundation; either version 2
6# of the License, or (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16# USA.
17
18"""MailList mixin class managing the general options."""
19
20import re
21
22from types import IntType
23
24from Mailman import mm_cfg
25from Mailman import Utils
26from Mailman import Errors
27#from Mailman import MailList #sneha
28#from Mailman.DlistUserDesc import DlistUserDesc
29from Mailman.i18n import _
30from Mailman.Gui.GUIBase import GUIBase
31
32OPTIONS = ('hide', 'ack', 'notmetoo', 'nodupes')
33
34
35
036
37class General(GUIBase):
38 def GetConfigCategory(self):
39 return 'general', _('General Options')
40
41 def GetConfigInfo(self, mlist, category, subcat):
42 if category <> 'general':
43 return None
44 WIDTH = mm_cfg.TEXTFIELDWIDTH
45
46 # These are for the default_options checkboxes below.
47 bitfields = {'hide' : mm_cfg.ConcealSubscription,
48 'ack' : mm_cfg.AcknowledgePosts,
49 'notmetoo' : mm_cfg.DontReceiveOwnPosts,
50 'nodupes' : mm_cfg.DontReceiveDuplicates
51 }
52 bitdescrs = {
53 'hide' : _("Conceal the member's address"),
54 'ack' : _("Acknowledge the member's posting"),
55 'notmetoo' : _("Do not send a copy of a member's own post"),
56 'nodupes' :
57 _('Filter out duplicate messages to list members (if possible)'),
58 }
59
60 optvals = [mlist.new_member_options & bitfields[o] for o in OPTIONS]
61 opttext = [bitdescrs[o] for o in OPTIONS]
62
63 rtn = [
64 _('''Fundamental list characteristics, including descriptive
65 info and basic behaviors.'''),
66
67 _('General list personality'),
68
69 ('real_name', mm_cfg.String, WIDTH, 0,
70 _('The public name of this list (make case-changes only).'),
71 _('''The capitalization of this name can be changed to make it
72 presentable in polite company as a proper noun, or to make an
73 acronym part all upper case, etc. However, the name will be
74 advertised as the email address (e.g., in subscribe confirmation
75 notices), so it should <em>not</em> be otherwise altered. (Email
76 addresses are not case sensitive, but they are sensitive to
77 almost everything else :-)''')),
78
79 ('owner', mm_cfg.EmailList, (3, WIDTH), 0,
80 _("""The list administrator email addresses. Multiple
81 administrator addresses, each on separate line is okay."""),
82
83 _('''There are two ownership roles associated with each mailing
84 list. The <em>list administrators</em> are the people who have
85 ultimate control over all parameters of this mailing list. They
86 are able to change any list configuration variable available
87 through these administration web pages.
88
89 <p>The <em>list moderators</em> have more limited permissions;
90 they are not able to change any list configuration variable, but
91 they are allowed to tend to pending administration requests,
92 including approving or rejecting held subscription requests, and
93 disposing of held postings. Of course, the <em>list
94 administrators</em> can also tend to pending requests.
95
96 <p>In order to split the list ownership duties into
97 administrators and moderators, you must
98 <a href="passwords">set a separate moderator password</a>,
99 and also provide the <a href="?VARHELP=general/moderator">email
100 addresses of the list moderators</a>. Note that the field you
101 are changing here specifies the list administrators.''')),
102
103 ('moderator', mm_cfg.EmailList, (3, WIDTH), 0,
104 _("""The list moderator email addresses. Multiple
105 moderator addresses, each on separate line is okay."""),
106
107 _('''There are two ownership roles associated with each mailing
108 list. The <em>list administrators</em> are the people who have
109 ultimate control over all parameters of this mailing list. They
110 are able to change any list configuration variable available
111 through these administration web pages.
112
113 <p>The <em>list moderators</em> have more limited permissions;
114 they are not able to change any list configuration variable, but
115 they are allowed to tend to pending administration requests,
116 including approving or rejecting held subscription requests, and
117 disposing of held postings. Of course, the <em>list
118 administrators</em> can also tend to pending requests.
119
120 <p>In order to split the list ownership duties into
121 administrators and moderators, you must
122 <a href="passwords">set a separate moderator password</a>,
123 and also provide the email addresses of the list moderators in
124 this section. Note that the field you are changing here
125 specifies the list moderators.''')),
126
127 ('description', mm_cfg.String, WIDTH, 0,
128 _('A terse phrase identifying this list.'),
129
130 _('''This description is used when the mailing list is listed with
131 other mailing lists, or in headers, and so forth. It should
132 be as succinct as you can get it, while still identifying what
133 the list is.''')),
134
135 ('info', mm_cfg.Text, (7, WIDTH), 0,
136 _('''An introductory description - a few paragraphs - about the
137 list. It will be included, as html, at the top of the listinfo
138 page. Carriage returns will end a paragraph - see the details
139 for more info.'''),
140 _("""The text will be treated as html <em>except</em> that
141 newlines will be translated to &lt;br&gt; - so you can use links,
142 preformatted text, etc, but don't put in carriage returns except
143 where you mean to separate paragraphs. And review your changes -
144 bad html (like some unterminated HTML constructs) can prevent
145 display of the entire listinfo page.""")),
146
147 ('subject_prefix', mm_cfg.String, WIDTH, 0,
148 _('Prefix for subject line of list postings.'),
149 _("""This text will be prepended to subject lines of messages
150 posted to the list, to distinguish mailing list messages in
151 mailbox summaries. Brevity is premium here, it's ok to shorten
152 long mailing list names to something more concise, as long as it
153 still identifies the mailing list.
154 You can also add a sequential number by %%d substitution
155 directive. eg.; [listname %%d] -> [listname 123]
156 (listname %%05d) -> (listname 00123)
157 """)),
158
159 ('anonymous_list', mm_cfg.Radio, (_('No'), _('Yes')), 0,
160 _("""Hide the sender of a message, replacing it with the list
161 address (Removes From, Sender and Reply-To fields)""")),
162
163 _('''<tt>Reply-To:</tt> header munging'''),
164
165 ('first_strip_reply_to', mm_cfg.Radio, (_('No'), _('Yes')), 0,
166 _('''Should any existing <tt>Reply-To:</tt> header found in the
167 original message be stripped? If so, this will be done
168 regardless of whether an explict <tt>Reply-To:</tt> header is
169 added by Mailman or not.''')),
170
171 ('reply_goes_to_list', mm_cfg.Radio,
172 (_('Poster'), _('This list'), _('Explicit address')), 0,
173 _('''Where are replies to list messages directed?
174 <tt>Poster</tt> is <em>strongly</em> recommended for most mailing
175 lists.'''),
176
177 # Details for reply_goes_to_list
178 _("""This option controls what Mailman does to the
179 <tt>Reply-To:</tt> header in messages flowing through this
180 mailing list. When set to <em>Poster</em>, no <tt>Reply-To:</tt>
181 header is added by Mailman, although if one is present in the
182 original message, it is not stripped. Setting this value to
183 either <em>This list</em> or <em>Explicit address</em> causes
184 Mailman to insert a specific <tt>Reply-To:</tt> header in all
185 messages, overriding the header in the original message if
186 necessary (<em>Explicit address</em> inserts the value of <a
187 href="?VARHELP=general/reply_to_address">reply_to_address</a>).
188
189 <p>There are many reasons not to introduce or override the
190 <tt>Reply-To:</tt> header. One is that some posters depend on
191 their own <tt>Reply-To:</tt> settings to convey their valid
192 return address. Another is that modifying <tt>Reply-To:</tt>
193 makes it much more difficult to send private replies. See <a
194 href="http://www.unicom.com/pw/reply-to-harmful.html">`Reply-To'
195 Munging Considered Harmful</a> for a general discussion of this
196 issue. See <a
197 href="http://www.metasystema.net/essays/reply-to.mhtml">Reply-To
198 Munging Considered Useful</a> for a dissenting opinion.
199
200 <p>Some mailing lists have restricted posting privileges, with a
201 parallel list devoted to discussions. Examples are `patches' or
202 `checkin' lists, where software changes are posted by a revision
203 control system, but discussion about the changes occurs on a
204 developers mailing list. To support these types of mailing
205 lists, select <tt>Explicit address</tt> and set the
206 <tt>Reply-To:</tt> address below to point to the parallel
207 list.""")),
208
209 ('reply_to_address', mm_cfg.Email, WIDTH, 0,
210 _('Explicit <tt>Reply-To:</tt> header.'),
211 # Details for reply_to_address
212 _("""This is the address set in the <tt>Reply-To:</tt> header
213 when the <a
214 href="?VARHELP=general/reply_goes_to_list">reply_goes_to_list</a>
215 option is set to <em>Explicit address</em>.
216
217 <p>There are many reasons not to introduce or override the
218 <tt>Reply-To:</tt> header. One is that some posters depend on
219 their own <tt>Reply-To:</tt> settings to convey their valid
220 return address. Another is that modifying <tt>Reply-To:</tt>
221 makes it much more difficult to send private replies. See <a
222 href="http://www.unicom.com/pw/reply-to-harmful.html">`Reply-To'
223 Munging Considered Harmful</a> for a general discussion of this
224 issue. See <a
225 href="http://www.metasystema.net/essays/reply-to.mhtml">Reply-To
226 Munging Considered Useful</a> for a dissenting opinion.
227
228 <p>Some mailing lists have restricted posting privileges, with a
229 parallel list devoted to discussions. Examples are `patches' or
230 `checkin' lists, where software changes are posted by a revision
231 control system, but discussion about the changes occurs on a
232 developers mailing list. To support these types of mailing
233 lists, specify the explicit <tt>Reply-To:</tt> address here. You
234 must also specify <tt>Explicit address</tt> in the
235 <tt>reply_goes_to_list</tt>
236 variable.
237
238 <p>Note that if the original message contains a
239 <tt>Reply-To:</tt> header, it will not be changed.""")),
240
241 _('Umbrella list settings'),
242
243 ('umbrella_list', mm_cfg.Radio, (_('No'), _('Yes')), 0,
244 _('''Send password reminders to, eg, "-owner" address instead of
245 directly to user.'''),
246
247 _("""Set this to yes when this list is intended to cascade only
248 to other mailing lists. When set, meta notices like
249 confirmations and password reminders will be directed to an
250 address derived from the member\'s address - it will have the
251 value of "umbrella_member_suffix" appended to the member's
252 account name.""")),
253
254 ('umbrella_member_suffix', mm_cfg.String, WIDTH, 0,
255 _('''Suffix for use when this list is an umbrella for other
256 lists, according to setting of previous "umbrella_list"
257 setting.'''),
258
259 _("""When "umbrella_list" is set to indicate that this list has
260 other mailing lists as members, then administrative notices like
261 confirmations and password reminders need to not be sent to the
262 member list addresses, but rather to the owner of those member
263 lists. In that case, the value of this setting is appended to
264 the member's account name for such notices. `-owner' is the
265 typical choice. This setting has no effect when "umbrella_list"
266 is "No".""")),
267
268 _('Notifications'),
269
270 ('send_reminders', mm_cfg.Radio, (_('No'), _('Yes')), 0,
271 _('''Send monthly password reminders?'''),
272
273 _('''Turn this on if you want password reminders to be sent once
274 per month to your members. Note that members may disable their
275 own individual password reminders.''')),
276
277 ('welcome_msg', mm_cfg.Text, (4, WIDTH), 1,
278 _('''List-specific text prepended to new-subscriber welcome
279 message'''),
280
281 _("""This value, if any, will be added to the front of the
282 new-subscriber welcome message. The rest of the welcome message
283 already describes the important addresses and URLs for the
284 mailing list, so you don't need to include any of that kind of
285 stuff here. This should just contain mission-specific kinds of
286 things, like etiquette policies or team orientation, or that kind
287 of thing.
288
289 <p>Note that this text will be wrapped, according to the
290 following rules:
291 <ul><li>Each paragraph is filled so that no line is longer than
292 70 characters.
293 <li>Any line that begins with whitespace is not filled.
294 <li>A blank line separates paragraphs.
295 </ul>""")),
296
297 ('send_welcome_msg', mm_cfg.Radio, (_('No'), _('Yes')), 0,
298 _('Send welcome message to newly subscribed members?'),
299 _("""Turn this off only if you plan on subscribing people manually
300 and don't want them to know that you did so. This option is most
301 useful for transparently migrating lists from some other mailing
302 list manager to Mailman.""")),
303
304 ('goodbye_msg', mm_cfg.Text, (4, WIDTH), 0,
305 _('''Text sent to people leaving the list. If empty, no special
306 text will be added to the unsubscribe message.''')),
307
308 ('send_goodbye_msg', mm_cfg.Radio, (_('No'), _('Yes')), 0,
309 _('Send goodbye message to members when they are unsubscribed?')),
310
311 ('admin_immed_notify', mm_cfg.Radio, (_('No'), _('Yes')), 0,
312 _('''Should the list moderators get immediate notice of new
313 requests, as well as daily notices about collected ones?'''),
314
315 _('''List moderators (and list administrators) are sent daily
316 reminders of requests pending approval, like subscriptions to a
317 moderated list, or postings that are being held for one reason or
318 another. Setting this option causes notices to be sent
319 immediately on the arrival of new requests as well.''')),
320
321 ('admin_notify_mchanges', mm_cfg.Radio, (_('No'), _('Yes')), 0,
322 _('''Should administrator get notices of subscribes and
323 unsubscribes?''')),
324
325 ('respond_to_post_requests', mm_cfg.Radio,
326 (_('No'), _('Yes')), 0,
327 _('Send mail to poster when their posting is held for approval?')
328 ),
329
330 _('Additional settings'),
331
332 ('emergency', mm_cfg.Toggle, (_('No'), _('Yes')), 1,
333 _('Emergency moderation of all list traffic.'),
334 _("""When this option is enabled, all list traffic is emergency
335 moderated, i.e. held for moderation. Turn this option on when
336 your list is experiencing a flamewar and you want a cooling off
337 period.""")),
338
339 ('new_member_options', mm_cfg.Checkbox,
340 (opttext, optvals, 0, OPTIONS),
341 # The description for new_member_options includes a kludge where
342 # we add a hidden field so that even when all the checkboxes are
343 # deselected, the form data will still have a new_member_options
344 # key (it will always be a list). Otherwise, we'd never be able
345 # to tell if all were deselected!
346 0, _('''Default options for new members joining this list.<input
347 type="hidden" name="new_member_options" value="ignore">'''),
348
349 _("""When a new member is subscribed to this list, their initial
350 set of options is taken from the this variable's setting.""")),
351
352 ('administrivia', mm_cfg.Radio, (_('No'), _('Yes')), 1,
353 _('''(Administrivia filter) Check postings and intercept ones
354 that seem to be administrative requests?'''),
355
356 _("""Administrivia tests will check postings to see whether it's
357 really meant as an administrative request (like subscribe,
358 unsubscribe, etc), and will add it to the the administrative
359 requests queue, notifying the administrator of the new request,
360 in the process.""")),
361
362 ('max_message_size', mm_cfg.Number, 7, 0,
363 _('''Maximum length in kilobytes (KB) of a message body. Use 0
364 for no limit.''')),
365
366 ('admin_member_chunksize', mm_cfg.Number, 7, 0,
367 _('''Maximum number of members to show on one page of the
368 Membership List.''')),
369
370 ('host_name', mm_cfg.Host, WIDTH, 0,
371 _('Host name this list prefers for email.'),
372
373 _("""The "host_name" is the preferred name for email to
374 mailman-related addresses on this host, and generally should be
375 the mail host's exchanger address, if any. This setting can be
376 useful for selecting among alternative names of a host that has
377 multiple addresses.""")),
378
379 ('essay_enabled', mm_cfg.Radio, (_('No'), _('Yes')), 0,
380 _('Should an essay be provided during subscription?'),
381 _("""Turn this on if you want to require subscribers to answer
382 some questions about their eligibility for the list when they
383 request membership. """)),
384
385 ('questions', mm_cfg.Text, (4, WIDTH), 0,
386 _('''Text for subscription essay.'''),
387 _("""The essay instructions may include the lightweight markup
388 language <a href="http://en.wikipedia.org/wiki/Markdown" Title=
389 "Link to examples of markdown syntax">Markdown</a>.Changing this
390 section will have no effect until you have set the value of
391 essay_enabled to True in the previous section. """)),
392
393
394 ('fullname_required', mm_cfg.Radio, (_('No'), _('Yes')), 0,
395 _('''Should a name be provided during subscription?'''),
396 _("""Turn this on if you want to require subscribers to include
397 their name as well as email when they request membership.""")),
398
399
400 ]
401
402 if mm_cfg.ALLOW_RFC2369_OVERRIDES:
403 rtn.append(
404 ('include_rfc2369_headers', mm_cfg.Radio,
405 (_('No'), _('Yes')), 0,
406 _("""Should messages from this mailing list include the
407 <a href="http://www.faqs.org/rfcs/rfc2369.html">RFC 2369</a>
408 (i.e. <tt>List-*</tt>) headers? <em>Yes</em> is highly
409 recommended."""),
410
411 _("""RFC 2369 defines a set of List-* headers that are
412 normally added to every message sent to the list membership.
413 These greatly aid end-users who are using standards compliant
414 mail readers. They should normally always be enabled.
415
416 <p>However, not all mail readers are standards compliant yet,
417 and if you have a large number of members who are using
418 non-compliant mail readers, they may be annoyed at these
419 headers. You should first try to educate your members as to
420 why these headers exist, and how to hide them in their mail
421 clients. As a last resort you can disable these headers, but
422 this is not recommended (and in fact, your ability to disable
423 these headers may eventually go away)."""))
424 )
425 # Suppression of List-Post: headers
426 rtn.append(
427 ('include_list_post_header', mm_cfg.Radio,
428 (_('No'), _('Yes')), 0,
429 _('Should postings include the <tt>List-Post:</tt> header?'),
430 _("""The <tt>List-Post:</tt> header is one of the headers
431 recommended by
432 <a href="http://www.faqs.org/rfcs/rfc2369.html">RFC 2369</a>.
433 However for some <em>announce-only</em> mailing lists, only a
434 very select group of people are allowed to post to the list; the
435 general membership is usually not allowed to post. For lists of
436 this nature, the <tt>List-Post:</tt> header is misleading.
437 Select <em>No</em> to disable the inclusion of this header. (This
438 does not affect the inclusion of the other <tt>List-*:</tt>
439 headers.)"""))
440 )
441
442 # Discard held messages after this number of days
443 rtn.append(
444 ('max_days_to_hold', mm_cfg.Number, 7, 0,
445 _("""Discard held messages older than this number of days.
446 Use 0 for no automatic discarding."""))
447 )
448
449 return rtn
450
451 def _setValue(self, mlist, property, val, doc):
452 if property == 'real_name' and \
453 val.lower() <> mlist.internal_name().lower():
454 # These values can't differ by other than case
455 doc.addError(_("""<b>real_name</b> attribute not
456 changed! It must differ from the list's name by case
457 only."""))
458 elif property == 'new_member_options':
459 newopts = 0
460 for opt in OPTIONS:
461 bitfield = mm_cfg.OPTINFO[opt]
462 if opt in val:
463 newopts |= bitfield
464 mlist.new_member_options = newopts
465 elif property == 'subject_prefix':
466 # Convert any html entities to Unicode
467 mlist.subject_prefix = Utils.canonstr(
468 val, mlist.preferred_language)
469 elif property == 'info':
470 if val <> mlist.info:
471 if Utils.suspiciousHTML(val):
472 doc.addError(_("""The <b>info</b> attribute you saved
473contains suspicious HTML that could potentially expose your users to cross-site
474scripting attacks. This change has therefore been rejected. If you still want
475to make these changes, you must have shell access to your Mailman server.
476This change can be made with bin/withlist or with bin/config_list by setting
477mlist.info.
478 """))
479 else:
480 mlist.info = val
481 elif property == 'admin_member_chunksize' and (val < 1
482 or not isinstance(val, IntType)):
483 doc.addError(_("""<b>admin_member_chunksize</b> attribute not
484 changed! It must be an integer > 0."""))
485 else:
486 GUIBase._setValue(self, mlist, property, val, doc)
487
488
489 def _postValidate(self, mlist, doc):
490 if not mlist.reply_to_address.strip() and \
491 mlist.reply_goes_to_list == 2:
492 # You can't go to an explicit address that is blank
493 doc.addError(_("""You cannot add a Reply-To: to an explicit
494 address if that address is blank. Resetting these values."""))
495 mlist.reply_to_address = ''
496 mlist.reply_goes_to_list = 0
497
498 def getValue(self, mlist, kind, varname, params):
499 if varname <> 'subject_prefix':
500 return None
501 # The subject_prefix may be Unicode
502 return Utils.uncanonstr(mlist.subject_prefix, mlist.preferred_language)

Subscribers

People subscribed via source and target branches