summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2011-11-22 00:02:59 +0100
committerDave Lawrence <dlawrence@mozilla.com>2011-11-22 00:02:59 +0100
commit8c7652a2a8beceb65a5189d0393a8111186de32c (patch)
tree4fce452f2fca19d8cde67f4d66b656fb156cb0e7 /js
parent5f1ae49c9a96fca5be3297c4d6b322df4c7ac77f (diff)
downloadbugzilla-8c7652a2a8beceb65a5189d0393a8111186de32c.tar.gz
bugzilla-8c7652a2a8beceb65a5189d0393a8111186de32c.tar.xz
Added some missing files from bmo/4.0
Diffstat (limited to 'js')
-rw-r--r--js/create_bug.js116
1 files changed, 116 insertions, 0 deletions
diff --git a/js/create_bug.js b/js/create_bug.js
new file mode 100644
index 000000000..62d24a642
--- /dev/null
+++ b/js/create_bug.js
@@ -0,0 +1,116 @@
+function toggleAdvancedFields() {
+ TUI_toggle_class('expert_fields');
+ var elements = YAHOO.util.Dom.getElementsByClassName('expert_fields');
+ if (YAHOO.util.Dom.hasClass(elements[0], TUI_HIDDEN_CLASS)) {
+ handleWantsBugFlags(false);
+ }
+}
+
+function handleWantsBugFlags(wants) {
+ if (wants) {
+ hideElementById('bug_flags_false');
+ showElementById('bug_flags_true');
+ }
+ else {
+ showElementById('bug_flags_false');
+ hideElementById('bug_flags_true');
+ clearBugFlagFields();
+ }
+}
+
+function clearBugFlagFields() {
+ var flags_table;
+ flags_table = document.getElementById('bug_flags');
+ if (flags_table) {
+ var selects = flags_table.getElementsByTagName('select');
+ for (var i = 0, il = selects.length; i < il; i++) {
+ if (selects[i].value != 'X') {
+ selects[i].value = 'X';
+ toggleRequesteeField(selects[i]);
+ }
+ }
+ }
+ flags_table = document.getElementById('bug_tracking_flags');
+ if (flags_table) {
+ var selects = flags_table.getElementsByTagName('select');
+ for (var i = 0, il = selects.length; i < il; i++) {
+ selects[i].value = '---';
+ }
+ }
+}
+
+YAHOO.util.Event.onDOMReady(function() {
+ function set_width(id, width) {
+ var el = document.getElementById(id);
+ if (!el) return;
+ el.style.width = width + 'px';
+ }
+
+ // force field widths
+
+ var width = document.getElementById('short_desc').clientWidth + 'px';
+ var el;
+
+ el = document.getElementById('comment');
+ el.style.width = width;
+
+ el = document.getElementById('cf_crash_signature');
+ if (el) el.style.width = width;
+
+ // show the bug flags if a flag is set
+
+ var flag_set = false;
+ var flags_table;
+ flags_table = document.getElementById('bug_flags');
+ if (flags_table) {
+ var selects = flags_table.getElementsByTagName('select');
+ for (var i = 0, il = selects.length; i < il; i++) {
+ if (selects[i].value != 'X') {
+ flag_set = true;
+ break;
+ }
+ }
+ }
+ if (!flag_set) {
+ flags_table = document.getElementById('bug_tracking_flags');
+ if (flags_table) {
+ var selects = flags_table.getElementsByTagName('select');
+ for (var i = 0, il = selects.length; i < il; i++) {
+ if (selects[i].value != '---') {
+ flag_set = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (flag_set) {
+ hideElementById('bug_flags_false');
+ showElementById('bug_flags_true');
+ } else {
+ hideElementById('bug_flags_true');
+ showElementById('bug_flags_false');
+ }
+ showElementById('btn_no_bug_flags')
+});
+
+function take_bug(user) {
+ var el = Dom.get('assigned_to');
+ el.value = user;
+ el.focus();
+ el.select();
+ assignee_change(user);
+ return false;
+}
+
+function assignee_change(user) {
+ var el = Dom.get('take_bug');
+ if (!el) return;
+ el.style.display = Dom.get('assigned_to').value == user ? 'none' : '';
+}
+
+function init_take_handler(user) {
+ YAHOO.util.Event.addListener(
+ 'assigned_to', 'change', function() { assignee_change(user); });
+ assignee_change(user);
+}