Allow to take care of a liaison with deadline. Fixes #385
- Legacy-Id: 2545
This commit is contained in:
parent
4b96b2b309
commit
80ca4e9f18
|
@ -41,7 +41,6 @@ class Command(BaseCommand):
|
|||
{'liaison': liaison,
|
||||
'days_msg': days_msg,
|
||||
})
|
||||
print body
|
||||
mail = IETFEmailMessage(subject=subject,
|
||||
to=to_email,
|
||||
from_email=from_email,
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
# Copyright The IETF Trust 2007, All Rights Reserved
|
||||
import datetime
|
||||
from email.utils import parseaddr
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import Q
|
||||
from django.forms.fields import email_re
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
|
@ -11,7 +13,8 @@ from django.utils import simplejson
|
|||
from django.views.generic.list_detail import object_list, object_detail
|
||||
|
||||
from ietf.liaisons.accounts import (get_person_for_user, can_add_outgoing_liaison,
|
||||
can_add_incoming_liaison, LIAISON_EDIT_GROUPS)
|
||||
can_add_incoming_liaison, LIAISON_EDIT_GROUPS,
|
||||
is_ietfchair, is_iabchair, is_iab_executive_director)
|
||||
from ietf.liaisons.decorators import can_submit_liaison
|
||||
from ietf.liaisons.forms import liaison_form_factory
|
||||
from ietf.liaisons.models import LiaisonDetail, OutgoingLiaisonApproval
|
||||
|
@ -168,16 +171,55 @@ def liaison_approval_detail(request, object_id):
|
|||
)
|
||||
|
||||
|
||||
def _can_take_care(liaison, user):
|
||||
if not liaison.deadline_date or liaison.taken_care:
|
||||
return False
|
||||
|
||||
if user.is_authenticated():
|
||||
if user.groups.filter(name__in=LIAISON_EDIT_GROUPS):
|
||||
return True
|
||||
else:
|
||||
return _can_take_care(liaison, get_person_for_user(user))
|
||||
return False
|
||||
|
||||
|
||||
def _find_person_in_emails(liaison, person):
|
||||
if not person:
|
||||
return False
|
||||
emails = ','.join([liaison.cc1, liaison.cc2, liaison.to_email,
|
||||
liaison.to_poc, liaison.submitter_email,
|
||||
liaison.replyto, liaison.response_contact,
|
||||
technical_contact])
|
||||
for email in emails.split(','):
|
||||
name, addr = parseaddr(email)
|
||||
if email_re.search(addr) and person.emailaddress_set.filter(address=addr):
|
||||
return True
|
||||
elif addr in ('chair@ietf.org', 'iesg@ietf.org') and is_ietfchair(person):
|
||||
return True
|
||||
elif addr in ('iab@iab.org', 'iab-chair@iab.org') and is_iabchair(person):
|
||||
return True
|
||||
elif addr in ('execd@iab.org', ) and is_iab_executive_director(person):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def liaison_detail(request, object_id):
|
||||
public_liaisons = LiaisonDetail.objects.filter(Q(approval__isnull=True)|Q(approval__approved=True)).order_by("-submitted_date")
|
||||
liaison = get_object_or_404(public_liaisons, pk=object_id)
|
||||
can_edit = False
|
||||
user = request.user
|
||||
can_take_care = _can_take_care(liaison, user)
|
||||
if user.is_authenticated() and user.groups.filter(name__in=LIAISON_EDIT_GROUPS):
|
||||
can_edit = True
|
||||
if request.method == 'POST' and request.POST.get('do_taken_care', None) and can_take_care:
|
||||
liaison.taken_care = True
|
||||
liaison.save()
|
||||
can_take_care = False
|
||||
return object_detail(request,
|
||||
public_liaisons,
|
||||
object_id=object_id,
|
||||
extra_context = {'can_edit': can_edit}
|
||||
extra_context = {'can_edit': can_edit,
|
||||
'can_take_care': can_take_care}
|
||||
)
|
||||
|
||||
def liaison_edit(request, object_id):
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
{% block title %}Liaison Statement: {% include 'liaisons/liaison_title.html' %}{% endblock %}
|
||||
|
||||
{% block pagehead %}
|
||||
<link rel="stylesheet" type="text/css" href="/css/liaisons.css"></link>
|
||||
|
||||
<meta name="description" content="Liaison Statement from {{ object.from_body }}{% if not object.by_secretariat %} to {{object.to_body}}{% endif %} ({{ object.submitted_date|date:"Y" }})" />
|
||||
{% endblock %}
|
||||
|
||||
|
@ -47,8 +49,23 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Purpose:</td><td>{% if object.purpose_text %}{{ object.purpose_text }}{% else %}{{ object.purpose }}{% endif %}</td></tr>
|
||||
{% if object.deadline_date %}
|
||||
<tr>
|
||||
<td>Deadline:</td><td>{{ object.deadline_date }}</td></tr>
|
||||
<td>Deadline:</td>
|
||||
{% if can_take_care %}
|
||||
<td><form method="post" action="">
|
||||
{{ object.deadline_date }}
|
||||
{% if object.taken_care %}<span class="takedCare">Already taken care</span>{% else %}<span class="noTakedCare">No actions taked</span>{% endif %}
|
||||
<input type="submit" value="Take care of" name='do_taken_care' />
|
||||
</form></td>
|
||||
{% else %}
|
||||
<td>{{ object.deadline_date }}
|
||||
{% if object.taken_care %}<span class="takedCare">Already taken care</span>{% else %}<span class="noTakedCare">No actions taked</span>{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if object.related_to %}
|
||||
|
@ -80,4 +97,5 @@
|
|||
<input type="submit" value="Edit" />
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -109,3 +109,15 @@ th.orderFieldActive a {
|
|||
background: #2647A0 url(/images/arrow-up.gif) no-repeat left center;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.noTakedCare,
|
||||
.takedCare {
|
||||
border: 1px solid green;
|
||||
padding: 2px 5px;
|
||||
background-color: #ccffbb;
|
||||
}
|
||||
|
||||
.noTakedCare {
|
||||
border: 1px solid red;
|
||||
background-color: #ffccbb;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue