diff --git a/src/postorius/forms.py b/src/postorius/forms.py index 56c4bde..e8f8810 100644 --- a/src/postorius/forms.py +++ b/src/postorius/forms.py @@ -609,7 +609,7 @@ class UserPreferences(FieldsetForm): """ - Form handling the user's global preferences. + Form handling the user's global, address and subscription based preferences. """ choices = ((True, _('Yes')), (False, _('No'))) @@ -619,32 +619,38 @@ ("summary_digests", _('Summary Digests'))) delivery_status_choices = ( ("enabled", _('Enabled')), ("by_user", _('Disabled'))) - acknowledge_posts = forms.BooleanField( - widget=forms.RadioSelect(choices=choices), + delivery_status = forms.ChoiceField( + widget=forms.RadioSelect, + choices=delivery_status_choices, required=False, - label=_('Acknowledge posts')) - hide_address = forms.BooleanField( - widget=forms.RadioSelect(choices=choices), - required=False, - label=_('Hide address')) - receive_list_copy = forms.BooleanField( - widget=forms.RadioSelect(choices=choices), - required=False, - label=_('Receive list copy')) - receive_own_postings = forms.BooleanField( - widget=forms.RadioSelect(choices=choices), - required=False, - label=_('Receive own postings')) + label=_('Delivery status'), + help_text=_('Set this option to Enabled to receive messages posted to this mailing list. Set it to Disabled if you want to stay subscribed, but don\'t want mail delivered to you for a while (e.g. you\'re going on vacation). If you disable mail delivery, don\'t forget to re-enable it when you come back; it will not be automatically re-enabled.')) delivery_mode = forms.ChoiceField( widget=forms.Select(), choices=delivery_mode_choices, required=False, - label=_('Delivery mode')) - delivery_status = forms.ChoiceField( - widget=forms.Select(), + label=_('Delivery mode'), + help_text=_('If you select summary digests , you\'ll get posts bundled together (usually one per day but possibly more on busy lists), instead of singly when they\'re sent. Your mail reader may or may not support MIME digests. In general MIME digests are preferred, but if you have a problem reading them, select plain text digests.')) + receive_own_postings = forms.BooleanField( + widget=forms.RadioSelect(choices=choices), required=False, - choices=delivery_status_choices, - label=_('Delivery status')) + label=_('Receive own postings'), + help_text=_('Ordinarily, you will get a copy of every message you post to the list. If you don\'t want to receive this copy, set this option to No')) + acknowledge_posts = forms.BooleanField( + widget=forms.RadioSelect(choices=choices), + required=False, + label=_('Acknowledge posts'), + help_text=_('Receive acknowledgement mail when you send mail to the list?')) + hide_address = forms.BooleanField( + widget=forms.RadioSelect(choices=choices), + required=False, + label=_('Hide address'), + help_text=_('When someone views the list membership, your email address is normally shown (in an obscured fashion to thwart spam harvesters). If you do not want your email address to show up on this membership roster at all, select Yes for this option.')) + receive_list_copy = forms.BooleanField( + widget=forms.RadioSelect(choices=choices), + required=False, + label=_('Receive list copy'), + help_text=_('When you are listed explicitly in the To: or Cc: headers of a list message, you can opt to not receive another copy from the mailing list. Select Yes to avoid receiving copies from the mailing list; select No to receive copies. ')) class Meta: @@ -652,7 +658,7 @@ Class to define the name of the fieldsets and what should be included in each. """ - layout = [["Membership Settings", "acknowledge_posts", "hide_address", + layout = [["User Preferences", "acknowledge_posts", "hide_address", "receive_list_copy", "receive_own_postings", "delivery_mode", "delivery_status"]] diff --git a/src/postorius/templates/postorius/user_address_preferences.html b/src/postorius/templates/postorius/user_address_preferences.html index 0075c77..e8092df 100644 --- a/src/postorius/templates/postorius/user_address_preferences.html +++ b/src/postorius/templates/postorius/user_address_preferences.html @@ -1,96 +1,128 @@ {% extends postorius_base_template %} {% load url from future %} {% load i18n %} - {% block main %} - {% include 'postorius/menu/user_nav.html' %} - - +{% include 'postorius/menu/user_nav.html' %} +

Per-Email-Address Based Preferences Overview

+

Table to view the preferences(for testing only)

- - - - - - - - - - - - -{%for a in addresses%} - - - - - - - - - - -{%endfor%} - -
{% trans 'Email Address' %}{% trans 'Acknowledge Posts' %}{% trans 'Hide Address' %}{% trans 'Receive List Copy' %}{% trans 'Receive Own Postings' %}{% trans 'Delivery Mode' %}{% trans 'Delivery Status' %}
{{ a }}{{ a.preferences.acknowledge_posts }}{{ a.preferences.hide_address }}{{ a.preferences.receive_list_copy }}{{ a.preferences.receive_own_postings }}{{ a.preferences.delivery_mode }}{{ a.preferences.delivery_status }}
- + + + + {% trans 'Email Address' %} + {% trans 'Delivery Status' %} + {% trans 'Delivery Mode' %} + {% trans 'Receive Own Postings' %} + {% trans 'Acknowledge Posts' %} + {% trans 'Hide Address' %} + {% trans 'Receive List Copy' %} + + {%for a in addresses%} + + {{ a }} + {{ a.preferences.delivery_status }} + {{ a.preferences.delivery_mode }} + {{ a.preferences.receive_own_postings }} + {{ a.preferences.acknowledge_posts }} + {{ a.preferences.hide_address }} + {{ a.preferences.receive_list_copy }} + + {%endfor%} + +

Address Based Preferences Form

- -
{% csrf_token %} - {{formset.management_form}} - {{formset.non_form_errors.as_ul}} - - - - {% for form,address in zipped_data %} - - {% endfor %} - - - - {% for form,address in zipped_data %} - - {% endfor %} - - - {% for form,address in zipped_data %} - - {% endfor %} - - - {% for form,address in zipped_data %} - - {% endfor %} - - - {% for form,address in zipped_data %} - - {% endfor %} - - - {% for form,address in zipped_data %} - - {% endfor %} - - - {% for form,address in zipped_data %} - - {% endfor %} - - -
Preferences {{address}}
Acknowledge Posts {{form.acknowledge_posts }}
Hide Address {{form.hide_address }}
Receive List Copy {{form.receive_list_copy }}
Receive Own Postings {{form.receive_own_postings }}
Delivery_Mode {{form.delivery_mode }}
Delivery_Status {{form.delivery_status }}
-
+ + + {% csrf_token %} + {{formset.management_form}} + {{formset.non_form_errors.as_ul}} + + + + + {% for form,address in zipped_data %} + + {% endfor %} + + + + + {% for form,address in zipped_data %} + + {% endfor %} + + + + {% for form,address in zipped_data %} + + {% endfor %} + + + + {% for form,address in zipped_data %} + + {% endfor %} + + + + {% for form,address in zipped_data %} + + {% endfor %} + + + + {% for form,address in zipped_data %} + + {% endfor %} + + + + {% for form,address in zipped_data %} + + {% endfor %} + +
Preferences {{address}}
+

Mail Delivery:

+

[More info{{ helperform.delivery_status.help_text }} + ] +

+
{{form.delivery_status }}
+

Select a Mode of Delivery:

+

[More info{{ helperform.delivery_mode.help_text }} + ] +

+
{{form.delivery_mode }}
+

Receive your own posts to the list?

+

[More info{{ helperform.receive_own_postings.help_text }} + ] +

+
{{form.receive_own_postings }}
+

Receive acknowledgement mails?

+

[More info{{ helperform.acknowledge_posts.help_text }} + ] +

+
{{form.acknowledge_posts }}
+

Conceal yourself from the subscriber list?

+

[More info{{ helperform.hide_address.help_text }} + ] +

+
{{form.hide_address }}
+

Avoid duplicate copies of messages?

+

[More info{{ helperform.receive_list_copy.help_text }} + ] +

+
{{form.receive_list_copy }}
+
- - {% endblock main %} -~ + + diff --git a/src/postorius/templates/postorius/user_mailmansettings.html b/src/postorius/templates/postorius/user_mailmansettings.html index c200989..6dac962 100644 --- a/src/postorius/templates/postorius/user_mailmansettings.html +++ b/src/postorius/templates/postorius/user_mailmansettings.html @@ -1,64 +1,117 @@ {% extends postorius_base_template %} {% load url from future %} {% load i18n %} - {% block main %} - {% include 'postorius/menu/user_nav.html' %} - - +{% include 'postorius/menu/user_nav.html' %} +

Global Preferences Overview

+

Table to view the preferences(for testing only)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% trans 'Preference' %} {% trans 'Value' %}
{% trans 'Receive List Copy' %}{{ mm_user.preferences.receive_list_copy }}
{% trans 'Hide Address' %}{{ mm_user.preferences.hide_address }}
{% trans 'Preferred Language' %}{{ mm_user.preferences.preferred_language }}
{% trans 'Acknowledge Posts' %}{{ mm_user.preferences.acknowledge_posts }}
{% trans 'Delivery Mode' %}{{ mm_user.preferences.delivery_mode }}
{% trans 'Receive Own Postings' %}{{ mm_user.preferences.receive_own_postings }}
{% trans 'Delivery Status' %}{{ mm_user.preferences.delivery_status }}
-
- -

Global Preferences Form

- -
{% csrf_token %} - {{ settingsform.as_p }} - -
- - + + + {% trans 'Preference' %} + {% trans 'Value' %} + + + {% trans 'Delivery Status' %} + {{ mm_user.preferences.delivery_status }} + + + {% trans 'Delivery Mode' %} + {{ mm_user.preferences.delivery_mode }} + + + {% trans 'Receive Own Postings' %} + {{ mm_user.preferences.receive_own_postings }} + + + {% trans 'Acknowledge Posts' %} + {{ mm_user.preferences.acknowledge_posts }} + + + {% trans 'Hide Address' %} + {{ mm_user.preferences.hide_address }} + + + {% trans 'Receive List Copy' %} + {{ mm_user.preferences.receive_list_copy }} + + + +
+

Global Preferences Form

+ +
+ {% csrf_token %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Preferences Global
+

Mail Delivery:

+

+ [More info{{ settingsform.delivery_status.help_text }} + ]

+
{{settingsform.delivery_status }}
+

Select a Mode of Delivery:

+

+ [More info{{ settingsform.delivery_mode.help_text }} + ]

+
{{settingsform.delivery_mode }}
+

Receive your own posts to the list?

+

+ [More info{{ settingsform.receive_own_postings.help_text }} + ]

+
{{settingsform.receive_own_postings }}
+

Receive acknowledgement mails?

+

+ [More info{{ settingsform.acknowledge_posts.help_text }} + ]

+
{{settingsform.acknowledge_posts }}
+

Conceal yourself from the subscriber list?

+

+ [More info{{ settingsform.hide_address.help_text }} + ]

+
{{settingsform.hide_address }}
+

Avoid duplicate copies of messages?

+

[More info{{ settingsform.receive_list_copy.help_text }} + ]

+
{{settingsform.receive_list_copy }}
+
+
{% endblock main %} -~ + + diff --git a/src/postorius/templates/postorius/user_subscription_preferences.html b/src/postorius/templates/postorius/user_subscription_preferences.html index acb6197..541ac0f 100644 --- a/src/postorius/templates/postorius/user_subscription_preferences.html +++ b/src/postorius/templates/postorius/user_subscription_preferences.html @@ -1,83 +1,84 @@ {% extends postorius_base_template %} {% load url from future %} {% load i18n %} - {% block main %} - {% include 'postorius/menu/user_nav.html' %} - {% if nolists %} -
-

{ % trans "No Preferences Available" % }

-
-

{ % trans 'You are not yet subscribed to any lists, so you have no Mailman preferences.' % }

- {% else %} - - +{% include 'postorius/menu/user_nav.html' %} +{% if nolists %} +
+

{ % trans "No Preferences Available" % }

+
+

{ % trans 'You are not yet subscribed to any lists, so you have no Mailman preferences.' % }

+{% else %} +
-

Per-Subscription Based Preferences Overview

+

Table to view the preferences(for testing only)

- - - - - - - - - - - -{%for s in subscriptions%} - - - - - - - - - -{%endfor%} - + + + + + + + + + + + {%for s in subscriptions%} + + + + + + + + + + {%endfor%} +
{% trans 'Subscription' %}{% trans 'Acknowledge Posts' %}{% trans 'Hide Address' %}{% trans 'Receive List Copy' %}{% trans 'Receive Own Postings' %}{% trans 'Delivery Mode' %}{% trans 'Delivery Status' %}
{{ s }}{{ s.preferences.acknowledge_posts }}{{ s.preferences.hide_address }}{{ s.preferences.receive_list_copy }}{{ s.preferences.receive_own_postings }}{{ s.preferences.delivery_mode }}{{ s.preferences.delivery_status }}
{% trans 'Subscription' %}{% trans 'Acknowledge Posts' %}{% trans 'Hide Address' %}{% trans 'Receive List Copy' %}{% trans 'Receive Own Postings' %}{% trans 'Delivery Mode' %}{% trans 'Delivery Status' %}
{{ s }}{{ s.preferences.acknowledge_posts }}{{ s.preferences.hide_address }}{{ s.preferences.receive_list_copy }}{{ s.preferences.receive_own_postings }}{{ s.preferences.delivery_mode }}{{ s.preferences.delivery_status }}
+
+

Subscription Based Preferences Form

+
+ +
+ {% csrf_token %} + {{formset.management_form}} + {{formset.non_form_errors.as_ul}} + + {% for form,subscription in zipped_data %} + {% if forloop.first %} + + + + {% for field in form.visible_fields %} + + {% endfor %} + + + {% endif %} + {% endfor %} + + {% for form,subscription in zipped_data %} + + + + + + + + + {% endfor %} +
Subscription {{field.label}}

[More info{{ field.help_text }} + ]

{{subscription.list_id}} {{form.delivery_status}} {{form.delivery_mode}} {{form.receive_own_postings}} {{form.acknowledge_posts}} {{form.hide_address}} {{form.receive_list_copy}}
+
+
- -
-

Subscription Based Preferences Form

- -
{% csrf_token %} - {{formset.management_form}} - {{formset.non_form_errors.as_ul}} - - {% for form,subscription in zipped_data %} - {% if forloop.first %} - - - {% for field in form.visible_fields %} - - {% endfor %} - - {% endif %} - - - {% for field in form.visible_fields %} - - {% endfor %} - - {% endfor %} -
Subscription {{field.label}}
{{ subscription.list_id}} - {{ field }} -
-

-
-
- - {% endif %} +{% endif %} {% endblock main %} - diff --git a/src/postorius/views/generic.py b/src/postorius/views/generic.py index 4490b65..b14b58a 100644 --- a/src/postorius/views/generic.py +++ b/src/postorius/views/generic.py @@ -115,14 +115,6 @@ def _get_memberships(self): memberships = [] if (self.mm_user): - - # remove the following, because there's a - # simpler method in mailman.client now: - # for a in self.mm_user.addresses: - # members = self.client()._connection.call('members/find', - # {'subscriber': a}) - # the same can be achieved doing this: - for m in self.mm_user.subscriptions: mlist = m.list_id memberships.append( diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index a26b27f..ca069c7 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -78,14 +78,9 @@ def get(self, request): try: mm_user = MailmanUser.objects.get(address=request.user.email) + settingsform = UserPreferences(initial=mm_user.preferences) except MailmanApiError: return utils.render_api_error(request) - except Mailman404Error: - return render_to_response( - 'postorius/user_mailmansettings.html', - {'nolists': 'true'}, - context_instance=RequestContext(request)) - settingsform = UserPreferences(initial=mm_user.preferences) return render_to_response('postorius/user_mailmansettings.html', {'mm_user': mm_user, 'settingsform': settingsform}, @@ -123,6 +118,7 @@ @method_decorator(login_required) def get(self, request): try: + helperform=UserPreferences() mm_user = MailmanUser.objects.get(address=request.user.email) addresses = mm_user.addresses i = 0 @@ -135,14 +131,10 @@ form.initial = address.preferences except MailmanApiError: return utils.render_api_error(request) - except Mailman404Error: - return render_to_response( - 'postorius/user_mailmansettings.html', - {'nolists': 'true'}, - context_instance=RequestContext(request)) return render_to_response('postorius/user_address_preferences.html', {'mm_user': mm_user, 'addresses': addresses, + 'helperform':helperform, 'formset': formset, 'zipped_data': zipped_data}, context_instance=RequestContext(request))