Skip to content

Commit 6835826

Browse files
committed
Splitting the ballot writeups page into three
- Legacy-Id: 2413
1 parent f87a937 commit 6835826

2 files changed

Lines changed: 188 additions & 0 deletions

File tree

rjs/ietf/idrfc/urls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
url(r'^(?P<name>[^/]+)/edit/undeferballot/$', views_ballot.undefer_ballot, name='doc_undefer_ballot'),
5757
url(r'^(?P<name>[^/]+)/edit/sendballotcomment/$', views_ballot.send_ballot_comment, name='doc_send_ballot_comment'),
5858
url(r'^(?P<name>[^/]+)/edit/ballotwriteups/$', views_ballot.ballot_writeups, name='doc_ballot_writeups'),
59+
url(r'^(?P<name>[^/]+)/edit/lastcalltext/$', views_ballot.lastcalltext, name='doc_ballot_lastcall'),
60+
url(r'^(?P<name>[^/]+)/edit/ballotwriteupnotes/$', views_ballot.ballot_writeupnotes, name='doc_ballot_writeupnotes'),
61+
url(r'^(?P<name>[^/]+)/edit/approvaltext/$', views_ballot.ballot_approvaltext, name='doc_ballot_approvaltext'),
5962
url(r'^(?P<name>[^/]+)/edit/approveballot/$', views_ballot.approve_ballot, name='doc_approve_ballot'),
6063
url(r'^(?P<name>[^/]+)/edit/makelastcall/$', views_ballot.make_last_call, name='doc_make_last_call'),
6164
)

rjs/ietf/idrfc/views_ballot.py

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,191 @@ def ballot_writeups(request, name):
431431
context_instance=RequestContext(request))
432432

433433

