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
This commit is contained in:
Robert Sparks 2019-08-07 02:03:15 +00:00
parent 798a57c9ab
commit 10422f87d2
5 changed files with 91 additions and 74 deletions

View file

@ -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') ]

View file

@ -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;

View file

@ -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:

View file

@ -24,23 +24,26 @@
</tr>
<tr class="bg1">
<td rowspan="3" valign="top" width="220">WG Sessions:<br>You may select multiple WGs within each priority</td>
<td width="320">First Priority:</td>
<td width="320">Chair Conflict:</td>
<td>{{ form.wg_selector1 }}
<input type="button" value="Delete the last entry" onClick="delete_last1(); return handleconflictfield(1);"><br>
{% comment %}<input type="button" value="Delete the last entry" onClick="delete_last1(); return handleconflictfield(1);"><br>{% endcomment %}
<input type="button" value="Delete the last entry" onClick="delete_last1(); return 1;"><br>
{{ form.conflict1.errors }}{{ form.conflict1 }}
</td>
</tr>
<tr class="bg1">
<td>Second Priority:</td>
<td>Technology Overlap:</td>
<td>{{ form.wg_selector2 }}
<input type="button" value="Delete the last entry" onClick="delete_last2(); return handleconflictfield(2);"><br>
{% comment %}<input type="button" value="Delete the last entry" onClick="delete_last2(); return handleconflictfield(2);"><br>{% endcomment %}
<input type="button" value="Delete the last entry" onClick="delete_last2(); return 1;"><br>
{{ form.conflict2.errors }}{{ form.conflict2 }}
</td>
</tr>
<tr class="bg1">
<td>Third Priority:</td>
<td>Key Participant Conflict:</td>
<td>{{ form.wg_selector3 }}
<input type="button" value="Delete the last entry" onClick="delete_last3(); return handleconflictfield(3);"><br>
{% comment %}<input type="button" value="Delete the last entry" onClick="delete_last3(); return handleconflictfield(3);"><br>{% endcomment %}
<input type="button" value="Delete the last entry" onClick="delete_last3(); return 1;"><br>
{{ form.conflict3.errors }}{{ form.conflict3 }}
</td>
</tr>

View file

@ -16,9 +16,9 @@
<td>Conflicts to Avoid:</td>
<td>
<table>
{% if session.conflict1 %}<tr><td>First Priority: </td><td>{{ session.conflict1 }}</td></tr>{% endif %}
{% if session.conflict2 %}<tr><td>Second Priority: </td><td>{{ session.conflict2 }}</td></tr>{% endif %}
{% if session.conflict3 %}<tr><td>Third Priority: </td><td>{{ session.conflict3 }}</td></tr>{% endif %}
{% if session.conflict1 %}<tr><td>Chair Conflict: </td><td>{{ session.conflict1 }}</td></tr>{% endif %}
{% if session.conflict2 %}<tr><td>Technology Overlap: </td><td>{{ session.conflict2 }}</td></tr>{% endif %}
{% if session.conflict3 %}<tr><td>Key Participant Conflict: </td><td>{{ session.conflict3 }}</td></tr>{% endif %}
</table>
</td>
</tr>