Made the popup position editing dialog work correctly for non-draft document types

- Legacy-Id: 4597
This commit is contained in:
Robert Sparks 2012-07-05 19:28:40 +00:00
parent f3fd4db35c
commit c93e6a764a
3 changed files with 27 additions and 24 deletions

View file

@ -569,36 +569,39 @@ def get_ballot(name):
from ietf.doc.models import DocAlias from ietf.doc.models import DocAlias
alias = get_object_or_404(DocAlias, name=name) alias = get_object_or_404(DocAlias, name=name)
d = alias.document d = alias.document
id = get_object_or_404(InternetDraft, name=d.name) id = None
try: bw = None
if not id.ballot.ballot_issued: dw = None
if (d.type_id=='draft'):
id = get_object_or_404(InternetDraft, name=d.name)
try:
if not id.ballot.ballot_issued:
raise Http404
except BallotInfo.DoesNotExist:
raise Http404 raise Http404
except BallotInfo.DoesNotExist:
raise Http404 bw = BallotWrapper(id) # XXX Fixme: Eliminate this as we go forward
# Python caches ~100 regex'es -- explicitly compiling it inside a method
# (where you then throw away the compiled version!) doesn't make sense at
# all.
if re.search("^rfc([1-9][0-9]*)$", name):
id.viewing_as_rfc = True
dw = RfcWrapper(id)
else:
dw = IdWrapper(id)
# XXX Fixme: Eliminate 'dw' as we go forward
try: try:
b = d.latest_event(BallotDocEvent, type="created_ballot") b = d.latest_event(BallotDocEvent, type="created_ballot")
except BallotDocEvent.DoesNotExist: except BallotDocEvent.DoesNotExist:
raise Http404 raise Http404
bw = BallotWrapper(id) # XXX Fixme: Eliminate this as we go forward
# Python caches ~100 regex'es -- explicitly compiling it inside a method
# (where you then throw away the compiled version!) doesn't make sense at
# all.
if re.search("^rfc([1-9][0-9]*)$", name):
id.viewing_as_rfc = True
dw = RfcWrapper(id)
else:
dw = IdWrapper(id)
# XXX Fixme: Eliminate 'dw' as we go forward
return (bw, dw, b, d) return (bw, dw, b, d)
def ballot_html(request, name): def ballot_html(request, name):
bw, dw, ballot, doc = get_ballot(name) bw, dw, ballot, doc = get_ballot(name)
return render_to_response('idrfc/doc_ballot.html', {'bw':bw, 'dw':dw, 'ballot':ballot, 'doc':doc}, context_instance=RequestContext(request)) content = document_ballot_content(request, doc, ballot.pk, editable=True)
return HttpResponse(content)
def ballot_tsv(request, name): def ballot_tsv(request, name):
ballot, doc, b, d = get_ballot(name) ballot, doc, b, d = get_ballot(name)

View file

@ -33,15 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->{% endcomment %} -->{% endcomment %}
{% load ietf_filters %} {% load ietf_filters %}
<table class="ietf-ballot"><tr valign="top"><td class="left"> <table class="ietf-ballot"><tr valign="top"><td class="left">
{% if doc_ballot_edit_button and user|in_group:"Area_Director,Secretariat" %} {% if doc_ballot_edit_button and user|in_group:"Area_Director,Secretariat" %}
{% if user|in_group:"Area_Director" %} {% if user|in_group:"Area_Director" %}
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url idrfc.views_ballot.edit_position name=doc.name,ballot_id=ballot.pk %}">Edit position</a></span></span></div> <div style="margin-top:8px; margin-bottom:8px;"><span id="doc_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url idrfc.views_ballot.edit_position name=doc.name,ballot_id=ballot.pk %}">Edit position</a></span></span></div>
{% endif %} {% endif %}
{% if bw.was_deferred %} {% if doc.active_defer_event %}
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_undefer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_undefer_ballot name=doc.name,ballot_id=ballot.pk %}">Undefer ballot</a></span></span></div> <div style="margin-top:8px; margin-bottom:8px;"><span id="doc_undefer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_undefer_ballot name=doc.name,ballot_id=ballot.pk %}">Undefer ballot</a></span></span></div>
<div style="margin-top:8px; margin-bottom:8px;">Ballot deferred by {{ bw.deferred_by }} on {{ bw.deferred_date }}.</div> <div style="margin-top:8px; margin-bottom:8px;">Ballot deferred by {{ doc.active_defer_event.by }} on {{ doc.active_defer_event.time|date:"Y-m-d" }}.</div>
{% else %} {% else %}
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_defer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_defer_ballot name=doc.name,ballot_id=ballot.pk %}">Defer ballot</a></span></span></div> <div style="margin-top:8px; margin-bottom:8px;"><span id="doc_defer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_defer_ballot name=doc.name,ballot_id=ballot.pk %}">Defer ballot</a></span></span></div>
{% endif %} {% endif %}

View file

@ -46,8 +46,9 @@ function showBallot(draftName, editPositionUrl) {
document.getElementById("ietf-extras").appendChild(el); document.getElementById("ietf-extras").appendChild(el);
var buttons = [{text:"Close", handler:handleClose, isDefault:true}]; var buttons = [{text:"Close", handler:handleClose, isDefault:true}];
if (("Area_Director" in IETF.user_groups) || // if (("Area_Director" in IETF.user_groups) ||
("Secretariat" in IETF.user_groups)) { // ("Secretariat" in IETF.user_groups)) {
if ("Area_Director" in IETF.user_groups) {
buttons.unshift({text:"Edit Position", handler:handleEditPosition}); buttons.unshift({text:"Edit Position", handler:handleEditPosition});
} }
var kl = [new YAHOO.util.KeyListener(document, {keys:27}, handleClose)] var kl = [new YAHOO.util.KeyListener(document, {keys:27}, handleClose)]