Skip to content

Commit 8a7c5ac

Browse files
committed
All documents show on the AD status page now
- Legacy-Id: 5422
1 parent 1cff618 commit 8a7c5ac

5 files changed

Lines changed: 217 additions & 2 deletions

File tree

ietf/doc/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ def friendly_state(self):
305305
iesg_state_summary = iesg_state_summary + "::"+"::".join(tag.name for tag in iesg_substate)
306306

307307
if self.get_state_slug() == "rfc":
308-
return "<a href=\"%s\">RFC %d</a>" % (urlreverse('doc_view', args=['rfc%d' % self.rfc_number]), self.rfc_number)
308+
#return "<a href=\"%s\">RFC %d</a>" % (urlreverse('doc_view', args=['rfc%d' % int(self.rfc_number())]), int(self.rfc_number()))
309+
return "RFC %d (%s)" % (int(self.rfc_number()), self.std_level)
309310
elif self.get_state_slug() == "repl":
310311
rs = self.replaced_by()
311312
if rs:

ietf/idrfc/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
url(r'^rfc-status-changes/$', views_status_change.rfc_status_changes, name='rfc_status_changes'),
4545
url(r'^start-rfc-status-change/(?P<name>[A-Za-z0-9._+-]*)$', views_status_change.start_rfc_status_change, name='start_rfc_status_change'),
4646
url(r'^ad/(?P<name>[A-Za-z0-9.-]+)/$', views_search.by_ad, name="doc_search_by_ad"),
47+
url(r'^ad2/(?P<name>[A-Za-z0-9.-]+)/$', views_search.by_ad2, name="doc_search_by_ad2"),
4748

4849
url(r'^(?P<name>[A-Za-z0-9._+-]+)/((?P<rev>[0-9-]+)/)?$', views_doc.document_main, name="doc_view"),
4950
url(r'^(?P<name>[A-Za-z0-9._+-]+)/history/$', views_doc.document_history, name="doc_history"),

ietf/idrfc/views_search.py

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from django.views.decorators.cache import cache_page
3939
from ietf.idtracker.models import IDState, IESGLogin, IDSubState, Area, InternetDraft, Rfc, IDInternal, IETFWG
4040
from ietf.idrfc.models import RfcIndex
41+
from ietf.ipr.models import IprDraft
4142
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponsePermanentRedirect
4243
from ietf.idrfc.idrfc_wrapper import IdWrapper,RfcWrapper,IdRfcWrapper
4344
from ietf.utils import normalize_draftname
@@ -579,6 +580,129 @@ def by_ad(request, name):
579580
results.sort(key=lambda obj: obj.view_sort_key_byad())
580581
return render_to_response('idrfc/by_ad.html', {'form':form, 'docs':results,'meta':meta, 'ad_name':ad_name}, context_instance=RequestContext(request))
581582

