$bug{'milestoneurl'} = $::milestoneurl{$bug{'product'}} ||
"notargetmilestone.html";
- $vars->{'use_votes'} = $::prodmaxvotes{$bug{'product'}};
+ $vars->{'use_votes'} = Param('usevotes')
+ && $::prodmaxvotes{$bug{'product'}} > 0;
# Add additional, calculated fields to the bug hash
if (@::legal_keywords) {
"b",
1);
+DefParam("usevotes",
+ "Do you wish to allow users to vote for bugs? Note that in order for this to be effective, you will have to change the maximum votes allowed in a product to be non-zero in <a href=\"editproducts.cgi\">the product edit page</a>.",
+ "b",
+ 1);
+
DefParam("webdotbase",
"It is possible to show graphs of dependent bugs. You may set this parameter to
any of the following:
my $mpart = $dotargetmilestone ? ", milestoneurl" : "";
SendSQL("select product, description, votesperuser, disallownew$mpart from products ORDER BY product");
- $::anyvotesallowed = 0;
while (@line = FetchSQLData()) {
my ($p, $d, $votesperuser, $dis, $u) = (@line);
$::proddesc{$p} = $d;
$::milestoneurl{$p} = $u;
}
$::prodmaxvotes{$p} = $votesperuser;
- if ($votesperuser > 0) {
- $::anyvotesallowed = 1;
- }
}
my $cols = LearnAboutColumns("bugs");
print FID GenerateCode('%::proddesc');
print FID GenerateCode('@::enterable_products');
print FID GenerateCode('%::prodmaxvotes');
- print FID GenerateCode('$::anyvotesallowed');
if ($dotargetmilestone) {
# reading target milestones in from the database - matthew@zeroknowledge.com
# User Agent - useful for detecting in templates
'user_agent' => $ENV{'HTTP_USER_AGENT'} ,
-
- 'use_votes' => $::anyvotesallowed,
};
1;
# Shut up "Used Only Once" errors
use vars qw(
- $anyvotesallowed
$template
$vars
);
ConnectToDatabase();
quietly_check_login();
-# Needed for $::anyvotesallowed
-GetVersionTable();
-
###############################################################################
# Main Body Execution
###############################################################################
$vars->{'username'} = $::COOKIE{'Bugzilla_login'} || '';
-$vars->{'anyvotesallowed'} = $::anyvotesallowed;
if (defined $::COOKIE{'Bugzilla_login'}) {
SendSQL("SELECT mybugslink, userid, blessgroupset FROM profiles " .
# The keys used in this template are
# tweakparams, editcomponents, creategroups, editkeywords, confirm,
# editbugs, editusers.
- # use_votes: boolean. True if we are using votes.
#%]
[%# Migration note: this whole file corresponds to the old %commandmenu%
<a href="reports.cgi">Reports</a>
- [% IF user.login AND use_votes %]
+ [% IF user.login && Param('usevotes') %]
| <a href="votes.cgi?action=show_user">My Votes</a>
[% END %]
</td>
[%- IF mybugsurl %]
<text class="text-link" onclick="load_relative_url('[% mybugsurl FILTER html %]')" value="my bugs"/>
[%- END %]
- [%- IF anyvotesallowed %]
+ [%- IF Param('usevotes') %]
<text class="text-link" onclick="load_relative_url('votes.cgi?action=show_user')" value="my votes"/>
[%- END %]