434+
@group_required('Area_Director','Secretariat')
435+
def lastcalltext(request, name):
436+
"""Editing of the last call text"""
437+
doc = get_object_or_404(InternetDraft, filename=name)
438+
if not doc.idinternal:
439+
raise Http404()
440+
441+
login = IESGLogin.objects.get(login_name=request.user.username)
442+
443+
try:
444+
ballot = doc.idinternal.ballot
445+
except BallotInfo.DoesNotExist:
446+
ballot = generate_ballot(request, doc)
447+
448+
last_call_form = LastCallTextForm(instance=ballot)
449+
450+
if request.method == 'POST':
451+
if "save_last_call_text" in request.POST or "send_last_call_request" in request.POST:
452+
last_call_form = LastCallTextForm(request.POST, instance=ballot)
453+
if last_call_form.is_valid():
454+
ballot.last_call_text = last_call_form.cleaned_data["last_call_text"]
455+
ballot.save()
456+
457+
if "send_last_call_request" in request.POST:
458+
doc.idinternal.change_state(IDState.objects.get(document_state_id=IDState.LAST_CALL_REQUESTED), None)
459+
460+
change = log_state_changed(request, doc, login)
461+
email_owner(request, doc, doc.idinternal.job_owner, login, change)
462+
request_last_call(request, doc)
463+
464+
doc.idinternal.event_date = date.today()
465+
doc.idinternal.save()
466+
467+
return render_to_response('idrfc/last_call_requested.html',
468+
dict(doc=doc),
469+
context_instance=RequestContext(request))
470+
471+
if "regenerate_last_call_text" in request.POST:
472+
ballot.last_call_text = generate_last_call_announcement(request, doc)
473+
ballot.save()
474+
475+
# make sure form has the updated text
476+
last_call_form = LastCallTextForm(instance=ballot)
477+
478+
doc.idinternal.event_date = date.today()
479+
doc.idinternal.save()
480+
481+
can_request_last_call = doc.idinternal.cur_state_id < 27
482+
can_make_last_call = doc.idinternal.cur_state_id < 20
483+
can_announce = doc.idinternal.cur_state_id > 19
484+
docs_with_invalid_status = [d.document().file_tag() for d in doc.idinternal.ballot_set() if "None" in d.document().intended_status.intended_status or "Request" in d.document().intended_status.intended_status]
485+
need_intended_status = ", ".join(docs_with_invalid_status)
486+
487+
return render_to_response('idrfc/ballot_lastcalltext.html',
488+
dict(doc=doc,
489+
ballot=ballot,
490+
last_call_form=last_call_form,
491+
can_request_last_call=can_request_last_call,
492+
can_make_last_call=can_make_last_call,
493+
need_intended_status=need_intended_status,
494+
),
495+
context_instance=RequestContext(request))
496+
497+
@group_required('Area_Director','Secretariat')
498+
def ballot_writeupnotes(request, name):
499+
"""Editing of ballot write-up and notes"""
500+
doc = get_object_or_404(InternetDraft, filename=name)
501+
if not doc.idinternal:
502+
raise Http404()
503+
504+
login = IESGLogin.objects.get(login_name=request.user.username)
505+
506+
try:
507+
ballot = doc.idinternal.ballot
508+
except BallotInfo.DoesNotExist:
509+
ballot = generate_ballot(request, doc)
510+
511+
ballot_writeup_form = BallotWriteupForm(instance=ballot)
512+
513+
if request.method == 'POST':
514+
515+
if "save_ballot_writeup" in request.POST:
516+
ballot_writeup_form = BallotWriteupForm(request.POST, instance=ballot)
517+
if ballot_writeup_form.is_valid():
518+
ballot.ballot_writeup = ballot_writeup_form.cleaned_data["ballot_writeup"]
519+
ballot.save()
520+
521+
if "issue_ballot" in request.POST:
522+
ballot_writeup_form = BallotWriteupForm(request.POST, instance=ballot)
523+
approval_text_form = ApprovalTextForm(request.POST, instance=ballot)
524+
if ballot_writeup_form.is_valid() and approval_text_form.is_valid():
525+
ballot.ballot_writeup = ballot_writeup_form.cleaned_data["ballot_writeup"]
526+
ballot.approval_text = approval_text_form.cleaned_data["approval_text"]
527+
ballot.active = True
528+
ballot.ballot_issued = True
529+
ballot.save()
530+
531+
if not Position.objects.filter(ballot=ballot, ad=login):
532+
pos = Position()
533+
pos.ballot = ballot
534+
pos.ad = login
535+
pos.yes = 1
536+
pos.noobj = pos.abstain = pos.approve = pos.discuss = pos.recuse = 0
537+
pos.save()
538+
539+
msg = generate_issue_ballot_mail(request, doc)
540+
send_mail_preformatted(request, msg)
541+
542+
email_iana(request, doc, 'drafts-eval@icann.org', msg)
543+
544+
doc.b_sent_date = date.today()
545+
doc.save()
546+
547+
add_document_comment(request, doc, "Ballot has been issued")
548+
549+
doc.idinternal.event_date = date.today()
550+
doc.idinternal.save()
551+
552+
return render_to_response('idrfc/ballot_issued.html',
553+
dict(doc=doc),
554+
context_instance=RequestContext(request))
555+
556+
557+
doc.idinternal.event_date = date.today()
558+
doc.idinternal.save()
559+
560+
docs_with_invalid_status = [d.document().file_tag() for d in doc.idinternal.ballot_set() if "None" in d.document().intended_status.intended_status or "Request" in d.document().intended_status.intended_status]
561+
need_intended_status = ", ".join(docs_with_invalid_status)
562+
563+
return render_to_response('idrfc/ballot_writeupnotes.html',
564+
dict(doc=doc,
565+
ballot=ballot,
566+
ballot_writeup_form=ballot_writeup_form,
567+
need_intended_status=need_intended_status,
568+
),
569+
context_instance=RequestContext(request))
570+
571+
@group_required('Area_Director','Secretariat')
572+
def ballot_approvaltext(request, name):
573+
"""Editing of approval text"""
574+
doc = get_object_or_404(InternetDraft, filename=name)
575+
if not doc.idinternal:
576+
raise Http404()
577+
578+
login = IESGLogin.objects.get(login_name=request.user.username)
579+
580+
try:
581+
ballot = doc.idinternal.ballot
582+
except BallotInfo.DoesNotExist:
583+
ballot = generate_ballot(request, doc)
584+
585+
approval_text_form = ApprovalTextForm(instance=ballot)
586+
587+
if request.method == 'POST':
588+
589+
if "save_approval_text" in request.POST:
590+
approval_text_form = ApprovalTextForm(request.POST, instance=ballot)
591+
if approval_text_form.is_valid():
592+
ballot.approval_text = approval_text_form.cleaned_data["approval_text"]
593+
ballot.save()
594+
595+
if "regenerate_approval_text" in request.POST:
596+
ballot.approval_text = generate_approval_mail(request, doc)
597+
ballot.save()
598+
599+
# make sure form has the updated text
600+
approval_text_form = ApprovalTextForm(instance=ballot)
601+
602+
doc.idinternal.event_date = date.today()
603+
doc.idinternal.save()
604+
605+
can_announce = doc.idinternal.cur_state_id > 19
606+
docs_with_invalid_status = [d.document().file_tag() for d in doc.idinternal.ballot_set() if "None" in d.document().intended_status.intended_status or "Request" in d.document().intended_status.intended_status]
607+
need_intended_status = ", ".join(docs_with_invalid_status)
608+
609+
return render_to_response('idrfc/ballot_approvaltext.html',
610+
dict(doc=doc,
611+
ballot=ballot,
612+
approval_text_form=approval_text_form,
613+
can_announce=can_announce,
614+
need_intended_status=need_intended_status,
615+
),
616+
context_instance=RequestContext(request))
617+
618+
434619
@group_required('Secretariat')
435620
def approve_ballot(request, name):
436621
"""Approve ballot, sending out announcement, changing state."""

0 commit comments

Comments
 (0)