diff --git a/src/postorius/forms.py b/src/postorius/forms.py index 6b7180c..9adf743 100644 --- a/src/postorius/forms.py +++ b/src/postorius/forms.py @@ -242,65 +242,10 @@ label=_('Archive Policy'), help_text=_('Policy for archiving messages for this list'), ) - autorespond_choices = ( - ("respond_and_continue", _("Respond and continue processing")), - ("respond_and_discard", _("Respond and discard message")), - ("none", _("No automatic response"))) - autorespond_owner = forms.ChoiceField( - choices=autorespond_choices, - widget=forms.RadioSelect, - label=_('Autorespond to list owner'), - help_text=( - 'Should Mailman send an auto-response to emails sent to the ' - '-owner address?')) - autoresponse_owner_text = forms.CharField( - label=_('Autoresponse owner text'), - widget=forms.Textarea(), - required=False, - help_text=('Auto-response text to send to -owner emails.')) - autorespond_postings = forms.ChoiceField( - choices=autorespond_choices, - widget=forms.RadioSelect, - label=_('Autorespond postings'), - help_text=( - 'Should Mailman send an auto-response to mailing list posters?')) - autoresponse_postings_text = forms.CharField( - label=_('Autoresponse postings text'), - widget=forms.Textarea(), - required=False, - help_text=('Auto-response text to send to mailing list posters.')) - autorespond_requests = forms.ChoiceField( - choices=autorespond_choices, - widget=forms.RadioSelect, - label=_('Autorespond requests'), - help_text=( - 'Should Mailman send an auto-response to emails sent to the ' - '-request address? If you choose yes, decide whether you want ' - 'Mailman to discard the original email, or forward it on to the ' - 'system as a normal mail command.')) - autoresponse_request_text = forms.CharField( - label=_('Autoresponse request text'), - widget=forms.Textarea(), - required=False, - help_text=('Auto-response text to send to -request emails.')) - autoresponse_grace_period = forms.CharField( - label=_('Autoresponse grace period'), - help_text=( - 'Number of days between auto-responses to either the mailing list ' - 'or -request/-owner address from the same poster. Set to zero ' - '(or negative) for no grace period (i.e. auto-respond to every ' - 'message).')) # This doesn't make sense as a configurable, so we're leaving it out # bounces_address = forms.EmailField( # label=_('Bounces Address'), # required=False) - advertised = forms.TypedChoiceField( - coerce=lambda x: x == 'True', - choices=((True, _('Yes')), (False, _('No'))), - widget=forms.RadioSelect, - label=_('Advertise the existence of this list?'), - help_text=( - 'Choose whether to include this list on the list of all lists')) filter_content = forms.TypedChoiceField( coerce=lambda x: x == 'True', choices=((True, _('Yes')), (False, _('No'))), @@ -365,14 +310,6 @@ 'is matched against the list of explicitly accepted, held, ' 'rejected (bounced), and discarded addresses. ' 'If no match is found, then this action is taken.')) - description = forms.CharField( - label=_('Description'), - help_text=( - 'This description is used when the mailing list is listed with ' - 'other mailing lists, or in headers, and so forth. It should be ' - 'as succinct as you can get it, while still identifying what the ' - 'list is.'), - widget=forms.Textarea()) digest_size_threshold = forms.DecimalField( label=_('Digest size threshold'), help_text=('How big in Kb should a digest be before it gets sent out?') @@ -399,17 +336,6 @@ 'invalid': _('Please provide an integer.') } ) - mail_host = forms.CharField( - label=_('Mail Host'), - error_messages={'required': _('Please a domain name'), - 'invalid': _('Please enter a valid domain name.')}, - required=True, - help_text=( - "The \"host_name\" is the preferred name for email to " - "'mailman-related addresses on this host, and generally should be " - "the mail host's exchanger address, if any. This setting can be " - "useful for selecting among alternative names of a host that " - "has multiple addresses.")) # informational, not editable # next_digest_number = forms.IntegerField( # label=_('Next digest number'), @@ -443,13 +369,6 @@ # }, # required=False, # ) - display_name = forms.CharField( - label=_('Display name'), - help_text=('Display name is the name shown in the web interface.') - ) - subject_prefix = forms.CharField( - label=_('Subject prefix'), - ) reply_goes_to_list = forms.ChoiceField( label=_('Reply goes to list'), widget=forms.Select(), @@ -497,24 +416,6 @@ # request_address = forms.EmailField( # label=_('Request address'), # required=False) - send_welcome_message = forms.TypedChoiceField( - coerce=lambda x: x == 'True', - choices=((True, _('Yes')), (False, _('No'))), - widget=forms.RadioSelect, - required=False, - label=_('Send welcome message'), - help_text=( - 'Send welcome message to newly subscribed members? ' - 'Turn this off only if you plan on subscribing people manually ' - 'and don\'t want them to know that you did so. This option is ' - 'most useful for transparently migrating lists from some other ' - 'mailing list manager to Mailman.')) - welcome_message_uri = forms.CharField( - label=_('URI for the welcome message'), - help_text=_( - 'If a welcome message is to be sent to subscribers, you can ' - 'specify a URI that gives the text of this message.'), - ) # tko - look this up # scheme = forms.CharField( # label=_('Scheme'), @@ -543,13 +444,6 @@ 'or postings that are being held for one reason or another. ' 'Setting this option causes notices to be sent immediately on the ' 'arrival of new requests as well. ')) - admin_notify_mchanges = forms.BooleanField( - widget=forms.RadioSelect(choices=choices), - required=False, - label=_('Notify admin of membership changes'), - help_text=( - 'Should administrator get notices of subscribes and unsubscribes?' - )) administrivia = forms.BooleanField( widget=forms.RadioSelect(choices=choices), required=False, @@ -646,16 +540,6 @@ """ # just a really temporary layout to see that it works. -- Anna layout = [ - ["list_identity", "display_name", "mail_host", "description", - "advertised", "subject_prefix"], - ["automatic_responses", "autorespond_owner", - "autoresponse_owner_text", "autorespond_postings", - "autoresponse_postings_text", "autorespond_requests", - "autoresponse_request_text", "autoresponse_grace_period", - "send_welcome_message", - "welcome_message_uri", - "admin_immed_notify", - "admin_notify_mchanges"], ["alter_messages", "filter_content", "collapse_alternatives", "convert_html_to_plaintext", "anonymous_list", "include_rfc2369_headers", @@ -671,6 +555,136 @@ ] +class ListAutomaticResponsesForm(forms.Form): + """ + List settings for automatic responses. + """ + autorespond_choices = ( + ("respond_and_continue", _("Respond and continue processing")), + ("respond_and_discard", _("Respond and discard message")), + ("none", _("No automatic response"))) + autorespond_owner = forms.ChoiceField( + choices=autorespond_choices, + widget=forms.RadioSelect, + label=_('Autorespond to list owner'), + help_text=( + 'Should Mailman send an auto-response to emails sent to the ' + '-owner address?')) + autoresponse_owner_text = forms.CharField( + label=_('Autoresponse owner text'), + widget=forms.Textarea(), + required=False, + help_text=('Auto-response text to send to -owner emails.')) + autorespond_postings = forms.ChoiceField( + choices=autorespond_choices, + widget=forms.RadioSelect, + label=_('Autorespond postings'), + help_text=( + 'Should Mailman send an auto-response to mailing list posters?')) + autoresponse_postings_text = forms.CharField( + label=_('Autoresponse postings text'), + widget=forms.Textarea(), + required=False, + help_text=('Auto-response text to send to mailing list posters.')) + autorespond_requests = forms.ChoiceField( + choices=autorespond_choices, + widget=forms.RadioSelect, + label=_('Autorespond requests'), + help_text=( + 'Should Mailman send an auto-response to emails sent to the ' + '-request address? If you choose yes, decide whether you want ' + 'Mailman to discard the original email, or forward it on to the ' + 'system as a normal mail command.')) + autoresponse_request_text = forms.CharField( + label=_('Autoresponse request text'), + widget=forms.Textarea(), + required=False, + help_text=('Auto-response text to send to -request emails.')) + autoresponse_grace_period = forms.CharField( + label=_('Autoresponse grace period'), + help_text=( + 'Number of days between auto-responses to either the mailing list ' + 'or -request/-owner address from the same poster. Set to zero ' + '(or negative) for no grace period (i.e. auto-respond to every ' + 'message).')) + send_welcome_message = forms.TypedChoiceField( + coerce=lambda x: x == 'True', + choices=((True, _('Yes')), (False, _('No'))), + widget=forms.RadioSelect, + required=False, + label=_('Send welcome message'), + help_text=( + 'Send welcome message to newly subscribed members? ' + 'Turn this off only if you plan on subscribing people manually ' + 'and don\'t want them to know that you did so. This option is ' + 'most useful for transparently migrating lists from some other ' + 'mailing list manager to Mailman.')) + welcome_message_uri = forms.CharField( + label=_('URI for the welcome message'), + help_text=_( + 'If a welcome message is to be sent to subscribers, you can ' + 'specify a URI that gives the text of this message.'), + ) + admin_immed_notify = forms.BooleanField( + widget=forms.RadioSelect(choices=((True, _('Yes')), (False, _('No')))), + required=False, + label=_('Admin immed notify'), + help_text=( + 'Should the list moderators get immediate notice of new requests, ' + 'as well as daily notices about collected ones? List moderators ' + '(and list administrators) are sent daily reminders of requests ' + 'pending approval, like subscriptions to a moderated list, ' + 'or postings that are being held for one reason or another. ' + 'Setting this option causes notices to be sent immediately on the ' + 'arrival of new requests as well. ')) + admin_notify_mchanges = forms.BooleanField( + widget=forms.RadioSelect(choices=((True, _('Yes')), (False, _('No')))), + required=False, + label=_('Notify admin of membership changes'), + help_text=( + 'Should administrator get notices of subscribes and unsubscribes?' + )) + + +class ListIdentityForm(forms.Form): + """ + List identity settings. + """ + advertised = forms.TypedChoiceField( + coerce=lambda x: x == 'True', + choices=((True, _('Yes')), (False, _('No'))), + widget=forms.RadioSelect, + label=_('Show list on index page'), + help_text=( + 'Choose whether to include this list on the list of all lists')) + description = forms.CharField( + label=_('Description'), + help_text=( + 'This description is used when the mailing list is listed with ' + 'other mailing lists, or in headers, and so forth. It should be ' + 'as succinct as you can get it, while still identifying what the ' + 'list is.'), + widget=forms.Textarea()) + mail_host = forms.CharField( + label=_('Mail Host'), + error_messages={'required': _('Please a domain name'), + 'invalid': _('Please enter a valid domain name.')}, + required=True, + help_text=( + "The \"host_name\" is the preferred name for email to " + "'mailman-related addresses on this host, and generally should be " + "the mail host's exchanger address, if any. This setting can be " + "useful for selecting among alternative names of a host that " + "has multiple addresses.")) + display_name = forms.CharField( + label=_('Display name'), + help_text=('Display name is the name shown in the web interface.') + ) + subject_prefix = forms.CharField( + label=_('Subject prefix'), + ) + + SUBSCRIPTION_POLICY_CHOICES = ( ('', _('Please Choose')), ('open', _('Open')), @@ -682,7 +696,7 @@ class ListSubscriptionPolicyForm(forms.Form): """ - List Settings for subscription policy. + List subscription policy settings. """ subscription_policy = forms.ChoiceField( label=_('Subscription Policy'), diff --git a/src/postorius/static/postorius/css/style.css b/src/postorius/static/postorius/css/style.css index af1a86f..40b34de 100755 --- a/src/postorius/static/postorius/css/style.css +++ b/src/postorius/static/postorius/css/style.css @@ -192,6 +192,12 @@ .btn { border-radius: 2px; } +.control-group textarea { + width: 80%; + max-width: 400px; + height: 100px; +} + /* tables */ .table .mm_action { diff --git a/src/postorius/templates/postorius/lists/settings.html b/src/postorius/templates/postorius/lists/settings.html index b8b1422..a139feb 100644 --- a/src/postorius/templates/postorius/lists/settings.html +++ b/src/postorius/templates/postorius/lists/settings.html @@ -29,11 +29,11 @@
{{ field.label_tag }} + [{% trans "?" %}{{ field.help_text }}]
{{ field }} -

