email.html.tmpl 8.07 KB
Newer Older
1 2 3
[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
  #
5 6
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
7 8 9
  #%]

[%# INTERFACE:
10
  # watchedusers: string.
11
  #               Comma-separated list of email addresses this user watches.
12 13
  # watchers:     array.
  #               Array of users watching this user's account.
14 15
  # excludeself:  boolean.
  #               True if user is not receiving self-generated mail.
16
  # <rolename>:   Multiple hashes, one for each rolename (e.g. assignee; see
17 18
  #               below), keyed by reasonname (e.g. comments; again, see
  #               below). The value is a boolean - true if the user is
19 20
  #               receiving mail for that reason when in that role.
  #%]
21

22 23 24 25 26
<p>
  If you don't like getting a notification for "trivial"
  changes to [% terms.bugs %], you can use the settings below to
  filter some or all notifications.
</p>
27

28 29 30 31 32
<script type="text/javascript">
<!--
function SetCheckboxes(setting) {
  for (var count = 0; count < document.userprefsform.elements.length; count++) {
    var theinput = document.userprefsform.elements[count];
33
    if (theinput.type == "checkbox" && !theinput.disabled) {
34 35 36 37 38 39 40 41 42
      if (theinput.name.match("neg")) {
        theinput.checked = false;
      }
      else {
        theinput.checked = setting;
      }
    }
  }
}
43

44 45 46 47
document.write('<input type="button" value="Enable All Mail" onclick="SetCheckboxes(true); return false;">\n');
document.write('<input type="button" value="Disable All Mail" onclick="SetCheckboxes(false); return false;">\n');
// -->
</script>
48

49
<hr>
50 51 52 53 54 55 56 57 58 59 60

<table>
  <tr>
    <td colspan="2">
      <b>Global options:</b>
    </td>
  </tr>

  <tr>
    <td width="150"></td>
    <td>
61 62 63
      [% prefname = "email-$constants.REL_ANY-$constants.EVT_FLAG_REQUESTED" %]
      <input type="checkbox" name="[% prefname %]" id="[% prefname %]" 
        value="1"
64 65
        [% " checked"
           IF user.mail_settings.${constants.REL_ANY}.${constants.EVT_FLAG_REQUESTED} %]>
66
      <label for="[% prefname %]">Email me when someone asks me to set a flag</label>
67 68 69 70 71 72
      <br>
    </td>
  </tr>
  <tr>
    <td width="150"></td>
    <td>
73 74 75
      [% prefname = "email-$constants.REL_ANY-$constants.EVT_REQUESTED_FLAG" %]
      <input type="checkbox" name="[% prefname %]" id="[% prefname %]" 
        value="1"
76 77
        [% " checked"
           IF user.mail_settings.${constants.REL_ANY}.${constants.EVT_REQUESTED_FLAG} %]>
78
      <label for="[% prefname %]">Email me when someone sets a flag I asked for</label>
79 80 81
      <br>
    </td>
  </tr>
82 83 84 85 86 87 88 89 90 91
[% IF user.is_global_watcher %]
  <tr>
    <td width="150"></td>
    <td>
      You are watching all [% terms.bugs %]. To be removed from this role,
      contact
      <a href="mailto:[% Param("maintainer") %]">[% Param("maintainer") %]</a>.
    </td>
  </tr>
[% END %]
92 93
</table>

94
<hr>
95 96 97 98
<b>Field/recipient specific options:</b>
<br>
<br>

99 100 101
[% events = [
    { id = constants.EVT_ADDED_REMOVED,
      description = "I'm added to or removed from this capacity" },
102 103
    { id = constants.EVT_BUG_CREATED,
      description = "A new $terms.bug is created" },
104 105 106 107 108 109 110 111 112 113 114 115 116 117
    { id = constants.EVT_OPENED_CLOSED,
      description = "The $terms.bug is resolved or reopened" },
    { id = constants.EVT_PROJ_MANAGEMENT,
      description = "The priority, status, severity, or milestone changes" },
    { id = constants.EVT_COMMENT,
      description = "New comments are added" },
    { id = constants.EVT_ATTACHMENT,
      description = "New attachments are added" },
    { id = constants.EVT_ATTACHMENT_DATA,
      description = "Some attachment data changes" },
    { id = constants.EVT_KEYWORD,
      description = "The keywords field changes" },
    { id = constants.EVT_CC,
      description = "The CC field changes" },
118 119
    { id = constants.EVT_DEPEND_BLOCK,
      description = "The dependency tree changes" },
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
    { id = constants.EVT_OTHER,
      description = "Any field not mentioned above changes" },
] %]

[% neg_events = [
    { id = constants.EVT_UNCONFIRMED,
      description = "The $terms.bug is in the UNCONFIRMED state" },
    { id = constants.EVT_CHANGED_BY_ME,
      description = "The change was made by me" },
] %]

[% relationships = [
    { id = constants.REL_ASSIGNEE,
      description = "Assignee" },
    { id = constants.REL_REPORTER,
      description = "Reporter" },
    { id = constants.REL_CC,
      description = "CCed" },
] %]
139

140 141 142 143 144 145 146 147 148 149 150 151 152
[% IF Param('useqacontact') %]
  [% relationships.push({ id = constants.REL_QA, 
                          description = "QA Contact" }) %]
[% END %]


[%# This is up here so that the "relationships" hook can modify it. %]
[% no_added_removed = [constants.REL_REPORTER] %]

[% Hook.process('relationships') %]

[% num_columns = relationships.size %]

153
<table class="bz_emailprefs" border="1">
154
  <tr>
155
    <td colspan="[% num_columns FILTER html %]" align="center" width="50%">
156
      <b>When my relationship to this [% terms.bug %] is:</b>
157
    </td>
158
    <td rowspan="2" width="40%">
159 160 161 162 163
      <b>I want to receive mail when:</b>
    </td>
  </tr>

  <tr>
164 165 166 167
    [% FOREACH relationship = relationships %]
      <th align="center" width="9%">
        [% relationship.description FILTER html %]
      </th>
168
    [% END %]
169 170 171
  </tr>
  
  [% FOREACH event = events %]  
172 173
    [% count = loop.count() %]
    <tr class="bz_row_[% count % 2 == 1 ? "odd" : "even" %]">
174 175 176 177 178 179 180
      [% FOREACH relationship = relationships %]
        <td align="center">
          <input type="checkbox" 
            name="email-[% relationship.id %]-[% event.id %]"
            value="1"
            [%# The combinations don't always make sense; disable a couple %]
            [% IF event.id == constants.EVT_ADDED_REMOVED AND 
181 182
                  no_added_removed.contains(relationship.id) 
            %]
183
               disabled
184
            [% ELSIF user.mail_settings.${relationship.id}.${event.id} %]
185 186 187 188 189 190
               checked
            [% END %]>
        </td>
      [% END %]
      <td>
        [% event.description FILTER html %]
191
      </td>
192 193 194 195
    </tr>
  [% END %]
  
  <tr>
196
    <td colspan="[% num_columns FILTER html %]" 
197 198 199 200 201 202
        align="center" width="50%">
      &nbsp;
    </td>
    <td width="40%">
      <b>but not when (overrides above):</b>
    </td>
203 204
  </tr>

205
  [% FOREACH event = neg_events %]  
206 207
    [% count = loop.count() %]
    <tr class="bz_row_[% count % 2 == 1 ? "odd" : "even" %]">
208
      [% FOREACH relationship = relationships %]
209
        <td align="center">
210 211 212
          <input type="checkbox" 
            name="neg-email-[% relationship.id %]-[% event.id %]"
            value="1"
213
            [% " checked" IF NOT user.mail_settings.${relationship.id}.${event.id} %]>
214 215 216
        </td>
      [% END %]
      <td>
217
        [% event.description FILTER html %]
218 219 220
      </td>
    </tr>
  [% END %]
221
  
222
</table>
223

224 225 226 227 228 229 230
<hr>
<b>User Watching</b>

<p>
If you watch a user, it is as if you are standing in their shoes for the 
purposes of getting email. Email is sent or not according to <u>your</u>
preferences for <u>their</u> relationship to the [% terms.bug %] 
231
(e.g. Assignee).
232
</p>
233

234 235 236 237
<p>
[% IF watchedusers.size %]
You are watching everyone in the following list:
  </p>
238 239 240 241 242 243 244 245 246 247 248
  <p>
    <select id="watched_by_you" name="watched_by_you" multiple="multiple" size="5">
        [% FOREACH w = watchedusers %]
           <option value="[% w FILTER html %]">[% w FILTER html %]</option>
        [% END %]
    </select> <br />
    <input type="checkbox" id="remove_watched_users" name="remove_watched_users">
    <label for="remove_watched_users">Remove selected users from my watch list</label>
[% ELSE %]
You are currently not watching any users.
[% END %]
249 250
</p>

251
<p id="new_watched_by_you">Add users to my watch list (comma separated list):
252 253 254 255 256 257 258
  [% INCLUDE global/userselect.html.tmpl
     id => "new_watchedusers"
     name => "new_watchedusers"
     value => ""
     size => 60
     multiple => 5
  %]
259 260
</p>            

261
<p id="watching_you">Users watching you:<br>
262 263 264 265 266
  [% IF watchers.size %]
    [% FOREACH watcher = watchers %]
      [% watcher FILTER html %] <br>
    [% END %]
  [% ELSE %]
267
    <i>No one</i>
268 269 270 271 272
  [% END %]
</p>

<hr>

273
<br>