Included MAX_WG_DELEGATES into settings.py

Some minor textual changes in templates.
Fixes #605
 - Legacy-Id: 2874
This commit is contained in:
Emilio A. Sánchez López 2011-03-03 11:35:10 +00:00
parent 53ad5be094
commit 7e8d51e405
8 changed files with 30 additions and 20 deletions

View file

@ -155,6 +155,9 @@ SERVER_MODE = 'development'
# The name of the method to use to invoke the test suite
TEST_RUNNER = 'ietf.utils.test_runner.run_tests'
# WG Chair configuration
MAX_WG_DELEGATES = 5
# Override this in settings_local.py if needed
# *_PATH variables ends with a slash/ .
INTERNET_DRAFT_PATH = '/a/www/ietf-ftp/internet-drafts/'

View file

@ -7,7 +7,14 @@
<div class="wg-chair-management">
<h2>Manage delegates</h2>
<p><strong>Please,</strong> rembember that you only can assign a maximum of three delegates.</p>
<p>
Sometimes, a WG has one (or more) WG Secretaries, in addition to the WG Chairs.
This page lets the WG Chairs delegate the authority to do updates to the WG state of WG documents in the datatracker.
</p>
<p>
You may at most delegate the datatracker update rights to {{ max_delegates }} persons at any given time.
</p>
<table style="width: 100%;">
<tr style="vertical-align: top;"><td>
@ -43,7 +50,7 @@ No delegates
</p>
</form>
{% else %}
You can only assign three delegates. Please remove delegates to add a new one.
You can only assign {{ max_delegates }} delegates. Please remove delegates to add a new one.
{% endif %}
</td></tr>
</table>

View file

@ -43,12 +43,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% block wg_content %}
<h2>Documets by its shepherd</h2>
<h2>Documents by its shepherd</h2>
<div id="mytabs" class="yui-navset">
<ul class="yui-nav">
<li class="selected"><a href="#noshepherd"><em>Without shepherd</em></a></li>
<li><a href="#mydocs"><em>I Shepherd</em></a></li>
<li><a href="#othershepherds"><em>Other shepherds</em></a></li>
<li><a href="#mydocs"><em>Shepherded by me</em></a></li>
<li><a href="#othershepherds"><em>Shepherded by others</em></a></li>
</ul>
<div class="yui-content">

View file

@ -8,9 +8,9 @@
{% if can_manage_delegates %}
{% ifequal selected "manage_delegates" %}
<span class="selected">Manage delegates</span>
<span class="selected">Manage delegations</span>
{% else %}
<a href="{% url manage_delegates wg.group_acronym.acronym %}">Manage delegates</a>
<a href="{% url manage_delegates wg.group_acronym.acronym %}">Manage delegations</a>
{% endifequal %} |
{% endif %}

View file

@ -71,7 +71,7 @@ def can_manage_writeup_of_a_document_no_state(user, document):
return False
group = document.group.ietfwg
return (is_group_chair(person, group) or
is_areadirector_for_group(person, group) or
is_area_director_for_group(person, group) or
is_group_delegate(person, group))
@ -79,6 +79,5 @@ def can_manage_writeup_of_a_document(user, document):
person = get_person_for_user(user)
if not person or not document.group:
return False
group = document.group.ietfwg
return (can_manage_writeup_of_a_document_no_state(user, document) or
is_document_shepherd(person, doc))
is_document_shepherd(person, document))

View file

@ -1,5 +1,4 @@
from django import forms
from django.db.models import Q
from django.conf import settings
from django.core.mail import EmailMessage
from django.forms.models import BaseModelFormSet
@ -337,14 +336,13 @@ class WriteUpEditForm(RelatedWGForm):
followup = forms.BooleanField(required=False)
comment = forms.CharField(widget=forms.Textarea, required=False)
def __init__(self, *args, **kwargs):
self.doc = kwargs.pop('doc', None)
self.doc_writeup = self.doc.protowriteup_set.all()
if self.doc_writeup.count():
self.doc_writeup=self.doc_writeup[0]
self.doc_writeup = self.doc_writeup[0]
else:
self.doc_writeup=None
self.doc_writeup = None
super(WriteUpEditForm, self).__init__(*args, **kwargs)
self.person = get_person_for_user(self.user)

View file

@ -40,6 +40,6 @@ class ProtoWriteUp(models.Model):
)
writeup = models.TextField(
blank = False,
null = False,
blank=False,
null=False,
)

View file

@ -1,4 +1,5 @@
from ietf.idtracker.models import IETFWG, InternetDraft, IESGLogin
from django.conf import settings
from ietf.idtracker.models import IETFWG, InternetDraft
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.http import HttpResponseForbidden, Http404
@ -37,11 +38,13 @@ def manage_delegates(request, acronym):
elif add_form.is_valid():
add_form.save()
add_form = add_form.get_next_form()
max_delegates = getattr(settings, 'MAX_WG_DELEGATES', 3)
return render_to_response('wgchairs/manage_delegates.html',
{'wg': wg,
'delegates': delegates,
'selected': 'manage_delegates',
'can_add': delegates.count() < 3,
'can_add': delegates.count() < max_delegates,
'max_delegates': max_delegates,
'add_form': add_form,
}, RequestContext(request))
@ -145,16 +148,16 @@ def wg_shepherd_documents(request, acronym):
}
return render_to_response('wgchairs/wg_shepherd_documents.html', context, RequestContext(request))
def managing_writeup(request, acronym, name):
wg = get_object_or_404(IETFWG, group_acronym__acronym=acronym, group_type=1)
user = request.user
person = get_person_for_user(user)
doc = get_object_or_404(InternetDraft, filename=name)
if not can_manage_writeup_of_a_document(user, doc):
raise Http404
current_state = get_state_for_draft(doc)
can_edit = True
if current_state != get_state_by_name(WAITING_WRITEUP) and not can_manage_writeup_of_a_document_no_state(user,doc):
if current_state != get_state_by_name(WAITING_WRITEUP) and not can_manage_writeup_of_a_document_no_state(user, doc):
can_edit = False
writeup = doc.protowriteup_set.all()
if writeup.count():