]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 41972 : Per-user pref to turn quips off
authortravis%sedsystems.ca <>
Fri, 11 Mar 2005 00:21:33 +0000 (00:21 +0000)
committertravis%sedsystems.ca <>
Fri, 11 Mar 2005 00:21:33 +0000 (00:21 +0000)
Patch by Shane H. W. Travis <travis@sedsystems.ca>  r=mkanat  a=justdave

Bugzilla/Config.pm
checksetup.pl
defparams.pl
quips.cgi
template/en/default/global/setting-descs.none.tmpl
template/en/default/global/user-error.html.tmpl
template/en/default/list/list.html.tmpl
template/en/default/list/quips.html.tmpl

index 097c7b6c45d3b74e2ad00a06492116275f2d05b1..d91755891b329236ba7a0f1016aca68c3169f87c 100644 (file)
@@ -237,6 +237,19 @@ sub UpdateParams {
         delete $param{'loginmethod'};
     }
 
+    # Remove quip-display control from parameters
+    # and give it to users via User Settings (Bug 41972)
+    if ( exists $param{'enablequips'} 
+         && !exists $param{'quip_list_entry_control'}) 
+    {
+        my $new_value;
+        ($param{'enablequips'} eq 'on')       && do {$new_value = 'open';};
+        ($param{'enablequips'} eq 'approved') && do {$new_value = 'moderated';};
+        ($param{'enablequips'} eq 'frozen')   && do {$new_value = 'closed';};
+        $param{'quip_list_entry_control'} = $new_value;
+        delete $param{'enablequips'};
+    }
+
     # --- DEFAULTS FOR NEW PARAMS ---
 
     foreach my $item (@param_list) {
index 529b025b51d110897b27983cddf2d9852843b870..42ee7e29583b53609451a4514067e195e303a279 100755 (executable)
@@ -4136,6 +4136,9 @@ if (!defined $dbh->bz_get_index_def('bugs_activity','who')) {
     $dbh->do('ALTER TABLE bugs_activity ADD INDEX (who)');
 }
 
+# 2005-03-03 travis@sedsystems.ca -- Bug 41972
+add_setting ("display_quips", {"on" => 1, "off" => 2 }, "on" );
+
 #
 # Final checks...
 
index af5715235e7d9742cbbba54d43752728ce56570d..5e2110d6143b26bb2ae984af23705738cbf305ef 100644 (file)
@@ -390,16 +390,16 @@ sub find_languages {
   },
 
   {
-   name => 'enablequips',
-   desc => 'Controls the appearance of quips at the top of buglists.<ul> ' .
-           '<li>on - Bugzilla will display a quip, and lets users add to ' .
-           'the list.</li><li>approved - quips can be entered, but need ' .
-           'be approved before shown</li><li>frozen - Bugzilla will display ' .
-           'a quip but not permit new additions.</li><li>off - Bugzilla ' .
-           'will not display quips.</li></ul>',
+   name => 'quip_list_entry_control',
+   desc => 'Controls how easily users can add entries to the quip list.' .
+           '<ul><li>open - Users may freely add to the quip list, and ' .
+           'their entries will immediately be available for viewing.</li>' .
+           '<li>moderated - quips can be entered, but need to be approved ' .
+           'by an admin before they will be shown</li><li>closed - no new ' .
+           'additions to the quips list are allowed.</li></ul>',
    type => 's',
-   choices => ['on', 'approved', 'frozen', 'off'],
-   default => 'on',
+   choices => ['open', 'moderated', 'closed'],
+   default => 'open',
    checker => \&check_multi
   },
 
index dc0106450ba60b5b90e5554865a98ac6d16718e1..766d1a79217efdbd12d788a4c426b0b9e2cc99ab 100755 (executable)
--- a/quips.cgi
+++ b/quips.cgi
@@ -41,10 +41,6 @@ Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 
-if (Param('enablequips') eq "off") {
-    ThrowUserError("quips_disabled");
-}
-    
 my $action = $cgi->param('action') || "";
 
 if ($action eq "show") {
@@ -75,12 +71,12 @@ if ($action eq "show") {
 }
 
 if ($action eq "add") {
-    (Param('enablequips') eq "on" or Param('enablequips') eq "approved")
-      || ThrowUserError("no_new_quips");
-    
+    (Param('quip_list_entry_control') eq "closed") &&
+      ThrowUserError("no_new_quips");
+
     # Add the quip 
-    my $approved = (Param('enablequips') eq "on") ? '1' : '0';
-    $approved = 1 if(UserInGroup('admin'));
+    my $approved = 
+      (Param('quip_list_entry_control') eq "open") || (UserInGroup('admin')) || 0;
     my $comment = $cgi->param("quip");
     $comment || ThrowUserError("need_quip");
     $comment !~ m/</ || ThrowUserError("no_html_in_quips");
index 26bed57a743aced4423b8901eaaa899404e5fb4e..9e7ac95966e0ba81a40ae403e89e8a2d3f2f6f68 100644 (file)
@@ -20,6 +20,7 @@
 [% PROCESS global/variables.none.tmpl %]
 
 [% setting_descs = { 
+                      "display_quips"  => "Show a quip at the top of each bug list",
                       "off"            => "Off",
                       "on"             => "On"
                    } 
index 2d992dfce3c9f171e6bf1f6708c434f52e84af2f..0821fbcd37f533804611441b8d8c41b0000e5522 100644 (file)
     [% title = "Query Name Too Long" %]
     The name of the query must be less than 64 characters long.
 
-  [% ELSIF error == "quips_disabled" %]
-    [% title = "Quips Disabled" %]
-    Quips are disabled.
-
   [% ELSIF error == "reassign_to_empty" %]
     [% title = "Illegal Reassignment" %]
     To reassign [% terms.abug %], you must provide an address for
index 919c9b21cace53abeb0d05bd44a171d7da70ffed..e0a5a2b9367e22f8fa1ad5c76d89c2974d2dc62b 100644 (file)
@@ -57,7 +57,7 @@
     <p>[% query FILTER html %]</p>
   [% END %]
 
-  [% IF Param('enablequips') != 'off' %]
+  [% IF user.settings.display_quips.value == 'on' %]
     [% DEFAULT quip = "$terms.Bugzilla would like to put a random quip here, but no one has entered any." %]
     <a href="quips.cgi"><i>[% quip FILTER html %]</i></a>
   [% END %]
index f5f22edd13253fff494497b182af1dcdc9200bb3..c43822aa1d22d5d58e92d838e3e9a2bbb38dd92a 100644 (file)
@@ -37,7 +37,7 @@
   <p>
     <font color="red">
       Your quip '<tt>[% added_quip FILTER html %]</tt>' has been added.
-      [% IF Param("enablequips") == "approved" AND !user.groups.admin %]
+      [% IF Param("quip_list_entry_control") == "moderated" AND !user.groups.admin %]
         It will be used as soon as it gets approved.
       [% END %]
     </font>
@@ -60,7 +60,7 @@
   [% terms.Bugzilla %] will pick a random quip for the headline on each [% terms.bug %] list, and
   you can extend the quip list. Type in something clever or funny or boring
   (but not obscene or offensive, please) and bonk on the button.
-  [% IF Param("enablequips") == "approved" AND !user.groups.admin %]
+  [% IF Param("quip_list_entry_control") == "moderated" AND !user.groups.admin %]
     Note that your quip has to be approved before it is used.
   [% END %]
 </p>
@@ -88,8 +88,8 @@
     <h2>Edit existing quips:</h2>
     <p>
       <strong>Note:</strong> Only approved quips will be shown.
-      If enablequips is set to <q>on</q>, entered quips are automatically
-      approved.
+      If the parameter 'quip_list_entry_control' is set to <q>open</q>, 
+      entered quips are automatically approved.
     </p>
     <form name="editform" method="post" action="quips.cgi">
       <input type="hidden" name="action" value="approve">