diff --git a/src/postorius/templates/postorius/lists/memberoptions.html b/src/postorius/templates/postorius/lists/memberoptions.html new file mode 100644 index 0000000..77f061a --- /dev/null +++ b/src/postorius/templates/postorius/lists/memberoptions.html @@ -0,0 +1,77 @@ +{% extends postorius_base_template %} +{% load url from future %} +{% load i18n %} +{% block main %} +{% if not user.is_superuser or not user.is_list_owner %} +
+

{% trans "No Preferences Available" %}

+
+

{% trans 'You are not the owner for this list' %}

+{% else %} +
+ {% csrf_token %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans 'Preference' %}{% trans 'Setting' %}
+

{% trans 'Mail Delivery:' %}

+

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

+
{{settingsform.delivery_status }}
+

{% trans 'Mode of Delivery:' %}

+

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

+
{{settingsform.delivery_mode }}
+

{% trans 'Receive own posts to the list?' %}

+

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

+
{{settingsform.receive_own_postings }}
+

{% trans 'Receive acknowledgement mails?' %}

+

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

+
{{settingsform.acknowledge_posts }}
+

{% trans 'Conceal address from the subscriber list?' %}

+

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

+
{{settingsform.hide_address }}
+

{% trans 'Avoid duplicate copies of messages? ' %}

+

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

+
{{settingsform.receive_list_copy }}
+
+
+{% endif %} +{% endblock main %} diff --git a/src/postorius/templates/postorius/lists/members.html b/src/postorius/templates/postorius/lists/members.html index 89ab036..10c9a03 100644 --- a/src/postorius/templates/postorius/lists/members.html +++ b/src/postorius/templates/postorius/lists/members.html @@ -73,7 +73,8 @@ {% for member in list.member_page %} - {{ member.address }} + + {{ member.address }} {% trans member.role %} {% trans 'Unsubscribe' %} diff --git a/src/postorius/urls.py b/src/postorius/urls.py index 6a5c502..6c35912 100644 --- a/src/postorius/urls.py +++ b/src/postorius/urls.py @@ -31,6 +31,9 @@ url(r'^members/$', ListMembersView.as_view( ), name='list_members'), + url(r'^members/options/(?P[^/]+)/$', + ListMemberOptionsView.as_view( + ), name='list_member_options'), url(r'^metrics$', ListMetricsView.as_view( ), name='list_metrics'), diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 2208eab..3fcae04 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -97,6 +97,54 @@ 'moderator_form': moderator_form}, context_instance=RequestContext(request)) +class ListMemberOptionsView(MailingListView): + '''View the preferences for a single member of a mailing list''' + + @method_decorator(list_owner_required) + def post(self, request, fqdn_listname, email): + try: + mm_user = MailmanUser.objects.get(address=request.user.email) + + #formset_class = formset_factory(UserPreferences) + #formset = formset_class(request.POST) + #zipped_data = zip(formset.forms, mm_user.subscriptions) + #if formset.is_valid(): + # for form, subscription in zipped_data: + # preferences = subscription.preferences + # for key in form.fields.keys(): + # preferences[key] = form.cleaned_data[key] + # preferences.save() + # messages.success( + # request, 'The member\'s preferences have been updated.') + #else: + # messages.error(request, 'Something went wrong.') + except MailmanApiError: + return utils.render_api_error(request) + except HTTPError, e: + messages.error(request, e.msg) + return redirect("list_member_options") + + @method_decorator(list_owner_required) + def get(self, request, fqdn_listname, email): + try: + mm_user = MailmanUser.objects.get(address=request.user.email) + #settingsform = UserPeferences(initial=mm_user.preferences) + except MailmanApiError: + return utils.render_api_error(request) + except Mailman404Error: + return render_to_response( + 'postorius/lists/memberoptions.html', + {'nolists': 'true'}, + context_instance=RequestContext(request)) + return render_to_response( + 'postorius/lists/memberoptions.html', + {'mm_user': mm_user, + #'settingsform': settingsform, + #'subscriptions': subscriptions, + #'zipped_data': zipped_data, + #'formset': formset}, + }, + context_instance=RequestContext(request)) class ListMetricsView(MailingListView): diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index e3bdc34..22e26ee 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -202,7 +202,6 @@ 'formset': formset}, context_instance=RequestContext(request)) - class UserSummaryView(MailmanUserView): """Shows a summary of a user.