583+
def ad_dashboard_group(doc):
584+
585+
if doc.type.slug=='draft':
586+
if doc.get_state_slug('draft') == 'rfc':
587+
return 'RFC'
588+
elif doc.get_state_slug('draft') == 'active' and doc.get_state_slug('draft-iesg'):
589+
return '%s Internet-Draft' % doc.get_state('draft-iesg').name
590+
else:
591+
return '%s Internet-Draft' % doc.get_state('draft').name
592+
elif doc.type.slug=='conflrev':
593+
if doc.get_state_slug('conflrev') in ('appr-reqnopub-sent','appr-noprob-sent'):
594+
return 'Approved Conflict Review'
595+
elif doc.get_state_slug('conflrev') in ('appr-reqnopub-pend','appr-noprob-pend','appr-reqnopub-pr','appr-noprob-pr'):
596+
return "%s Conflict Review" % State.objects.get(type__slug='draft-iesg',slug='approved')
597+
else:
598+
return '%s Conflict Review' % doc.get_state('conflrev')
599+
elif doc.type.slug=='statchg':
600+
if doc.get_state_slug('statchg') in ('appr-sent',):
601+
return 'Approved Status Change'
602+
if doc.get_state_slug('statchg') in ('appr-pend','appr-pr'):
603+
return '%s Status Change' % State.objects.get(type__slug='draft-iesg',slug='approved')
604+
else:
605+
return '%s Status Change' % doc.get_state('statchg')
606+
elif doc.type.slug=='charter':
607+
if doc.get_state_slug('charter') == 'approved':
608+
return "Approved Charter"
609+
else:
610+
return '%s Charter' % doc.get_state('charter')
611+
else:
612+
return "Document"
613+
614+
def ad_dashboard_sort_key(doc):
615+
616+
if doc.type.slug=='draft' and doc.get_state_slug('draft') == 'rfc':
617+
return "21%04d" % int(doc.rfc_number())
618+
if doc.type.slug=='statchg' and doc.get_state_slug('statchg') == 'appr-sent':
619+
return "22%d" % 0 # TODO - get the date of the transition into this state here
620+
if doc.type.slug=='conflrev' and doc.get_state_slug('conflrev') in ('appr-reqnopub-sent','appr-noprob-sent'):
621+
return "23%d" % 0 # TODO - get the date of the transition into this state here
622+
if doc.type.slug=='charter' and doc.get_state_slug('charter') == 'approved':
623+
return "24%d" % 0 # TODO - get the date of the transition into this state here
624+
625+
seed = ad_dashboard_group(doc)
626+
627+
if doc.type.slug=='conflrev' and doc.get_state_slug('conflrev') == 'adrev':
628+
state = State.objects.get(type__slug='draft-iesg',slug='ad-eval')
629+
return "1%d%s" % (state.order,seed)
630+
631+
if doc.type.slug=='charter':
632+
if doc.get_state_slug('charter') in ('notrev','infrev'):
633+
return "100%s" % seed
634+
elif doc.get_state_slug('charter') == 'intrev':
635+
state = State.objects.get(type__slug='draft-iesg',slug='ad-eval')
636+
return "1%d%s" % (state.order,seed)
637+
elif doc.get_state_slug('charter') == 'extrev':
638+
state = State.objects.get(type__slug='draft-iesg',slug='lc')
639+
return "1%d%s" % (state.order,seed)
640+
elif doc.get_state_slug('charter') == 'iesgrev':
641+
state = State.objects.get(type__slug='draft-iesg',slug='iesg-eva')
642+
return "1%d%s" % (state.order,seed)
643+
644+
if seed.startswith('Needs Shepherd'):
645+
return "100%s" % seed
646+
if seed.endswith(' Document'):
647+
seed = seed[:-9]
648+
elif seed.endswith(' Internet-Draft'):
649+
seed = seed[:-15]
650+
elif seed.endswith(' Conflict Review'):
651+
seed = seed[:-16]
652+
elif seed.endswith(' Status Change'):
653+
seed = seed[:-14]
654+
state = State.objects.filter(type__slug='draft-iesg',name=seed)
655+
if state:
656+
ageseconds = 0
657+
changetime= doc.latest_event(type='changed_document')
658+
if changetime:
659+
ageseconds = (datetime.datetime.now()-doc.latest_event(type='changed_document').time).total_seconds()
660+
return "1%d%s%010d" % (state[0].order,seed,ageseconds)
661+
662+
return "3%s" % seed
663+
664+
def by_ad2(request, name):
665+
responsible = Document.objects.values_list('ad', flat=True).distinct()
666+
for p in Person.objects.filter(Q(role__name__in=("pre-ad", "ad"),
667+
role__group__type="area",
668+
role__group__state="active")
669+
| Q(pk__in=responsible)).distinct():
670+
if name == p.full_name_as_key():
671+
ad_id = p.id
672+
ad_name = p.plain_name()
673+
break
674+
docqueryset = Document.objects.filter(ad__id=ad_id)
675+
docs=[]
676+
for doc in docqueryset:
677+
doc.ad_dashboard_sort_key = ad_dashboard_sort_key(doc)
678+
doc.ad_dashboard_group = ad_dashboard_group(doc)
679+
if doc.get_state_slug() == 'rfc':
680+
doc.display_date = doc.latest_event(type='published_rfc').time
681+
else:
682+
revision = doc.latest_event(type='new_revision')
683+
if revision:
684+
doc.display_date = revision.time
685+
# This might be better handled as something Documents know about themselves
686+
now = datetime.datetime.now()
687+
doc.can_expire = (doc.type.slug=='draft' and doc.get_state_slug('draft')=='active' and ( not doc.get_state('draft-iesg') or doc.get_state('draft-iesg').order >= 42) and doc.expires>now)
688+
if doc.get_state_slug('draft') == 'rfc':
689+
doc.obsoleted_by = ", ".join([ 'RFC %04d' % int(rel.source.rfc_number()) for alias in doc.docalias_set.all() for rel in alias.relateddocument_set.filter(relationship='obsoletes') ] )
690+
doc.updated_by = ", ".join([ 'RFC %04d' % int(rel.source.rfc_number()) for alias in doc.docalias_set.all() for rel in alias.relateddocument_set.filter(relationship='updates') ] )
691+
doc.has_errata = bool(doc.tags.filter(slug="errata"))
692+
else:
693+
s = doc.get_state("draft-rfceditor")
694+
if s:
695+
# extract possible extra annotations
696+
tags = doc.tags.filter(slug__in=("iana", "ref"))
697+
doc.rfc_editor_state = "*".join([s.name] + [t.slug.upper() for t in tags])
698+
if doc.type.slug == 'draft':
699+
doc.iprCount = IprDraft.objects.filter(document=doc, ipr__status__in=[1,3]).count()
700+
doc.iprUrl = "/ipr/search?option=document_search&id_document_tag=%s" % doc.name
701+
docs.append(doc)
702+
docs.sort(key=ad_dashboard_sort_key)
703+
return render_to_response('idrfc/by_ad2.html',{'docs':docs,'ad_name':ad_name}, context_instance=RequestContext(request))
704+
705+
582706
@cache_page(15*60) # 15 minutes
583707
def all(request):
584708
if settings.USE_DB_REDESIGN_PROXY_CLASSES:

