Bug 378797: Ability to turn "My votes" page into a bug list - Patch by GavinS <bugzilla@chimpychompy.org> r/a=LpSolit

This commit is contained in:
lpsolit%gmail.com 2008-02-03 11:37:23 +00:00
Родитель fbe71eb1dc
Коммит 01a2d3c3c5
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -25,6 +25,7 @@
# voting: # voting:
# name: name of product # name: name of product
# bugs: list of bugs the user has voted for # bugs: list of bugs the user has voted for
# bug_ids: list of bug ids the user has voted for
# onevoteonly: one or more votes allowed per bug? # onevoteonly: one or more votes allowed per bug?
# total: users current vote count for the product # total: users current vote count for the product
# maxvotes: max votes allowed for a user in this product # maxvotes: max votes allowed for a user in this product
@ -33,6 +34,8 @@
# bug_id: number; if the user is voting for a bug, this is the bug id # bug_id: number; if the user is voting for a bug, this is the bug id
# #
# canedit: boolean; Should the votes be presented in a form, or readonly? # canedit: boolean; Should the votes be presented in a form, or readonly?
#
# all_bug_ids: List of all bug ids the user has voted for, across all products
#%] #%]
[% PROCESS global/variables.none.tmpl %] [% PROCESS global/variables.none.tmpl %]
@ -89,7 +92,10 @@
[% END %] [% END %]
<tr> <tr>
<th>[% product.name FILTER html %]</th> <th>[% product.name FILTER html %]</th>
<td colspan="3"> <td colspan="2" ><a href="buglist.cgi?bug_id=
[%- product.bug_ids.join(",") FILTER url_quote %]">([% terms.bug %] list)</a>
</td>
<td>
[% IF product.maxperbug < product.maxvotes AND [% IF product.maxperbug < product.maxvotes AND
product.maxperbug > 1 %] product.maxperbug > 1 %]
<font size="-1"> <font size="-1">
@ -142,7 +148,9 @@
</table> </table>
[% IF canedit %] [% IF canedit %]
<input type="submit" value="Change My Votes" id="change"> <input type="submit" value="Change My Votes" id="change"> or
<a href="buglist.cgi?bug_id=[% all_bug_ids.join(",") FILTER url_quote %]">view all
as [% terms.bug %] list</a>
<br> <br>
<br> <br>
To change your votes, To change your votes,
@ -154,6 +162,9 @@
change the checkbox change the checkbox
[% END %] [% END %]
and then click <b>Change My Votes</b>. and then click <b>Change My Votes</b>.
[% ELSE %]
<a href="buglist.cgi?bug_id=[% all_bug_ids.join(",") FILTER url_quote %]">View all
as [% terms.bug %] list</a>
[% END %] [% END %]
</form> </form>
[% ELSE %] [% ELSE %]

Просмотреть файл

@ -144,6 +144,7 @@ sub show_user {
} }
} }
my @all_bug_ids;
my @products; my @products;
my $products = $user->get_selectable_products; my $products = $user->get_selectable_products;
# Read the votes data for this user for each product. # Read the votes data for this user for each product.
@ -151,6 +152,7 @@ sub show_user {
next unless ($product->votes_per_user > 0); next unless ($product->votes_per_user > 0);
my @bugs; my @bugs;
my @bug_ids;
my $total = 0; my $total = 0;
my $onevoteonly = 0; my $onevoteonly = 0;
@ -178,6 +180,8 @@ sub show_user {
push (@bugs, { id => $id, push (@bugs, { id => $id,
summary => $summary, summary => $summary,
count => $count }); count => $count });
push (@bug_ids, $id);
push (@all_bug_ids, $id);
} }
$onevoteonly = 1 if (min($product->votes_per_user, $onevoteonly = 1 if (min($product->votes_per_user,
@ -187,6 +191,7 @@ sub show_user {
if ($#bugs > -1) { if ($#bugs > -1) {
push (@products, { name => $product->name, push (@products, { name => $product->name,
bugs => \@bugs, bugs => \@bugs,
bug_ids => \@bug_ids,
onevoteonly => $onevoteonly, onevoteonly => $onevoteonly,
total => $total, total => $total,
maxvotes => $product->votes_per_user, maxvotes => $product->votes_per_user,
@ -201,6 +206,7 @@ sub show_user {
$vars->{'voting_user'} = { "login" => $name }; $vars->{'voting_user'} = { "login" => $name };
$vars->{'products'} = \@products; $vars->{'products'} = \@products;
$vars->{'bug_id'} = $bug_id; $vars->{'bug_id'} = $bug_id;
$vars->{'all_bug_ids'} = \@all_bug_ids;
print $cgi->header(); print $cgi->header();
$template->process("bug/votes/list-for-user.html.tmpl", $vars) $template->process("bug/votes/list-for-user.html.tmpl", $vars)