]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Patch by freitag@suse.de (Klaas Freitag) -- add options to let Bugzilla require comme...
authorterry%mozilla.org <>
Fri, 17 Dec 1999 00:37:55 +0000 (00:37 +0000)
committerterry%mozilla.org <>
Fri, 17 Dec 1999 00:37:55 +0000 (00:37 +0000)
CGI.pl
defparams.pl
process_bug.cgi

diff --git a/CGI.pl b/CGI.pl
index a5a4b3b1e3034764459ec569ccb2a72823ee8f3f..1e22afc5253e4cc9247067386050f78f0cd08003 100644 (file)
--- a/CGI.pl
+++ b/CGI.pl
@@ -631,8 +631,16 @@ sub DumpBugActivity {
 }
 
 
-
-
+#
+# Prints a warnbanner incl. image with given message
+# 
+sub warnBanner( $ )
+{
+  my ($msg) = (@_);
+  print Param("warnbannerhtml");
+  print $msg;
+  print Param("warnfooterhtml");
+}
 
 
 ############# Live code below here (that is, not subroutine defs) #############
index f035b5761895c9783b71238fec0603feba6cf249..41841eb19cc0ee685edcdefbca4722f16ab9a2ef 100644 (file)
@@ -176,6 +176,17 @@ information about what Bugzilla is and what it can do, see
 
 
     
+DefParam("warnbannerhtml",
+         "HTML to prepend to warning messages.",
+         "l",
+         "<font size=+1>");
+
+DefParam("warnfooterhtml",
+         "HTML to append to warning messages.",
+         "l",
+         "</font>");
+
+
 DefParam("changedmail",
 q{The email that gets sent to people when a bug changes.  Within this
 text, %to% gets replaced by the assigned-to and reported-by people,
@@ -378,5 +389,36 @@ DefParam("browserbugmessage",
          "If strictvaluechecks is on, and the bugzilla gets unexpected data from the browser, in addition to displaying the cause of the problem, it will output this HTML as well.",
          "l",
          "this may indicate a bug in your browser.\n");
+
+#
+# Parameters to force users to comment their changes for different actions.
+DefParam("commentonaccept", 
+         "If this option is on, the user needs to enter a short comment if he accepts the bug",
+         "b", 0 );
+DefParam("commentonclearresolution", 
+         "If this option is on, the user needs to enter a short comment if the bugs resolution is cleared",
+         "b", 0 );
+DefParam("commentonresolve", 
+         "If this option is on, the user needs to enter a short comment if the bug is resolved",
+         "b", 0 );
+DefParam("commentonreassign", 
+         "If this option is on, the user needs to enter a short comment if the bug is reassigned",
+         "b", 0 );
+DefParam("commentonreassignbycomponent", 
+         "If this option is on, the user needs to enter a short comment if the bug is reassigned by component",
+         "b", 0 );
+DefParam("commentonreopen", 
+         "If this option is on, the user needs to enter a short comment if the bug is reopened",
+         "b", 0 );
+DefParam("commentonverify", 
+         "If this option is on, the user needs to enter a short comment if the bug is verified",
+         "b", 0 );
+DefParam("commentonclose", 
+         "If this option is on, the user needs to enter a short comment if the bug is closed",
+         "b", 0 );
+DefParam("commentonduplicate",
+         "If this option is on, the user needs to enter a short comment if the bug is marked as duplicate",
+         "b", 0 );
+
 1;
 
index 63e1147fa9a0db8607abfca6f70f85bf4fb3b5dc..858f04319f927a00db94e436d1dc31ef1359aacc 100755 (executable)
@@ -169,6 +169,35 @@ sub ChangeResolution {
     }
 }
 
+#
+# This function checks if there is a comment required for a specific
+# function and tests, if the comment was given.
+# If comments are required for functions  is defined by params.
+#
+sub CheckonComment( $ ) {
+    my ($function) = (@_);
+    
+    # Param is 1 if comment should be added !
+    my $ret = Param( "commenton" . $function );
+
+    # Allow without comment in case of undefined Params.
+    $ret = 0 unless ( defined( $ret ));
+
+    if( $ret ) {
+        if (!defined $::FORM{'comment'} || $::FORM{'comment'} =~ /^\s*$/) {
+            # No commet - sorry, action not allowed !
+            warnBanner("You have to specify a <b>comment</b> on this change." .
+                       "<p>" .
+                       "Please press <b>Back</b> and give some words " .
+                       "on the reason of the your change.\n" );
+            exit( 0 );
+        } else {
+            $ret = 0;
+        }
+    }
+    return( ! $ret ); # Return val has to be inverted
+}
+
 
 my $foundbit = 0;
 foreach my $b (grep(/^bit-\d*$/, keys %::FORM)) {
@@ -220,20 +249,20 @@ SWITCH: for ($::FORM{'knob'}) {
     /^none$/ && do {
         last SWITCH;
     };
-    /^accept$/ && do {
+    /^accept$/ && CheckonComment( "accept" ) && do {
         ChangeStatus('ASSIGNED');
         last SWITCH;
     };
-    /^clearresolution$/ && do {
+    /^clearresolution$/ && CheckonComment( "clearresolution" ) &&do {
         ChangeResolution('');
         last SWITCH;
     };
-    /^resolve$/ && do {
+    /^resolve$/ && CheckonComment( "resolve" ) && do {
         ChangeStatus('RESOLVED');
         ChangeResolution($::FORM{'resolution'});
         last SWITCH;
     };
-    /^reassign$/ && do {
+    /^reassign$/ && CheckonComment( "reassign" ) && do {
         ChangeStatus('NEW');
         DoComma();
         if ( Param("strictvaluechecks") ) {
@@ -248,7 +277,7 @@ SWITCH: for ($::FORM{'knob'}) {
         $::query .= "assigned_to = $newid";
         last SWITCH;
     };
-    /^reassignbycomponent$/ && do {
+    /^reassignbycomponent$/  && CheckonComment( "reassignbycomponent" ) && do {
         if ($::FORM{'product'} eq $::dontchange) {
             print "You must specify a product to help determine the new\n";
             print "owner of these bugs.\n";
@@ -269,19 +298,19 @@ SWITCH: for ($::FORM{'knob'}) {
         $::query .= "assigned_to = $newid";
         last SWITCH;
     };   
-    /^reopen$/ && do {
+    /^reopen$/  && CheckonComment( "reopen" ) && do {
         ChangeStatus('REOPENED');
         last SWITCH;
     };
-    /^verify$/ && do {
+    /^verify$/ && CheckonComment( "verify" ) && do {
         ChangeStatus('VERIFIED');
         last SWITCH;
     };
-    /^close$/ && do {
+    /^close$/ && CheckonComment( "close" ) && do {
         ChangeStatus('CLOSED');
         last SWITCH;
     };
-    /^duplicate$/ && do {
+    /^duplicate$/ && CheckonComment( "duplicate" ) && do {
         ChangeStatus('RESOLVED');
         ChangeResolution('DUPLICATE');
         if ( Param('strictvaluechecks') ) {