From b521a0f3775e6598e8174c32b3ec309db96c7817 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" <> Date: Wed, 5 Jan 2000 05:29:51 +0000 Subject: A few months ago, we lost the ability to edit the votes-per-user field in a product. Which meant nobody could turn on or off this feature. Restored the editing ability. --- editproducts.cgi | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'editproducts.cgi') diff --git a/editproducts.cgi b/editproducts.cgi index 5e54813a2..f976a569b 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -72,9 +72,10 @@ sub CheckProduct ($) # Displays the form to edit a products parameters # -sub EmitFormElements ($$$$) +sub EmitFormElements ($$$$$) { - my ($product, $description, $milestoneurl, $disallownew) = @_; + my ($product, $description, $milestoneurl, $disallownew, + $votesperuser) = @_; $product = value_quote($product); $description = value_quote($description); @@ -97,6 +98,10 @@ sub EmitFormElements ($$$$) print " Closed for bug entry:\n"; my $closed = $disallownew ? "CHECKED" : ""; print " \n"; + + print "\n"; + print " Maximum votes per person:\n"; + print " \n"; } @@ -167,7 +172,8 @@ my $localtrailer = "edit more products"; unless ($action) { PutHeader("Select product"); - SendSQL("SELECT products.product,description,disallownew,COUNT(bug_id) + SendSQL("SELECT products.product,description,disallownew, + votesperuser,COUNT(bug_id) FROM products LEFT JOIN bugs ON products.product=bugs.product GROUP BY products.product @@ -176,11 +182,13 @@ unless ($action) { print " Edit product ...\n"; print " Description\n"; print " Status\n"; + print " Votes
per
user\n"; print " Bugs\n"; print " Action\n"; print ""; while ( MoreSQLData() ) { - my ($product, $description, $disallownew, $bugs) = FetchSQLData(); + my ($product, $description, $disallownew, $votesperuser, + $bugs) = FetchSQLData(); $description ||= "missing"; $disallownew = $disallownew ? 'closed' : 'open'; $bugs ||= 'none'; @@ -188,7 +196,8 @@ unless ($action) { print " $product\n"; print " $description\n"; print " $disallownew\n"; - print " $bugs\n"; + print " $votesperuser\n"; + print " $bugs\n"; print " Delete\n"; print ""; } @@ -218,7 +227,7 @@ if ($action eq 'add') { print "
\n"; print "\n"; - EmitFormElements('', '', '', 0); + EmitFormElements('', '', '', 0, 0); print "\n"; print " \n"; @@ -272,15 +281,18 @@ if ($action eq 'new') { my $milestoneurl = trim($::FORM{milestoneurl} || ''); my $disallownew = 0; $disallownew = 1 if $::FORM{disallownew}; + my $votesperuser = $::FORM{votesperuser}; + $votesperuser ||= 0; # Add the new product. SendSQL("INSERT INTO products ( " . - "product, description, milestoneurl, disallownew" . + "product, description, milestoneurl, disallownew, votesperuser" . " ) VALUES ( " . SqlQuote($product) . "," . SqlQuote($description) . "," . SqlQuote($milestoneurl) . "," . - $disallownew . ")" ); + $disallownew . "," . + SqlQuote($votesperuser) . ")" ); SendSQL("INSERT INTO versions ( " . "value, program" . " ) VALUES ( " . @@ -501,15 +513,17 @@ if ($action eq 'edit') { CheckProduct($product); # get data of product - SendSQL("SELECT description,milestoneurl,disallownew + SendSQL("SELECT description,milestoneurl,disallownew,votesperuser FROM products WHERE product=" . SqlQuote($product)); - my ($description, $milestoneurl, $disallownew) = FetchSQLData(); + my ($description, $milestoneurl, $disallownew, $votesperuser) = + FetchSQLData(); print "\n"; print "
Version:
\n"; - EmitFormElements($product, $description, $milestoneurl, $disallownew); + EmitFormElements($product, $description, $milestoneurl, $disallownew, + $votesperuser); print "\n"; print " \n"; @@ -571,6 +585,7 @@ if ($action eq 'edit') { print "\n"; print "\n"; + print "\n"; print "\n"; print "\n"; @@ -598,6 +613,8 @@ if ($action eq 'update') { my $disallownewold = trim($::FORM{disallownewold} || ''); my $milestoneurl = trim($::FORM{milestoneurl} || ''); my $milestoneurlold = trim($::FORM{milestoneurlold} || ''); + my $votesperuser = trim($::FORM{votesperuser} || 0); + my $votesperuserold = trim($::FORM{votesperuserold} || ''); CheckProduct($productold); @@ -637,6 +654,13 @@ if ($action eq 'update') { print "Updated mile stone URL.
\n"; } + if ($votesperuser ne $votesperuserold) { + SendSQL("UPDATE products + SET votesperuser=$votesperuser + WHERE product=" . SqlQuote($productold)); + print "Update votes per user.
\n"; + } + if ($product ne $productold) { unless ($product) { -- cgit v1.2.3-24-g4f1b
Edit components: