SendSQL("select profiles.login_name, votes.who, votes.count from votes, profiles where votes.bug_id = ".SqlQuote($id)." and profiles.userid = votes.who");
print"<table>\n";
print"<tr><th>Who</th><th>Number of votes</th></tr>\n";
# Oh, boy, what a hack. Make sure there is an entry for this bug
# in the vote table, just so that things display right.
# Yuck yuck yuck.###
SendSQL("select votes.count from votes where votes.bug_id = $::FORM{'voteon'} and votes.who = $who");
if(!MoreSQLData()){
SendSQL("insert into votes (who, bug_id, count) values ($who, $::FORM{'voteon'}, 0)");
}
}
my$canedit=(defined$::COOKIE{'Bugzilla_login'}&&
$::COOKIE{'Bugzilla_login'}eq$name);
my%maxvotesperbug;
if($canedit){
SendSQL("SELECT products.product, products.maxvotesperbug FROM products");
while(MoreSQLData()){
my($prod,$max)=(FetchSQLData());
$maxvotesperbug{$prod}=$max;
}
}
foreachmy$product(sort(keys(%::prodmaxvotes))){
if($::prodmaxvotes{$product}<=0){
next;
}
my$qprod=value_quote($product);
SendSQL("select votes.bug_id, votes.count, bugs.short_desc, bugs.bug_status from votes, bugs where votes.who = $who and votes.bug_id = bugs.bug_id and bugs.product = ".SqlQuote($product)."order by votes.bug_id");
nextif!MoreSQLData();# don't show products without any votes