diff options
author | myk%mozilla.org <> | 2002-04-13 06:01:53 +0200 |
---|---|---|
committer | myk%mozilla.org <> | 2002-04-13 06:01:53 +0200 |
commit | 5c0c85df6d698ad183a88a8794ed0212de2895c1 (patch) | |
tree | 59f323dce2a9803285d9c6f5e68f79eae3b30f5c | |
parent | 452bd0f653a9afea703e637b77b3f1c60b0f5c18 (diff) | |
download | bugzilla-5c0c85df6d698ad183a88a8794ed0212de2895c1.tar.gz bugzilla-5c0c85df6d698ad183a88a8794ed0212de2895c1.tar.xz |
Fix for bug 125660: Templatizes process_bug.cgi.
Patch by Myk Melez <myk@mozilla.org>
r=gerv,bbaetz
-rw-r--r-- | globals.pl | 55 | ||||
-rwxr-xr-x | process_bug.cgi | 417 | ||||
-rw-r--r-- | template/default/global/hidden-fields.html.tmpl | 32 | ||||
-rw-r--r-- | template/default/process/confirm-dupe.html.tmpl | 73 | ||||
-rw-r--r-- | template/default/process/mid-air.html.tmpl | 75 | ||||
-rw-r--r-- | template/default/process/next-bug.html.tmpl | 32 | ||||
-rw-r--r-- | template/default/process/results.html.tmpl | 50 | ||||
-rw-r--r-- | template/default/process/verify-new-product.html.tmpl | 100 |
8 files changed, 519 insertions, 315 deletions
diff --git a/globals.pl b/globals.pl index 249945ad9..560e0c4ae 100644 --- a/globals.pl +++ b/globals.pl @@ -373,61 +373,6 @@ sub lsearch { return -1; } -sub Product_element { - my ($prod,$onchange) = (@_); - return make_popup("product", keys %::versions, $prod, 1, $onchange); -} - -sub Component_element { - my ($comp,$prod,$onchange) = (@_); - my $componentlist; - if (! defined $::components{$prod}) { - $componentlist = []; - } else { - $componentlist = $::components{$prod}; - } - my $defcomponent; - if ($comp ne "" && lsearch($componentlist, $comp) >= 0) { - $defcomponent = $comp; - } else { - $defcomponent = $componentlist->[0]; - } - return make_popup("component", $componentlist, $defcomponent, 1, ""); -} - -sub Version_element { - my ($vers, $prod, $onchange) = (@_); - my $versionlist; - if (!defined $::versions{$prod}) { - $versionlist = []; - } else { - $versionlist = $::versions{$prod}; - } - my $defversion = $versionlist->[0]; - if (lsearch($versionlist,$vers) >= 0) { - $defversion = $vers; - } - return make_popup("version", $versionlist, $defversion, 1, $onchange); -} - -sub Milestone_element { - my ($tm, $prod, $onchange) = (@_); - my $tmlist; - if (!defined $::target_milestone{$prod}) { - $tmlist = []; - } else { - $tmlist = $::target_milestone{$prod}; - } - - my $deftm = $tmlist->[0]; - - if (lsearch($tmlist, $tm) >= 0) { - $deftm = $tm; - } - - return make_popup("target_milestone", $tmlist, $deftm, 1, $onchange); -} - # Generate a string which, when later interpreted by the Perl compiler, will # be the same as the given string. diff --git a/process_bug.cgi b/process_bug.cgi index 561db45e7..fe9163eef 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -22,6 +22,7 @@ # Dan Mosedale <dmose@mozilla.org> # Dave Miller <justdave@syndicomm.com> # Christopher Aillon <christopher@aillon.com> +# Myk Melez <myk@mozilla.org> use diagnostics; use strict; @@ -56,6 +57,8 @@ my $whoid = confirm_login(); my $requiremilestone = 0; +use vars qw($template $vars); + ###################################################################### # Begin Data/Security Validation ###################################################################### @@ -103,7 +106,12 @@ ValidateComment($::FORM{'comment'}); print "Content-type: text/html\n\n"; -PutHeader ("Bug processed"); +# Start displaying the response page. +$vars->{'title'} = "Bug processed"; +$template->process("global/header", $vars) + || ThrowTemplateError($template->error()); + +$vars->{'header_done'} = 1; GetVersionTable(); @@ -135,9 +143,8 @@ sub CheckonComment( $ ) { if( $ret ) { if (!defined $::FORM{'comment'} || $::FORM{'comment'} =~ /^\s*$/) { # No comment - sorry, action not allowed ! - PuntTryAgain("You have to specify a <b>comment</b> on this " . - "change. Please give some words " . - "on the reason for your change."); + ThrowUserError("You have to specify a <b>comment</b> on this change. + Please give some words on the reason for your change."); } else { $ret = 0; } @@ -177,106 +184,34 @@ if ((($::FORM{'id'} && $::FORM{'product'} ne $::oldproduct) $mok = lsearch($::target_milestone{$prod}, $::FORM{'target_milestone'}) >= 0; } - # If anything needs to be verified, generate a form for verifying it. + # If the product-specific fields need to be verified, or we need to verify + # whether or not to add the bugs to their new product's group, display + # a verification form. if (!$vok || !$cok || !$mok || (Param('usebuggroups') && !defined($::FORM{'addtonewgroup'}))) { - - # Start the form. - print qq|<form action="process_bug.cgi" method="post">\n|; - - # Add all form fields to the form as hidden fields (except those - # being verified), so the user's changes are preserved. - foreach my $i (keys %::FORM) { - if ($i ne 'version' && $i ne 'component' && $i ne 'target_milestone') { - print qq|<input type="hidden" name="$i" value="| . value_quote($::FORM{$i}) . qq|">\n|; - } - } - - # Display UI for verifying the version, component, and target milestone fields. + $vars->{'form'} = \%::FORM; + if (!$vok || !$cok || !$mok) { - my ($sectiontitle, $sectiondescription); - if ( Param('usetargetmilestone') ) { - $sectiontitle = "Verify Version, Component, Target Milestone"; - $sectiondescription = qq| - You are moving the bug(s) to the product <b>$prod</b>, and now the - version, component, and/or target milestone fields are not correct - (or perhaps they were not correct in the first place). In any case, - please set the correct version, component, and target milestone now: - |; - } else { - $sectiontitle = "Verify Version, Component"; - $sectiondescription = qq| - You are moving the bug(s) to the product <b>$prod</b>, and now the - version, and component fields are not correct (or perhaps they were - not correct in the first place). In any case, please set the correct - version and component now: - |; + $vars->{'verify_fields'} = 1; + $vars->{'versions'} = $::versions{$prod}; + $vars->{'components'} = $::components{$prod}; + + if (Param("usetargetmilestone")) { + $vars->{'use_target_milestone'} = 1; + $vars->{'milestones'} = $::target_milestone{$prod}; } - - my $versionmenu = Version_element($::FORM{'version'}, $prod); - my $componentmenu = Component_element($::FORM{'component'}, $prod); - - print qq| - <h3>$sectiontitle</h3> - - <p> - $sectiondescription - <p> - - <table><tr> - <td> - <b>Version:</b><br> - $versionmenu - </td> - <td> - <b>Component:</b><br> - $componentmenu - </td> - |; - - if ( Param("usetargetmilestone") ) { - my $milestonemenu = Milestone_element($::FORM{'target_milestone'}, $prod); - print qq| - <td> - <b>Target Milestone:</b><br> - $milestonemenu - </td> - |; + else { + $vars->{'use_target_milestone'} = 0; } - - print qq| - </tr></table> - |; } - - # Display UI for determining whether or not to remove the bug from - # its old product's group and/or add it to its new product's group. - if (Param('usebuggroups') && !defined($::FORM{'addtonewgroup'})) { - print qq| - <h3>Verify Bug Group</h3> - - <p> - Do you want to add the bug to its new product's group (if any)? - </p> - - <p> - <input type="radio" name="addtonewgroup" value="no"><b>no</b><br> - <input type="radio" name="addtonewgroup" value="yes"><b>yes</b><br> - <input type="radio" name="addtonewgroup" value="yesifinold" checked> - <b>yes, but only if the bug was in its old product's group</b><br> - </p> - |; + else { + $vars->{"verify_fields"} = 0; } - - # End the form. - print qq| - <input type="submit" value="Commit"> - </form> - <hr> - <a href="query.cgi">Cancel and Return to the Query Page</a> - |; - - # End the page and stop processing. - PutFooter(); + + $vars->{'verify_bug_group'} = (Param('usebuggroups') + && !defined($::FORM{'addtonewgroup'})); + + $template->process("process/verify-new-product.html.tmpl", $vars) + || ThrowTemplateError($template->error()); exit; } } @@ -355,18 +290,12 @@ sub CheckCanChangeField { return 1; } SendSQL("UNLOCK TABLES"); - $oldvalue = value_quote($oldvalue); - $newvalue = value_quote($newvalue); - print PuntTryAgain(qq{ -Only the owner or submitter of the bug, or a sufficiently -empowered user, may make that change to the $f field. -<TABLE> -<TR><TH ALIGN="right">Old value:</TH><TD>$oldvalue</TD></TR> -<TR><TH ALIGN="right">New value:</TH><TD>$newvalue</TD></TR> -</TABLE> -}); - PutFooter(); - exit(); + $oldvalue = html_quote($oldvalue); + $newvalue = html_quote($newvalue); + ThrowUserError("You tried to change the <strong>$f</strong> field + from <em>$oldvalue</em> to <em>$newvalue</em>, + but only the owner or submitter of the bug, or a + sufficiently empowered user, may change that field."); } # Confirm that the reporter of the current bug can access the bug we are duping to. @@ -390,45 +319,21 @@ sub DuplicateUserConfirm { } SendSQL("SELECT cclist_accessible FROM bugs WHERE bug_id = $original"); - my $cclist_accessible = FetchOneColumn(); + $vars->{'cclist_accessible'} = FetchOneColumn(); # Once in this part of the subroutine, the user has not been auto-validated # and the duper has not chosen whether or not to add to CC list, so let's # ask the duper what he/she wants to do. - # First, will the user gain access to this bug immediately by being CC'd? - my $reporter_access = $cclist_accessible ? "will immediately" : "might, in the future,"; - + $vars->{'form'} = \%::FORM; + $vars->{'original_bug_id'} = $original; + $vars->{'duplicate_bug_id'} = $dupe; + + # Confirm whether or not to add the reporter to the cc: list + # of the original bug (the one this bug is being duped against). print "Content-type: text/html\n\n"; - PutHeader("Duplicate Warning"); - print "<P> -When marking a bug as a duplicate, the reporter of the -duplicate is normally added to the CC list of the original. -The permissions on bug #$original (the original) are currently set -such that the reporter would not normally be able to see it. -<P><B>Adding the reporter to the CC list of bug #$original -$reporter_access allow him/her access to view this bug.</B> -Do you wish to do this?</P> -</P> -"; - print "<form method=post>\n\n"; - - foreach my $i (keys %::FORM) { - # Make sure we don't include the username/password fields in the - # HTML. If cookies are off, they'll have to reauthenticate after - # hitting "submit changes anyway". - # see http://bugzilla.mozilla.org/show_bug.cgi?id=15980 - if ($i !~ /^(Bugzilla|LDAP)_(login|password)$/) { - my $value = value_quote($::FORM{$i}); - print qq{<input type=hidden name="$i" value="$value">\n}; - } - } - - print qq{<p><input type=radio name="confirm_add_duplicate" value="1"> Yes, add the reporter to CC list on bug $original</p>\n}; - print qq{<p><input type=radio name="confirm_add_duplicate" value="0" checked="checked"> No, do not add the reporter to CC list on bug $original</p>\n}; - print qq{\n<p><a href="show_bug.cgi?id=$dupe">Throw away my changes, and go revisit bug $dupe</a>\n}; - print qq{\n<p><input type="submit" value="Submit"></p></form>\n}; - PutFooter(); + $template->process("process/confirm-dupe.html.tmpl", $vars) + || ThrowTemplateError($template->error()); exit; } # end DuplicateUserConfirm() @@ -466,11 +371,6 @@ if ($action eq Param("move-button-text")) { } -# the common updates to all bugs in @idlist start here -# -print "<TITLE>Update Bug " . join(" ", @idlist) . "</TITLE>\n"; -print "<HR>\n"; - $::query = "update bugs\nset"; $::comma = ""; umask(0); @@ -686,10 +586,9 @@ SWITCH: for ($::FORM{'knob'}) { DoComma(); if ( !defined$::FORM{'assigned_to'} || trim($::FORM{'assigned_to'}) eq "") { - PuntTryAgain("You cannot reassign to a bug to nobody. Unless " . - "you intentionally cleared out the " . - "\"Reassign bug to\" field, " . - Param("browserbugmessage")); + ThrowUserError("You cannot reassign to a bug to nobody. Unless you + intentionally cleared out the \"Reassign bug to\" + field, " . Param("browserbugmessage")); } my $newid = DBNameToIdAndCheck($::FORM{'assigned_to'}); $::query .= "assigned_to = $newid"; @@ -697,12 +596,12 @@ SWITCH: for ($::FORM{'knob'}) { }; /^reassignbycomponent$/ && CheckonComment( "reassignbycomponent" ) && do { if ($::FORM{'product'} eq $::dontchange) { - PuntTryAgain("You must specify a product to help determine the " . - "new owner of these bugs."); + ThrowUserError("You must specify a product to help determine + the new owner of these bugs."); } if ($::FORM{'component'} eq $::dontchange) { - PuntTryAgain("You must specify a component whose owner should " . - "get assigned these bugs."); + ThrowUserError("You must specify a component whose owner + should get assigned these bugs."); } if ($::FORM{'compconfirm'}) { DoConfirm(); @@ -752,20 +651,19 @@ SWITCH: for ($::FORM{'knob'}) { SendSQL("SELECT bug_id FROM bugs WHERE bug_id = " . SqlQuote($num)); $num = FetchOneColumn(); if (!$num) { - PuntTryAgain("You must specify a valid bug number of which this bug " . - "is a duplicate. The bug has not been changed.") + ThrowUserError("You must specify a valid bug number of which this bug + is a duplicate. The bug has not been changed.") } if (!defined($::FORM{'id'}) || $num == $::FORM{'id'}) { - PuntTryAgain("Nice try, $::COOKIE{'Bugzilla_login'}. But it doesn't really ". - "make sense to mark a bug as a duplicate of " . - "itself, does it?"); + ThrowUserError("Nice try, $::COOKIE{'Bugzilla_login'}, but it doesn't + really make sense to mark a bug as a duplicate of itself, + does it?"); } my $checkid = trim($::FORM{'id'}); SendSQL("SELECT bug_id FROM bugs where bug_id = " . SqlQuote($checkid)); $checkid = FetchOneColumn(); if (!$checkid) { - PuntTryAgain("The bug id $::FORM{'id'} is invalid. Please reload this bug ". - "and try again."); + ThrowUserError("The bug id $::FORM{'id'} is invalid."); } $::FORM{'comment'} .= "\n\n*** This bug has been marked as a duplicate of $num ***"; $duplicate = $num; @@ -773,14 +671,13 @@ SWITCH: for ($::FORM{'knob'}) { last SWITCH; }; # default - print "Unknown action $::FORM{'knob'}!\n"; - PutFooter(); - exit; + my $escaped_knob = html_quote($::FORM{'knob'}); + ThrowCodeError("Unknown action $escaped_knob!\n"); } if ($#idlist < 0) { - PuntTryAgain("You apparently didn't choose any bugs to modify."); + ThrowUserError("You apparently didn't choose any bugs to modify."); } @@ -794,11 +691,9 @@ if ($::FORM{'keywords'}) { } my $i = GetKeywordIdFromName($keyword); if (!$i) { - PuntTryAgain("Unknown keyword named <code>" . - html_quote($keyword) . "</code>. " . - "<P>The legal keyword names are " . - "<A HREF=describekeywords.cgi>" . - "listed here</A>."); + ThrowUserError("Unknown keyword named <code>" . html_quote($keyword) . + "</code>. <p>The legal keyword names are + <a href=\"describekeywords.cgi\">listed here</a></p>."); } if (!$keywordseen{$i}) { push(@keywordlist, $i); @@ -814,8 +709,8 @@ if ($::comma eq "" && defined $::FORM{'masscc'} && ! $::FORM{'masscc'} ) { if (!defined $::FORM{'comment'} || $::FORM{'comment'} =~ /^\s*$/) { - PuntTryAgain("Um, you apparently did not change anything on the " . - "selected bugs."); + ThrowUserError("Um, you apparently did not change anything + on the selected bugs."); } } @@ -948,64 +843,30 @@ foreach my $id (@idlist) { SqlQuote($oldhash{'product'})); if ($value eq FetchOneColumn()) { SendSQL("UNLOCK TABLES"); - PuntTryAgain("You must determine a target milestone for bug $id " . - "if you are going to accept it. (Part of " . - "accepting a bug is giving an estimate of when it " . - "will be fixed.)"); + ThrowUserError("You must determine a target milestone for bug $id + if you are going to accept it. Part of accepting + a bug is giving an estimate of when it will be fixed.", + undef, + "abort"); } } if (defined $::FORM{'delta_ts'} && $::FORM{'delta_ts'} ne $delta_ts) { - print " -<H1>Mid-air collision detected!</H1> -Someone else has made changes to this bug at the same time you were trying to. -The changes made were: -<p> -"; - use vars qw($template $vars); + ($vars->{'operations'}) = GetBugActivity($::FORM{'id'}, $::FORM{'delta_ts'}); + + $vars->{'start_at'} = $::FORM{'longdesclength'}; + $vars->{'comments'} = GetComments($id); - ($vars->{'operations'}, $vars->{'incomplete_data'}) = - GetBugActivity($::FORM{'id'}, $::FORM{'delta_ts'}); - - $template->process("show/activity.html.tmpl", $vars) - || DisplayError("Template process failed: " . $template->error()) - && exit; - - my $comments = GetComments($id); - my $longchanged = 0; - - if (scalar(@$comments) > $::FORM{'longdesclength'}) { - $longchanged = 1; - print "<P>Added comments:<blockquote>"; - $vars->{'start_at'} = $::FORM{'longdesclength'}; - $vars->{'comments'} = $comments; - $vars->{'quoteUrls'} = \"eUrls; - $template->process("show/comments.tmpl", $vars) - || DisplayError("Template process failed: " . $template->error()) - && exit; - - print "</blockquote>\n"; - } - SendSQL("unlock tables"); - print "You have the following choices: <ul>\n"; $::FORM{'delta_ts'} = $delta_ts; - print "<li><form method=post>"; - foreach my $i (keys %::FORM) { - # Make sure we don't include the username/password fields in the - # HTML. If cookies are off, they'll have to reauthenticate after - # hitting "submit changes anyway". - # see http://bugzilla.mozilla.org/show_bug.cgi?id=15980 - if ($i !~ /^(Bugzilla|LDAP)_(login|password)$/) { - my $value = value_quote($::FORM{$i}); - print qq{<input type=hidden name="$i" value="$value">\n}; - } - } - print qq{<input type=submit value="Submit my changes anyway">\n}; - print " This will cause all of the above changes to be overwritten"; - if ($longchanged) { - print ", except for the added comments"; - } - print qq{.</form>\n<li><a href="show_bug.cgi?id=$id">Throw away my changes, and go revisit bug $id</a></ul>\n}; - PutFooter(); + $vars->{'form'} = \%::FORM; + + $vars->{'bug_id'} = $id; + $vars->{'quoteUrls'} = \"eUrls; + + SendSQL("UNLOCK TABLES"); + + # Warn the user about the mid-air collision and ask them what to do. + $template->process("process/mid-air.html.tmpl", $vars) + || ThrowTemplateError($template->error()); exit; } @@ -1024,7 +885,7 @@ The changes made were: my $orig = $i; if (!detaint_natural($i)) { - PuntTryAgain("$orig is not a legal bug number"); + ThrowUserError("$orig is not a legal bug number", undef, "abort"); } # Don't use CanSeeBug, since we want to keep deps to bugs a @@ -1033,10 +894,12 @@ The changes made were: SqlQuote($i)); my $comp = FetchOneColumn(); if ($comp ne $i) { - PuntTryAgain("$i is not a legal bug number"); + ThrowUserError("$i is not a legal bug number", undef, "abort"); } if ($id eq $i) { - PuntTryAgain("You can't make a bug blocked or dependent on itself."); + ThrowUserError("You can't make a bug blocked or dependent on itself.", + undef, + "abort"); } if (!exists $seen{$i}) { push(@{$deptree{$target}}, $i); @@ -1078,11 +941,13 @@ The changes made were: foreach my $i (@isect) { $both = $both . GetBugLink($i, "#" . $i) . " "; } - PuntTryAgain("Dependency loop detected!<P>" . - "The following bug(s) would appear on both the \"depends on\" " . - "and \"blocks\" parts of the dependency tree if these changes " . - "are committed: $both<br>" . - "This would create a circular dependency, which is not allowed."); + ThrowUserError(qq|Dependency loop detected!<p> + The following bug(s) would appear on both the "depends on" + and "blocks" parts of the dependency tree if these changes + are committed: $both<br>This would create a circular + dependency, which is not allowed.</p>|, + undef, + "abort"); } } my $tmp = $me; @@ -1131,8 +996,6 @@ The changes made were: } my $query = "$basequery\nwhere bug_id = $id"; -# print "<PRE>$query</PRE>\n"; - if ($::comma ne "") { SendSQL($query); } @@ -1292,7 +1155,6 @@ The changes made were: SendSQL("UPDATE bugs SET groupset = groupset - $groupbit WHERE bug_id = $id"); } - print qq|</p>|; } # get a snapshot of the newly set values out of the database, @@ -1352,8 +1214,7 @@ The changes made were: if ($bug_changed) { SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp) . " WHERE bug_id = $id"); } - print "<TABLE BORDER=1><TD><H2>Changes to bug $id submitted</H2>\n"; - SendSQL("unlock tables"); + SendSQL("UNLOCK TABLES"); my @ARGLIST = (); if ( $removedCcString ne "" ) { @@ -1366,10 +1227,25 @@ The changes made were: push @ARGLIST, ( "-forceqacontact", $origQaContact); } push @ARGLIST, ($id, $::COOKIE{'Bugzilla_login'}); - system ("./processmail",@ARGLIST); - - print "<TD><A HREF=\"show_bug.cgi?id=$id\">Back To BUG# $id</A></TABLE>\n"; - + + # Send mail to let people know the bug has been changed. Uses + # a special syntax of the "open" and "exec" commands to capture + # the output "processmail", which "system" doesn't allow + # (i.e. "system ('./processmail', $bugid , $::userid);"), without + # the insecurity of running the command through a shell via backticks + # (i.e. "my $mailresults = `./processmail $bugid $::userid`;"). + $vars->{'mail'} = ""; + open(PMAIL, "-|") or exec('./processmail', @ARGLIST); + $vars->{'mail'} .= $_ while <PMAIL>; + close(PMAIL); + + $vars->{'id'} = $id; + + # Let the user know the bug was changed and who did and didn't + # receive email about the change. + $template->process("process/results.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + if ($duplicate) { # Check to see if Reporter of this bug is reporter of Dupe SendSQL("SELECT reporter FROM bugs WHERE bug_id = " . SqlQuote($::FORM{'id'})); @@ -1387,15 +1263,34 @@ The changes made were: AppendComment($duplicate, $::COOKIE{'Bugzilla_login'}, "*** Bug $::FORM{'id'} has been marked as a duplicate of this bug. ***"); CheckFormFieldDefined(\%::FORM,'comment'); SendSQL("INSERT INTO duplicates VALUES ($duplicate, $::FORM{'id'})"); - print "<TABLE BORDER=1><TD><H2>Duplicate notation added to bug $duplicate</H2>\n"; - system("./processmail", $duplicate, $::COOKIE{'Bugzilla_login'}); - print "<TD><A HREF=\"show_bug.cgi?id=$duplicate\">Go To BUG# $duplicate</A></TABLE>\n"; + + $vars->{'mail'} = ""; + open(PMAIL, "-|") or exec('./processmail', $duplicate, $::COOKIE{'Bugzilla_login'}); + $vars->{'mail'} .= $_ while <PMAIL>; + close(PMAIL); + + $vars->{'id'} = $duplicate; + $vars->{'type'} = "dupe"; + + # Let the user know a duplication notation was added to the original bug. + $template->process("process/results.html.tmpl", $vars) + || ThrowTemplateError($template->error()); } foreach my $k (keys(%dependencychanged)) { - print "<TABLE BORDER=1><TD><H2>Checking for dependency changes on bug $k</H2>\n"; - system("./processmail", $k, $::COOKIE{'Bugzilla_login'}); - print "<TD><A HREF=\"show_bug.cgi?id=$k\">Go To BUG# $k</A></TABLE>\n"; + $vars->{'mail'} = ""; + open(PMAIL, "-|") or exec('./processmail', $k, $::COOKIE{'Bugzilla_login'}); + $vars->{'mail'} .= $_ while <PMAIL>; + close(PMAIL); + + $vars->{'id'} = $k; + $vars->{'type'} = "dep"; + + # Let the user know we checked to see if we should email notice + # of this change to users with a relationship to the dependent + # bug and who did and didn't receive email about it. + $template->process("process/results.html.tmpl", $vars) + || ThrowTemplateError($template->error()); } } @@ -1403,26 +1298,28 @@ The changes made were: # Show next bug, if it exists. if ($::COOKIE{"BUGLIST"} && $::FORM{'id'}) { my @bugs = split(/:/, $::COOKIE{"BUGLIST"}); + $vars->{'bug_list'} = \@bugs; my $cur = lsearch(\@bugs, $::FORM{"id"}); if ($cur >= 0 && $cur < $#bugs) { my $next_bug = $bugs[$cur + 1]; if (detaint_natural($next_bug) && CanSeeBug($next_bug)) { - - print "<hr>\n"; - print("<p>The next bug in your list is bug "); - print("<a href='show_bug.cgi?id=$next_bug'>$next_bug</a>:</p>\n"); $::FORM{'id'} = $next_bug; + + $vars->{'next_id'} = $next_bug; + + # Let the user know we are about to display the next bug in their list. + $template->process("process/next-bug.html.tmpl", $vars) + || ThrowTemplateError($template->error()); show_bug("header is already done"); exit; } - else { - # Need this until the navigation_header() fn. goes away totally. - undef $::next_bug; - } } } -navigation_header(); -PutFooter(); +# End the response page. +$template->process("show/navigate.html.tmpl", $vars) + || ThrowTemplateError($template->error()); +$template->process("global/footer", $vars) + || ThrowTemplateError($template->error()); diff --git a/template/default/global/hidden-fields.html.tmpl b/template/default/global/hidden-fields.html.tmpl new file mode 100644 index 000000000..85df62435 --- /dev/null +++ b/template/default/global/hidden-fields.html.tmpl @@ -0,0 +1,32 @@ +<!-- 1.0@bugzilla.org --> +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Myk Melez <myk@mozilla.org> + #%] + +[%# INTERFACE: + # form: hash; the form fields/values for which to generate hidden fields. + # exclude: string; a regular expression matching fields to exclude + # from the list of hidden fields generated by this template + #%] + +[%# Generate hidden form fields for non-excluded fields. %] +[% FOREACH field = form %] + [% NEXT IF field.key.search(exclude) %] + <input type="hidden" name="[% field.key %]" value="[% field.value FILTER html %]"> +[% END %] diff --git a/template/default/process/confirm-dupe.html.tmpl b/template/default/process/confirm-dupe.html.tmpl new file mode 100644 index 000000000..d17bfa55f --- /dev/null +++ b/template/default/process/confirm-dupe.html.tmpl @@ -0,0 +1,73 @@ +<!-- 1.0@bugzilla.org --> +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Myk Melez <myk@mozilla.org> + #%] + +[%# INTERFACE: + # form: hash; the form values submitted to the script + # original_bug_id: number; the bug number for the bug + # against which a bug is being duped + # duplicate_bug_id: number; the bug number for the bug + # being duped + # cclist_accessible: boolean; whether or not users on the cc: list + # of the original bug can access that bug. + #%] + +[% PROCESS global/header title="Duplicate Warning" %] + +<p> + When marking a bug as a duplicate, the reporter of the duplicate + is normally added to the CC list of the original. The permissions + on bug [% original_bug_id %] (the original) are currently set + such that the reporter would not normally be able to see it. +</p> + +<p> + <b>Adding the reporter to the CC list of bug [% original_bug_id %] + [% IF cclist_accessible %] + will immediately + [% ELSE %] + might, in the future, + [% END %] + allow him/her access to view this bug.</b> + Do you wish to do this? +</p> + +<form method="post"> + +[% PROCESS "global/hidden-fields.html.tmpl" exclude="^(Bugzilla|LDAP)_(login|password)$" %] + +<p> + <input type="radio" name="confirm_add_duplicate" value="1"> + Yes, add the reporter to CC list on bug [% original_bug_id %] +</p> +<p> + <input type="radio" name="confirm_add_duplicate" value="0" checked="checked"> + No, do not add the reporter to CC list on bug [% original_bug_id %] +</p> +<p> + <a href="show_bug.cgi?id=[% duplicate_bug_id %]">Throw away my changes, + and revisit bug [% duplicate_bug_id %]</a> +<p> + <input type="submit" value="Submit"> +</p> + +</form> + +[% PROCESS global/footer %] diff --git a/template/default/process/mid-air.html.tmpl b/template/default/process/mid-air.html.tmpl new file mode 100644 index 000000000..89ac71fe3 --- /dev/null +++ b/template/default/process/mid-air.html.tmpl @@ -0,0 +1,75 @@ +<!-- 1.0@bugzilla.org --> +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Myk Melez <myk@mozilla.org> + #%] + +[%# INTERFACE: + # form: hash; the form values submitted to the script + # operations: array; bug activity since the user last displayed the bug form, + # used by show/activity.html.tmpl to display recent changes that will be + # overwritten if the user submits these changes. See that template + # for further documentation. + # start_at: number; the comment at which show/comments.tmpl should begin + # displaying comments, either the index of the last comment (if the user + # entered a comment along with their change) or a number less than that + # (if they didn't), in which case no comments are displayed. + # comments: array; all the comments on the bug. + # bug_id: number; the ID of the bug being changed. + #%] + +<h1>Mid-air collision detected!</h1> + +<p> + Someone else has made changes to this bug at the same time you were trying to. + The changes made were: +</p> + +<p> + [% PROCESS "show/activity.html.tmpl" incomplete_data=0 %] +</p> + +[% IF comments.size > start_at %] +<p> + Added comments: + <blockquote> + [% PROCESS "show/comments.tmpl" %] + </blockquote> +</p> +[% END %] + +<p> +You have the following choices: +</p> + +<ul> + <li> + <form method="post"> + [% PROCESS "global/hidden-fields.html.tmpl" exclude="^(Bugzilla|LDAP)_(login|password)$" %] + <input type="submit" value="Submit my changes anyway"> + This will cause all of the above changes to be overwritten + [% ", except for the added comment(s)" IF comments.size > start_at %]. + </form> + </li> + <li> + <a href="show_bug.cgi?id=[% bug_id %]">Throw away my changes, + and revisit bug [% bug_id %]</a> + </li> +</ul> + +[% PROCESS global/footer %] diff --git a/template/default/process/next-bug.html.tmpl b/template/default/process/next-bug.html.tmpl new file mode 100644 index 000000000..b7a2605e9 --- /dev/null +++ b/template/default/process/next-bug.html.tmpl @@ -0,0 +1,32 @@ +<!-- 1.0@bugzilla.org --> +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Myk Melez <myk@mozilla.org> + #%] + +[%# INTERFACE: + # next_id : number; the ID of the next bug in the user's bug list. + #%] + +<hr> + +<p> + The next bug in your list is bug + <a href="show_bug.cgi?id=[% next_id %]">[% next_id %]</a>: +</p> + diff --git a/template/default/process/results.html.tmpl b/template/default/process/results.html.tmpl new file mode 100644 index 000000000..4c1b7d742 --- /dev/null +++ b/template/default/process/results.html.tmpl @@ -0,0 +1,50 @@ +<!-- 1.0@bugzilla.org --> +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Myk Melez <myk@mozilla.org> + #%] + +[%# INTERFACE: + # id: number; the ID of the bug that was changed/checked. + # + # type: string; the type of change/check that was made: "bug" when a bug + # is changed, "dupe" when a duplication notation is added to a bug, + # and "dep" when a bug is checked for changes to its dependencies. + #%] + +[% DEFAULT type="bug" %] + +[% + title = { + 'bug' => "Changes submitted for bug" , + 'dupe' => "Duplicate notation added to bug" , + 'dep' => "Checking for dependency changes on bug" , + } +%] + +<table border="1"> + <tr> + <td> + <h2>[% title.$type %] [%+ id %]</h2> + [% mail %] + </td> + <td> + <a href="show_bug.cgi?id=[% id %]">Back To BUG# [% id %]</a> + </td> + </tr> +</table> diff --git a/template/default/process/verify-new-product.html.tmpl b/template/default/process/verify-new-product.html.tmpl new file mode 100644 index 000000000..2f319af2b --- /dev/null +++ b/template/default/process/verify-new-product.html.tmpl @@ -0,0 +1,100 @@ +<!-- 1.0@bugzilla.org --> +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Myk Melez <myk@mozilla.org> + #%] + +[%# INTERFACE: + # form: hash; the form values submitted to the script + # verify_fields: boolean; whether or not to verify + # the version, component, and target milestone fields + # versions: array; versions for the new product. + # components: array; components for the new product. + # milestones: array; milestones for the new product. + # verify_bug_group: boolean; whether or not to ask the user + # if they want to add the bug to its new product's group + # use_target_milestone: boolean; whether or not to use + # the target milestone field + #%] + +[% USE mycgi = CGI %] + +<form action="process_bug.cgi" method="post"> + +[% PROCESS "global/hidden-fields.html.tmpl" exclude="^version|component|target_milestone$" %] + +[%# Verify the version, component, and target milestone fields. %] +[% IF verify_fields %] + <h3>Verify Version, Component[% ", Target Milestone" IF use_target_milestone %]</h3> + + <p> + [% IF usetargetmilestone %] + You are moving the bug(s) to the product <b>[% form.product %]</b>, + and the version, component, and/or target milestone fields are no longer + correct. Please set the correct version, component, and target milestone now: + [% ELSE %] + You are moving the bug(s) to the product <b>[% form.product %]</b>, + and the version and component fields are no longer correct. + Please set the correct version and component now: + [% END %] + <p> + + <table> + <tr> + <td> + <b>Version:</b><br> + [% mycgi.popup_menu(Name => "version" , Values => versions) %] + </td> + <td> + <b>Component:</b><br> + [% mycgi.popup_menu(Name => "component" , Values => components) %] + </td> + [% IF use_target_milestone %] + <td> + <b>Target Milestone:</b><br> + [% mycgi.popup_menu(Name => "target_milestone" , Values => milestones) %] + </td> + [% END %] + </tr> + </table> + +[% END %] + +[% IF verify_bug_group %] + <h3>Verify Bug Group</h3> + + <p> + Do you want to add the bug to its new product's group (if any)? + </p> + + <p> + <input type="radio" name="addtonewgroup" value="no"><b>no</b><br> + <input type="radio" name="addtonewgroup" value="yes"><b>yes</b><br> + <input type="radio" name="addtonewgroup" value="yesifinold" checked> + <b>yes, but only if the bug was in its old product's group</b><br> + </p> +[% END %] + +<input type="submit" value="Commit"> + +</form> +<hr> +<a href="query.cgi">Cancel and Return to the Query Page</a> + +[% PROCESS global/footer %] + |