Commit fad558c7 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 414284: Bug edit page is bad for changing components

Patch By Guy Pyrzak <guy.pyrzak@gmail.com> r=mkanat, a=mkanat
parent 1f0e11b9
......@@ -176,18 +176,77 @@ function showEditableField (e, ContainerInputArray) {
*/
function checkForChangedFieldValues(e, ContainerInputArray ) {
var el = document.getElementById(ContainerInputArray[2]);
var unhide = false;
if ( el ) {
if ( el.value != ContainerInputArray[3] || ( el.value == "" && el.id != "alias") ) {
YAHOO.util.Dom.setStyle(ContainerInputArray[0], 'display', 'none');
YAHOO.util.Dom.setStyle(ContainerInputArray[1], 'display', 'inline');
}
unhide = true;
}
else {
var set_default = document.getElementById("set_default_" + ContainerInputArray[2]);
if ( set_default ) {
if(set_default.checked){
unhide = true;
}
}
}
}
if(unhide){
YAHOO.util.Dom.setStyle(ContainerInputArray[0], 'display', 'none');
YAHOO.util.Dom.setStyle(ContainerInputArray[1], 'display', 'inline');
}
}
function hideAliasAndSummary(short_desc_value, alias_value) {
// check the short desc field
hideEditableField( 'summary_alias_container', 'summary_alias_input', 'editme_action', 'short_desc', short_desc_value);
// check that the alias hasn't changed
bz_alias_check_array = new Array('summary_alias_container', 'summary_alias_input', 'alias', alias_value )
YAHOO.util.Event.addListener( window, 'load', checkForChangedFieldValues, bz_alias_check_array);
}
function showPeopleOnChange( field_id_list ) {
for(var i = 0; i < field_id_list.length; i++) {
YAHOO.util.Event.addListener(field_id_list[i],'change', showEditableField, new Array('bz_qa_contact_edit_container', 'bz_qa_contact_input'));
YAHOO.util.Event.addListener(field_id_list[i],'change', showEditableField, new Array('bz_assignee_edit_container', 'bz_assignee_input'));
}
}
function assignToDefaultOnChange(field_id_list) {
showPeopleOnChange( field_id_list );
for(var i = 0; i < field_id_list.length; i++) {
YAHOO.util.Event.addListener(field_id_list[i],'change', setDefaultCheckbox, 'set_default_assignee' );
YAHOO.util.Event.addListener(field_id_list[i],'change', setDefaultCheckbox, 'set_default_qa_contact' );
}
}
function initAssignedQA(){
YAHOO.util.Event.addListener('set_default_qa_contact','change', boldOnChange, 'set_default_qa_contact');
YAHOO.util.Event.addListener('set_default_assignee','change', boldOnChange, 'set_default_assignee');
YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues, new Array( 'bz_assignee_edit_container', 'bz_assignee_input', 'set_default_assignee', '' ) );
YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues, new Array( 'bz_qa_contact_edit_container', 'bz_qa_contact_input', 'set_default_qa_contact', '' ) );
YAHOO.util.Event.addListener(window, 'load', boldOnChange, 'set_default_assignee');
YAHOO.util.Event.addListener(window, 'load', boldOnChange, 'set_default_qa_contact');
}
function setDefaultCheckbox(e, field_id ) {
var el = document.getElementById(field_id);
var elLabel = document.getElementById(field_id + "_label");
if( el && elLabel ) {
el.checked = "true";
YAHOO.util.Dom.setStyle(elLabel, 'font-weight', 'bold');
}
}
function hideAliasAndSummary(short_desc_value, alias_value){
// check the short desc field
hideEditableField( 'summary_alias_container', 'summary_alias_input', 'editme_action', 'short_desc', short_desc_value);
// check that the alias hasn't changed
bz_alias_check_array = new Array('summary_alias_container', 'summary_alias_input', 'alias', alias_value )
YAHOO.util.Event.addListener( window, 'load', checkForChangedFieldValues, bz_alias_check_array);
function boldOnChange(e, field_id){
var el = document.getElementById(field_id);
var elLabel = document.getElementById(field_id + "_label");
if( el && elLabel ) {
if( el.checked ){
YAHOO.util.Dom.setStyle(elLabel, 'font-weight', 'bold');
}
else{
YAHOO.util.Dom.setStyle(elLabel, 'font-weight', 'normal');
}
}
}
......@@ -379,6 +379,9 @@
<td>
[% PROCESS select selname => "rep_platform" no_td=> 1 %]
[%+ PROCESS select selname => "op_sys" no_td=> 1 %]
<script type="text/javascript">
assignToDefaultOnChange(['product', 'component']);
</script>
</td>
</tr>
......@@ -482,7 +485,7 @@
%]
<br>
<input type="checkbox" id="set_default_assignee" name="set_default_assignee" value="1">
<label for="set_default_assignee">Reset Assignee to default</label>
<label id="set_default_assignee_label" for="set_default_assignee">Reset Assignee to default</label>
</div>
<script type="text/javascript">
hideEditableField('bz_assignee_edit_container',
......@@ -526,7 +529,10 @@
%]
<br>
<input type="checkbox" id="set_default_qa_contact" name="set_default_qa_contact" value="1">
<label for="set_default_qa_contact">Reset QA Contact to default</label>
<label for="set_default_qa_contact" id="set_default_qa_contact_label">Reset QA Contact to default</label>
<script type="text/javascript">
initAssignedQA();
</script>
</div>
[% IF bug.qa_contact != "" %]
<script type="text/javascript">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment