All documents show on the AD status page now

- Legacy-Id: 5422
This commit is contained in:
Robert Sparks 2013-02-04 02:24:14 +00:00
parent 1cff6187f5
commit 8a7c5ac977
5 changed files with 217 additions and 2 deletions

View file

@ -305,7 +305,8 @@ class Document(DocumentInfo):
iesg_state_summary = iesg_state_summary + "::"+"::".join(tag.name for tag in iesg_substate)
if self.get_state_slug() == "rfc":
return "<a href=\"%s\">RFC %d</a>" % (urlreverse('doc_view', args=['rfc%d' % self.rfc_number]), self.rfc_number)
#return "<a href=\"%s\">RFC %d</a>" % (urlreverse('doc_view', args=['rfc%d' % int(self.rfc_number())]), int(self.rfc_number()))
return "RFC %d (%s)" % (int(self.rfc_number()), self.std_level)
elif self.get_state_slug() == "repl":
rs = self.replaced_by()
if rs:

View file

@ -44,6 +44,7 @@ urlpatterns = patterns('',
url(r'^rfc-status-changes/$', views_status_change.rfc_status_changes, name='rfc_status_changes'),
url(r'^start-rfc-status-change/(?P<name>[A-Za-z0-9._+-]*)$', views_status_change.start_rfc_status_change, name='start_rfc_status_change'),
url(r'^ad/(?P<name>[A-Za-z0-9.-]+)/$', views_search.by_ad, name="doc_search_by_ad"),
url(r'^ad2/(?P<name>[A-Za-z0-9.-]+)/$', views_search.by_ad2, name="doc_search_by_ad2"),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/((?P<rev>[0-9-]+)/)?$', views_doc.document_main, name="doc_view"),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/history/$', views_doc.document_history, name="doc_history"),

View file

