summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Bug.pm25
-rw-r--r--Bugzilla/Constants.pm2
-rw-r--r--Bugzilla/Field.pm2
-rw-r--r--extensions/BMO/Extension.pm13
-rw-r--r--extensions/BMO/lib/Data.pm17
-rw-r--r--extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl10
-rw-r--r--extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl11
-rw-r--r--extensions/BMO/web/styles/edit_bug.css40
-rw-r--r--template/en/default/bug/field.html.tmpl4
-rw-r--r--template/en/default/global/field-descs.none.tmpl1
-rw-r--r--template/en/default/global/user-error.html.tmpl6
11 files changed, 100 insertions, 31 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 7d47e9bb5..e1f533274 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -179,6 +179,9 @@ sub VALIDATORS {
elsif ($field->type == FIELD_TYPE_BUG_ID) {
$validator = \&_check_bugid_field;
}
+ elsif ($field->type == FIELD_TYPE_INTEGER) {
+ $validator = \&_check_integer_field;
+ }
else {
$validator = \&_check_default_field;
}
@@ -2251,6 +2254,28 @@ sub _check_bugid_field {
return $checked_id;
}
+sub _check_integer_field {
+ my ($invocant, $value, $field) = @_;
+ $value = defined($value) ? trim($value) : '';
+
+ # BMO - allow empty values
+ if ($value eq '') {
+ return undef;
+ }
+
+ my $orig_value = $value;
+ if (!detaint_signed($value)) {
+ ThrowUserError("number_not_integer",
+ {field => $field, num => $orig_value});
+ }
+ elsif ($value > MAX_INT_32) {
+ ThrowUserError("number_too_large",
+ {field => $field, num => $orig_value, max_num => MAX_INT_32});
+ }
+
+ return $value;
+}
+
sub _check_relationship_loop {
# Generates a dependency tree for a given bug. Calls itself recursively
# to generate sub-trees for the bug's dependencies.
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 6e0a9c7d3..ad507c2ca 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -135,6 +135,7 @@ use Memoize;
FIELD_TYPE_BUG_ID
FIELD_TYPE_BUG_URLS
FIELD_TYPE_KEYWORDS
+ FIELD_TYPE_INTEGER
FIELD_TYPE_EXTENSION
FIELD_TYPE_HIGHEST_PLUS_ONE
@@ -437,6 +438,7 @@ use constant FIELD_TYPE_BUG_ID => 6;
use constant FIELD_TYPE_BUG_URLS => 7;
use constant FIELD_TYPE_KEYWORDS => 8;
use constant FIELD_TYPE_DATE => 9;
+use constant FIELD_TYPE_INTEGER => 10;
use constant FIELD_TYPE_EXTENSION => 99;
# Add new field types above this line, and change the below value in the
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index 86811d9bc..84e2a1bfe 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -165,6 +165,8 @@ use constant SQL_DEFINITIONS => {
FIELD_TYPE_DATETIME, { TYPE => 'DATETIME' },
FIELD_TYPE_DATE, { TYPE => 'DATE' },
FIELD_TYPE_BUG_ID, { TYPE => 'INT3' },
+ # BMO : allow integer fields to be NULL
+ FIELD_TYPE_INTEGER, { TYPE => 'INT4' },
};
# Field definitions for the fields that ship with Bugzilla.
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 75ca30d8d..97e31796c 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -834,6 +834,19 @@ sub install_update_db {
# remove tables from the old TryAutoLand extension
$dbh->bz_drop_table('autoland_branches');
$dbh->bz_drop_table('autoland_attachments');
+
+ unless (Bugzilla::Field->new({ name => 'cf_rank' })) {
+ Bugzilla::Field->create({
+ name => 'cf_rank',
+ description => 'Rank',
+ type => FIELD_TYPE_INTEGER,
+ mailhead => 0,
+ enter_bug => 0,
+ obsolete => 0,
+ custom => 1,
+ buglist => 1,
+ });
+ }
}
sub _last_closed_date {
diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm
index bc205de19..521f585d9 100644
--- a/extensions/BMO/lib/Data.pm
+++ b/extensions/BMO/lib/Data.pm
@@ -49,7 +49,7 @@ tie(%$cf_visible_in_products, "Tie::IxHash",
"DCOps",
],
},
- qw/^cf_office$/ => {
+ qr/^cf_office$/ => {
"mozilla.org" => ["Server Operations: Desktop Issues"],
},
qr/^cf_crash_signature$/ => {
@@ -86,7 +86,7 @@ tie(%$cf_visible_in_products, "Tie::IxHash",
"Thunderbird" => [],
"Toolkit" => [],
},
- qw/^cf_due_date$/ => {
+ qr/^cf_due_date$/ => {
"bugzilla.mozilla.org" => [],
"Community Building" => [],
"Data & BI Services Team" => [],
@@ -98,16 +98,20 @@ tie(%$cf_visible_in_products, "Tie::IxHash",
"Mozilla PR" => [],
"Mozilla Reps" => [],
},
- qw/^cf_locale$/ => {
+ qr/^cf_locale$/ => {
"Mozilla Localizations" => ['Other'],
"www.mozilla.org" => [],
},
- qw/^cf_mozilla_project$/ => {
+ qr/^cf_mozilla_project$/ => {
"Data & BI Services Team" => [],
},
- qw/^cf_machine_state$/ => {
+ qr/^cf_machine_state$/ => {
"Release Engineering" => ["Buildduty"],
},
+ qr/^cf_rank$/ => {
+ "Loop" => [],
+ "Firefox" => [],
+ },
);
# Who to CC on particular bugmails when certain groups are added or removed.
@@ -124,7 +128,8 @@ our %group_change_notification = (
# Who can set custom flags (use full field names only, not regex's)
our $cf_setters = {
- 'cf_colo_site' => ['infra', 'build'],
+ 'cf_colo_site' => [ 'infra', 'build' ],
+ 'cf_rank' => [ 'rank-setters' ],
};
# Groups in which you can always file a bug, regardless of product or user.
diff --git a/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl b/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl
index d7c0d58a8..5260a6c7a 100644
--- a/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl
@@ -74,3 +74,13 @@
}
});
</script>
+
+[% UNLESS cf_hidden_in_product('cf_rank', bug.product, bug.component) %]
+ [% IF bug.check_can_change_field('cf_rank', 0, 1) %]
+ <label class="field_label" id="rank_label" for="cf_rank">Rank:</label>
+ <input type="number" id="cf_rank" name="cf_rank" size="3" value="[% bug.cf_rank FILTER html %]">
+ [% ELSIF bug.cf_rank != '' %]
+ <label class="field_label" id="rank_label" for="cf_rank">Rank:</label>
+ <span id="cf_rank">[% bug.cf_rank FILTER html %]</span>
+ [% END %]
+[% END %]
diff --git a/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl b/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
new file mode 100644
index 000000000..6e871f731
--- /dev/null
+++ b/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
@@ -0,0 +1,11 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF field.name == 'cf_rank' %]
+ [% field.hidden = 1 %]
+[% END %]
diff --git a/extensions/BMO/web/styles/edit_bug.css b/extensions/BMO/web/styles/edit_bug.css
index 24212270d..a5dc72d0c 100644
--- a/extensions/BMO/web/styles/edit_bug.css
+++ b/extensions/BMO/web/styles/edit_bug.css
@@ -1,29 +1,12 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the BMO Bugzilla Extension;
- *
- * The Initial Developer of the Original Code is the Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2011 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Byron Jones <glob@mozilla.com>
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * ***** END LICENSE BLOCK *****
- */
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0. */
-#project-flags,
+
+#project-flags,
#custom-flags {
width: auto;
}
@@ -47,3 +30,12 @@
#toggle_comp_desc {
white-space: nowrap;
}
+
+#rank_label {
+ padding-right: 0;
+}
+
+input#cf_rank {
+ text-align: right;
+ width: 3em;
+}
diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl
index 8492b1615..25f49bbd4 100644
--- a/template/en/default/bug/field.html.tmpl
+++ b/template/en/default/bug/field.html.tmpl
@@ -51,11 +51,13 @@
[% Hook.process('start_field_column') %]
[% IF editable %]
[% SWITCH field.type %]
- [% CASE constants.FIELD_TYPE_FREETEXT %]
+ [% CASE [ constants.FIELD_TYPE_FREETEXT
+ constants.FIELD_TYPE_INTEGER ] %]
<input id="[% field.name FILTER html %]" class="text_input"
name="[% field.name FILTER html %]"
value="[% value FILTER html %]" size="40"
maxlength="[% constants.MAX_FREETEXT_LENGTH FILTER none %]"
+ [% ' pattern="\d+"' IF field.type == constants.FIELD_TYPE_INTEGER %]
[% ' aria-required="true"' IF field.is_mandatory %]>
[% CASE [constants.FIELD_TYPE_DATETIME, constants.FIELD_TYPE_DATE] %]
[% size = (field.type == constants.FIELD_TYPE_DATE) ? 10 : 20 %]
diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl
index 6b365b35f..1b8b765bf 100644
--- a/template/en/default/global/field-descs.none.tmpl
+++ b/template/en/default/global/field-descs.none.tmpl
@@ -56,6 +56,7 @@
[% field_types = { ${constants.FIELD_TYPE_UNKNOWN} => "Unknown Type",
${constants.FIELD_TYPE_FREETEXT} => "Free Text",
+ ${constants.FIELD_TYPE_INTEGER} => "Integer",
${constants.FIELD_TYPE_SINGLE_SELECT} => "Drop Down",
${constants.FIELD_TYPE_MULTI_SELECT} => "Multiple-Selection Box",
${constants.FIELD_TYPE_TEXTAREA} => "Large Text Box",
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index c36ae2c4c..938c4d44d 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -1346,6 +1346,12 @@
Either no products have been defined to enter [% terms.bugs %] against or you have not
been given access to any.
+ [% ELSIF error == "number_not_integer" %]
+ [% title = "Integer Value Required" %]
+ The value '[% num FILTER html %]' in the
+ <em>[% field_descs.$field FILTER html %]</em> field
+ is not an integer value (i.e. a whole number).
+
[% ELSIF error == "number_not_numeric" %]
[% title = "Numeric Value Required" %]
The value '[% num FILTER html %]' in the