coar 98/01/20 07:06:11
Modified: . bugdb.cgi Log: Fix problem with canned closure messages not being interpreted correctly (i.e., "\n" remained verbatim rather than being replaced with a newline character). Revision Changes Path 1.24 +41 -27 apache-site/bugdb.cgi Index: bugdb.cgi =================================================================== RCS file: /export/home/cvs/apache-site/bugdb.cgi,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- bugdb.cgi 1998/01/03 18:17:41 1.23 +++ bugdb.cgi 1998/01/20 15:06:09 1.24 @@ -20,30 +20,31 @@ [and leave the subject line UNCHANGED. This is not done] [automatically because of the potential for mail loops. ] EOT -$CANNED_LABEL{"Stale"} = - '[This is a standard response.]\n' . - 'No response from submitter, assuming issue has been resolved.'; -$CANNED_LABEL{"Duplicate"} = - '[This is a standard response.]\n' . - 'This issue has been reported before;\n' . - 'please search the FAQ and the bug database.\n' . - 'Thanks for using Apache!'; -$CANNED_LABEL{"Inappropriate"} = - '[This is a standard response.]\n' . - 'This is a CGI programming or basic configuration issue.\n' . - 'As mentioned on the main bug database page, we must refer\n' . - 'all such basic or non-Apache-related questions to the\n' . - 'comp.infosystems.www.servers.unix and related newsgroups.\n' . - 'Please ask your question there.\n' . - 'Please also search the FAQ and the bug database.\n' . - 'Thanks for using Apache!'; + # -# Turn the \n markers in the canned text into real newlines. +# Canned closure messages. These are used in one-click "close this +# sucker" operations. The text isn't passed directly to the handle_edit_pr +# function; instead, the StateReason field is set to "_C_" plus the +# appropriate message key (e.g., "_C_Stale"). handle_edit_pr senses +# this and substitutes the actual text. # -foreach (keys(%CANNED_LABEL)) { - $CANNED_TEXT{$_} = $CANNED_LABEL{$_}; - $CANNED_TEXT{$_} =~ s/\\n/\n/g; -} +$CANNED_TEXT{"Stale"} = + "[This is a standard response.]\n" . + "No response from submitter, assuming issue has been resolved."; +$CANNED_TEXT{"Duplicate"} = + "[This is a standard response.]\n" . + "This issue has been reported before;\n" . + "please search the FAQ and the bug database.\n" . + "Thanks for using Apache!"; +$CANNED_TEXT{"Inappropriate"} = + "[This is a standard response.]\n" . + "This is a CGI programming or basic configuration issue.\n" . + "As mentioned on the main bug database page, we must refer\n" . + "all such basic or non-Apache-related questions to the\n" . + "comp.infosystems.www.servers.unix and related newsgroups.\n" . + "Please ask your question there.\n" . + "Please also search the FAQ and the bug database.\n" . + "Thanks for using Apache!"; # Outside commands $MAILER = "/usr/sbin/sendmail -oi -t"; @@ -105,6 +106,8 @@ # 01/03/1998 Ken Coar - Add a checkbox to the edit form to prevent # email from being sent. This allows cosmetic changes to be made, # even to closed PRs, without spamming people. +# 01/20/1998 Ken Coar - Simplify the canned message handling by using +# sentinels. # ### End Modification log @@ -242,7 +245,7 @@ ### Main menu } elsif ($PATH_INFO eq "") { &main_menu(); - print "<HR><SMALL>Version: 3 January 1998<BR>Authors: ", + print "<HR><SMALL>Version: 20 January 1998<BR>Authors: ", "<A HREF=\"http://alumni.caltech.edu/~dank/gnats.html\">Dan Kegel ", "and Huy Le</A>, <BR> ", "with revamp work by ", @@ -686,7 +689,8 @@ # Check that the timestamp hasn't changed since the form was generated if ($timestamp ne ×tamp($fullpr)) { - $ed_err = "$errmsg\nThis PR has been modified since you started editing it.\n"; + $ed_err = "$errmsg\nThis PR has been modified since you started" + . " editing it.\n"; last LOCKED; } @@ -708,6 +712,16 @@ $mail_to{&tolower($nEditor{$input{'Editor'}})} = 1; local($to_subm, $to_old, $to_new); + # + # If the StateReason begins with "_C_" the remainder of the + # value is a key into the canned-closure-messages hash. + # Make the substitution. + # + if ($input{'StateReason'} =~ /^_C_/) { + local ($key) = $input{'StateReason'}; + $key =~ s/^_C_//; + $input{'StateReason'} = $CANNED_TEXT{$key}; + } # Update the audit trail #print "if ($input{'State'} ne $fieldvalues{'State'})\n"; if ($input{"State"} ne $fieldvalues{'State'}) { @@ -1486,7 +1500,7 @@ <INPUT TYPE="hidden" NAME="Release" VALUE="$fieldvalues{'Release'}"> <INPUT TYPE="hidden" NAME="Severity" VALUE="$fieldvalues{'Severity'}"> <INPUT TYPE="hidden" NAME="State" VALUE="closed"> - <INPUT TYPE="hidden" NAME="StateReason" VALUE="$CANNED_LABEL{'Stale'}"> + <INPUT TYPE="hidden" NAME="StateReason" VALUE="_C_Stale"> <INPUT TYPE="hidden" NAME="Category" VALUE="$fieldvalues{'Category'}"> <INPUT TYPE="hidden" NAME="Responsible" VALUE="$fieldvalues{'Responsible'}"> <INPUT TYPE="hidden" NAME="ResponsibleReason" VALUE=""> @@ -1512,7 +1526,7 @@ <INPUT TYPE="hidden" NAME="Release" VALUE="$fieldvalues{'Release'}"> <INPUT TYPE="hidden" NAME="Severity" VALUE="$fieldvalues{'Severity'}"> <INPUT TYPE="hidden" NAME="State" VALUE="closed"> - <INPUT TYPE="hidden" NAME="StateReason" VALUE="$CANNED_LABEL{'Duplicate'}"> + <INPUT TYPE="hidden" NAME="StateReason" VALUE="_C_Duplicate"> <INPUT TYPE="hidden" NAME="Category" VALUE="$fieldvalues{'Category'}"> <INPUT TYPE="hidden" NAME="Responsible" VALUE="$fieldvalues{'Responsible'}"> <INPUT TYPE="hidden" NAME="ResponsibleReason" VALUE=""> @@ -1538,7 +1552,7 @@ <INPUT TYPE="hidden" NAME="Release" VALUE="$fieldvalues{'Release'}"> <INPUT TYPE="hidden" NAME="Severity" VALUE="non-critical"> <INPUT TYPE="hidden" NAME="State" VALUE="closed"> - <INPUT TYPE="hidden" NAME="StateReason" VALUE="$CANNED_LABEL{'Inappropriate'}"> + <INPUT TYPE="hidden" NAME="StateReason" VALUE="_C_Inappropriate"> <INPUT TYPE="hidden" NAME="Category" VALUE="$fieldvalues{'Category'}"> <INPUT TYPE="hidden" NAME="Responsible" VALUE="$fieldvalues{'Responsible'}"> <INPUT TYPE="hidden" NAME="ResponsibleReason" VALUE="">