Bug fixes, changes based on feedback from RjS. Abandon, recharter and initial charter views. Forward snapshots for abandoned efforts.

- Legacy-Id: 3421
This commit is contained in:
Martin Qvist 2011-09-15 12:28:08 +00:00
parent ebafa58c21
commit f025993f50
16 changed files with 191 additions and 316 deletions

View file

@ -154,75 +154,6 @@ if settings.USE_DB_REDESIGN_PROXY_CLASSES:
def dehtmlify_textarea_text(s):
return s.replace("<br>", "\n").replace("<b>", "").replace("</b>", "").replace(" ", " ")
class EditInfoForm(forms.Form):
intended_status = forms.ModelChoiceField(IDIntendedStatus.objects.all(), empty_label=None, required=True)
status_date = forms.DateField(required=False, help_text="Format is YYYY-MM-DD")
area_acronym = forms.ModelChoiceField(Area.active_areas(), required=True, empty_label='None Selected')
via_rfc_editor = forms.BooleanField(required=False, label="Via IRTF or RFC Editor")
job_owner = forms.ModelChoiceField(IESGLogin.objects.filter(user_level__in=(IESGLogin.AD_LEVEL, IESGLogin.INACTIVE_AD_LEVEL)).order_by('user_level', 'last_name'), label="Responsible AD", empty_label=None, required=True)
create_in_state = forms.ModelChoiceField(IDState.objects.filter(document_state_id__in=(IDState.PUBLICATION_REQUESTED, IDState.AD_WATCHING)), empty_label=None, required=True)
state_change_notice_to = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False)
telechat_date = forms.TypedChoiceField(coerce=lambda x: datetime.datetime.strptime(x, '%Y-%m-%d').date(), empty_value=None, required=False)
returning_item = forms.BooleanField(required=False)
def __init__(self, *args, **kwargs):
old_ads = kwargs.pop('old_ads')
super(self.__class__, self).__init__(*args, **kwargs)
job_owners = IESGLogin.objects.in_bulk([t[0] for t in self.fields['job_owner'].choices])
choices = [("","None Selected"), ]
if old_ads:
# separate active ADs from inactive
separated = False
for t in self.fields['job_owner'].choices:
if job_owners[t[0]].user_level != IESGLogin.AD_LEVEL and not separated:
choices.append(("", "----------------"))
separated = True
choices.append(t)
self.fields['job_owner'].choices = choices
else:
# remove old ones
for t in self.fields['job_owner'].choices:
if job_owners[t[0]].user_level==IESGLogin.AD_LEVEL:
choices.append(t)
self.fields['job_owner'].choices = choices
# telechat choices
dates = TelechatDates.objects.all()[0].dates()
init = kwargs['initial']['telechat_date']
if init and init not in dates:
dates.insert(0, init)
choices = [("", "(not on agenda)")]
for d in dates:
choices.append((d, d.strftime("%Y-%m-%d")))
self.fields['telechat_date'].choices = choices
# if kwargs['initial']['area_acronym'] == Acronym.INDIVIDUAL_SUBMITTER:
# # default to "gen"
# kwargs['initial']['area_acronym'] = 1008
# returning item is rendered non-standard
self.standard_fields = [x for x in self.visible_fields() if x.name not in ('returning_item',)]
def clean_status_date(self):
d = self.cleaned_data['status_date']
if d:
if d < date.today():
raise forms.ValidationError("Date must not be in the past.")
if d >= date.today() + timedelta(days=365 * 2):
raise forms.ValidationError("Date must be within two years.")
return d
def clean_note(self):
# note is stored munged in the database
return self.cleaned_data['note'].replace('\n', '<br>').replace('\r', '').replace(' ', '&nbsp; ')
def get_initial_state_change_notice(doc):
# set change state notice to something sensible
receivers = []
@ -245,144 +176,11 @@ def get_initial_state_change_notice(doc):
def get_new_ballot_id():
return IDInternal.objects.aggregate(Max('ballot'))['ballot__max'] + 1
@group_required('Area_Director','Secretariat')
def edit_info(request, name):
"""Edit various Internet Draft attributes, notifying parties as
necessary and logging changes as document comments."""
doc = get_object_or_404(InternetDraft, filename=name)
if doc.status.status == "Expired":
raise Http404()
login = IESGLogin.objects.get(login_name=request.user.username)
new_document = False
if not doc.idinternal:
new_document = True
doc.idinternal = IDInternal(draft=doc,
rfc_flag=type(doc) == Rfc,
cur_state_id=IDState.PUBLICATION_REQUESTED,
prev_state_id=IDState.PUBLICATION_REQUESTED,
state_change_notice_to=get_initial_state_change_notice(doc),
primary_flag=1,
area_acronym_id=Acronym.INDIVIDUAL_SUBMITTER,
# would be better to use NULL to
# signify an empty ballot
ballot_id=get_new_ballot_id(),
via_rfc_editor = False,
)
if doc.idinternal.agenda:
initial_telechat_date = doc.idinternal.telechat_date
else:
initial_telechat_date = None
if request.method == 'POST':
form = EditInfoForm(request.POST,
old_ads=False,
initial=dict(telechat_date=initial_telechat_date,
area_acronym=doc.idinternal.area_acronym_id))
if form.is_valid():
changes = []
r = form.cleaned_data
entry = "%s has been changed to <b>%s</b> from <b>%s</b>"
if new_document:
doc.idinternal.cur_state_id=r['create_in_state'].document_state_id
doc.idinternal.prev_state_id=r['create_in_state'].document_state_id
# Django barfs in the diff below because these fields
# can't be NULL
doc.idinternal.job_owner = r['job_owner']
if 'area_acronym' in r:
doc.idinternal.area_acronym = r['area_acronym']
replaces = doc.replaces_set.all()
if replaces and replaces[0].idinternal:
c = "Earlier history may be found in the Comment Log for <a href=\"%s\">%s</a>" % (replaces[0], replaces[0].idinternal.get_absolute_url())
add_document_comment(request, doc, c)
orig_job_owner = doc.idinternal.job_owner
# update the attributes, keeping track of what we're doing
# coalesce some of the changes into one comment, mail them below
def diff(obj, attr, name):
v = getattr(obj, attr)
if r[attr] != v:
changes.append(entry % (name, r[attr], v))
setattr(obj, attr, r[attr])
diff(doc, 'intended_status', "Intended Status")
diff(doc.idinternal, 'status_date', "Status date")
if 'area_acronym' in r and r['area_acronym']:
diff(doc.idinternal, 'area_acronym', 'Area acronym')
diff(doc.idinternal, 'job_owner', 'Responsible AD')
diff(doc.idinternal, 'state_change_notice_to', "State Change Notice email list")
if changes and not new_document:
add_document_comment(request, doc, "<br>".join(changes))
# handle note (for some reason the old Perl code didn't
# include that in the changes)
if r['note'] != doc.idinternal.note:
if not r['note']:
if doc.idinternal.note:
add_document_comment(request, doc, "Note field has been cleared")
else:
if doc.idinternal.note:
add_document_comment(request, doc, "[Note]: changed to '%s'" % r['note'])
else:
add_document_comment(request, doc, "[Note]: '%s' added" % r['note'])
doc.idinternal.note = r['note']
update_telechat(request, doc.idinternal,
r['telechat_date'], r['returning_item'])
if in_group(request.user, 'Secretariat'):
doc.idinternal.via_rfc_editor = bool(r['via_rfc_editor'])
doc.idinternal.email_display = str(doc.idinternal.job_owner)
doc.idinternal.token_name = str(doc.idinternal.job_owner)
doc.idinternal.token_email = doc.idinternal.job_owner.person.email()[1]
doc.idinternal.mark_by = login
doc.idinternal.event_date = date.today()
if changes and not new_document:
email_owner(request, doc, orig_job_owner, login, "\n".join(changes))
if new_document:
add_document_comment(request, doc, "Draft added in state %s" % doc.idinternal.cur_state.state)
doc.idinternal.save()
doc.save()
return HttpResponseRedirect(doc.idinternal.get_absolute_url())
else:
init = dict(intended_status=doc.intended_status_id,
status_date=doc.idinternal.status_date,
area_acronym=doc.idinternal.area_acronym_id,
job_owner=doc.idinternal.job_owner_id,
state_change_notice_to=doc.idinternal.state_change_notice_to,
note=dehtmlify_textarea_text(doc.idinternal.note),
telechat_date=initial_telechat_date,
returning_item=doc.idinternal.returning_item,
)
form = EditInfoForm(old_ads=False, initial=init)
if not in_group(request.user, 'Secretariat'):
form.standard_fields = [x for x in form.standard_fields if x.name != "via_rfc_editor"]
return render_to_response('idrfc/edit_info.html',
dict(doc=doc,
form=form,
user=request.user,
login=login),
context_instance=RequestContext(request))
class EditInfoFormREDESIGN(forms.Form):
intended_std_level = forms.ModelChoiceField(IntendedStdLevelName.objects.all(), empty_label=None, required=True)
status_date = forms.DateField(required=False, help_text="Format is YYYY-MM-DD")
via_rfc_editor = forms.BooleanField(required=False, label="Via IRTF or RFC Editor")
ad = forms.ModelChoiceField(Person.objects.filter(email__role__name__in=("ad", "ex-ad")).order_by('email__role__name', 'name'), label="Responsible AD", empty_label=None, required=True)
ad = forms.ModelChoiceField(Person.objects.filter(email__role__name="ad", email__role__group__state="active").order_by('name'), label="Responsible AD", empty_label=None, required=True)
create_in_state = forms.ModelChoiceField(IesgDocStateName.objects.filter(slug__in=("pub-req", "watching")), empty_label=None, required=True)
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False)
@ -390,22 +188,13 @@ class EditInfoFormREDESIGN(forms.Form):
returning_item = forms.BooleanField(required=False)
def __init__(self, *args, **kwargs):
old_ads = kwargs.pop('old_ads')
super(self.__class__, self).__init__(*args, **kwargs)
# fix up ad field
# if previous AD is now ex-AD, append that person to the list
ad_pk = self.initial.get('ad')
choices = self.fields['ad'].choices
ex_ads = dict((e.pk, e) for e in Person.objects.filter(email__role__name="ex-ad").distinct())
if old_ads:
# separate active ADs from inactive
for i, t in enumerate(choices):
if t[0] in ex_ads:
choices.insert(i, ("", "----------------"))
break
else:
# remove old ones
self.fields['ad'].choices = [t for t in choices if t[0] not in ex_ads]
if ad_pk and ad_pk not in [pk for pk, name in choices]:
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).name)]
# telechat choices
dates = TelechatDates.objects.all()[0].dates()
@ -473,8 +262,8 @@ def edit_infoREDESIGN(request, name):
if request.method == 'POST':
form = EditInfoForm(request.POST,
old_ads=False,
initial=dict(telechat_date=initial_telechat_date))
initial=dict(ad=doc.ad_id,
telechat_date=initial_telechat_date))
if form.is_valid():
save_document_in_history(doc)
@ -539,6 +328,7 @@ def edit_infoREDESIGN(request, name):
for c in changes:
e = DocEvent(doc=doc, by=login)
e.desc = c
e.type = "changed_document"
e.save()
@ -550,8 +340,8 @@ def edit_infoREDESIGN(request, name):
if r["status_date"] != status_date:
e = StatusDateDocEvent(doc=doc, by=login)
e.type ="changed_status_date"
d = desc("Status date", r["status_date"], status_date)
changes.append(d)
e.desc = desc("Status date", r["status_date"], status_date)
changes.append(e.desc)
e.date = r["status_date"]
e.save()
@ -572,16 +362,16 @@ def edit_infoREDESIGN(request, name):
else:
e = doc.latest_event(StatusDateDocEvent)
status = e.date if e else None
init = dict(intended_std_level=doc.intended_std_level,
init = dict(intended_std_level=doc.intended_std_level_id,
status_date=status,
ad=doc.ad,
ad=doc.ad_id,
notify=doc.notify,
note=dehtmlify_textarea_text(doc.note),
telechat_date=initial_telechat_date,
returning_item=initial_returning_item,
)
form = EditInfoForm(old_ads=False, initial=init)
form = EditInfoForm(initial=init)
if not has_role(request.user, 'Secretariat'):
# filter out Via RFC Editor

View file

@ -1,6 +1,20 @@
{% extends "base.html" %}
{% block title %}Change state of WG {{ wg.acronym }}{% endblock %}
{% block title %}
{% ifequal option "initcharter" %}
Initiate chartering of WG {{ wg.acronym }}
{% else %}
{% ifequal option "recharter" %}
Recharter WG {{ wg.acronym }}
{% else %}
{% ifequal option "abandon" %}
Abandon effort on WG {{ wg.acronym }}
{% else %}
Change state of WG {{ wg.acronym }}
{% endifequal %}
{% endifequal %}
{% endifequal %}
{% endblock %}
{% block morecss %}
form.change-state select {
@ -19,22 +33,49 @@ form.change-state .actions {
{% endblock %}
{% block content %}
<h1>Change state of {{ wg.acronym }}</h1>
<h1>{% ifequal option "initcharter" %}
Initiate chartering of WG {{ wg.acronym }}
{% else %}
{% ifequal option "recharter" %}
Recharter WG {{ wg.acronym }}
{% else %}
{% ifequal option "abandon" %}
Abandon effort on WG {{ wg.acronym }}
{% else %}
Change state of WG {{ wg.acronym }}
{% endifequal %}
{% endifequal %}
{% endifequal %}
</h1>
<p class="helptext">For help on the states, see the <a href="{% url help_charter_states %}">state table</a>.</p>
{% ifnotequal option "initcharter" %}{% ifnotequal option "recharter" %}{% ifnotequal option "abandon" %}<p class="helptext">For help on the states, see the <a href="{% url help_charter_states %}">state table</a>.</p>{% endifnotequal %}{% endifnotequal %}{% endifnotequal %}
<form class="change-state" action="" method="post">
<table>
{% for field in form.visible_fields %}
<tr>
<th>{{ field.label_tag }}:</th>
<td>{{ field }}
{% ifequal field.name "initial_time" %}
{% ifequal option "recharter" %}
<th>{{ field.label_tag }}:</th>
<td>{{ field }}
{% if field.help_text %}<div class="help">{{ field.help_text }}</div>{% endif %}
{% else %}
{% ifequal option "initcharter" %}
<th>{{ field.label_tag }}:</th>
<td>{{ field }}
{% if field.help_text %}<div class="help">{{ field.help_text }}</div>{% endif %}
{% endifequal %}
{% endifequal %}
{% else %}
<th>{{ field.label_tag }}:</th>
<td>{{ field }}
{% if field.help_text %}<div class="help">{{ field.help_text }}</div>{% endif %}
{% endifequal %}
{% ifequal field.name "charter_state" %}
{% ifequal field.errors "warning" %}
<ul><li>The initial review time hasn't elapsed. Proceed anyway? <label><input type="checkbox" name="confirm_state" /></label></li></ul>
<ul><li>The initial review time hasn't elapsed. Select this checkbox to proceed anyway: <label><input type="checkbox" name="confirm_state" /></label></li></ul>
{% endifequal %}
{% endifequal %}
{% if field.help_text %}<div class="help">{{ field.help_text }}</div>{% endif %}
{% ifnotequal field.name "charter_state" %}
{{ field.errors }}
{% endifnotequal %}
@ -43,8 +84,12 @@ form.change-state .actions {
{% endfor %}
<tr>
<td colspan="2" class="actions">
{% if option %}
<input type="submit" value="Submit"/>
{% else %}
<a href="{% url wg_view_record name=wg.acronym %}">Back</a>
<input type="submit" value="Save"/>
{% endif %}
</td>
</tr>
</table>

View file

@ -69,8 +69,10 @@ Create WG record
<td class="actions">
{% if wg %}
<a href="{% url wg_view_record name=wg.acronym %}">Back</a>
<input type="submit" value="Save"/>
{% else %}
<input type="submit" value="Create"/>
{% endif %}
<input type="submit" value="Save"/>
</td>
</tr>
</table>

View file

@ -21,7 +21,19 @@ Copyright The IETF Trust 2011, All Rights Reserved
{% if user|in_group:"Area_Director,Secretariat" %}
{% if not snapshot %}
<div style="padding-bottom:2px;">
{% ifnotequal wg.charter.charter_state_id "notrev" %}
{% ifnotequal wg.charter.charter_state_id "approved" %}
<span id="wg_edit_state_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_startstop_process name=wg.acronym option='abandon' %}">Abandon effort</a></span></span>
<span id="wg_edit_state_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_change_state name=wg.acronym %}">Change state</a></span></span>
{% ifnotequal wg.state_id "conclude" %}
<span id="wg_edit_info_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_submit name=wg.acronym %}">Edit charter</a></span></span>
{% endifnotequal %}
{% else %}
<span id="wg_edit_state_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_startstop_process name=wg.acronym option='recharter' %}">Recharter</a></span></span>
{% endifnotequal %}
{% else %}
<span id="wg_edit_state_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_startstop_process name=wg.acronym option='recharter' %}">Recharter</a></span></span>
{% endifnotequal %}
{% ifequal wg.state_id "active" %}{% ifequal wg.charter.charter_state_id "approved" %}
<span id="wg_conclude_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_conclude name=wg.acronym %}">Conclude WG</a></span></span>
@ -31,9 +43,7 @@ Copyright The IETF Trust 2011, All Rights Reserved
<span id="wg_edit_info_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_edit_info name=wg.acronym %}">Edit WG</a></span></span>
{% endifnotequal %}
{% ifnotequal wg.state_id "conclude" %}
<span id="wg_edit_info_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url wg_submit name=wg.acronym %}">Edit charter</a></span></span>
{% endifnotequal %}
</div>
{% endif %}{# if not snapshot #}
{% endif %}{# if user in group #}

View file

@ -7,7 +7,7 @@ Copyright The IETF Trust 2011, All Rights Reserved
{% load ietf_filters %}
{% block record_revision %}
Snapshots: {% if not snapshot %}<strong>{% else %}<a href="{% url wg_view_record name=wg.acronym %}">{% endif %}current{% if not snapshot %}</strong>{% else %}</a>{% endif %} {% for d in versions reversed %}{% ifnotequal d.rev wg.charter.rev %}{% ifequal snapshot d.rev %}<strong>{% else %}<a href="{% url wg_view_record name=wg.acronym %}{{d.rev}}/">{% endifequal %}{{ d.rev }}{% ifequal snapshot d.rev %}</strong>{% else %}</a>{% endifequal %} {% endifnotequal %}{% endfor %}
Snapshots: {% for d in versions reversed %}{% ifequal active_rev d.rev %}<strong>{% endifequal %}{% ifequal rev d.rev %}{% else %}{% ifequal active_rev d.rev %}<a href="{% url wg_view_record name=wg.acronym %}">{% else %}<a href="{% url wg_view_record name=wg.acronym %}{{d.rev}}/">{% endifequal %}{% endifequal %}{{ d.rev }}{% ifequal rev d.rev %}{% else %}</a>{% endifequal %}{% ifequal active_rev d.rev %}</strong>{% endifequal %} {% endfor %}
{% endblock %}
{% block record_metatable %}

View file

@ -5,7 +5,14 @@ Copyright The IETF Trust 2011, All Rights Reserved
<form name="search_form" id="search_form" class="search_form" action="/wgrecord/search/" method="get">
<div class="search_field">
<label>Name:</label> {{ form.name }}
<label>Name/acronym:</label> {{ form.nameacronym }}
</div>
<div class="search_field">
<label>Types:</label>
<table id="search_types">
<tr><td>{{ form.inprocess }} WGs (in chartering process)</td></tr>
<tr><td>{{ form.active }} WGs (approved charter)</td></tr>
</table>
</div>
<span onclick="toggleAdvanced();"><b><img src="/images/{% if meta.advanced %}minus{% else %}plus{% endif %}.png" alt="" id="search_advanced-img" /> Advanced</b></span>
@ -13,9 +20,6 @@ Copyright The IETF Trust 2011, All Rights Reserved
<div id="search_advanced" style="{% if not meta.advanced %}display:none;{%endif%}margin-top:1em;">
Additional search criteria:
<div class="search_field">
<label><input type="radio" class="radio" name="by" value="acronym" {% ifequal meta.by "acronym" %}checked="checked"{% endifequal %} onclick="changeBy();"/> Acronym:</label> {{ form.acronym }}
</div>
<div class="search_field">
<label><input type="radio" class="radio" name="by" value="state" {% ifequal meta.by "state" %}checked="checked"{% endifequal %} onclick="changeBy();"/> State:</label> {{ form.state }} :: {{ form.charter_state }}
</div>
@ -49,8 +53,9 @@ function toggleSubmit() {
var button = document.getElementById("id_search_submit");
var by = findCheckedSearchBy();
var value = findSearchByValue(by);
var text = document.getElementById("id_name");
if ((value == "") && (text.value == "")) {
var active = document.getElementById("id_active");
var text = document.getElementById("id_nameacronym");
if ((value == "") && (text.value == "" && active.checked)) {
button.disabled = true;
} else {
button.disabled = false;
@ -90,7 +95,6 @@ function findCheckedSearchBy() {
}
function findSearchByValue(by) {
if (by == 'acronym') { return document.getElementById("id_acronym").value; }
if (by == 'state') {
// state might be wg state...
state_value = document.getElementById("id_state").value;
@ -108,13 +112,11 @@ function findSearchByValue(by) {
function changeBy() {
var by=findCheckedSearchBy();
var f = document.search_form;
f.acronym.disabled=true;
f.state.disabled=true; f.charter_state.disabled=true;
f.ad.disabled=true;
f.area.disabled=true;
f.anyfield.disabled=true;
f.eacronym.disabled=true;
if (by=='acronym') { f.acronym.disabled=false;}
if (by=='state') { f.state.disabled=false; f.charter_state.disabled=false;}
if (by=='ad') { f.ad.disabled=false; }
if (by=='area') { f.area.disabled=false;}

View file

@ -4,11 +4,11 @@ Copyright The IETF Trust 2011, All Rights Reserved
{% load ietf_filters ietf_streams %}{% load wg_ballot_icon %}
<td class="status">
{% if wg.charter %}
{{ wg.charter.charter_state|safe }}
{{ wg.charter.charter_state|safe }} {% ifequal wg.state_id "proposed" %}{% ifnotequal wg.charter.charter_state_id "notrev" %}(Initial Chartering){% endifnotequal %}{% else %}{% ifnotequal wg.charter.charter_state_id "approved" %}(Rechartering){% endifnotequal %}{% endifequal %}
{% else %}
(data missing)
{% endif %}
{% if not hide_telechat_date %}{% if doc.telechat_date %}<br/>IESG Telechat: {{ doc.telechat_date }}{% endif %}{% endif %}
{% if wg.charter.telechat_date %}<br/>IESG Telechat: {{ wg.charter.telechat_date }}{% endif %}
{% block extra_status %}{% endblock %}
</td>

View file

@ -13,8 +13,8 @@ urlpatterns = patterns('',
(r'^1wg-summary-by-acronym.txt', views.wg_summary_acronym),
(r'^1wg-charters.txt', views.wg_charters),
(r'^1wg-charters-by-acronym.txt', views.wg_charters_by_acronym),
(r'^(?P<acronym>[a-z0-9-]+)/documents/txt/$', views.wg_documents_txt),
(r'^(?P<acronym>[a-z0-9-]+)/$', views.wg_documents_html),
(r'^(?P<acronym>[a-z0-9-]+)/charter/$', views.wg_charter),
(r'^(?P<acronym>[a-zA-Z0-9-]+)/documents/txt/$', views.wg_documents_txt),
(r'^(?P<acronym>[a-zA-Z0-9-]+)/$', views.wg_documents_html),
(r'^(?P<acronym>[a-zA-Z0-9-]+)/charter/$', views.wg_charter),
(r'^(?P<acronym>[^/]+)/management/', include('ietf.wgchairs.urls')),
)

View file

@ -17,6 +17,7 @@ from redesign.person.models import Person
# These become part of the subject of the email
types = {}
types['state'] = "State changed"
types['state-notrev'] = "State changed to Not currently under review"
types['state-infrev'] = "State changed to Informal review"
types['state-intrev'] = "State changed to Internal review"
types['state-extrev'] = "State changed to External review"

View file

@ -17,6 +17,7 @@ urlpatterns += patterns('',
url(r'^(?P<name>[A-Za-z0-9._+-]+)/((?P<rev>[0-9][0-9](-[0-9][0-9])?)/)?((?P<tab>ballot|writeup|history)/)?$', views_rec.wg_main, name="wg_view_record"),
(r'^(?P<name>[A-Za-z0-9._+-]+)/_ballot.data$', views_rec.wg_ballot),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/state/$', views_edit.change_state, name='wg_change_state'),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/(?P<option>initcharter|recharter|abandon)/$', views_edit.change_state, name='wg_startstop_process'),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/info/$', views_edit.edit_info, name='wg_edit_info'),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/conclude/$', views_edit.conclude, name='wg_conclude'),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/addcomment/$', views_edit.add_comment, name='wg_add_comment'),

View file

@ -419,7 +419,7 @@ def approve_ballot(request, name):
destination.write(raw_content)
destination.close()
except IOError:
raise Http404
raise Http404("Charter text %s" % (filename))
charter.rev = next_approved_revision(charter.rev)
charter.save()

View file

@ -22,23 +22,30 @@ from group.models import Group, GroupEvent, GroupHistory, GroupURL, Role, RoleHi
from views_search import json_emails
class ChangeStateForm(forms.Form):
charter_state = forms.ModelChoiceField(CharterDocStateName.objects.all(), label="Charter state", empty_label=None, required=True)
state = forms.ModelChoiceField(GroupStateName.objects.filter(slug__in=["proposed", "active", "conclude"]), label="WG state", empty_label=None, required=True)
charter_state = forms.ModelChoiceField(CharterDocStateName.objects.all(), label="Charter state", empty_label=None, required=False)
confirm_state = forms.BooleanField(widget=forms.HiddenInput, required=False, initial=True)
initial_time = forms.IntegerField(initial=1, label="Review time", help_text="(in weeks)", required=False)
message = forms.CharField(widget=forms.Textarea, help_text="Message the the secretariat", required=False)
initial_time = forms.IntegerField(initial=0, label="Review time", help_text="(in weeks)", required=False)
message = forms.CharField(widget=forms.Textarea, help_text="Message to the secretariat", required=False)
comment = forms.CharField(widget=forms.Textarea, help_text="Comment for the WG history", required=False)
def __init__(self, *args, **kwargs):
if 'queryset' in kwargs:
qs = kwargs.pop('queryset')
else:
qs = None
if 'hide' in kwargs:
self.hide = kwargs.pop('hide')
else:
self.hide = None
super(ChangeStateForm, self).__init__(*args, **kwargs)
if qs:
self.fields['charter_state'].queryset = qs
# hide requested fields
if self.hide:
for f in self.hide:
self.fields[f].widget = forms.HiddenInput
@group_required('Area_Director','Secretariat')
def change_state(request, name):
def change_state(request, name, option=None):
"""Change state of WG and charter, notifying parties as necessary
and logging the change as a comment."""
# Get WG by acronym, redirecting if there's a newer acronym
@ -59,11 +66,19 @@ def change_state(request, name):
if request.method == 'POST':
form = ChangeStateForm(request.POST)
if form.is_valid():
if charter.charter_state_id == "infrev" and initial_review and form.cleaned_data['charter_state'].slug != "infrev" and initial_review.expires > datetime.now() and not form.cleaned_data['confirm_state']:
if initial_review and form.cleaned_data['charter_state'] and form.cleaned_data['charter_state'].slug != "infrev" and initial_review.expires > datetime.now() and not form.cleaned_data['confirm_state']:
form._errors['charter_state'] = "warning"
else:
state = form.cleaned_data['state']
charter_state = form.cleaned_data['charter_state']
if option == "initcharter" or option == "recharter":
charter_state=CharterDocStateName.objects.get(slug="infrev")
elif option == "abandon":
if wg.state_id == "proposed":
charter_state = CharterDocStateName.objects.get(slug="notrev")
else:
charter_state = CharterDocStateName.objects.get(slug="approved")
else:
charter_state = form.cleaned_data['charter_state']
comment = form.cleaned_data['comment']
message = form.cleaned_data['message']
@ -87,17 +102,6 @@ def change_state(request, name):
# This is an error
raise Http404
if state != wg.state:
# WG state changed
change = True
save_group_in_history(wg)
prev = wg.state
wg.state = state
ge = log_group_state_changed(request, wg, login, comment)
wg.save()
if change:
if charter:
messages = {}
@ -108,7 +112,7 @@ def change_state(request, name):
if charter.charter_state_id == "extrev":
email_secretariat(request, wg, "state-%s" % charter.charter_state_id, messages['extrev'])
if form.cleaned_data["charter_state"].slug == "infrev":
if charter_state.slug == "infrev":
e = DocEvent()
e.type = "started_iesg_process"
e.by = login
@ -116,7 +120,7 @@ def change_state(request, name):
e.desc = "IESG process started in state <b>%s</b>" % charter.charter_state.name
e.save()
if form.cleaned_data["charter_state"].slug == "infrev" and form.cleaned_data["initial_time"] and form.cleaned_data["initial_time"] != 0:
if charter_state.slug == "infrev" and form.cleaned_data["initial_time"] and form.cleaned_data["initial_time"] != 0:
e = InitialReviewDocEvent()
e.type = "initial_review"
e.by = login
@ -127,17 +131,22 @@ def change_state(request, name):
return redirect('wg_view_record', name=wg.acronym)
else:
if wg.state_id != "proposed":
states = CharterDocStateName.objects.filter(slug__in=["infrev", "intrev", "extrev", "iesgrev", "approved"])
form = ChangeStateForm(queryset=states, initial=dict(charter_state=charter.charter_state_id, state=wg.state_id))
if option == "recharter":
hide = ['charter_state']
init = dict(initial_time=1, message="%s has initiated a recharter effort on the WG %s (%s)" % (login.name, wg.name, wg.acronym))
elif option == "initcharter":
hide = ['charter_state']
init = dict(initial_time=1, message="%s has initiated chartering of the proposed WG %s (%s)" % (login.name, wg.name, wg.acronym))
elif option == "abandon":
hide = ['initial_time', 'charter_state']
init = dict(message="%s has abandoned the chartering effort on the WG %s (%s)" % (login.name, wg.name, wg.acronym))
else:
form = ChangeStateForm(initial=dict(charter_state=charter.charter_state_id, state=wg.state_id))
hide = ['initial_time']
init = dict(charter_state=wg.charter.charter_state_id, state=wg.state_id)
states = CharterDocStateName.objects.filter(slug__in=["infrev", "intrev", "extrev", "iesgrev"])
form = ChangeStateForm(queryset=states, hide=hide, initial=init)
group_hists = GroupHistory.objects.filter(group=wg).exclude(state=wg.state).order_by("-time")[:1]
if group_hists:
prev_state = group_hists[0].state
else:
prev_state = None
if charter:
charter_hists = DocHistory.objects.filter(doc__name=charter.name).exclude(charter_state=charter.charter_state).order_by("-time")[:1]
if charter_hists:
@ -151,7 +160,7 @@ def change_state(request, name):
dict(form=form,
wg=wg,
login=login,
prev_state=prev_state,
option=option,
prev_charter_state=prev_charter_state),
context_instance=RequestContext(request))
@ -167,7 +176,6 @@ class EditInfoForm(forms.Form):
list_subscribe = forms.CharField(max_length=255, required=False)
list_archive = forms.CharField(max_length=255, required=False)
urls = forms.CharField(widget=forms.Textarea, label="Additional URLs", help_text="Format: http://site/url (optional description). Separate by newline.", required=False)
comments = forms.CharField(widget=forms.Textarea, label="Reason for chartering", required=False)
telechat_date = forms.TypedChoiceField(coerce=lambda x: datetime.strptime(x, '%Y-%m-%d').date(), empty_value=None, required=False)
def __init__(self, *args, **kwargs):
@ -318,7 +326,6 @@ def edit_info(request, name=None):
diff('list_email', "Mailing list email")
diff('list_subscribe', "Mailing list subscribe address")
diff('list_archive', "Mailing list archive")
diff('comments', "Comment")
def get_sorted_string(attr, splitter):
if splitter == '\n':
@ -377,7 +384,7 @@ def edit_info(request, name=None):
wg.save()
if new_wg:
return redirect('wg_change_state', name=wg.acronym)
return redirect('wg_startstop_process', name=wg.acronym, option="initcharter")
else:
return redirect('wg_view_record', name=wg.acronym)
else: # form.is_valid()
@ -394,7 +401,6 @@ def edit_info(request, name=None):
list_subscribe=wg.list_subscribe if wg.list_subscribe else None,
list_archive=wg.list_archive if wg.list_archive else None,
urls=format_urls(wg.groupurl_set.all()),
comments=wg.comments if wg.comments else None,
telechat_date=initial_telechat_date,
)
hide = None
@ -428,6 +434,18 @@ def conclude(request, name):
login = request.user.get_profile()
# if state != wg.state:
# # WG state changed
# change = True
# save_group_in_history(wg)
# prev = wg.state
# wg.state = state
# ge = log_group_state_changed(request, wg, login, comment)
# wg.save()
if request.method == 'POST':
form = ConcludeForm(request.POST)
if form.is_valid():

View file

@ -27,7 +27,7 @@ def _get_html(key, filename):
f = open(filename, 'rb')
raw_content = f.read()
except IOError:
return ("Error; cannot read ("+key+")", "")
return "Error; cannot read ("+key+")"
finally:
if f:
f.close()
@ -50,13 +50,19 @@ def wg_main(request, name, rev, tab):
if not wg.charter:
set_or_create_charter(wg)
if wg.charter.charter_state_id == "approved":
active_rev = approved_revision(wg.charter.rev)
else:
active_rev = wg.charter.rev
if rev != None:
ch = get_charter_for_revision(wg.charter, rev)
gh = get_group_for_revision(wg, rev)
else:
ch = get_charter_for_revision(wg.charter, wg.charter.rev)
ch = get_charter_for_revision(wg.charter, active_rev)
gh = get_group_for_revision(wg, wg.charter.rev)
info = {}
info['prev_acronyms'] = list(set([x.acronym for x in wg.history_set.exclude(acronym=wg.acronym)]))
@ -80,7 +86,7 @@ def wg_main(request, name, rev, tab):
if ch:
file_path = wg.charter.get_file_path() # Get from wg.charter
content = _get_html(
"charter-ietf-"+str(gh.acronym)+"-"+str(ch.rev)+",html",
"charter-ietf-"+str(gh.acronym)+"-"+str(ch.rev)+".txt",
os.path.join(file_path, "charter-ietf-"+gh.acronym+"-"+ch.rev+".txt"))
active_ads = list(Person.objects.filter(email__role__name="ad",
email__role__group__type="area",
@ -123,6 +129,7 @@ def wg_main(request, name, rev, tab):
{'content':content,
'charter':ch, 'info':info, 'wg':wg, 'tab':tab,
'rev': rev if rev else ch.rev, 'gh': gh,
'active_rev': active_rev,
'snapshot': rev, 'charter_text_url': charter_text_url,
'history': history, 'versions': versions,
},
@ -187,7 +194,7 @@ def _get_versions(charter, include_replaced=True):
g = get_group_for_revision(charter.chartered_group, r)
if d.rev != charter.rev:
ov.append({"name": "charter-ietf-%s" % g.acronym, "rev":d.rev, "date":d.time})
if charter.rev != "":
if charter.rev != "" and (not ov or ov[-1]['rev'] != charter.rev):
d = get_charter_for_revision(charter, charter.rev)
g = get_group_for_revision(charter.chartered_group, charter.rev)
ov.append({"name": "charter-ietf-%s" % g.acronym, "rev": d.rev, "date":d.time})

View file

@ -15,10 +15,12 @@ from django.conf import settings
from django.utils import simplejson
class SearchForm(forms.Form):
name = forms.CharField(required=False)
nameacronym = forms.CharField(required=False)
inprocess = forms.BooleanField(required=False,initial=True)
active = forms.BooleanField(required=False,initial=False)
by = forms.ChoiceField(choices=[(x,x) for x in ('acronym','state','ad','area','anyfield', 'eacronym')], required=False, initial='wg', label='Foobar')
acronym = forms.CharField(required=False)
state = forms.ModelChoiceField(GroupStateName.objects.all(), label="WG state", empty_label="any state", required=False)
charter_state = forms.ModelChoiceField(CharterDocStateName.objects.all(), label="Charter state", empty_label="any state", required=False)
ad = forms.ChoiceField(choices=(), required=False)
@ -40,19 +42,19 @@ class SearchForm(forms.Form):
self.fields['ad'].choices = c = [('', 'any AD')] + [(ad.pk, ad.name) for ad in active_ads] + [('', '------------------')] + [(ad.pk, ad.name) for ad in inactive_ads]
def clean_name(self):
value = self.cleaned_data.get('name','')
def clean_nameacronym(self):
value = self.cleaned_data.get('nameacronym','')
return value
def clean(self):
q = self.cleaned_data
# Reset query['by'] if needed
for k in ('acronym', 'ad', 'area', 'anyfield', 'eacronym'):
for k in ('ad', 'area', 'anyfield', 'eacronym'):
if (q['by'] == k) and not q[k]:
q['by'] = None
if (q['by'] == 'state') and not (q['state'] or q['charter_state']):
q['by'] = None
# Reset other fields
for k in ('acronym', 'ad', 'area', 'anyfield', 'eacronym'):
for k in ('ad', 'area', 'anyfield', 'eacronym'):
if q['by'] != k:
self.data[k] = ""
q[k] = ""
@ -68,7 +70,7 @@ def search_query(query_original, sort_by=None):
# Non-ASCII strings don't match anything; this check
# is currently needed to avoid complaints from MySQL.
for k in ['name','acronym','anyfield','eacronym']:
for k in ['nameacronym','anyfield','eacronym']:
try:
tmp = str(query.get(k, ''))
except:
@ -78,18 +80,25 @@ def search_query(query_original, sort_by=None):
MAX = 500
maxReached = False
results = Group.objects.filter(type="wg")
if query["inprocess"]:
if query["active"]:
results = Group.objects.filter(type="wg")
else:
results = Group.objects.filter(type="wg").exclude(charter__charter_state__slug="approved")
else:
if query["active"]:
results = Group.objects.filter(type="wg", charter__charter_state__slug="approved")
else:
raise Http404 # Empty, prevented by js
prefix = ""
q_objs = []
# name
if query["name"]:
results = results.filter(name__icontains=query["name"])
if query["nameacronym"]:
results = results.filter(Q(name__icontains=query["nameacronym"]) | Q(acronym__icontains=query["nameacronym"]))
# radio choices
by = query["by"]
if by == "acronym":
results = results.filter(acronym__icontains=query["acronym"])
elif by == "state":
if by == "state":
q_objs = []
if query['state']:
q_objs.append(Q(state=query['state']))
@ -102,7 +111,6 @@ def search_query(query_original, sort_by=None):
results = results.filter(parent=query["area"])
elif by == "anyfield":
q_obj = Q()
q_obj |= Q(acronym__icontains=query['anyfield'])
q_obj |= Q(state__name__icontains=query['anyfield'])
q_obj |= Q(charter__charter_state__name__icontains=query['anyfield'])
q_obj |= Q(ad__name__icontains=query['anyfield'])

View file

@ -122,6 +122,11 @@ class Document(DocumentInfo):
e = model.objects.filter(doc=self).filter(**filter_args).order_by('-time', '-id')[:1]
return e[0] if e else None
def telechat_date(self):
e = self.latest_event(TelechatDocEvent, type="scheduled_for_telechat")
if e and "Removed" not in e.desc:
return e.telechat_date
def canonical_name(self):
name = self.name
if self.type_id == "draft" and self.state_id == "rfc":

View file

@ -1,26 +1,12 @@
jQuery(document).ready(function () {
var initial_time = jQuery("#id_initial_time").parent().parent()
if (jQuery("#id_charter_state").val() != "infrev") {
initial_time.hide()
}
function setMessageDraft(state) {
if (jQuery("#id_state").val() == "conclude") {
jQuery("#id_message").val("");
initial_time.hide();
} else {
if (message[state]) {
if (state == "infrev") {
initial_time.show();
jQuery("#id_initial_time").val(1);
} else {
initial_time.hide();
jQuery("#id_initial_time").val(0);
}
jQuery("#id_message").val(message[state]);
} else {
jQuery("#id_message").val("");
initial_time.hide();
}
}
}