Bug 150829 - 'My Votes' link missing from footer

r=myk, jouni
parent 2a609ad5
...@@ -157,7 +157,8 @@ sub show_bug { ...@@ -157,7 +157,8 @@ sub show_bug {
$bug{'milestoneurl'} = $::milestoneurl{$bug{'product'}} || $bug{'milestoneurl'} = $::milestoneurl{$bug{'product'}} ||
"notargetmilestone.html"; "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 # Add additional, calculated fields to the bug hash
if (@::legal_keywords) { if (@::legal_keywords) {
......
...@@ -400,6 +400,11 @@ DefParam("usedependencies", ...@@ -400,6 +400,11 @@ DefParam("usedependencies",
"b", "b",
1); 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("usebugaliases", DefParam("usebugaliases",
"Do you wish to use bug aliases, which allow you to assign bugs "Do you wish to use bug aliases, which allow you to assign bugs
an easy-to-remember name by which you can refer to them?", an easy-to-remember name by which you can refer to them?",
......
...@@ -469,7 +469,6 @@ sub GenerateVersionTable { ...@@ -469,7 +469,6 @@ sub GenerateVersionTable {
my $mpart = $dotargetmilestone ? ", milestoneurl" : ""; my $mpart = $dotargetmilestone ? ", milestoneurl" : "";
SendSQL("select product, description, votesperuser, disallownew$mpart from products ORDER BY product"); SendSQL("select product, description, votesperuser, disallownew$mpart from products ORDER BY product");
$::anyvotesallowed = 0;
while (@line = FetchSQLData()) { while (@line = FetchSQLData()) {
my ($p, $d, $votesperuser, $dis, $u) = (@line); my ($p, $d, $votesperuser, $dis, $u) = (@line);
$::proddesc{$p} = $d; $::proddesc{$p} = $d;
...@@ -480,9 +479,6 @@ sub GenerateVersionTable { ...@@ -480,9 +479,6 @@ sub GenerateVersionTable {
$::milestoneurl{$p} = $u; $::milestoneurl{$p} = $u;
} }
$::prodmaxvotes{$p} = $votesperuser; $::prodmaxvotes{$p} = $votesperuser;
if ($votesperuser > 0) {
$::anyvotesallowed = 1;
}
} }
my $cols = LearnAboutColumns("bugs"); my $cols = LearnAboutColumns("bugs");
...@@ -551,7 +547,6 @@ sub GenerateVersionTable { ...@@ -551,7 +547,6 @@ sub GenerateVersionTable {
print FID GenerateCode('%::proddesc'); print FID GenerateCode('%::proddesc');
print FID GenerateCode('@::enterable_products'); print FID GenerateCode('@::enterable_products');
print FID GenerateCode('%::prodmaxvotes'); print FID GenerateCode('%::prodmaxvotes');
print FID GenerateCode('$::anyvotesallowed');
if ($dotargetmilestone) { if ($dotargetmilestone) {
# reading target milestones in from the database - matthew@zeroknowledge.com # reading target milestones in from the database - matthew@zeroknowledge.com
...@@ -1763,8 +1758,6 @@ $::vars = ...@@ -1763,8 +1758,6 @@ $::vars =
# User Agent - useful for detecting in templates # User Agent - useful for detecting in templates
'user_agent' => $ENV{'HTTP_USER_AGENT'} , 'user_agent' => $ENV{'HTTP_USER_AGENT'} ,
'use_votes' => $::anyvotesallowed,
}; };
1; 1;
...@@ -23,7 +23,6 @@ require "CGI.pl"; ...@@ -23,7 +23,6 @@ require "CGI.pl";
# Shut up "Used Only Once" errors # Shut up "Used Only Once" errors
use vars qw( use vars qw(
$anyvotesallowed
$template $template
$vars $vars
); );
...@@ -31,15 +30,11 @@ use vars qw( ...@@ -31,15 +30,11 @@ use vars qw(
ConnectToDatabase(); ConnectToDatabase();
quietly_check_login(); quietly_check_login();
# Needed for $::anyvotesallowed
GetVersionTable();
############################################################################### ###############################################################################
# Main Body Execution # Main Body Execution
############################################################################### ###############################################################################
$vars->{'username'} = $::COOKIE{'Bugzilla_login'} || ''; $vars->{'username'} = $::COOKIE{'Bugzilla_login'} || '';
$vars->{'anyvotesallowed'} = $::anyvotesallowed;
if (defined $::COOKIE{'Bugzilla_login'}) { if (defined $::COOKIE{'Bugzilla_login'}) {
SendSQL("SELECT mybugslink, userid, blessgroupset FROM profiles " . SendSQL("SELECT mybugslink, userid, blessgroupset FROM profiles " .
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
# The keys used in this template are # The keys used in this template are
# tweakparams, editcomponents, creategroups, editkeywords, confirm, # tweakparams, editcomponents, creategroups, editkeywords, confirm,
# editbugs, editusers. # editbugs, editusers.
# use_votes: boolean. True if we are using votes.
#%] #%]
[%# Migration note: this whole file corresponds to the old %commandmenu% [%# Migration note: this whole file corresponds to the old %commandmenu%
...@@ -52,7 +51,7 @@ ...@@ -52,7 +51,7 @@
<a href="reports.cgi">Reports</a> <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> | <a href="votes.cgi?action=show_user">My Votes</a>
[% END %] [% END %]
</td> </td>
......
...@@ -93,7 +93,7 @@ function normal_keypress_handler( aEvent ) { ...@@ -93,7 +93,7 @@ function normal_keypress_handler( aEvent ) {
[%- IF mybugsurl %] [%- IF mybugsurl %]
<text class="text-link" onclick="load_relative_url('[% mybugsurl FILTER html %]')" value="my bugs"/> <text class="text-link" onclick="load_relative_url('[% mybugsurl FILTER html %]')" value="my bugs"/>
[%- END %] [%- END %]
[%- IF anyvotesallowed %] [%- IF Param('usevotes') %]
<text class="text-link" onclick="load_relative_url('votes.cgi?action=show_user')" value="my votes"/> <text class="text-link" onclick="load_relative_url('votes.cgi?action=show_user')" value="my votes"/>
[%- END %] [%- END %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment