diff options
author | guy.pyrzak%gmail.com <> | 2008-03-01 12:33:04 +0100 |
---|---|---|
committer | guy.pyrzak%gmail.com <> | 2008-03-01 12:33:04 +0100 |
commit | 0804583f3b19913ad79b5e70268a25fe6ce07408 (patch) | |
tree | 2a0727ec1309fa55498acabc3b3e1f39960e4584 | |
parent | dc850794210056ff806b21c57149be7c7662be8c (diff) | |
download | bugzilla-0804583f3b19913ad79b5e70268a25fe6ce07408.tar.gz bugzilla-0804583f3b19913ad79b5e70268a25fe6ce07408.tar.xz |
Bug 418895: Assignee and QA contact fields always become revealed (editable),
The patch moves what used to be in one function to hide the qa and assignee
into 2 separate calls. It also fixes some typos in the comments and adds my
name to the committers list
Patch By Guy Pyrzak <guy.pyrzak@gmail.com.com> r=mkanat, a=mkanat
-rw-r--r-- | js/field.js | 96 | ||||
-rw-r--r-- | template/en/default/bug/edit.html.tmpl | 15 |
2 files changed, 88 insertions, 23 deletions
diff --git a/js/field.js b/js/field.js index 4341a1543..04b80fc34 100644 --- a/js/field.js +++ b/js/field.js @@ -15,6 +15,7 @@ * Solved, Inc. All Rights Reserved. * * Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> + * Guy Pyrzak <guy.pyrzak@gmail.com> */ /* This library assumes that the needed YUI libraries have been loaded @@ -140,9 +141,21 @@ function updateCalendarFromField(date_field) { function hideEditableField( container, input, action, field_id, original_value ) { YAHOO.util.Dom.setStyle(container, 'display', 'inline'); YAHOO.util.Dom.setStyle(input, 'display', 'none'); - YAHOO.util.Event.addListener(action, 'click', showEditableField, new Array(container, input) ); + YAHOO.util.Event.addListener(action, + 'click', + showEditableField, + new Array(container, input) + ); if(field_id != ""){ - YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues, new Array(container, input, field_id, original_value )); + YAHOO.util.Event.addListener(window, + 'load', + checkForChangedFieldValues, + new Array(container, + input, + field_id, + original_value + ) + ); } } @@ -178,11 +191,13 @@ 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") ) { + if ( el.value != ContainerInputArray[3] || + ( el.value == "" && el.id != "alias") ) { unhide = true; } else { - var set_default = document.getElementById("set_default_" + ContainerInputArray[2]); + var set_default = document.getElementById("set_default_" + + ContainerInputArray[2]); if ( set_default ) { if(set_default.checked){ unhide = true; @@ -199,34 +214,79 @@ function checkForChangedFieldValues(e, ContainerInputArray ) { 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); + 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); + 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')); + 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' ); + 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 initDefaultCheckbox(field_id){ + YAHOO.util.Event.addListener( 'set_default_' + field_id, + 'change', boldOnChange, + 'set_default_' + field_id + ); + YAHOO.util.Event.addListener( window, + 'load', + checkForChangedFieldValues, + new Array( 'bz_' + field_id + '_edit_container', + 'bz_' + field_id + '_input', + 'set_default_' + field_id , + '1' + ) + ); + + YAHOO.util.Event.addListener( window, + 'load', + boldOnChange, + 'set_default_' + field_id + ); } function setDefaultCheckbox(e, field_id ) { diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index 3516500f5..728086649 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -20,6 +20,7 @@ # Max Kanat-Alexander <mkanat@bugzilla.org> # Frédéric Buclin <LpSolit@gmail.com> # Olav Vitters <olav@bkor.dhs.org> + # Guy Pyrzak <guy.pyrzak@gmail.com> #%] [% PROCESS global/variables.none.tmpl %] @@ -493,6 +494,7 @@ 'bz_assignee_edit_action', 'assigned_to', '[% bug.assigned_to.login FILTER js %]' ); + initDefaultCheckbox('assignee'); </script> [% ELSE %] <input type="hidden" name="assigned_to" id="assigned_to" @@ -530,9 +532,6 @@ <br> <input type="checkbox" id="set_default_qa_contact" name="set_default_qa_contact" value="1"> <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"> @@ -541,6 +540,7 @@ 'bz_qa_contact_edit_action', 'qa_contact', '[% bug.qa_contact.login FILTER js %]'); + initDefaultCheckbox('qa_contact'); </script> [% END %] [% ELSE %] @@ -551,9 +551,11 @@ </td> </tr> [% END %] - [% END %] +[%############################################################################%] +[%# Block for URL Keyword and Whiteboard #%] +[%############################################################################%] [% BLOCK section_url_keyword_whiteboard %] [%# *** URL Whiteboard Keywords *** %] <tr> @@ -621,6 +623,9 @@ [% END %] [% END %] +[%############################################################################%] +[%# Block for Depends On / Blocks #%] +[%############################################################################%] [% BLOCK section_dependson_blocks %] <tr> [% PROCESS dependencies @@ -906,7 +911,7 @@ [% END %] [%############################################################################%] -[%# Block for Section Spacer #%] +[%# Block for Custom Fields #%] [%############################################################################%] [% BLOCK section_customfields %] |