parent
3942d63733
commit
512f179a45
|
@ -464,5 +464,5 @@ class MetaDataForm(AutoPostForm):
|
|||
if self.draft.group_acronym:
|
||||
cc += [i.person.email()[1] for i in self.draft.group_acronym.wgchair_set.all()]
|
||||
cc = list(set(cc))
|
||||
send_mail(request, from_email, to_email, subject, 'submit/manual_post_mail.txt',
|
||||
send_mail(request, to_email, from_email, subject, 'submit/manual_post_mail.txt',
|
||||
{'form': self, 'draft': self.draft }, cc=cc)
|
||||
|
|
|
@ -46,6 +46,18 @@ class IdSubmissionDetail(models.Model):
|
|||
db_table = 'id_submission_detail'
|
||||
|
||||
|
||||
class IdApprovedDetail(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
filename = models.CharField(null=True, blank=True, max_length=255)
|
||||
approved_status = models.IntegerField(null=True, blank=True)
|
||||
approved_person_tag = models.IntegerField(null=True, blank=True)
|
||||
approved_date = models.DateField(null=True, blank=True)
|
||||
recorded_by = models.IntegerField(null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'id_approved_detail'
|
||||
|
||||
|
||||
class TempIdAuthors(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
id_document_tag = models.IntegerField()
|
||||
|
|
|
@ -8,6 +8,7 @@ urlpatterns = patterns('ietf.submit.views',
|
|||
url(r'^status/(?P<submission_id>\d+)/edit/$', 'draft_edit', name='draft_edit'),
|
||||
url(r'^status/(?P<submission_id>\d+)/confirm/(?P<auth_key>[a-f\d]+)/$', 'draft_confirm', name='draft_confirm'),
|
||||
url(r'^status/(?P<submission_id>\d+)/cancel/$', 'draft_cancel', name='draft_cancel'),
|
||||
url(r'^status/(?P<submission_id>\d+)/approve/$', 'draft_approve', name='draft_approve'),
|
||||
)
|
||||
|
||||
urlpatterns += patterns('django.views.generic.simple',
|
||||
|
|
|
@ -2,6 +2,7 @@ import os
|
|||
import re
|
||||
import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from ietf.idtracker.models import InternetDraft, EmailAddress, PersonOrOrgInfo
|
||||
|
||||
|
||||
|
@ -12,6 +13,7 @@ MANUAL_POST_REQUESTED = 5
|
|||
POSTED = -1
|
||||
POSTED_BY_SECRETARIAT = -2
|
||||
CANCELED = -4
|
||||
INITIAL_VERSION_APPROVAL_REQUESTED = 10
|
||||
|
||||
|
||||
# Not a real WG
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
# Copyright The IETF Trust 2007, All Rights Reserved
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect, Http404
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
from ietf.submit.models import IdSubmissionDetail
|
||||
from ietf.submit.models import IdSubmissionDetail, IdApprovedDetail
|
||||
from ietf.submit.forms import UploadForm, AutoPostForm, MetaDataForm
|
||||
from ietf.submit.utils import (DraftValidation, UPLOADED, WAITING_AUTHENTICATION, CANCELED,
|
||||
perform_post)
|
||||
from ietf.submit.utils import (DraftValidation, perform_post,
|
||||
UPLOADED, WAITING_AUTHENTICATION, CANCELED, INITIAL_VERSION_APPROVAL_REQUESTED)
|
||||
from ietf.utils.mail import send_mail
|
||||
|
||||
|
||||
|
||||
def submit_index(request):
|
||||
|
@ -53,12 +57,33 @@ def draft_status(request, submission_id, message=None):
|
|||
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.POST.get('autopost', False):
|
||||
auto_post_form = AutoPostForm(draft=detail, validation=validation, data=request.POST)
|
||||
if auto_post_form.is_valid():
|
||||
auto_post_form.save(request)
|
||||
return HttpResponseRedirect(reverse(draft_status, None, kwargs={'submission_id': detail.submission_id}))
|
||||
try:
|
||||
approved_detail = IdApprovedDetail.objects.get(filename=detail.filename)
|
||||
except ObjectDoesNotExist:
|
||||
approved_detail = None
|
||||
detail.status_id = INITIAL_VERSION_APPROVAL_REQUESTED
|
||||
detail.save()
|
||||
|
||||
if detail.revision == '00' and not approved_detail:
|
||||
subject = 'New draft waiting for approval: %s' % detail.filename
|
||||
from_email = settings.IDST_FROM_EMAIL
|
||||
to_email = []
|
||||
if detail.group_acronym:
|
||||
to_email += [i.person.email()[1] for i in detail.group_acronym.wgchair_set.all()]
|
||||
to_email = list(set(to_email))
|
||||
if to_email:
|
||||
metadata_form = MetaDataForm(draft=detail, validation=validation)
|
||||
send_mail(request, to_email, from_email, subject, 'submit/manual_post_mail.txt',
|
||||
{'form': metadata_form, 'draft': detail})
|
||||
else:
|
||||
auto_post_form = AutoPostForm(draft=detail, validation=validation, data=request.POST)
|
||||
if auto_post_form.is_valid():
|
||||
auto_post_form.save(request)
|
||||
return HttpResponseRedirect(reverse(draft_status, None, kwargs={'submission_id': detail.submission_id}))
|
||||
|
||||
else:
|
||||
return HttpResponseRedirect(reverse(draft_edit, None, kwargs={'submission_id': detail.submission_id}))
|
||||
else:
|
||||
|
@ -114,3 +139,12 @@ def draft_confirm(request, submission_id, auth_key):
|
|||
message = ('success', 'Authorization key accepted. Auto-Post complete')
|
||||
perform_post(detail)
|
||||
return draft_status(request, submission_id, message)
|
||||
|
||||
|
||||
def draft_approve(request, submission_id):
|
||||
detail = get_object_or_404(IdSubmissionDetail, submission_id=submission_id)
|
||||
if detail.status_id == INITIAL_VERSION_APPROVAL_REQUESTED:
|
||||
validation = DraftValidation(detail)
|
||||
approved_detail = IdApprovedDetail()
|
||||
perform_post(detail)
|
||||
return HttpResponseRedirect(reverse(draft_status, None, kwargs={'submission_id': submission_id}))
|
||||
|
|
|
@ -22,7 +22,7 @@ table.metadata-table ul.errorlist { color: red; padding: 0px; margin: 0px; list-
|
|||
<script type="text/javascript">
|
||||
function confirmCancelation(){
|
||||
if (confirm("Cancel this submission?"))
|
||||
document.location = "cancel";
|
||||
document.location = "/submit/status/{{ detail.submission_id }}/cancel/";
|
||||
}
|
||||
|
||||
(function ($) {
|
||||
|
@ -146,40 +146,49 @@ returned to the submitter.
|
|||
</table>
|
||||
|
||||
{% if allow_edit %}
|
||||
<form method="post" action="" name="auto_post_form">
|
||||
<input type="submit" value="Adjust Meta-Data" value="adjust" /> (Leads to manual post by the Secretariat)
|
||||
</form>
|
||||
{% if is_valid %}
|
||||
<h2>Please edit the following meta-data before proceeding to Auto-Post</h2>
|
||||
<p>
|
||||
If you are one of the authors of this document, then please click the button with your name on it to automatically fill in the submitter information as requested below. Otherwise, please manually enter your information.
|
||||
</p>
|
||||
<form method="post" action="">
|
||||
{{ auto_post_form.get_author_buttons|safe }}
|
||||
<table class="metadata-table">
|
||||
{{ auto_post_form }}
|
||||
</table>
|
||||
<input type="submit" value="Post" name="autopost" />
|
||||
</form>
|
||||
{% endif %}
|
||||
<form method="post" action="" name="auto_post_form">
|
||||
<input type="submit" value="Adjust Meta-Data" value="adjust" /> (Leads to manual post by the Secretariat)
|
||||
</form>
|
||||
|
||||
{% if is_valid %}
|
||||
<h2>Please edit the following meta-data before proceeding to Auto-Post</h2>
|
||||
<p>
|
||||
If you are one of the authors of this document, then please click the button with your name on it to automatically fill in the submitter information as requested below. Otherwise, please manually enter your information.
|
||||
</p>
|
||||
<form method="post" action="">
|
||||
{{ auto_post_form.get_author_buttons|safe }}
|
||||
<table class="metadata-table">
|
||||
{{ auto_post_form }}
|
||||
</table>
|
||||
<input type="submit" value="Post" name="autopost" />
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<h2>Cancel submission</h2>
|
||||
<p>
|
||||
<input type="button" onclick="confirmCancelation();" value="Cancel Submission" /><br>
|
||||
This submission will be canceled, and its uploaded document(s) permanently deleted.
|
||||
</p>
|
||||
|
||||
<h2>Cancel submission</h2>
|
||||
<p>
|
||||
<input type="button" onclick="confirmCancelation();" value="Cancel Submission" /><br>
|
||||
This submission will be canceled, and its uploaded document(s) permanently deleted.
|
||||
</p>
|
||||
{% else %}
|
||||
{% if validation.submitter %}
|
||||
<h3>Submitter information</h3>
|
||||
<table class="metadata-table">
|
||||
<tr><th>First name</th><td>{{ validation.submitter.first_name }}</td></tr>
|
||||
<tr><th>Last name</th><td>{{ validation.submitter.last_name }}</td></tr>
|
||||
<tr><th>Email address</th><td>{{ validation.submitter.email_address|default:validation.submitter.email.1 }}</td></tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if validation.submitter %}
|
||||
<h3>Submitter information</h3>
|
||||
<table class="metadata-table">
|
||||
<tr><th>First name</th><td>{{ validation.submitter.first_name }}</td></tr>
|
||||
<tr><th>Last name</th><td>{{ validation.submitter.last_name }}</td></tr>
|
||||
<tr><th>Email address</th><td>{{ validation.submitter.email_address|default:validation.submitter.email.1 }}</td></tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% ifequal status.status_value "Initial Version Approval Requested" %}
|
||||
<p>
|
||||
<form method="post" action="/submit/status/{{ detail.submission_id }}/approve/">
|
||||
<input type="submit" value="Approve this submission" />
|
||||
</form>
|
||||
</p>
|
||||
{% endifequal %}
|
||||
|
||||
<p>
|
||||
The IETF is an organized activity of the <a href="http://www.isoc.org">Internet Society</a>
|
||||
<br>Please send problem reports to <a href="mailto:ietf-action@ietf.org">ietf-action@ietf.org</a>.
|
||||
|
|
Loading…
Reference in a new issue