summaryrefslogtreecommitdiffstats
path: root/globals.pl
diff options
context:
space:
mode:
authorterry%mozilla.org <>2000-03-22 01:47:04 +0100
committerterry%mozilla.org <>2000-03-22 01:47:04 +0100
commit6b2eec91f21d4aa28e68f18435c8636f377a4b2a (patch)
tree855b795f02d39a7d676949572d872d15bf1e7901 /globals.pl
parentc7ae4f650a612ccf62f68c9894f5a6cd62f464b0 (diff)
downloadbugzilla-6b2eec91f21d4aa28e68f18435c8636f377a4b2a.tar.gz
bugzilla-6b2eec91f21d4aa28e68f18435c8636f377a4b2a.tar.xz
Patch by "Matt Masson" <matthew@zeroknowledge.com> -- allow definition
of different target milestones by product.
Diffstat (limited to 'globals.pl')
-rw-r--r--globals.pl37
1 files changed, 33 insertions, 4 deletions
diff --git a/globals.pl b/globals.pl
index 9a62a2336..7f4a536da 100644
--- a/globals.pl
+++ b/globals.pl
@@ -260,7 +260,23 @@ sub Version_element {
return make_popup("version", $versionlist, $defversion, 1, $onchange);
}
+sub Milestone_element {
+ my ($tm, $prod, $onchange) = (@_);
+ my $tmlist;
+ if (!defined $::target_milestone{$prod}) {
+ $tmlist = [];
+ } else {
+ $tmlist = $::target_milestone{$prod};
+ }
+ my $deftm = $tmlist->[0];
+
+ if (lsearch($tmlist, $tm) >= 0) {
+ $deftm = $tm;
+ }
+
+ return make_popup("target_milestone", $tmlist, $deftm, 1, $onchange);
+}
# Generate a string which, when later interpreted by the Perl compiler, will
# be the same as the given string.
@@ -427,11 +443,24 @@ sub GenerateVersionTable {
print FID GenerateCode('$::anyvotesallowed');
if ($dotargetmilestone) {
- my $last = Param("nummilestones");
- my $i;
- for ($i=1 ; $i<=$last ; $i++) {
- push(@::legal_target_milestone, "M$i");
+ # reading target milestones in from the database - matthew@zeroknowledge.com
+ SendSQL("SELECT value, product FROM milestones ORDER BY sortkey, value");
+ my @line;
+ my %tmarray;
+ @::legal_target_milestone = ();
+ while(@line = FetchSQLData()) {
+ my ($tm, $pr) = (@line);
+ if (!defined $::target_milestone{$pr}) {
+ $::target_milestone{$pr} = [];
+ }
+ push @{$::target_milestone{$pr}}, $tm;
+ if (!exists $tmarray{$tm}) {
+ $tmarray{$tm} = 1;
+ push(@::legal_target_milestone, $tm);
+ }
}
+
+ print FID GenerateCode('%::target_milestone');
print FID GenerateCode('@::legal_target_milestone');
print FID GenerateCode('%::milestoneurl');
}