@ -38,6 +38,7 @@ from django.template import RequestContext
from django.views.decorators.cache import cache_page
from ietf.idtracker.models import IDState, IESGLogin, IDSubState, Area, InternetDraft, Rfc, IDInternal, IETFWG
from ietf.idrfc.models import RfcIndex
from ietf.ipr.models import IprDraft
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponsePermanentRedirect
from ietf.idrfc.idrfc_wrapper import IdWrapper,RfcWrapper,IdRfcWrapper
from ietf.utils import normalize_draftname
@ -579,6 +580,129 @@ def by_ad(request, name):
results.sort(key=lambda obj: obj.view_sort_key_byad())
return render_to_response('idrfc/by_ad.html', {'form':form, 'docs':results,'meta':meta, 'ad_name':ad_name}, context_instance=RequestContext(request))
def ad_dashboard_group(doc):
if doc.type.slug=='draft':
if doc.get_state_slug('draft') == 'rfc':
return 'RFC'
elif doc.get_state_slug('draft') == 'active' and doc.get_state_slug('draft-iesg'):
return '%s Internet-Draft' % doc.get_state('draft-iesg').name
else:
return '%s Internet-Draft' % doc.get_state('draft').name
elif doc.type.slug=='conflrev':
if doc.get_state_slug('conflrev') in ('appr-reqnopub-sent','appr-noprob-sent'):
return 'Approved Conflict Review'
elif doc.get_state_slug('conflrev') in ('appr-reqnopub-pend','appr-noprob-pend','appr-reqnopub-pr','appr-noprob-pr'):
return "%s Conflict Review" % State.objects.get(type__slug='draft-iesg',slug='approved')
else:
return '%s Conflict Review' % doc.get_state('conflrev')
elif doc.type.slug=='statchg':
if doc.get_state_slug('statchg') in ('appr-sent',):
return 'Approved Status Change'
if doc.get_state_slug('statchg') in ('appr-pend','appr-pr'):
return '%s Status Change' % State.objects.get(type__slug='draft-iesg',slug='approved')
else:
return '%s Status Change' % doc.get_state('statchg')
elif doc.type.slug=='charter':
if doc.get_state_slug('charter') == 'approved':
return "Approved Charter"
else:
return '%s Charter' % doc.get_state('charter')
else:
return "Document"
def ad_dashboard_sort_key(doc):
if doc.type.slug=='draft' and doc.get_state_slug('draft') == 'rfc':
return "21%04d" % int(doc.rfc_number())
if doc.type.slug=='statchg' and doc.get_state_slug('statchg') == 'appr-sent':
return "22%d" % 0 # TODO - get the date of the transition into this state here
if doc.type.slug=='conflrev' and doc.get_state_slug('conflrev') in ('appr-reqnopub-sent','appr-noprob-sent'):
return "23%d" % 0 # TODO - get the date of the transition into this state here
if doc.type.slug=='charter' and doc.get_state_slug('charter') == 'approved':
return "24%d" % 0 # TODO - get the date of the transition into this state here
seed = ad_dashboard_group(doc)
if doc.type.slug=='conflrev' and doc.get_state_slug('conflrev') == 'adrev':
state = State.objects.get(type__slug='draft-iesg',slug='ad-eval')
return "1%d%s" % (state.order,seed)
if doc.type.slug=='charter':
if doc.get_state_slug('charter') in ('notrev','infrev'):
return "100%s" % seed
elif doc.get_state_slug('charter') == 'intrev':
state = State.objects.get(type__slug='draft-iesg',slug='ad-eval')
return "1%d%s" % (state.order,seed)
elif doc.get_state_slug('charter') == 'extrev':
state = State.objects.get(type__slug='draft-iesg',slug='lc')
return "1%d%s" % (state.order,seed)
elif doc.get_state_slug('charter') == 'iesgrev':
state = State.objects.get(type__slug='draft-iesg',slug='iesg-eva')
return "1%d%s" % (state.order,seed)
if seed.startswith('Needs Shepherd'):
return "100%s" % seed
if seed.endswith(' Document'):
seed = seed[:-9]
elif seed.endswith(' Internet-Draft'):
seed = seed[:-15]
elif seed.endswith(' Conflict Review'):
seed = seed[:-16]
elif seed.endswith(' Status Change'):
seed = seed[:-14]
state = State.objects.filter(type__slug='draft-iesg',name=seed)
if state:
ageseconds = 0
changetime= doc.latest_event(type='changed_document')
if changetime:
ageseconds = (datetime.datetime.now()-doc.latest_event(type='changed_document').time).total_seconds()
return "1%d%s%010d" % (state[0].order,seed,ageseconds)
return "3%s" % seed
def by_ad2(request, name):
responsible = Document.objects.values_list('ad', flat=True).distinct()
for p in Person.objects.filter(Q(role__name__in=("pre-ad", "ad"),
role__group__type="area",
role__group__state="active")
| Q(pk__in=responsible)).distinct():
if name == p.full_name_as_key():
ad_id = p.id
ad_name = p.plain_name()
break
docqueryset = Document.objects.filter(ad__id=ad_id)
docs=[]
for doc in docqueryset:
doc.ad_dashboard_sort_key = ad_dashboard_sort_key(doc)
doc.ad_dashboard_group = ad_dashboard_group(doc)
if doc.get_state_slug() == 'rfc':
doc.display_date = doc.latest_event(type='published_rfc').time
else:
revision = doc.latest_event(type='new_revision')
if revision:
doc.display_date = revision.time
# This might be better handled as something Documents know about themselves
now = datetime.datetime.now()
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)
if doc.get_state_slug('draft') == 'rfc':
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') ] )
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') ] )
doc.has_errata = bool(doc.tags.filter(slug="errata"))
else:
s = doc.get_state("draft-rfceditor")
if s:
# extract possible extra annotations
tags = doc.tags.filter(slug__in=("iana", "ref"))
doc.rfc_editor_state = "*".join([s.name] + [t.slug.upper() for t in tags])
if doc.type.slug == 'draft':
doc.iprCount = IprDraft.objects.filter(document=doc, ipr__status__in=[1,3]).count()
doc.iprUrl = "/ipr/search?option=document_search&id_document_tag=%s" % doc.name
docs.append(doc)
docs.sort(key=ad_dashboard_sort_key)
return render_to_response('idrfc/by_ad2.html',{'docs':docs,'ad_name':ad_name}, context_instance=RequestContext(request))
@cache_page(15*60) # 15 minutes
def all(request):
if settings.USE_DB_REDESIGN_PROXY_CLASSES:

View file

@ -40,7 +40,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<li><a href="{% url account_index %}">{% if request.user.is_authenticated %}Manage Account{% else %}New Account{% endif %}</a></li>
{% if user|in_group:"Area_Director" %}
<li class="sect first">AD Dashboard</li>
<li><a href="{% url doc_search_by_ad name=user.get_profile.person.full_name_as_key %}">My Documents</a></li>
<li><a href="{% url doc_search_by_ad name=user.get_profile.person.full_name_as_key %}">My Documents (old)</a></li>
<li><a href="{% url doc_search_by_ad2 name=user.get_profile.person.full_name_as_key %}">My Documents (new)</a></li>
<li><a href="{% url ietf.iesg.views.agenda_documents %}">Next Telechat</a></li>
<li><a href="{% url ietf.iesg.views.discusses %}">Discusses</a></li>
<li><a href="{% url ietf.iesg.views.working_group_actions %}">Working Groups</a></li>

View file

@ -0,0 +1,88 @@
{% extends "base.html" %}
{% load ietf_filters %}
{% load ietf_streams_redesign %}
{% load ballot_icon_redesign %}
{% block title %}Documents for {{ ad_name }}{% endblock %}
{% block content %}
<h1>Documents for {{ ad_name }}</h1>
{% regroup docs by ad_dashboard_group as grouped_docs %}
<table class="ietf-table ietf-doctable">
<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>
{% for doc_group in grouped_docs %}
<tr class="header"><td colspan="7">{{doc_group.grouper}}s</td></tr>
{% for doc in doc_group.list %}
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
<td class="doc">
{#{{doc.ad_dashboard_sort_key}}<br/>#}
{% if doc.get_state_slug == 'rfc' %}
{{ doc.canonical_name|upper|rfcspace|urlize_ietf_docs }}<br/>{{ doc.name|urlize_ietf_docs }}
{% else %}
{{ doc.name|urlize_ietf_docs }}
{% endif %}
</td>
<td class="title">{{ doc.title }}</td>
<td class="date">
{% if doc.display_date %}
{% if doc.get_state_slug == 'rfc' %}
{{ doc.display_date|date:"Y-m"}}
{% else %}
{{ doc.display_date|date:"Y-m-d" }}
{% endif %}
{% if doc.display_date|timesince_days|new_enough:request %}
<br/><span class="ietf-small ietf-highlight-y">
{% if not doc.type.slug == 'draft' or doc.get_state_slug == 'rfc' %}
new
{% else %}
<a href="http:{{rfcdiff_prefix}}?url2={{doc.filename_with_rev}}">new</a>
{% endif %}
</span>
{% endif %}
{% if doc.can_expire and doc.expires and doc.expires|timesince_days|expires_soon:request %}
<br/><span class="ietf-small ietf-highlight-y">expires soon</span>
{%endif%}
{% endif %}
</td>
<td class="status">
{{ doc.friendly_state|safe }} {% if not doc.get_state_slug == 'rfc' %}{{ doc|state_age_colored|safe }}{% endif %}
{% if doc.on_upcoming_agenda %}<br/>IESG Telechat: {{ doc.telechat_date }}{% endif %}
{% if doc.get_state_slug == 'rfc' %}
{% if doc.obsoleted_by %}<br />Obsoleted by {{ doc.obsoleted_by|urlize_ietf_docs }}{%endif %}
{% if doc.updated_by %}<br />Updated by {{ doc.updated_by|urlize_ietf_docs }}{%endif %}
{% if doc.has_errata %}<br /><a href="http://www.rfc-editor.org/errata_search.php?rfc={{doc.rfc_number}}" rel="nofollow">Errata</a>{% endif %}
{% else %}{# not rfc #}
{% 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 %}
{% stream_state doc %}
{% endif %}
</td>
<td class="ballot">
{% ballot_icon doc %}
</td>
<td class="ipr">
{% if doc.iprCount %}<a href="{{ doc.iprUrl }}" rel="nofollow"> {{ doc.iprCount }} </a>{% endif %}
</td>
{% comment %}
{% include "idrfc/ipr_column.html" %}
{% endcomment %}
</tr>
{% endfor %}
{% endfor %}
</table>
{% endblock content %}