From 10422f87d24bcc1a3435497b6079808fbf2d64e6 Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Wed, 7 Aug 2019 02:03:15 +0000 Subject: [PATCH] Rework how we are labeling constraints to provide a quick-fix for session requests at IETF106. Turned off several javascript functions that added/enforced old (possibly no longer correct) semantics for the session request forms. Fixes #2754. Commit ready for merge. - Legacy-Id: 16630 --- ietf/secr/sreq/forms.py | 17 ++- ietf/secr/static/secr/js/sessions.js | 121 +++++++++--------- ietf/secr/templates/includes/session_info.txt | 6 +- .../includes/sessions_request_form.html | 15 ++- .../includes/sessions_request_view.html | 6 +- 5 files changed, 91 insertions(+), 74 deletions(-) diff --git a/ietf/secr/sreq/forms.py b/ietf/secr/sreq/forms.py index 36a804042..be401b207 100644 --- a/ietf/secr/sreq/forms.py +++ b/ietf/secr/sreq/forms.py @@ -89,11 +89,18 @@ class SessionForm(forms.Form): self.fields['length_session2'].widget.attrs['onClick'] = "if (check_num_session(2)) this.disabled=true;" self.fields['length_session3'].widget.attrs['onClick'] = "if (check_third_session()) { this.disabled=true;}" self.fields['comments'].widget = forms.Textarea(attrs={'rows':'6','cols':'65'}) - self.fields['wg_selector1'].widget.attrs['onChange'] = "document.form_post.conflict1.value=document.form_post.conflict1.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(1);" - self.fields['wg_selector2'].widget.attrs['onChange'] = "document.form_post.conflict2.value=document.form_post.conflict2.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(2);" - self.fields['wg_selector2'].widget.attrs['onClick'] = "return check_prior_conflict(2);" - self.fields['wg_selector3'].widget.attrs['onChange'] = "document.form_post.conflict3.value=document.form_post.conflict3.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(3);" - self.fields['wg_selector3'].widget.attrs['onClick'] = "return check_prior_conflict(3);" + # disabling handleconflictfield (which only enables or disables form elements) while we're hacking the meaning of the three constraints currently in use: + #self.fields['wg_selector1'].widget.attrs['onChange'] = "document.form_post.conflict1.value=document.form_post.conflict1.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(1);" + #self.fields['wg_selector2'].widget.attrs['onChange'] = "document.form_post.conflict2.value=document.form_post.conflict2.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(2);" + #self.fields['wg_selector3'].widget.attrs['onChange'] = "document.form_post.conflict3.value=document.form_post.conflict3.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(3);" + self.fields['wg_selector1'].widget.attrs['onChange'] = "document.form_post.conflict1.value=document.form_post.conflict1.value + ' ' + this.options[this.selectedIndex].value; return 1;" + self.fields['wg_selector2'].widget.attrs['onChange'] = "document.form_post.conflict2.value=document.form_post.conflict2.value + ' ' + this.options[this.selectedIndex].value; return 1;" + self.fields['wg_selector3'].widget.attrs['onChange'] = "document.form_post.conflict3.value=document.form_post.conflict3.value + ' ' + this.options[this.selectedIndex].value; return 1;" + + # disabling check_prior_conflict javascript while we're hacking the meaning of the three constraints currently in use + #self.fields['wg_selector2'].widget.attrs['onClick'] = "return check_prior_conflict(2);" + #self.fields['wg_selector3'].widget.attrs['onClick'] = "return check_prior_conflict(3);" + self.fields['third_session'].widget.attrs['onClick'] = "if (document.form_post.num_session.selectedIndex < 2) { alert('Cannot use this field - Number of Session is not set to 2'); return false; } else { if (this.checked==true) { document.form_post.length_session3.disabled=false; } else { document.form_post.length_session3.value=0;document.form_post.length_session3.disabled=true; } }" self.fields["resources"].choices = [(x.pk,x.desc) for x in ResourceAssociation.objects.filter(name__used=True).order_by('name__order') ] diff --git a/ietf/secr/static/secr/js/sessions.js b/ietf/secr/static/secr/js/sessions.js index 8f0d5c245..e01e591aa 100644 --- a/ietf/secr/static/secr/js/sessions.js +++ b/ietf/secr/static/secr/js/sessions.js @@ -51,36 +51,39 @@ function check_third_session () { } return false; } -function handleconflictfield (val) { - if (val==1) { - if (document.form_post.conflict1.value.length > 0) { - document.form_post.conflict2.disabled=false; - if (document.form_post.conflict2.value.length > 0) { - document.form_post.conflict3.disabled=false; - } - return 1; - } else { - if (document.form_post.conflict2.value.length > 0 || document.form_post.conflict3.value.length > 0) { - alert("Second and Third Conflicts to Avoid fields are being disabled"); - document.form_post.conflict2.disabled=true; - document.form_post.conflict3.disabled=true; - return 0; - } - } - } else { - if (document.form_post.conflict2.value.length > 0) { - document.form_post.conflict3.disabled=false; - return 1; - } else { - if (document.form_post.conflict3.value.length > 0) { - alert("Third Conflicts to Avoid field is being disabled"); - document.form_post.conflict3.disabled=true; - return 0; - } - } - } - return 1; -} + +// All calls to handleconflictfield are being disabled while we hack on the meaning of the three constraint fields +// function handleconflictfield (val) { +// if (val==1) { +// if (document.form_post.conflict1.value.length > 0) { +// document.form_post.conflict2.disabled=false; +// if (document.form_post.conflict2.value.length > 0) { +// document.form_post.conflict3.disabled=false; +// } +// return 1; +// } else { +// if (document.form_post.conflict2.value.length > 0 || document.form_post.conflict3.value.length > 0) { +// alert("Second and Third Conflicts to Avoid fields are being disabled"); +// document.form_post.conflict2.disabled=true; +// document.form_post.conflict3.disabled=true; +// return 0; +// } +// } +// } else { +// if (document.form_post.conflict2.value.length > 0) { +// document.form_post.conflict3.disabled=false; +// return 1; +// } else { +// if (document.form_post.conflict3.value.length > 0) { +// alert("Third Conflicts to Avoid field is being disabled"); +// document.form_post.conflict3.disabled=true; +// return 0; +// } +// } +// } +// return 1; +// } + function delete_last1 () { var b = document.form_post.conflict1.value; var temp = new Array(); @@ -109,34 +112,38 @@ function delete_last3 () { document.form_post.wg_selector3.selectedIndex=0; } -function check_prior_conflict(val) { - if (val == 2) { - if (document.form_post.conflict1.value=="") { - alert("Please specify your First Priority prior to using this field"); - document.form_post.conflict2.disabled=true; - document.form_post.conflict3.disabled=true; - document.form_post.wg_selector1.focus(); - return 0; - } - } - else { - if (document.form_post.conflict2.value=="" && document.form_post.conflict1.value=="") { - alert("Please specify your First and Second Priority prior to using this field"); - document.form_post.conflict3.disabled=true; - document.form_post.wg_selector1.focus(); - return 0; - } else { - if (document.form_post.conflict2.value=="") { - alert("Please specify your Second Priority prior to using this field"); - document.form_post.conflict3.disabled=true; - document.form_post.wg_selector2.focus(); - return 0; - } - } - } +// Not calling check_prior_confict (see ietf/secr/sreq/forms.py definition of SessionForm) +// while we are hacking the use of the current three constraint types around. We could bring +// this back in when we solve the general case of what constraints to use at what meeting. +// When we do, the else should explicitly check for a value of 3. +// function check_prior_conflict(val) { +// if (val == 2) { +// if (document.form_post.conflict1.value=="") { +// alert("Please specify your First Priority prior to using this field"); +// document.form_post.conflict2.disabled=true; +// document.form_post.conflict3.disabled=true; +// document.form_post.wg_selector1.focus(); +// return 0; +// } +// } +// else { +// if (document.form_post.conflict2.value=="" && document.form_post.conflict1.value=="") { +// alert("Please specify your First and Second Priority prior to using this field"); +// document.form_post.conflict3.disabled=true; +// document.form_post.wg_selector1.focus(); +// return 0; +// } else { +// if (document.form_post.conflict2.value=="") { +// alert("Please specify your Second Priority prior to using this field"); +// document.form_post.conflict3.disabled=true; +// document.form_post.wg_selector2.focus(); +// return 0; +// } +// } +// } - return 1; -} +// return 1; +// } function retrieve_data () { document.form_post.num_session.selectedIndex = document.form_post.prev_num_session.value; diff --git a/ietf/secr/templates/includes/session_info.txt b/ietf/secr/templates/includes/session_info.txt index 10ea973cf..855ff7a27 100644 --- a/ietf/secr/templates/includes/session_info.txt +++ b/ietf/secr/templates/includes/session_info.txt @@ -8,9 +8,9 @@ Number of Sessions: {{ session.num_session }} Length of Session(s): {{ session.length_session1|display_duration }}{% if session.length_session2 %}, {{ session.length_session2|display_duration }}{% endif %}{% if session.length_session3 %}, {{ session.length_session3|display_duration }}{% endif %} Number of Attendees: {{ session.attendees }} Conflicts to Avoid: -{% if session.conflict1 %} First Priority: {{ session.conflict1 }}{% endif %} -{% if session.conflict2 %} Second Priority: {{ session.conflict2 }}{% endif %} -{% if session.conflict3 %} Third Priority: {{ session.conflict3 }}{% endif %} +{% if session.conflict1 %} Chair Conflict: {{ session.conflict1 }}{% endif %} +{% if session.conflict2 %} Technology Overlap: {{ session.conflict2 }}{% endif %} +{% if session.conflict3 %} Key Participant Conflict: {{ session.conflict3 }}{% endif %} People who must be present: diff --git a/ietf/secr/templates/includes/sessions_request_form.html b/ietf/secr/templates/includes/sessions_request_form.html index ed3edb2eb..85bdf707d 100755 --- a/ietf/secr/templates/includes/sessions_request_form.html +++ b/ietf/secr/templates/includes/sessions_request_form.html @@ -24,23 +24,26 @@ WG Sessions:
You may select multiple WGs within each priority - First Priority: + Chair Conflict: {{ form.wg_selector1 }} -
+ {% comment %}
{% endcomment %} +
{{ form.conflict1.errors }}{{ form.conflict1 }} - Second Priority: + Technology Overlap: {{ form.wg_selector2 }} -
+ {% comment %}
{% endcomment %} +
{{ form.conflict2.errors }}{{ form.conflict2 }} - Third Priority: + Key Participant Conflict: {{ form.wg_selector3 }} -
+ {% comment %}
{% endcomment %} +
{{ form.conflict3.errors }}{{ form.conflict3 }} diff --git a/ietf/secr/templates/includes/sessions_request_view.html b/ietf/secr/templates/includes/sessions_request_view.html index 90d26a3f8..687a637af 100644 --- a/ietf/secr/templates/includes/sessions_request_view.html +++ b/ietf/secr/templates/includes/sessions_request_view.html @@ -16,9 +16,9 @@ Conflicts to Avoid: - {% if session.conflict1 %}{% endif %} - {% if session.conflict2 %}{% endif %} - {% if session.conflict3 %}{% endif %} + {% if session.conflict1 %}{% endif %} + {% if session.conflict2 %}{% endif %} + {% if session.conflict3 %}{% endif %}
First Priority: {{ session.conflict1 }}
Second Priority: {{ session.conflict2 }}
Third Priority: {{ session.conflict3 }}
Chair Conflict: {{ session.conflict1 }}
Technology Overlap: {{ session.conflict2 }}
Key Participant Conflict: {{ session.conflict3 }}