]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 585440 - Allow disabled accounts to turn off all bugmail
authorDavid Lawrence <dlawrence@mozilla.com>
Tue, 9 Aug 2011 22:03:23 +0000 (18:03 -0400)
committerDavid Lawrence <dlawrence@mozilla.com>
Tue, 9 Aug 2011 22:03:23 +0000 (18:03 -0400)
r/a=mkanat

js/field.js
template/en/default/admin/users/edit.html.tmpl
template/en/default/admin/users/userdata.html.tmpl
template/en/default/global/textarea.html.tmpl

index ea1769bd1ce676d661a6c3c8304b5bb55ccb7b72..69f71e526a14ea7598fca538bdd0778618697859 100644 (file)
@@ -897,3 +897,16 @@ YAHOO.bugzilla.keywordAutocomplete = {
         });
     }
 };
+
+/**
+ * Set the disable email checkbox to true if the user has disabled text
+ */
+function userDisabledTextOnChange(disabledtext) {
+    var disable_mail = document.getElementById('disable_mail');
+    if (disabledtext.value === "" && !disable_mail_manually_set) {
+        disable_mail.checked = false;
+    }
+    if (disabledtext.value !== "" && !disable_mail_manually_set) {
+        disable_mail.checked = true;
+    }
+}
index 3efa4b8bf1b2de51616d77e27bf6196628e312e3..d684dcebd49e87c89966c537569212e5cf2e3826 100644 (file)
@@ -31,6 +31,7 @@
   message = message
   style_urls = ['skins/standard/admin.css', 'skins/standard/editusers.css']
   doc_section = "useradmin.html#modifyusers"
+  javascript_urls = [ 'js/field.js' ]
 %]
 
 [% PROCESS admin/users/listselectvars.html.tmpl
index f3f0e5aa9f9b884dcbd258c5e0f8121af8539df2..3315d87da6996d8c76c91eb2ca26438abd57b772 100644 (file)
   # otheruser: Bugzilla::User object of user to edit
   #%]
 
+<script type="text/javascript">
+  var disable_mail_manually_set = [% (otheruser.email_disabled ? 1 : 0) FILTER js %];
+</script>
+
 <tr>
   <th><label for="login">Login name:</label></th>
   <td>
@@ -86,7 +90,8 @@
     <th><label for="disable_mail">[% terms.Bug %]mail Disabled:</label></th>
     <td>
       <input type="checkbox" name="disable_mail" id="disable_mail" value="1" 
-      [% IF otheruser.email_disabled %] checked="checked" [% END %] />
+             [% IF otheruser.email_disabled %] checked="checked" [% END %] 
+             onchange="disable_mail_manually_set=1;">
       (This affects [% terms.bug %]mail and whinemail, not password-reset or other 
       non-[% terms.bug %]-related emails)
     </td>
          defaultrows    = 10
          cols           = 60
          defaultcontent = otheruser.disabledtext
+         onchange       = "userDisabledTextOnChange(this);"
        %]<br>
       (If non-empty, then the account will be disabled, and this text should
       explain why.)
index c158615bd723afd431dadc57966622fb5b5da9ae..84aacf2ee6ae709bffc9ee37ec4e3d2c6cf2f7eb 100644 (file)
@@ -53,4 +53,7 @@
           [% END %]
           [% IF mandatory %]
             aria-required="true"
+          [% END %]
+          [% IF onchange %]
+            onchange="[% onchange FILTER html %]"
           [% END %]>[% defaultcontent FILTER html %]</textarea>