ietf/templates/base_leftmenu.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
<li><a href="{% url account_index %}">{% if request.user.is_authenticated %}Manage Account{% else %}New Account{% endif %}</a></li>
4141
{% if user|in_group:"Area_Director" %}
4242
<li class="sect first">AD Dashboard</li>
43-
<li><a href="{% url doc_search_by_ad name=user.get_profile.person.full_name_as_key %}">My Documents</a></li>
43+
<li><a href="{% url doc_search_by_ad name=user.get_profile.person.full_name_as_key %}">My Documents (old)</a></li>
44+
<li><a href="{% url doc_search_by_ad2 name=user.get_profile.person.full_name_as_key %}">My Documents (new)</a></li>
4445
<li><a href="{% url ietf.iesg.views.agenda_documents %}">Next Telechat</a></li>
4546
<li><a href="{% url ietf.iesg.views.discusses %}">Discusses</a></li>
4647
<li><a href="{% url ietf.iesg.views.working_group_actions %}">Working Groups</a></li>

ietf/templates/idrfc/by_ad2.html

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{% extends "base.html" %}
2+
3+
{% load ietf_filters %}
4+
{% load ietf_streams_redesign %}
5+
{% load ballot_icon_redesign %}
6+
7+
{% block title %}Documents for {{ ad_name }}{% endblock %}
8+
9+
{% block content %}
10+
<h1>Documents for {{ ad_name }}</h1>
11+
12+
{% regroup docs by ad_dashboard_group as grouped_docs %}
13+
14+
<table class="ietf-table ietf-doctable">
15+
<tr><th class="doc">Document</th><th class="title">Title</th><th class="date">Date</th><th class="status" colspan="2">Status</th><th class="ipr">ipr</th></tr>
16+
{% for doc_group in grouped_docs %}
17+
<tr class="header"><td colspan="7">{{doc_group.grouper}}s</td></tr>
18+
19+
{% for doc in doc_group.list %}
20+
21+
22+
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
23+
24+
<td class="doc">
25+
{#{{doc.ad_dashboard_sort_key}}<br/>#}
26+
{% if doc.get_state_slug == 'rfc' %}
27+
{{ doc.canonical_name|upper|rfcspace|urlize_ietf_docs }}<br/>{{ doc.name|urlize_ietf_docs }}
28+
{% else %}
29+
{{ doc.name|urlize_ietf_docs }}
30+
{% endif %}
31+
</td>
32+
33+
<td class="title">{{ doc.title }}</td>
34+
35+
36+
<td class="date">
37+
{% if doc.display_date %}
38+
{% if doc.get_state_slug == 'rfc' %}
39+
{{ doc.display_date|date:"Y-m"}}
40+
{% else %}
41+
{{ doc.display_date|date:"Y-m-d" }}
42+
{% endif %}
43+
{% if doc.display_date|timesince_days|new_enough:request %}
44+
<br/><span class="ietf-small ietf-highlight-y">
45+
{% if not doc.type.slug == 'draft' or doc.get_state_slug == 'rfc' %}
46+
new
47+
{% else %}
48+
<a href="http:{{rfcdiff_prefix}}?url2={{doc.filename_with_rev}}">new</a>
49+
{% endif %}
50+
</span>
51+
{% endif %}
52+
{% if doc.can_expire and doc.expires and doc.expires|timesince_days|expires_soon:request %}
53+
<br/><span class="ietf-small ietf-highlight-y">expires soon</span>
54+
{%endif%}
55+
{% endif %}
56+
</td>
57+
58+
<td class="status">
59+
{{ doc.friendly_state|safe }} {% if not doc.get_state_slug == 'rfc' %}{{ doc|state_age_colored|safe }}{% endif %}
60+
{% if doc.on_upcoming_agenda %}<br/>IESG Telechat: {{ doc.telechat_date }}{% endif %}
61+
{% if doc.get_state_slug == 'rfc' %}
62+
{% if doc.obsoleted_by %}<br />Obsoleted by {{ doc.obsoleted_by|urlize_ietf_docs }}{%endif %}
63+
{% if doc.updated_by %}<br />Updated by {{ doc.updated_by|urlize_ietf_docs }}{%endif %}
64+
{% if doc.has_errata %}<br /><a href="http://www.rfc-editor.org/errata_search.php?rfc={{doc.rfc_number}}" rel="nofollow">Errata</a>{% endif %}
65+
{% else %}{# not rfc #}
66+
{% if doc.rfc_editor_state %}<br />RFC Editor State: <a href="http://www.rfc-editor.org/queue2.html#{{doc.name}}">{{ doc.rfc_editor_state|escape }}</a>{% endif %}
67+
{% stream_state doc %}
68+
{% endif %}
69+
</td>
70+
<td class="ballot">
71+
{% ballot_icon doc %}
72+
</td>
73+
74+
75+
<td class="ipr">
76+
{% if doc.iprCount %}<a href="{{ doc.iprUrl }}" rel="nofollow"> {{ doc.iprCount }} </a>{% endif %}
77+
</td>
78+
79+
{% comment %}
80+
{% include "idrfc/ipr_column.html" %}
81+
{% endcomment %}
82+
</tr>
83+
84+
{% endfor %}
85+
86+
{% endfor %}
87+
</table>
88+
{% endblock content %}

0 commit comments

Comments
 (0)