Add a warning when submitting a draft that belongs to a non active WG. Fixes #607
- Legacy-Id: 2877
This commit is contained in:
parent
3bd2097171
commit
cf455f5be2
|
@ -3,7 +3,7 @@ import re
|
|||
import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from ietf.idtracker.models import InternetDraft, PersonOrOrgInfo
|
||||
from ietf.idtracker.models import InternetDraft, PersonOrOrgInfo, IETFWG
|
||||
|
||||
|
||||
# Some usefull states
|
||||
|
@ -124,6 +124,11 @@ class DraftValidation(object):
|
|||
self.validate_authors()
|
||||
self.validate_abstract()
|
||||
self.validate_creation_date()
|
||||
self.validate_wg()
|
||||
|
||||
def validate_wg(self):
|
||||
if self.wg and not self.wg.status.pk == IETFWG.ACTIVE:
|
||||
self.add_warning('group', 'Working Group exists but is not an active WG')
|
||||
|
||||
def validate_abstract(self):
|
||||
if not self.draft.abstract:
|
||||
|
|
|
@ -18,7 +18,6 @@ from ietf.submit.utils import (DraftValidation, perform_post, remove_docs,
|
|||
from ietf.utils.mail import send_mail
|
||||
|
||||
|
||||
|
||||
def submit_index(request):
|
||||
if request.method == 'POST':
|
||||
form = UploadForm(request=request, data=request.POST, files=request.FILES)
|
||||
|
@ -27,7 +26,7 @@ def submit_index(request):
|
|||
return HttpResponseRedirect(reverse(draft_status, None, kwargs={'submission_id': submit.submission_id}))
|
||||
else:
|
||||
form = UploadForm(request=request)
|
||||
return render_to_response('submit/submit_index.html',
|
||||
return render_to_response('submit/submit_index.html',
|
||||
{'selected': 'index',
|
||||
'form': form},
|
||||
context_instance=RequestContext(request))
|
||||
|
@ -42,12 +41,11 @@ def submit_status(request):
|
|||
if detail:
|
||||
return HttpResponseRedirect(reverse(draft_status, None, kwargs={'submission_id': detail[0].submission_id}))
|
||||
error = 'No valid history found for %s' % filename
|
||||
return render_to_response('submit/submit_status.html',
|
||||
return render_to_response('submit/submit_status.html',
|
||||
{'selected': 'status',
|
||||
'error': error,
|
||||
'filename': filename},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
|
||||
def _can_approve(user, detail):
|
||||
|
@ -58,14 +56,15 @@ def _can_approve(user, detail):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _can_force_post(user, detail):
|
||||
person = get_person_for_user(user)
|
||||
if detail.status_id != MANUAL_POST_REQUESTED:
|
||||
return None
|
||||
if is_secretariat(user):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def draft_status(request, submission_id, message=None):
|
||||
detail = get_object_or_404(IdSubmissionDetail, submission_id=submission_id)
|
||||
validation = DraftValidation(detail)
|
||||
|
@ -76,11 +75,11 @@ def draft_status(request, submission_id, message=None):
|
|||
can_approve = _can_approve(request.user, detail)
|
||||
if detail.status_id != UPLOADED:
|
||||
if detail.status_id == CANCELED:
|
||||
message=('error', 'This submission has been canceled, modification is no longer possible')
|
||||
message = ('error', 'This submission has been canceled, modification is no longer possible')
|
||||
status = detail.status
|
||||
allow_edit = None
|
||||
|
||||
if request.method=='POST' and allow_edit:
|
||||
if request.method == 'POST' and allow_edit:
|
||||
if request.POST.get('autopost', False):
|
||||
auto_post_form = AutoPostForm(draft=detail, validation=validation, data=request.POST)
|
||||
if auto_post_form.is_valid():
|
||||
|
@ -111,7 +110,7 @@ def draft_status(request, submission_id, message=None):
|
|||
return HttpResponseRedirect(reverse(draft_edit, None, kwargs={'submission_id': detail.submission_id}))
|
||||
else:
|
||||
auto_post_form = AutoPostForm(draft=detail, validation=validation)
|
||||
return render_to_response('submit/draft_status.html',
|
||||
return render_to_response('submit/draft_status.html',
|
||||
{'selected': 'status',
|
||||
'detail': detail,
|
||||
'validation': validation,
|
||||
|
@ -139,14 +138,15 @@ def draft_edit(request, submission_id):
|
|||
if detail.status_id != UPLOADED:
|
||||
raise Http404
|
||||
validation = DraftValidation(detail)
|
||||
if request.method=='POST':
|
||||
validation.validate_wg()
|
||||
if request.method == 'POST':
|
||||
form = MetaDataForm(draft=detail, validation=validation, data=request.POST)
|
||||
if form.is_valid():
|
||||
form.save(request)
|
||||
return HttpResponseRedirect(reverse(draft_status, None, kwargs={'submission_id': detail.submission_id}))
|
||||
else:
|
||||
form = MetaDataForm(draft=detail, validation=validation)
|
||||
return render_to_response('submit/draft_edit.html',
|
||||
return render_to_response('submit/draft_edit.html',
|
||||
{'selected': 'status',
|
||||
'detail': detail,
|
||||
'validation': validation,
|
||||
|
@ -170,7 +170,6 @@ def draft_confirm(request, submission_id, auth_key):
|
|||
|
||||
def draft_approve(request, submission_id, check_function=_can_approve):
|
||||
detail = get_object_or_404(IdSubmissionDetail, submission_id=submission_id)
|
||||
person = get_person_for_user(request.user)
|
||||
can_perform = check_function(request.user, detail)
|
||||
if not can_perform:
|
||||
if can_perform == None:
|
||||
|
|
|
@ -92,7 +92,11 @@ table.ietf-table span.field-error { display: block; color: red; }
|
|||
{% show_submission_files detail %}
|
||||
</td></tr>
|
||||
<tr><th>Submission date</th><td>{{ detail.submission_date }}</td></tr>
|
||||
<tr><th>WG</th><td>{{ validation.wg|default:"Individual Submission" }}</td></tr>
|
||||
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>WG</th><td>{{ validation.wg|default:"Individual Submission" }}
|
||||
{% if validation.warnings.group %}
|
||||
<div class="warn_message">The secretariat will be notified that the working group is not active</div>
|
||||
{% endif %}
|
||||
</td></tr>
|
||||
<tr><th>File size</th><td>{{ detail.filesize|filesizeformat }}</td></tr>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ I-D Submission Tool URL: http://{{ domain }}/submit/status/{{ draft.submission_i
|
|||
|
||||
File name: {{ draft.filename }}
|
||||
Submission date: {{ draft.submission_date }}
|
||||
WG: {{ draft.wg|default:"Individual Submission" }}
|
||||
WG: {{ draft.group_acronym|default:"Individual Submission" }} {% if form.validation.warnings.group %}*Please note that this WG is not an active one*{% endif %}
|
||||
File size: {{ draft.filesize|filesizeformat }}
|
||||
|
||||
Title: {{ draft.id_document_name }}
|
||||
Version: {{ draft.revision }}
|
||||
Creation date: {{ draft.id_document_name }}
|
||||
Creation date: {{ draft.creation_date }}
|
||||
Pages: {{ draft.txt_page_count }}
|
||||
Abstract: {{ draft.abstract }}
|
||||
Submitter: {{ form.cleaned_data.first_name }} {{ form.cleaned_data.last_name }} <{{ form.cleaned_data.email }}>
|
||||
|
|
|
@ -4,12 +4,12 @@ I-D Submission Tool URL: http://{{ domain }}/submit/status/{{ draft.submission_i
|
|||
|
||||
File name: {{ draft.filename }}
|
||||
Submission date: {{ draft.submission_date }}
|
||||
WG: {{ draft.wg|default:"Individual Submission" }}
|
||||
WG: {{ draft.group_acronym|default:"Individual Submission" }}
|
||||
File size: {{ draft.filesize|filesizeformat }}
|
||||
|
||||
Title: {{ draft.id_document_name }}
|
||||
Version: {{ draft.revision }}
|
||||
Creation date: {{ draft.id_document_name }}
|
||||
Creation date: {{ draft.creation_date }}
|
||||
Pages: {{ draft.txt_page_count }}
|
||||
Abstract: {{ draft.abstract }}
|
||||
Submitter: {{ submitter.first_name }} {{ submitter.last_name }} <{{ submitter.email_address }}>
|
||||
|
|
Loading…
Reference in a new issue