Create "allononeline" filter and use it for list_wizard_done_email.
Use the Site to get the URL in list_wizard_done_email. Set req for list_wizard_done_email as it is for approval email. Only use domain-based extra approvers for non-WG requests. Supply hidden fields for mlist_name and domain_name for deletion. (These should be visible but uneditable, but passing them through is a start) - Legacy-Id: 267
This commit is contained in:
parent
4e3769c963
commit
e08772430a
|
@ -120,3 +120,8 @@ def fill(text, width):
|
||||||
para = textwrap.fill(para, width, replace_whitespace=False)
|
para = textwrap.fill(para, width, replace_whitespace=False)
|
||||||
wrapped.append(para)
|
wrapped.append(para)
|
||||||
return "\n\n".join(wrapped)
|
return "\n\n".join(wrapped)
|
||||||
|
|
||||||
|
@register.filter(name='allononeline')
|
||||||
|
def allononeline(text):
|
||||||
|
"""Simply removes CRs, LFs, leading and trailing whitespace from the given string."""
|
||||||
|
return text.replace("\r", "").replace("\n", "").strip()
|
||||||
|
|
|
@ -169,7 +169,9 @@ class ListReqAuthorized(forms.Form):
|
||||||
class ListReqClose(forms.Form):
|
class ListReqClose(forms.Form):
|
||||||
requestor = forms.CharField(label = "Requestor's full name", widget = forms.TextInput(attrs = {'size': 55}))
|
requestor = forms.CharField(label = "Requestor's full name", widget = forms.TextInput(attrs = {'size': 55}))
|
||||||
requestor_email = forms.EmailField(label = "Requestor's email address", widget = forms.TextInput(attrs = {'size': 55}))
|
requestor_email = forms.EmailField(label = "Requestor's email address", widget = forms.TextInput(attrs = {'size': 55}))
|
||||||
#mlist_name: with a widget that just displays the value as text
|
# todo: right widgets for these
|
||||||
|
mlist_name = forms.CharField(widget = forms.HiddenInput())
|
||||||
|
domain_name = forms.CharField(widget = forms.HiddenInput())
|
||||||
reason_to_delete = forms.CharField(label = 'Reason for closing list', widget = forms.Textarea(attrs = {'rows': 4, 'cols': 60}))
|
reason_to_delete = forms.CharField(label = 'Reason for closing list', widget = forms.Textarea(attrs = {'rows': 4, 'cols': 60}))
|
||||||
|
|
||||||
class AdminRequestor(forms.MultiWidget):
|
class AdminRequestor(forms.MultiWidget):
|
||||||
|
|
|
@ -5,6 +5,7 @@ from django import newforms as forms
|
||||||
from django.shortcuts import get_object_or_404, render_to_response
|
from django.shortcuts import get_object_or_404, render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
from django.contrib.sites.models import Site
|
||||||
from ietf.contrib import wizard, form_decorator
|
from ietf.contrib import wizard, form_decorator
|
||||||
from ietf.utils.mail import send_mail_subj
|
from ietf.utils.mail import send_mail_subj
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -256,17 +257,23 @@ class ListReqWizard(wizard.Wizard):
|
||||||
list.approved = 0
|
list.approved = 0
|
||||||
list.save()
|
list.save()
|
||||||
approver_email = list.auth_person.email()
|
approver_email = list.auth_person.email()
|
||||||
send_mail_subj(request, [ approver_email ], None, 'mailinglists/list_wizard_subject.txt', 'mailinglists/list_wizard_done_email.txt', {'list': list, 'forms': self.clean_forms, 'requestor_is_approver': self.requestor_is_approver})
|
site = Site.objects.get_current()
|
||||||
return render_to_response('mailinglists/list_wizard_done.html', {'list': list, 'forms': self.clean_forms, 'requestor_is_approver': self.requestor_is_approver}, context_instance=RequestContext(request) )
|
if list.mail_type == 5 or list.mail_type == 6:
|
||||||
|
req = 'delete'
|
||||||
|
else:
|
||||||
|
req = 'add'
|
||||||
|
send_mail_subj(request, [ approver_email ], None, 'mailinglists/list_wizard_subject.txt', 'mailinglists/list_wizard_done_email.txt', {'list': list, 'forms': self.clean_forms, 'requestor_is_approver': self.requestor_is_approver, 'site': site, 'req': req})
|
||||||
|
return render_to_response('mailinglists/list_wizard_done.html', {'list': list, 'forms': self.clean_forms, 'requestor_is_approver': self.requestor_is_approver, 'req': req}, context_instance=RequestContext(request) )
|
||||||
|
|
||||||
def mlist_approvers(mail_type, domain_name, group):
|
def mlist_approvers(mail_type, domain_name, group):
|
||||||
approvers = []
|
approvers = []
|
||||||
if domain_name == 'ietf.org':
|
if domain_name == 'ietf.org':
|
||||||
approvers += AreaDirector.objects.filter(area__status=Area.ACTIVE)
|
approvers += AreaDirector.objects.filter(area__status=Area.ACTIVE)
|
||||||
if mail_type.endswith('wg'):
|
if mail_type == 'movewg':
|
||||||
approvers += WGChair.objects.filter(group_acronym=group)
|
approvers += WGChair.objects.filter(group_acronym=group)
|
||||||
domain = Domain.objects.get(domain=domain_name)
|
if mail_type.endswith('non'):
|
||||||
approvers += domain.approvers.all()
|
domain = Domain.objects.get(domain=domain_name)
|
||||||
|
approvers += domain.approvers.all()
|
||||||
return approvers
|
return approvers
|
||||||
|
|
||||||
def list_req_wizard(request):
|
def list_req_wizard(request):
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{% filter wordwrap:"72" %}
|
{% load ietf_filters %}{% filter wordwrap:"72" %}
|
||||||
The Secretariat has received a request from {{ list.requestor }}
|
The Secretariat has received a request from {{ list.requestor }}
|
||||||
to {% include "mailinglists/list_type_message2.txt" %}
|
to {% filter allononeline %}{% include "mailinglists/list_type_message2.txt" %}{% endfilter %}.
|
||||||
Please use the following URL to review and approve or deny this request:
|
Please use the following URL to review and approve or deny this request:
|
||||||
https://datatracker.ietf.org{% url ietf.mailinglists.views.list_approve list.mailing_list_id %}
|
{# https is only for production #}https://{{ site.domain }}{% url ietf.mailinglists.views.list_approve list.mailing_list_id %}
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
|
|
||||||
{# gotta set req for list_summary to work #}
|
|
||||||
{% include "mailinglists/list_summary.txt" %}
|
{% include "mailinglists/list_summary.txt" %}
|
||||||
|
|
Loading…
Reference in a new issue