{{ field.help_text }}

diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 255f1cd..e55a6b9 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -639,8 +639,8 @@ ) SETTINGS_FORMS = { - 'list_identity': None, - 'automatic_responses': None, + 'list_identity': ListIdentityForm, + 'automatic_responses': ListAutomaticResponsesForm, 'alter_messages': None, 'digest': None, 'message_acceptance': None, @@ -663,21 +663,29 @@ result in using //option """ message = "" - # List object. + if visible_section is None: + visible_section = 'list_identity' + form_class = SETTINGS_FORMS.get(visible_section) try: m_list = List.objects.get_or_404(fqdn_listname=list_id) - except MailmanApiError: + list_settings = m_list.settings + except MailmanApiError, HTTPError: return utils.render_api_error(request) - list_settings = m_list.settings # List settings are grouped an processed in different forms. - form_class = SETTINGS_FORMS.get(visible_section) if form_class: if request.method == 'POST': form = form_class(request.POST) if form.is_valid(): - for key in form.fields.keys(): - list_settings[key] = form.cleaned_data[key] - list_settings.save() + try: + for key in form.fields.keys(): + list_settings[key] = form.cleaned_data[key] + list_settings.save() + messages.success(request, + _('The settings have been updated.')) + except HTTPError as e: + messages.error( + request, + '{0}: {1}'.format(_('An error occured'), e.reason)) else: form = form_class(initial=list_settings) @@ -686,8 +694,6 @@ # This really needs to be cleaned up. else: template='postorius/lists/settings_legacy.html' - if visible_section is None: - visible_section = 'list_identity' form_sections = [] # collect all Form sections for the links: temp = ListSettings('', '')