summaryrefslogtreecommitdiffstats
path: root/js/field.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/field.js')
-rw-r--r--js/field.js96
1 files changed, 78 insertions, 18 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 ) {