Made various changes to session request form, mostly removal of fields, to support virtual session requests. Also added settings.SECR_VIRTUAL_MEETINGS list.

- Legacy-Id: 17803
This commit is contained in:
Ryan Cross 2020-05-15 23:48:06 +00:00
parent ddca2128b5
commit d90d97d8cc
7 changed files with 78 additions and 32 deletions

View file

@ -19,6 +19,7 @@ from ietf.utils.html import clean_text_field
NUM_SESSION_CHOICES = (('','--Please select'),('1','1'),('2','2'))
# LENGTH_SESSION_CHOICES = (('','--Please select'),('1800','30 minutes'),('3600','1 hour'),('5400','1.5 hours'), ('7200','2 hours'),('9000','2.5 hours'))
LENGTH_SESSION_CHOICES = (('','--Please select'),('1800','30 minutes'),('3600','1 hour'),('5400','1.5 hours'), ('7200','2 hours'))
VIRTUAL_LENGTH_SESSION_CHOICES = (('','--Please select'),('3000','50 minutes'),('6000','100 minutes'))
SESSION_TIME_RELATION_CHOICES = (('', 'No preference'),) + Constraint.TIME_RELATION_CHOICES
JOINT_FOR_SESSION_CHOICES = (('1', 'First session'), ('2', 'Second session'), ('3', 'Third session'), )
@ -207,7 +208,16 @@ class SessionForm(forms.Form):
'because you have not requested a third session.')
return data
class VirtualSessionForm(SessionForm):
'''A SessionForm customized for special virtual meeting requirements'''
length_session1 = forms.ChoiceField(choices=VIRTUAL_LENGTH_SESSION_CHOICES)
length_session2 = forms.ChoiceField(choices=VIRTUAL_LENGTH_SESSION_CHOICES,required=False)
length_session3 = forms.ChoiceField(choices=VIRTUAL_LENGTH_SESSION_CHOICES,required=False)
attendees = forms.IntegerField(required=False)
class ToolStatusForm(forms.Form):
message = forms.CharField(widget=forms.Textarea(attrs={'rows':'3','cols':'80'}), strip=False)

View file

