summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2008-02-08 06:56:31 +0100
committermkanat%bugzilla.org <>2008-02-08 06:56:31 +0100
commitfad558c794527a2c0bd32b378917be0fc27e453f (patch)
treef63b1d24514aeaa38c852f95d06728baf08dda53 /js
parent1f0e11b9bbe5b880c488b214a45755792646f0b3 (diff)
downloadbugzilla-fad558c794527a2c0bd32b378917be0fc27e453f.tar.gz
bugzilla-fad558c794527a2c0bd32b378917be0fc27e453f.tar.xz
Bug 414284: Bug edit page is bad for changing components
Patch By Guy Pyrzak <guy.pyrzak@gmail.com> r=mkanat, a=mkanat
Diffstat (limited to 'js')
-rw-r--r--js/field.js77
1 files changed, 68 insertions, 9 deletions
diff --git a/js/field.js b/js/field.js
index 164ce1c31..4341a1543 100644
--- a/js/field.js
+++ b/js/field.js
@@ -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');
+ }
+ }
}