From 88e0ac4cb8bd8932005341e47ee7310a956366d7 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 13 Feb 2012 23:36:05 +0800 Subject: Bug 725923: backport bug 663835 to extend test coverage to extensions --- extensions/BMO/Extension.pm | 7 +- .../en/default/bug/create/user-message.html.tmpl | 128 ++-------------- .../template/en/default/pages/etiquette.html.tmpl | 8 +- .../en/default/pages/user_activity.html.tmpl | 16 +- extensions/BMO/web/js/sorttable.js | 162 ++++++++++----------- extensions/BMO/web/js/swag.js | 38 ++--- 6 files changed, 128 insertions(+), 231 deletions(-) (limited to 'extensions/BMO') diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index e8b8e5173..3de85dbec 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -302,9 +302,10 @@ sub bugmail_recipients { if (@$diffs) { # Changed bug foreach my $ref (@$diffs) { - my ($who, $whoname, $what, $when, - $old, $new, $attachid, $fieldname) = (@$ref); - + my $old = $ref->{old}; + my $new = $ref->{new}; + my $fieldname = $ref->{field_name}; + if ($fieldname eq "bug_group") { _cc_if_special_group($old, $recipients); _cc_if_special_group($new, $recipients); diff --git a/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl b/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl index 35f086abf..ccf008a38 100644 --- a/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl @@ -19,123 +19,19 @@ # Contributor(s): Matthew Tuck #%] -[%# Migration note: this file corresponds to the old Param - # 'entryheaderhtml' - #%] - -[%# You can make the output of this template product-specific by using - # Template Toolkit IF statements. The current product name is stored in - # the 'product' variable. - #%] - [% PROCESS global/variables.none.tmpl %] -[% IF product == "Bugzilla" %] - [% IF format == "guided" %] -

- - -
- -Are you here because you have a problem with -Firefox or -Thunderbird?
-If so, you're in the wrong place.

- -If you are having a problem with Firefox, -file -your [% terms.bug %] in the Firefox product.
- -If you are having a problem with Thunderbird, -file -your [% terms.bug %] in the Thunderbird product.
- -If none of those is a good fit for your [% terms.bug %], you can pick from -the full product list. -
- -

- -

Step 0 - Make sure you are in the right place

- - [% END %] - -

-The product you have chosen is for [% terms.bug %] reports and enhancement requests for the -[% terms.Bugzilla +%] [%+ terms.bug %] tracking software only. -If your [% terms.bug %] is not reporting that [% terms.Bugzilla %] is broken or that you'd like -a new feature in [% terms.Bugzilla %], your [% terms.bug %] report does not belong in this product. -[% IF format == "guided" %] - See the instructions next to the stop sign above. -[% ELSE %] - Please choose a different product. -[% END %] -

- -

We WILL NOT accept [% terms.bug %] reports for [% terms.Bugzilla %] -installed via the Debian packaging system. If you obtained [% terms.Bugzilla %] from Debian, -please visit the Debian Support page, -or file a [% terms.bug %] on the Debian -[% terms.Bug %] Tracker. The Debian package maintainer will then determine whether the [% terms.bug %] -is specific to the package or not, and can move the [% terms.bug %] "upstream" if needed.

- -

-[% terms.Bugs %] specific to bugzilla.mozilla.org, rather than the [% terms.Bugzilla %] software in -general (which is used by many sites), should be filed in the -mozilla.org product. -

- -

-Please do not file test [% terms.bugs %] or support requests here! You -can test [% terms.Bugzilla %] at -landfill.bugzilla.org and ask -for support in the - -mozilla.support.bugzilla newsgroup, - -support-bugzilla@lists.mozilla.org mailing list, or -#mozwebtools IRC channel. -

- -
- -[% ELSE %] - - [% IF format != "guided" %] -

-[% UNLESS cloned_bug_id %] -Consider using the - -[% terms.Bugzilla %] Helper instead of this form. -[% END +%] -Before reporting a [% terms.bug %], make sure you've read our - -[% terms.bug %] writing guidelines and double checked that your [% terms.bug %] hasn't already -been reported. Consult our list of - -most frequently reported [% terms.bugs %] and -search through descriptions -of previously reported [% terms.bugs %]. -

- [% ELSE %]

- This form prompts you for the information required to - file a good [% terms.bug %] report (or enhancement request.) - It may seem lengthy, but developers need all this information - to understand and reproduce the [% terms.bug %], which is the first step towards - fixing it. Please note that we do not accept [% terms.bug %] reports by - email - please do not email developers or mozilla.org staff - with [% terms.bug %] reports. Also, please do not - file [% terms.bugs %] on browser/email software older than two weeks - first, - download a newer build of - Firefox, - Thunderbird, - SeaMonkey, - or - Camino - and check that the problem is still present. - + [% UNLESS cloned_bug_id %] + Consider using the + + [%+ terms.Bugzilla %] Helper instead of this form. + [% END +%] + Before reporting a [% terms.bug %], make sure you've read our + + [% terms.bug %] writing guidelines and double checked that your [% terms.bug %] hasn't already + been reported. Consult our list of + most frequently reported [% terms.bugs %] and + search through descriptions of previously reported [% terms.bugs %].

- [% END %] -[% END %] diff --git a/extensions/BMO/template/en/default/pages/etiquette.html.tmpl b/extensions/BMO/template/en/default/pages/etiquette.html.tmpl index 8bccaea9d..23302cbb5 100644 --- a/extensions/BMO/template/en/default/pages/etiquette.html.tmpl +++ b/extensions/BMO/template/en/default/pages/etiquette.html.tmpl @@ -20,16 +20,16 @@ # Gervase Markham #%] -[% INCLUDE global/header.html.tmpl - title = "$terms.Bugzilla Etiquette" +[% PROCESS global/header.html.tmpl + title = "Bugzilla Etiquette" style = "li { margin: 5px } .heading { font-weight: bold }" %]

There's a number of faux pas you can commit when using - [% terms.Bugzilla %]. At the very + [%+ terms.Bugzilla %]. At the very least, these will make Mozilla contributors upset at you; if committed enough times they will cause those contributors to demand the disabling of your - [% terms.Bugzilla %] account. So, ignore this advice at your peril. + [%+ terms.Bugzilla %] account. So, ignore this advice at your peril.

diff --git a/extensions/BMO/template/en/default/pages/user_activity.html.tmpl b/extensions/BMO/template/en/default/pages/user_activity.html.tmpl index 6982148cd..3e6695484 100644 --- a/extensions/BMO/template/en/default/pages/user_activity.html.tmpl +++ b/extensions/BMO/template/en/default/pages/user_activity.html.tmpl @@ -144,7 +144,7 @@ [% END %] [% IF change.attachid %] - Attachment #[% change.attachid FILTER html %] @@ -164,7 +164,7 @@ [% END %]

- + Show as a [% terms.Bug %] List

@@ -204,16 +204,16 @@ [% BLOCK sort_when_link %] When [% END %] [% BLOCK sort_bug_link %] [% terms.Bug %] [% END %] diff --git a/extensions/BMO/web/js/sorttable.js b/extensions/BMO/web/js/sorttable.js index 1703a06ae..33b35de88 100644 --- a/extensions/BMO/web/js/sorttable.js +++ b/extensions/BMO/web/js/sorttable.js @@ -588,66 +588,66 @@ window.onload = sorttable.init; // http://dean.edwards.name/weblog/2005/10/add-event/ function dean_addEvent(element, type, handler) { - if (element.addEventListener) { - element.addEventListener(type, handler, false); - } else { - // assign each event handler a unique ID - if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++; - // create a hash table of event types for the element - if (!element.events) element.events = {}; - // create a hash table of event handlers for each element/event pair - var handlers = element.events[type]; - if (!handlers) { - handlers = element.events[type] = {}; - // store the existing event handler (if there is one) - if (element["on" + type]) { - handlers[0] = element["on" + type]; - } - } - // store the event handler in the hash table - handlers[handler.$$guid] = handler; - // assign a global event handler to do all the work - element["on" + type] = handleEvent; - } + if (element.addEventListener) { + element.addEventListener(type, handler, false); + } else { + // assign each event handler a unique ID + if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++; + // create a hash table of event types for the element + if (!element.events) element.events = {}; + // create a hash table of event handlers for each element/event pair + var handlers = element.events[type]; + if (!handlers) { + handlers = element.events[type] = {}; + // store the existing event handler (if there is one) + if (element["on" + type]) { + handlers[0] = element["on" + type]; + } + } + // store the event handler in the hash table + handlers[handler.$$guid] = handler; + // assign a global event handler to do all the work + element["on" + type] = handleEvent; + } }; // a counter used to create unique IDs dean_addEvent.guid = 1; function removeEvent(element, type, handler) { - if (element.removeEventListener) { - element.removeEventListener(type, handler, false); - } else { - // delete the event handler from the hash table - if (element.events && element.events[type]) { - delete element.events[type][handler.$$guid]; - } - } + if (element.removeEventListener) { + element.removeEventListener(type, handler, false); + } else { + // delete the event handler from the hash table + if (element.events && element.events[type]) { + delete element.events[type][handler.$$guid]; + } + } }; function handleEvent(event) { - var returnValue = true; - // grab the event object (IE uses a global event object) - event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event); - // get a reference to the hash table of event handlers - var handlers = this.events[event.type]; - // execute each event handler - for (var i in handlers) { - this.$$handleEvent = handlers[i]; - if (this.$$handleEvent(event) === false) { - returnValue = false; - } - } - return returnValue; + var returnValue = true; + // grab the event object (IE uses a global event object) + event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event); + // get a reference to the hash table of event handlers + var handlers = this.events[event.type]; + // execute each event handler + for (var i in handlers) { + this.$$handleEvent = handlers[i]; + if (this.$$handleEvent(event) === false) { + returnValue = false; + } + } + return returnValue; }; function fixEvent(event) { - // add W3C standard event methods - event.preventDefault = fixEvent.preventDefault; - event.stopPropagation = fixEvent.stopPropagation; - return event; + // add W3C standard event methods + event.preventDefault = fixEvent.preventDefault; + event.stopPropagation = fixEvent.stopPropagation; + return event; }; fixEvent.preventDefault = function() { - this.returnValue = false; + this.returnValue = false; }; fixEvent.stopPropagation = function() { this.cancelBubble = true; @@ -655,55 +655,55 @@ fixEvent.stopPropagation = function() { // Dean's forEach: http://dean.edwards.name/base/forEach.js /* - forEach, version 1.0 - Copyright 2006, Dean Edwards - License: http://www.opensource.org/licenses/mit-license.php + forEach, version 1.0 + Copyright 2006, Dean Edwards + License: http://www.opensource.org/licenses/mit-license.php */ // array-like enumeration if (!Array.forEach) { // mozilla already supports this - Array.forEach = function(array, block, context) { - for (var i = 0; i < array.length; i++) { - block.call(context, array[i], i, array); - } - }; + Array.forEach = function(array, block, context) { + for (var i = 0; i < array.length; i++) { + block.call(context, array[i], i, array); + } + }; } // generic enumeration Function.prototype.forEach = function(object, block, context) { - for (var key in object) { - if (typeof this.prototype[key] == "undefined") { - block.call(context, object[key], key, object); - } - } + for (var key in object) { + if (typeof this.prototype[key] == "undefined") { + block.call(context, object[key], key, object); + } + } }; // character enumeration String.forEach = function(string, block, context) { - Array.forEach(string.split(""), function(chr, index) { - block.call(context, chr, index, string); - }); + Array.forEach(string.split(""), function(chr, index) { + block.call(context, chr, index, string); + }); }; // globally resolve forEach enumeration var forEach = function(object, block, context) { - if (object) { - var resolve = Object; // default - if (object instanceof Function) { - // functions have a "length" property - resolve = Function; - } else if (object.forEach instanceof Function) { - // the object implements a custom forEach method so use that - object.forEach(block, context); - return; - } else if (typeof object == "string") { - // the object is a string - resolve = String; - } else if (typeof object.length == "number") { - // the object is array-like - resolve = Array; - } - resolve.forEach(object, block, context); - } + if (object) { + var resolve = Object; // default + if (object instanceof Function) { + // functions have a "length" property + resolve = Function; + } else if (object.forEach instanceof Function) { + // the object implements a custom forEach method so use that + object.forEach(block, context); + return; + } else if (typeof object == "string") { + // the object is a string + resolve = String; + } else if (typeof object.length == "number") { + // the object is array-like + resolve = Array; + } + resolve.forEach(object, block, context); + } }; diff --git a/extensions/BMO/web/js/swag.js b/extensions/BMO/web/js/swag.js index 47886b2a9..cd9561b54 100644 --- a/extensions/BMO/web/js/swag.js +++ b/extensions/BMO/web/js/swag.js @@ -19,42 +19,42 @@ function evalToNumberString(numberString) { function getTotal(item_array) { var total = 0; for(var i in item_array) { - total += evalToNumber(document.getElementById(item_array[i]).value); + total += evalToNumber(document.getElementById(item_array[i]).value); } return total; } function calculateTotalSwag() { document.getElementById('Totalswag').value = - getTotal( new Array('Lanyards', - 'Stickers', - 'Bracelets', - 'Tattoos', - 'Buttons', - 'Posters')); + getTotal( new Array('Lanyards', + 'Stickers', + 'Bracelets', + 'Tattoos', + 'Buttons', + 'Posters')); } function calculateTotalMensShirts() { document.getElementById('mens_total').value = - getTotal( new Array('mens_s', - 'mens_m', - 'mens_l', - 'mens_xl', - 'mens_xxl', - 'mens_xxxl')); + getTotal( new Array('mens_s', + 'mens_m', + 'mens_l', + 'mens_xl', + 'mens_xxl', + 'mens_xxxl')); } function calculateTotalWomensShirts() { document.getElementById('womens_total').value = - getTotal( new Array('womens_s', - 'womens_m', - 'womens_l', - 'womens_xl', - 'womens_xxl', - 'womens_xxxl')); + getTotal( new Array('womens_s', + 'womens_m', + 'womens_l', + 'womens_xl', + 'womens_xxl', + 'womens_xxxl')); } -- cgit v1.2.3-24-g4f1b