Port /iesg/agenda/documents/ to new schema, fix problem with rows

being colored for ADs with their position even if a ballot icon is not
shown (issue #1128)
 - Legacy-Id: 6405
This commit is contained in:
Ole Laursen 2013-10-10 10:31:28 +00:00
parent a728468711
commit 0860342e34
8 changed files with 113 additions and 98 deletions

View file

@ -339,7 +339,7 @@ class Document(DocumentInfo):
return self.latest_event(LastCallDocEvent,type="sent_last_call")
def displayname_with_link(self):
return '<a href="%s">%s-%s</a>' % (self.get_absolute_url(), self.name , self.rev)
return mark_safe('<a href="%s">%s-%s</a>' % (self.get_absolute_url(), self.name , self.rev))
def rfc_number(self):
n = self.canonical_name()

View file

@ -40,11 +40,30 @@ from django.utils.safestring import mark_safe
from ietf.ietfauth.utils import user_is_person, has_role
from ietf.doc.models import BallotDocEvent, BallotPositionDocEvent, IESG_BALLOT_ACTIVE_STATES, IESG_SUBSTATE_TAGS
from ietf.name.models import BallotPositionName
register = template.Library()
def render_ballot_icon(user, doc):
@register.filter
def showballoticon(doc):
if doc.type_id == "draft":
if doc.get_state_slug("draft-iesg") not in IESG_BALLOT_ACTIVE_STATES:
return False
elif doc.type_id == "charter":
if doc.get_state_slug() not in ("intrev", "iesgrev"):
return False
elif doc.type_id == "conflrev":
if doc.get_state_slug() not in ("iesgeval","defer"):
return False
elif doc.type_id == "statchg":
if doc.get_state_slug() not in ("iesgeval","defer"):
return False
return True
def render_ballot_icon(doc, user):
if not doc:
return ""
@ -53,18 +72,8 @@ def render_ballot_icon(user, doc):
if not isinstance(doc, Document):
doc = doc._draft
if doc.type_id == "draft":
if doc.get_state_slug("draft-iesg") not in IESG_BALLOT_ACTIVE_STATES:
return ""
elif doc.type_id == "charter":
if doc.get_state_slug() not in ("intrev", "iesgrev"):
return ""
elif doc.type_id == "conflrev":
if doc.get_state_slug() not in ("iesgeval","defer"):
return ""
elif doc.type_id == "statchg":
if doc.get_state_slug() not in ("iesgeval","defer"):
return ""
if not showballoticon(doc):
return ""
ballot = doc.active_ballot()
if not ballot:
@ -119,7 +128,7 @@ class BallotIconNode(template.Node):
self.doc_var = doc_var
def render(self, context):
doc = template.resolve_variable(self.doc_var, context)
return render_ballot_icon(context.get("user"), doc)
return render_ballot_icon(doc, context.get("user"))
def do_ballot_icon(parser, token):
try:
@ -131,6 +140,23 @@ def do_ballot_icon(parser, token):
register.tag('ballot_icon', do_ballot_icon)
@register.filter
def ballotposition(doc, user):
if not showballoticon(doc) or not has_role(user, "Area Director"):
return None
ballot = doc.active_ballot()
if not ballot:
return None
changed_pos = doc.latest_event(BallotPositionDocEvent, type="changed_ballot_position", ad__user=user, ballot=ballot)
if changed_pos:
pos = changed_pos.pos
else:
pos = BallotPositionName.objects.get(slug="norecord")
return pos
@register.filter
def my_position(doc, user):
if not has_role(user, "Area Director"):

View file

@ -306,8 +306,7 @@ def handle_reschedule_form(request, doc, dates):
if request.method == 'POST':
form = RescheduleForm(request.POST, **formargs)
if form.is_valid():
login = request.user.get_profile()
update_telechat(request, doc, login,
update_telechat(request, doc, request.user.get_profile(),
form.cleaned_data['telechat_date'],
False if form.cleaned_data['clear_returning_item'] else None)
doc.time = datetime.datetime.now()
@ -319,21 +318,21 @@ def handle_reschedule_form(request, doc, dates):
return form
def agenda_documents(request):
dates = TelechatDates.objects.all()[0].dates()
from ietf.doc.models import TelechatDocEvent
dates = list(TelechatDate.objects.active().order_by('date').values_list("date", flat=True)[:4])
docs = []
for d in Document.objects.filter(docevent__telechatdocevent__telechat_date__in=dates).distinct():
for d in Document.objects.filter(docevent__telechatdocevent__telechat_date__in=dates).select_related().distinct():
if d.latest_event(TelechatDocEvent, type="scheduled_for_telechat").telechat_date in dates:
docs.append(d)
e = d.latest_event(type="started_iesg_process")
d.balloting_started = e.time if e else datetime.datetime.min
docs.sort(key=lambda d: d.balloting_started)
for i in docs:
i.reschedule_form = handle_reschedule_form(request, i, dates)
# some may have been taken off the schedule by the reschedule form
docs = [d for d in docs if d.telechat_date()]
docs = [d for d in docs if d.telechat_date() in dates]
telechats = []
for date in dates:
@ -351,7 +350,7 @@ def agenda_documents(request):
i.iprCount = len(i.ipr())
res[section_key].append(i)
telechats.append({'date':date, 'docs':res})
return direct_to_template(request, 'iesg/agenda_documents_redesign.html', {'telechats':telechats, 'hide_telechat_date':True})
return direct_to_template(request, 'iesg/agenda_documents.html', { 'telechats':telechats })
def telechat_docs_tarfile(request,year,month,day):
from tempfile import mkstemp

View file

@ -2,12 +2,9 @@
<td class="status">
{{ doc.friendly_state|safe }} {% if not doc.get_state_slug == "rfc" %}{{ doc|state_age_colored }}{% endif %}
{% if not hide_telechat_date and doc.telechat_date %}
<br/>IESG Telechat: {{ doc.telechat_date }}
{% endif %}
{% block extra_status %}{% endblock %}
{% block extra_status %}
{% if doc.telechat_date %}<br/>IESG Telechat: {{ doc.telechat_date }}{% endif %}
{% endblock %}
{% if doc.get_state_slug != "rfc" %}{# I-D #}

View file

@ -39,22 +39,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% block morecss %}
.agenda_docs tr.oddrow {background-color: #EDF5FF; }
.agenda_docs tr.header.telechat_date { margin-top:10px; background:#2647A0; color: white;}
.agenda_docs tr.header.telechat_date td { font-size: 125%; }
.agenda_docs tr.header.telechat-date { margin-top:10px; background:#2647A0; color: white;}
.agenda_docs tr.header.telechat-date td { font-size: 125%; }
.agenda_docs tr.header + tr.header { border-top: 2px solid white;}
.agenda_docs tr td {
vertical-align: top;
}
.agenda_docs tr td { vertical-align: top; }
.agenda_docs tr .reschedule,
.agenda_docs tr .clear-returning-item {
font-size: 11px;
}
.agenda_docs tr .doc_pages {
font-size:80%; font-style:italic;
}
.secretariat-actions {
margin-bottom: 10px;
}
.agenda_docs tr .clear-returning-item { font-size: 11px; }
.agenda_docs tr .doc_pages { font-size: 80%; font-style: italic; }
.secretariat-actions { margin-bottom: 1em; }
{% endblock %}
{% block pagehead %}
@ -65,12 +57,14 @@ font-size:80%; font-style:italic;
<h1>Documents on Future IESG Telechat Agendas</h1>
<form action="" method="POST">
{% if user|in_group:"Secretariat" %}
{% if user|has_role:"Secretariat" %}
<div class="secretariat-actions">
<input type="submit" value="Save"/>
<input title="Save reschedule changes done with the drop-down boxes below" type="submit" value="Save Reschedules"/>
</div>
{% endif %}
<table class="ietf-table ietf-doctable agenda_docs">
{% for t in telechats %}
@ -78,7 +72,7 @@ font-size:80%; font-style:italic;
<tr class="header"><td colspan="6">&nbsp;</td></tr>
{% endif %}
<tr class="header telechat_date"><td colspan="6">IESG telechat {{t.date}}</td></tr>
<tr class="header telechat-date"><td colspan="6">IESG telechat {{t.date}}</td></tr>
{% if forloop.first %}
<tr class="header"><td colspan="6"><a href="/iesg/agenda/">Full IESG Agenda</a></td></tr>
@ -90,77 +84,77 @@ font-size:80%; font-style:italic;
<tr class="header"><td colspan="6">2.1 WG Submissions</td></tr>
{% for doc in t.docs.s211 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s211 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s212 %}<tr class="header"><td colspan="6">2.1.2 Returning Item</td></tr>{% endif %}
{% for doc in t.docs.s212 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s212 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s213 %}<tr class="header"><td colspan="6">2.1.3 For Action</td></tr>{% endif %}
{% for doc in t.docs.s213 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s213 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
<tr class="header"><td colspan="6">2.2 Individual Submissions</td></tr>
{% for doc in t.docs.s221 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s221 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s222 %}<tr class="header"><td colspan="6">2.2.2 Returning Item</td></tr>{% endif %}
{% for doc in t.docs.s222 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s222 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s223 %}<tr class="header"><td colspan="6">2.2.3 For Action</td></tr>{% endif %}
{% for doc in t.docs.s223 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s223 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
<tr class="header"><td colspan="6">2.3 Status Changes</td></tr>
{% for doc in t.docs.s231 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s231 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s222 %}<tr class="header"><td colspan="6">2.3.2 Returning Item</td></tr>{% endif %}
{% for doc in t.docs.s232 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s232 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s223 %}<tr class="header"><td colspan="6">2.3.3 For Action</td></tr>{% endif %}
{% for doc in t.docs.s233 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s233 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
<tr class="header"><td colspan="6">3. Document Actions</td></tr>
<tr class="header"><td colspan="6">3.1 WG Submissions</td></tr>
{% for doc in t.docs.s311 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s311 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s312 %}<tr class="header"><td colspan="6">3.1.2 Returning Item</td></tr>{% endif %}
{% for doc in t.docs.s312 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s312 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s313 %}<tr class="header"><td colspan="6">3.1.3 For Action</td></tr>{% endif %}
{% for doc in t.docs.s313 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s313 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
<tr class="header"><td colspan="6">3.2 Individual Submissions Via AD</td></tr>
{% for doc in t.docs.s321 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s321 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s322 %}<tr class="header"><td colspan="6">3.2.2 Returning Item</td></tr>{% endif %}
{% for doc in t.docs.s322 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s322 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s323 %}<tr class="header"><td colspan="6">3.2.3 For Action</td></tr>{% endif %}
{% for doc in t.docs.s323 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s323 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
<tr class="header"><td colspan="6">3.3 Status Changes</td></tr>
{% for doc in t.docs.s331 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s331 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s332 %}<tr class="header"><td colspan="6">3.3.2 Returning Item</td></tr>{% endif %}
{% for doc in t.docs.s332 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s332 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s333 %}<tr class="header"><td colspan="6">3.3.3 For Action</td></tr>{% endif %}
{% for doc in t.docs.s333 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s333 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
<tr class="header"><td colspan="6">3.4 IRTF and Independent Submission Stream Documents</td></tr>
{% for doc in t.docs.s341 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s341 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s342 %}<tr class="header"><td colspan="6">3.4.2 Returning Item</td></tr>{% endif %}
{% for doc in t.docs.s342 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s342 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s343 %}<tr class="header"><td colspan="6">3.4.3 For Action</td></tr>{% endif %}
{% for doc in t.docs.s343 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s343 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
<tr class="header"><td colspan="6">4. Working Group Actions</td></tr>
{% if t.docs.s411 or t.docs.s412%}<tr class="header"><td colspan="6">4.1 WG Creation</td></tr>{% endif %}
{% if t.docs.s411 %}<tr class="header"><td colspan="6">4.1.1 Proposed for IETF Review</td></tr>{% endif %}
{% for doc in t.docs.s411 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s411 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s412 %}<tr class="header"><td colspan="6">4.1.2 Proposed for Approval</td></tr>{% endif %}
{% for doc in t.docs.s412 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s412 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s421 or t.docs.s422 %}<tr class="header"><td colspan="6">4.2 WG Rechartering</td></tr>{% endif %}
{% if t.docs.s421 %}<tr class="header"><td colspan="6">4.2.1 Under Evaluation for IETF Review</td></tr>{% endif %}
{% for doc in t.docs.s421 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s421 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% if t.docs.s422 %}<tr class="header"><td colspan="6">4.2.2 Proposed for Approval</td></tr>{% endif %}
{% for doc in t.docs.s422 %}{% include "iesg/agenda_documents_row_redesign.html" %}{%endfor%}
{% for doc in t.docs.s422 %}{% include "iesg/agenda_documents_row.html" %}{%endfor%}
{% endfor %}

View file

@ -36,31 +36,32 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% load ballot_icon %}
{% load ietf_filters %}
<tr
{% if user|in_group:"Area_Director" %}
{% if doc|my_position:user|equal:"Discuss" %}style="background:#ffa0a0;"{% endif %}
{% if doc|my_position:user|equal:"Block" %}style="background:#ffa0a0;"{% endif %}
{% if doc|my_position:user|equal:"Abstain" %}style="background:#ffff00;"{% endif %}
{% if doc|my_position:user|equal:"Yes" or doc|my_position:user|slugify|equal:"no-objection" %}style="background:#a0ffa0;"{% endif %}
{% if doc|my_position:user|equal:"Recuse" %}style="background:#c0c0c0;"{% endif %}
<tr {% spaceless %}
{% with doc|ballotposition:user as pos %}
{% if pos %}
{% if pos.blocking %}style="background:#ffa0a0;"{% endif %}
{% if pos.slug == "yes" or pos.slug == "noobj" %}style="background:#a0ffa0;"{% endif %}
{% if pos.slug == "abstain" %}style="background:#ffff00;"{% endif %}
{% if pos.slug == "recuse" %}style="background:#c0c0c0;"{% endif %}
{% endif %}
>
{% endwith %}
{% endspaceless %} >
<td class="doc">
<div>{{ doc.displayname_with_link|safe }}</div>
{% with doc.active_defer_event as defer %}{% if defer %}
<div><b title="deferred by {{ defer.by }}">(deferred on {{ defer.time|date:"Y-m-d" }})</b></div>
{% endif %}{% endwith %}
{% if user|in_group:"Secretariat" %}
<div class="reschedule"><label>Reschedule: {{ doc.reschedule_form.telechat_date }}</label></div>
{% if doc.reschedule_form.show_clear %}
<div class="clear-returning-item"><label>{{ doc.reschedule_form.clear_returning_item }} Clear returning item</label></div>
{% endif %}
{% endif %}
<div>{{ doc.displayname_with_link }}</div>
{% with doc.active_defer_event as defer %}{% if defer %}
<div><b title="deferred by {{ defer.by }}">(deferred on {{ defer.time|date:"Y-m-d" }})</b></div>
{% endif %}{% endwith %}
{% if user|has_role:"Secretariat" %}
<div class="reschedule"><label>Reschedule: {{ doc.reschedule_form.telechat_date }}</label></div>
{% if doc.reschedule_form.show_clear %}
<div class="clear-returning-item"><label>{{ doc.reschedule_form.clear_returning_item }} Clear returning item</label></div>
{% endif %}
{% endif %}
</td>
<td class="title">{{ doc.title }}
{% with doc.pages as pagecount %}{% if pagecount %}<span class="doc_pages">({{doc.pages}} pp)</span>{% endif %}{% endwith %}
{% if doc.pages %}<span class="doc_pages">({{doc.pages}} pp)</span>{% endif %}
</td>
{% include "iesg/agenda_documents_row_status_redesign.html" %}
{% include "iesg/agenda_documents_row_status.html" %}
{% include "doc/search/ipr_column_with_label.html" %}
<td class="ad">{{ doc.ad.plain_name|default:"" }}</td>
<td class="ad">{{ doc.ad|default:"" }}</td>
</tr>

View file

@ -0,0 +1,4 @@
{% extends "doc/search/status_columns.html" %}
{% block extra_status %}
{% if doc.type_id == 'draft' %}<br/>Intended status: {{ doc.intended_std_level }}{% endif %}
{% endblock %}

View file

@ -1,6 +0,0 @@
{% extends "doc/search/status_columns.html" %}
{% block extra_status %}
{% if doc.type.slug == 'draft' %}
<br/>Intended status: {{ doc.intended_std_level }}
{% endif %}
{% endblock %}