[903] | 1 | # Copyright (C) 1998,1999,2000,2001,2002 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, USA. |
---|
| 16 | |
---|
| 17 | """Administrative GUI for digest deliveries.""" |
---|
| 18 | |
---|
| 19 | from Mailman import mm_cfg |
---|
| 20 | from Mailman import Utils |
---|
| 21 | from Mailman.i18n import _ |
---|
| 22 | |
---|
| 23 | # Intra-package import |
---|
| 24 | from Mailman.Gui.GUIBase import GUIBase |
---|
| 25 | |
---|
| 26 | # Common b/w nondigest and digest headers & footers. Personalizations may add |
---|
| 27 | # to this. |
---|
| 28 | ALLOWEDS = ('real_name', 'list_name', 'host_name', 'web_page_url', |
---|
| 29 | 'description', 'info', 'cgiext', '_internal_name','from_header', |
---|
| 30 | ) |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | class Digest(GUIBase): |
---|
| 35 | def GetConfigCategory(self): |
---|
| 36 | return 'digest', _('Digest options') |
---|
| 37 | |
---|
| 38 | def GetConfigInfo(self, mlist, category, subcat=None): |
---|
| 39 | if category <> 'digest': |
---|
| 40 | return None |
---|
| 41 | WIDTH = mm_cfg.TEXTFIELDWIDTH |
---|
| 42 | |
---|
| 43 | info = [ |
---|
| 44 | _("Batched-delivery digest characteristics."), |
---|
| 45 | |
---|
| 46 | ('digestable', mm_cfg.Toggle, (_('No'), _('Yes')), 1, |
---|
| 47 | _('Can list members choose to receive list traffic ' |
---|
| 48 | 'bunched in digests?')), |
---|
| 49 | |
---|
| 50 | ('digest_is_default', mm_cfg.Radio, |
---|
| 51 | (_('Regular'), _('Digest')), 0, |
---|
| 52 | _('Which delivery mode is the default for new users?')), |
---|
| 53 | |
---|
| 54 | ('mime_is_default_digest', mm_cfg.Radio, |
---|
| 55 | (_('Plain'), _('MIME')), 0, |
---|
| 56 | _('When receiving digests, which format is default?')), |
---|
| 57 | |
---|
| 58 | ('digest_size_threshhold', mm_cfg.Number, 3, 0, |
---|
| 59 | _('How big in Kb should a digest be before it gets sent out?')), |
---|
| 60 | # Should offer a 'set to 0' for no size threshhold. |
---|
| 61 | |
---|
| 62 | ('digest_send_periodic', mm_cfg.Radio, (_('No'), _('Yes')), 1, |
---|
| 63 | _('Should a digest be dispatched daily when the size threshold ' |
---|
| 64 | "isn't reached?")), |
---|
| 65 | |
---|
| 66 | ('digest_header', mm_cfg.Text, (4, WIDTH), 0, |
---|
| 67 | _('Header added to every digest'), |
---|
| 68 | _("Text attached (as an initial message, before the table" |
---|
| 69 | " of contents) to the top of digests. ") |
---|
| 70 | + Utils.maketext('headfoot.html', raw=1, mlist=mlist)), |
---|
| 71 | |
---|
| 72 | ('digest_footer', mm_cfg.Text, (4, WIDTH), 0, |
---|
| 73 | _('Footer added to every digest'), |
---|
| 74 | _("Text attached (as a final message) to the bottom of digests. ") |
---|
| 75 | + Utils.maketext('headfoot.html', raw=1, mlist=mlist)), |
---|
| 76 | |
---|
| 77 | ('digest_volume_frequency', mm_cfg.Radio, |
---|
| 78 | (_('Yearly'), _('Monthly'), _('Quarterly'), |
---|
| 79 | _('Weekly'), _('Daily')), 0, |
---|
| 80 | _('How often should a new digest volume be started?'), |
---|
| 81 | _('''When a new digest volume is started, the volume number is |
---|
| 82 | incremented and the issue number is reset to 1.''')), |
---|
| 83 | |
---|
| 84 | ('_new_volume', mm_cfg.Toggle, (_('No'), _('Yes')), 0, |
---|
| 85 | _('Should Mailman start a new digest volume?'), |
---|
| 86 | _('''Setting this option instructs Mailman to start a new volume |
---|
| 87 | with the next digest sent out.''')), |
---|
| 88 | |
---|
| 89 | ('_send_digest_now', mm_cfg.Toggle, (_('No'), _('Yes')), 0, |
---|
| 90 | _('''Should Mailman send the next digest right now, if it is not |
---|
| 91 | empty?''')), |
---|
| 92 | ] |
---|
| 93 | |
---|
| 94 | ## if mm_cfg.OWNERS_CAN_ENABLE_PERSONALIZATION: |
---|
| 95 | ## info.extend([ |
---|
| 96 | ## ('digest_personalize', mm_cfg.Toggle, (_('No'), _('Yes')), 1, |
---|
| 97 | |
---|
| 98 | ## _('''Should Mailman personalize each digest delivery? |
---|
| 99 | ## This is often useful for announce-only lists, but <a |
---|
| 100 | ## href="?VARHELP=digest/digest_personalize">read the details</a> |
---|
| 101 | ## section for a discussion of important performance |
---|
| 102 | ## issues.'''), |
---|
| 103 | |
---|
| 104 | ## _("""Normally, Mailman sends the digest messages to |
---|
| 105 | ## the mail server in batches. This is much more efficent |
---|
| 106 | ## because it reduces the amount of traffic between Mailman and |
---|
| 107 | ## the mail server. |
---|
| 108 | |
---|
| 109 | ## <p>However, some lists can benefit from a more personalized |
---|
| 110 | ## approach. In this case, Mailman crafts a new message for |
---|
| 111 | ## each member on the digest delivery list. Turning this on |
---|
| 112 | ## adds a few more expansion variables that can be included in |
---|
| 113 | ## the <a href="?VARHELP=digest/digest_header">message header</a> |
---|
| 114 | ## and <a href="?VARHELP=digest/digest_footer">message footer</a> |
---|
| 115 | ## but it may degrade the performance of your site as |
---|
| 116 | ## a whole. |
---|
| 117 | |
---|
| 118 | ## <p>You need to carefully consider whether the trade-off is |
---|
| 119 | ## worth it, or whether there are other ways to accomplish what |
---|
| 120 | ## you want. You should also carefully monitor your system load |
---|
| 121 | ## to make sure it is acceptable. |
---|
| 122 | |
---|
| 123 | ## <p>These additional substitution variables will be available |
---|
| 124 | ## for your headers and footers, when this feature is enabled: |
---|
| 125 | |
---|
| 126 | ## <ul><li><b>user_address</b> - The address of the user, |
---|
| 127 | ## coerced to lower case. |
---|
| 128 | ## <li><b>user_delivered_to</b> - The case-preserved address |
---|
| 129 | ## that the user is subscribed with. |
---|
| 130 | ## <li><b>user_password</b> - The user's password. |
---|
| 131 | ## <li><b>user_name</b> - The user's full name. |
---|
| 132 | ## <li><b>user_optionsurl</b> - The url to the user's option |
---|
| 133 | ## page. |
---|
| 134 | ## """)) |
---|
| 135 | ## ]) |
---|
| 136 | |
---|
| 137 | return info |
---|
| 138 | |
---|
| 139 | def _setValue(self, mlist, property, val, doc): |
---|
| 140 | # Watch for the special, immediate action attributes |
---|
| 141 | if property == '_new_volume' and val: |
---|
| 142 | mlist.bump_digest_volume() |
---|
| 143 | volume = mlist.volume |
---|
| 144 | number = mlist.next_digest_number |
---|
| 145 | doc.AddItem(_("""The next digest will be sent as volume |
---|
| 146 | %(volume)s, number %(number)s""")) |
---|
| 147 | elif property == '_send_digest_now' and val: |
---|
| 148 | status = mlist.send_digest_now() |
---|
| 149 | if status: |
---|
| 150 | doc.AddItem(_("""A digest has been sent.""")) |
---|
| 151 | else: |
---|
| 152 | doc.AddItem(_("""There was no digest to send.""")) |
---|
| 153 | else: |
---|
| 154 | # Everything else... |
---|
| 155 | if property in ('digest_header', 'digest_footer'): |
---|
| 156 | val = self._convertString(mlist, property, ALLOWEDS, val, doc) |
---|
| 157 | if val is None: |
---|
| 158 | # There was a problem, so don't set it |
---|
| 159 | return |
---|
| 160 | GUIBase._setValue(self, mlist, property, val, doc) |
---|