@ -27,8 +27,10 @@ def display_duration(value):
label."""
map = {'0':'None',
'1800':'30 Minutes',
'3000':'50 Miuntes',
'3600':'1 Hour',
'5400':'1.5 Hours',
'6000':'100 Minutes',
'7200':'2 Hours',
'9000':'2.5 Hours'}
return map[value]

View file

@ -19,7 +19,8 @@ from ietf.meeting.models import Meeting, Session, Constraint, ResourceAssociatio
from ietf.meeting.helpers import get_meeting
from ietf.meeting.utils import add_event_info_to_session_qs
from ietf.name.models import SessionStatusName, ConstraintName
from ietf.secr.sreq.forms import SessionForm, ToolStatusForm, allowed_conflicting_groups, JOINT_FOR_SESSION_CHOICES
from ietf.secr.sreq.forms import (SessionForm, ToolStatusForm, allowed_conflicting_groups,
JOINT_FOR_SESSION_CHOICES, VirtualSessionForm)
from ietf.secr.utils.decorators import check_permissions
from ietf.secr.utils.group import get_my_groups
from ietf.utils.mail import send_mail
@ -115,6 +116,13 @@ def get_requester_text(person,group):
if person.role_set.filter(name='secr',group__acronym='secretariat'):
return '%s, on behalf of the %s working group' % (person.ascii, group.acronym)
def get_session_form_class():
meeting = get_meeting()
if meeting.number in settings.SECR_VIRTUAL_MEETINGS:
return VirtualSessionForm
else:
return SessionForm
def save_conflicts(group, meeting, conflicts, name):
'''
This function takes a Group, Meeting a string which is a list of Groups acronyms (conflicts),
@ -261,9 +269,12 @@ def confirm(request, acronym):
'''
# FIXME: this should be using form.is_valid/form.cleaned_data - invalid input will make it crash
group = get_object_or_404(Group,acronym=acronym)
form = SessionForm(group, request.POST, hidden=True)
form.is_valid()
meeting = get_meeting()
FormClass = get_session_form_class()
form = FormClass(group, request.POST, hidden=True)
form.is_valid()
login = request.user.person
# check if request already exists for this group
@ -365,6 +376,7 @@ def confirm(request, acronym):
return render(request, 'sreq/confirm.html', {
'form': form,
'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
'session': session_data,
'group': group,
'session_conflicts': session_conflicts},
@ -397,6 +409,8 @@ def edit(request, acronym, num=None):
sessions = add_event_info_to_session_qs(Session.objects.filter(group=group, meeting=meeting)).filter(Q(current_status__isnull=True) | ~Q(current_status__in=['canceled', 'notmeet'])).order_by('id')
sessions_count = sessions.count()
initial = get_initial_session(sessions)
FormClass = get_session_form_class()
if 'resources' in initial:
initial['resources'] = [x.pk for x in initial['resources']]
@ -417,7 +431,7 @@ def edit(request, acronym, num=None):
if button_text == 'Cancel':
return redirect('ietf.secr.sreq.views.view', acronym=acronym)
form = SessionForm(group, request.POST, initial=initial)
form = FormClass(group, request.POST, initial=initial)
if form.is_valid():
if form.has_changed():
# might be cleaner to simply delete and rewrite all records (but maintain submitter?)
@ -566,10 +580,11 @@ def edit(request, acronym, num=None):
else:
if not sessions:
return redirect('ietf.secr.sreq.views.new', acronym=acronym)
form = SessionForm(group, initial=initial)
form = FormClass(group, initial=initial)
return render(request, 'sreq/edit.html', {
'is_locked': is_locked,
'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
'meeting': meeting,
'form': form,
'group': group,
@ -652,6 +667,8 @@ def new(request, acronym):
group = get_object_or_404(Group, acronym=acronym)
meeting = get_meeting()
session_conflicts = session_conflicts_as_string(group, meeting)
is_virtual = meeting.number in settings.SECR_VIRTUAL_MEETINGS,
FormClass = get_session_form_class()
# check if app is locked
is_locked = check_app_locked()
@ -664,7 +681,7 @@ def new(request, acronym):
if button_text == 'Cancel':
return redirect('ietf.secr.sreq.views.main')
form = SessionForm(group, request.POST)
form = FormClass(group, request.POST)
if form.is_valid():
return confirm(request, acronym)
@ -688,15 +705,16 @@ def new(request, acronym):
add_essential_people(group,initial)
if 'resources' in initial:
initial['resources'] = [x.pk for x in initial['resources']]
form = SessionForm(group, initial=initial)
form = FormClass(group, initial=initial)
else:
initial={}
add_essential_people(group,initial)
form = SessionForm(group, initial=initial)
form = FormClass(group, initial=initial)
return render(request, 'sreq/new.html', {
'meeting': meeting,
'is_virtual': is_virtual,
'form': form,
'group': group,
'session_conflicts': session_conflicts},
@ -807,7 +825,7 @@ def view(request, acronym, num = None):
is_locked = check_app_locked()
if is_locked:
messages.warning(request, "The Session Request Tool is closed")
# if there are no session requests yet, redirect to new session request page
if not sessions:
if is_locked:
@ -837,6 +855,7 @@ def view(request, acronym, num = None):
return render(request, 'sreq/view.html', {
'is_locked': is_locked,
'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
'session': session,
'activities': activities,
'meeting': meeting,

View file

@ -8,13 +8,15 @@
<tr class="bg1"><td>Number of Sessions:<span class="required">*</span></td><td>{{ form.num_session.errors }}{{ form.num_session }}</td></tr>
<tr class="bg2"><td>Length of Session 1:<span class="required">*</span></td><td>{{ form.length_session1.errors }}{{ form.length_session1 }}</td></tr>
<tr class="bg2"><td>Length of Session 2:<span class="required">*</span></td><td>{{ form.length_session2.errors }}{{ form.length_session2 }}</td></tr>
<tr class="bg2"><td>Time between two sessions:</td><td>{{ form.session_time_relation.errors }}{{ form.session_time_relation }}</td></tr>
{% if not is_virtual %}
<tr class="bg2"><td>Time between two sessions:</td><td>{{ form.session_time_relation.errors }}{{ form.session_time_relation }}</td></tr>
{% endif %}
{% if group.type.slug == "wg" %}
<tr class="bg2"><td>Additional Session Request:</td><td>{{ form.third_session }} Check this box to request an additional session.<br>
Additional slot may be available after agenda scheduling has closed and with the approval of an Area Director.<br>
Length of Third Session: {{ form.length_session3.errors }}{{ form.length_session3 }}</td></tr>
{% endif %}
<tr class="bg1"><td>Number of Attendees:<span class="required">*</span></td><td>{{ form.attendees.errors }}{{ form.attendees }}</td></tr>
<tr class="bg1"><td>Number of Attendees:{% if not is_virtual %}<span class="required">*</span>{% endif %}</td><td>{{ form.attendees.errors }}{{ form.attendees }}</td></tr>
<tr class="bg2"><td>People who must be present:</td><td>{{ form.bethere.errors }}{{ form.bethere }}</td></tr>
<tr class="bg1"><td>Conflicts to Avoid:</td>
<td>
@ -55,6 +57,9 @@
</table>
</td>
</tr>
{% if not is_virtual %}
<tr class="bg2"><td>Resources requested:</td>
<td>
{{ form.resources.errors }} {{ form.resources }}
@ -87,6 +92,9 @@
</td>
<td>{{ form.joint_for_session.errors }}{{ form.joint_for_session }}</td>
</tr>
{% endif %}
<tr class="bg2">
<td valign="top">Special Requests:<br />&nbsp;<br />i.e. restrictions on meeting times / days, etc.</td> (limit 200 characters)</td>
<td>{{ form.comments.errors }}{{ form.comments }}</td>

View file

@ -7,7 +7,9 @@
<tr class="row2"><td>Length of Session 1:</td><td>{{ session.length_session1|display_duration }}</td></tr>
{% if session.length_session2 %}
<tr class="row2"><td>Length of Session 2:</td><td>{{ session.length_session2|display_duration }}</td></tr>
<tr class="row2"><td>Time between sessions:</td><td>{% if session.session_time_relation_display %}{{ session.session_time_relation_display }}{% else %}No preference{% endif %}</td></tr>
{% if not is_virtual %}
<tr class="row2"><td>Time between sessions:</td><td>{% if session.session_time_relation_display %}{{ session.session_time_relation_display }}{% else %}No preference{% endif %}</td></tr>
{% endif %}
{% endif %}
{% if session.length_session3 %}
<tr class="row2"><td>Length of Session 3:</td><td>{{ session.length_session3|display_duration }}</td></tr>
@ -27,10 +29,12 @@
<td>Other WGs that included {{ group }} in their conflict list:</td>
<td>{% if session_conflicts %}{{ session_conflicts }}{% else %}<i>None so far</i>{% endif %}</td>
</tr>
<tr class="row2">
<td>Resources requested:</td>
<td>{% if session.resources %}<ul>{% for resource in session.resources %}<li>{{ resource.desc }}</li>{% endfor %}</ul>{% else %}<i>None so far</i>{% endif %}</td>
</tr>
{% if not is_virtual %}
<tr class="row2">
<td>Resources requested:</td>
<td>{% if session.resources %}<ul>{% for resource in session.resources %}<li>{{ resource.desc }}</li>{% endfor %}</ul>{% else %}<i>None so far</i>{% endif %}</td>
</tr>
{% endif %}
<tr class="row1">
<td>People who must be present:</td>
<td>{% if session.bethere %}<ul>{% for person in session.bethere %}<li>{{ person }}</li>{% endfor %}</ul>{% else %}<i>None</i>{% endif %}</td>
@ -38,19 +42,21 @@
<td>Can not meet on:</td>
<td>{% if session.timeranges_display %}{{ session.timeranges_display|join:', ' }}{% else %}No constraints{% endif %}</td>
</tr>
<tr class="row1">
<td>Adjacent with WG:</td>
<td>{{ session.adjacent_with_wg|default:'No preference' }}</td>
</tr>
<tr class="row2">
<td>Joint session:</td>
<td>
{% if session.joint_with_groups %}
{{ session.joint_for_session_display }} with: {{ session.joint_with_groups }}
{% else %}
Not a joint session
{% endif %}
</td>
</tr>
{% if not is_virtual %}
<tr class="row1">
<td>Adjacent with WG:</td>
<td>{{ session.adjacent_with_wg|default:'No preference' }}</td>
</tr>
<tr class="row2">
<td>Joint session:</td>
<td>
{% if session.joint_with_groups %}
{{ session.joint_for_session_display }} with: {{ session.joint_with_groups }}
{% else %}
Not a joint session
{% endif %}
</td>
</tr>
{% endif %}
<tr class="row1"><td>Special Requests:</td><td>{{ session.comments }}</td></tr>
</table>

View file

@ -32,7 +32,7 @@
</noscript>
<div class="module interim-container">
<h2>IETF {{ meeting.number }}: New Session Request</h2>
<h2>IETF {{ meeting.number }}: New Virtual Session Request</h2>
<div class="inline-related">
<br>
<ul class="session-buttons">

View file

@ -899,6 +899,7 @@ SECR_INTERIM_LISTING_DIR = '/a/www/www6/meeting/interim'
SECR_MAX_UPLOAD_SIZE = 40960000
SECR_PROCEEDINGS_DIR = '/a/www/www6s/proceedings/'
SECR_PPT2PDF_COMMAND = ['/usr/bin/soffice','--headless','--convert-to','pdf:writer_globaldocument_pdf_Export','--outdir']
SECR_VIRTUAL_MEETINGS = ['108']
STATS_REGISTRATION_ATTENDEES_JSON_URL = 'https://ietf.org/registration/attendees/{number}'
NEW_PROCEEDINGS_START = 95
USE_ETAGS=True