summaryrefslogtreecommitdiffstats
path: root/template/en/default/whine/schedule.html.tmpl
blob: a8dccdc3f3f385c2c56186630d00fe2b1b93778d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
[%# 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/.
  #
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
  #%]

[%# INTERFACE:
  # events: hash, keyed by event_id number.  Values are anonymous hashes of:
  #     schedule: array of hashes containing schedule info:
  #         day:    value in day column
  #         time:   value selected in time column
  #         mailto_type: 0=user 1=group
  #         mailto: recipient's id (profile or group)
  #     queries:  as with schedule, an anonymous array containing hashes of:
  #         name:  the named query's name
  #         title: title to be displayed on the results
  #         sort:  integer that sets execution order on named queries
  #%]

[% title = "Set up whining" %]
[% PROCESS global/header.html.tmpl
  title = title
  style_urls = ['skins/standard/admin.css']
  doc_section = "whining.html"
%]

<p>
  "Whining" is when [% terms.Bugzilla %] executes a saved search at a regular interval
  and sends the resulting list of [% terms.bugs %] via email.
</p>

<p>
  To set up a new whine event, click "Add a new event."  Enter a subject line
  for the message that will be sent, along with a block of text that will
  accompany the [% terms.bug %] list in the body of the message.
</p>

<p>
  Schedules are added to an event by clicking on "Add a new schedule."  A schedule
  consists of a day, a time of day or interval of times
  (e.g., every 15 minutes), and a target email address that may or may not be
  alterable, depending on your privileges.  Events may have more than one schedule
  in order to run at multiple times or for different users.
</p>

<p>
  Searches come from saved searches, which are created by executing a <a
  href="query.cgi">search</a>, then telling [% terms.Bugzilla %] to remember
  the search under a particular name.  Add a search by clicking "Add a 
  search", and select the desired saved search name under "Search" and add a
  title for the [% terms.bug %] table.  The optional number entered under
  "Sort" will determine the execution order (lowest to highest) if multiple
  queries are listed.  If you check "One message per [% terms.bug %]," each [%
  terms.bug %] that matches the search will be sent in its own email message.
</p>

<p>
  All times are server local time ([% local_timezone FILTER html %]).
</p>

<form method="post" action="editwhines.cgi">
[%# This hidden submit button must be here to set default behavior when
    the user presses return on a form input field #%]
<input type="submit" value="Update / Commit" name="commit"
       style="display: none;" id="commit">
<input type="hidden" name="update" value="1">
<input type="hidden" name="token" value="[% token FILTER html %]">

[% FOREACH event = events %]

<table cellspacing="2" cellpadding="2" style="border: 1px solid;">
  <tr>
    <th align="left">
      Event:
    </th>
    <td align="right" colspan="2">
      <input type="submit" value="Remove Event"
             name="remove_event_[% event.key %]"
             id="remove_event_[% event.key %]">
    </td>
  </tr>

  <tr>
    <td valign="top" align="right">
      Email subject line:
    </td>
    <td colspan="2">
      <input type="text" name="event_[% event.key %]_subject"
             size="60" maxlength="128" value="
             [%- event.value.subject FILTER html %]">
    </td>
  </tr>

  <tr>
    <td valign="top" align="right">
      Descriptive text sent within whine message:
    </td>
    <td colspan="2">
      [% INCLUDE global/textarea.html.tmpl
         name           = "event_${event.key}_body"
         minrows        = 3
         maxrows        = 10
         defaultrows    = 5
         cols           = 80
         defaultcontent = event.value.body
       %]
    </td>
  </tr>

  <tr>
    <td valign="top" align="right">
      Send a message even if there are no [% terms.bugs %] in the search result:
    </td>
    <td colspan="2">
      <input type="checkbox" name="event_[% event.key %]_mailifnobugs"
        [%- IF event.value.mailifnobugs == 1 %] checked [% END %]>
    </td>
  </tr>

  [% IF event.value.schedule.size == 0 %]

    <tr>
      <td valign="top" align="right">
        Schedule:
      </td>
      <td class="unset" colspan="2">
        Not scheduled to run<br>
        <input type="submit" value="Add a new schedule"
               name="add_schedule_[% event.key %]"
               id="add_schedule_[% event.key %]">
      </td>
    </tr>

  [% ELSE %]

    <tr>
      <td valign="top" align="right">
        Schedule:
      </td>
      <td class="set" colspan="2">

        <table>
          <tr>
            <th>
              Interval
            </th>
            <th>
              [% IF mail_others %]
                Mail to
              [% END %]
            </th>
            <th>
            </th>
          </tr>
          [% FOREACH schedule = event.value.schedule %]
            <tr>
              <td align="left">

                [%# these hidden fields allow us to compare old values instead
                    of reading the database to tell if a field has changed %]

                <input type="hidden" value="[% schedule.day FILTER html %]"
                       name="orig_day_[% schedule.id %]">
                <input type="hidden" value="[% schedule.time FILTER html %]"
                       name="orig_time_[% schedule.id %]">
                [% PROCESS day_field val=schedule.day %]
                [% PROCESS time_field val=schedule.time %]
              </td>
              <td align="left">
                [% IF mail_others %]
                  <input type="hidden" name="orig_mailto_type_[% schedule.id %]"
                         value="[% schedule.mailto_type FILTER html %]">
                  <select name="mailto_type_[% schedule.id %]">
                    <option value="0" [% IF schedule.mailto_type == 0 %]
                                        selected
                                      [% END %]>User</option>
                    <option value="1" [% IF schedule.mailto_type == 1 %]
                                        selected
                                      [% END %]>Group</option>
                  </select>
                  <input type="hidden" name="orig_mailto_[% schedule.id %]"
                         value="[% schedule.mailto FILTER html %]">
                  <input type="text" name="mailto_[% schedule.id %]"
                         value="[% schedule.mailto FILTER html %]" size="30">
                [% END %]
              </td>
              <td align="left">
                <input type="submit" value="Remove"
                       name="remove_schedule_[% schedule.id %]"
                       id="remove_schedule_[% schedule.id %]">
              </td>
            </tr>
          [% END %]

          <tr>
            <td colspan="3">
              <input type="submit" value="Add a new schedule"
                     name="add_schedule_[% event.key %]"
                     id="add_schedule_[% event.key %]">
            </td>
          </tr>
        </table>

      </td>
    </tr>

  [% END %]

  [% IF event.value.queries.size == 0 %]

    <tr>
      <td valign="top" align="right">
        Searches:
      </td>
      <td align="left">
        No searches <br>
        <input type="submit" value="Add a search"
               name="add_query_[% event.key %]"
               id="add_query_[% event.key %]">
      </td>
      <td align="right" valign="bottom">
        <input type="submit" value="Update / Commit" name="commit" id="update">
      </td>
    </tr>

  [% ELSE %]

    <tr>
      <td valign="top" align="right">
        Searches:
      </td>
      <td align="left" colspan="2">

        <table>
          <tr>
            <th>Sort</th>
            <th>Search</th>
            <th>Title</th>
            <th></th>
            <th></th>
          </tr>

          [% FOREACH query = event.value.queries %]

            <tr>
              <td align="left">
                <input type="text" name="query_sort_[% query.id %]"
                       size="3" value="[% query.sort %]">
                <input type="hidden" value="[% query.sort %]"
                       name="orig_query_sort_[% query.id %]">
              </td>
              <td align="left">
                <input type="hidden" value="[% query.name FILTER html %]"
                       name="orig_query_name_[% query.id %]">
                [% PROCESS query_field thisquery=query.name %]
              </td>
              <td align="left">
                <input type="hidden" value="[% query.title FILTER html %]"
                       name="orig_query_title_[% query.id %]">
                <input type="text" name="query_title_[% query.id %]"
                       size="50" value="[% query.title FILTER html %]"
                       maxlength="64">
              </td>
              <td align="left">
                <input type="hidden" value="[% query.onemailperbug FILTER html %]"
                       name="orig_query_onemailperbug_[% query.id %]">
                <input type="checkbox" [% IF query.onemailperbug == 1 %] checked [% END %]
                       id="query_onemailperbug_[% query.id %]"
                       name="query_onemailperbug_[% query.id %]">
                <label for="query_onemailperbug_[% query.id %]">One message per [% terms.bug %]</label>
              </td>
              <td align="right">
                <input type="submit" value="Remove"
                       name="remove_query_[% query.id %]"
                       id="remove_query_[% query.id %]">
              </td>
            </tr>

          [% END %]

          <tr>
            <td colspan="3">
              <input type="submit" value="Add a search"
                     name="add_query_[% event.key %]"
                     id="add_query_[% event.key %]">
            </td>
            <td align="right" colspan="2">
              <input type="submit" value="Update / Commit" name="commit" id="update">
            </td>
          </tr>
        </table>

      </td>
    </tr>

  [% END %]

</table>

[% END %]

<p align="left">
  <input type="submit" value="Add a new event" name="add_event" id="add_event">
</p>

</form>

[% PROCESS global/footer.html.tmpl %]

[% BLOCK query_field +%]

  [% IF available_queries.size > 0 %]

    <select name="query_name_[% query.id %]">
      [% FOREACH q = available_queries %]
        <option [% "selected" IF q == thisquery %] value="[% q FILTER html %]">
            [% q FILTER html %]
        </option>
      [% END %]
    </select>

  [% ELSE %]
    Please visit the <a href="query.cgi">Search</a> page and save a search
  [% END %]

[%+ END %]

[% BLOCK day_field +%]
  <select name="day_[% schedule.id %]">
      [%
        options = [
            ['All',  'Each day',                 ],
            ['MF',   'Monday through Friday',    ],
            ['Sun',  'Sunday',                   ],
            ['Mon',  'Monday',                   ],
            ['Tue',  'Tuesday',                  ],
            ['Wed',  'Wednesday',                ],
            ['Thu',  'Thursday',                 ],
            ['Fri',  'Friday',                   ],
            ['Sat',  'Saturday',                 ],
            ['1',    'On the 1st of the month',  ],
            ['2',    'On the 2nd of the month',  ],
            ['3',    'On the 3rd of the month',  ],
            ['4',    'On the 4th of the month',  ],
            ['5',    'On the 5th of the month',  ],
            ['6',    'On the 6th of the month',  ],
            ['7',    'On the 7th of the month',  ],
            ['8',    'On the 8th of the month',  ],
            ['9',    'On the 9th of the month',  ],
            ['10',   'On the 10th of the month', ],
            ['11',   'On the 11th of the month', ],
            ['12',   'On the 12th of the month', ],
            ['13',   'On the 13th of the month', ],
            ['14',   'On the 14th of the month', ],
            ['15',   'On the 15th of the month', ],
            ['16',   'On the 16th of the month', ],
            ['17',   'On the 17th of the month', ],
            ['18',   'On the 18th of the month', ],
            ['19',   'On the 19th of the month', ],
            ['20',   'On the 20th of the month', ],
            ['21',   'On the 21st of the month', ],
            ['22',   'On the 22nd of the month', ],
            ['23',   'On the 23rd of the month', ],
            ['24',   'On the 24th of the month', ],
            ['25',   'On the 25th of the month', ],
            ['26',   'On the 26th of the month', ],
            ['27',   'On the 27th of the month', ],
            ['28',   'On the 28th of the month', ],
            ['29',   'On the 29th of the month', ],
            ['30',   'On the 30th of the month', ],
            ['31',   'On the 31st of the month', ],
            ['last', 'Last day of the month',    ],
        ]
      %]

      [% FOREACH option = options %]
        <option value="[% option.0 %]" 
                [%- IF val == option.0 +%] selected[% END %]>
                [%- option.1 -%]
        </option>
      [% END %]

  </select>
[%+ END %]

[% BLOCK time_field +%]
<select name="time_[% schedule.id %]">

  [%
    options = [
        [ '0',     'at midnight',      ],
        [ '1',     'at 01:00',         ],
        [ '2',     'at 02:00',         ],
        [ '3',     'at 03:00',         ],
        [ '4',     'at 04:00',         ],
        [ '5',     'at 05:00',         ],
        [ '6',     'at 06:00',         ],
        [ '7',     'at 07:00',         ],
        [ '8',     'at 08:00',         ],
        [ '9',     'at 09:00',         ],
        [ '10',    'at 10:00',         ],
        [ '11',    'at 11:00',         ],
        [ '12',    'at 12:00',         ],
        [ '13',    'at 13:00',         ],
        [ '14',    'at 14:00',         ],
        [ '15',    'at 15:00',         ],
        [ '16',    'at 16:00',         ],
        [ '17',    'at 17:00',         ],
        [ '18',    'at 18:00',         ],
        [ '19',    'at 19:00',         ],
        [ '20',    'at 20:00',         ],
        [ '21',    'at 21:00',         ],
        [ '22',    'at 22:00',         ],
        [ '23',    'at 23:00',         ],
        [ '60min', 'every hour',       ],
        [ '30min', 'every 30 minutes', ],
        [ '15min', 'every 15 minutes', ],
    ]
  %]

      [% FOREACH option = options %]
        <option value="[% option.0 %]" 
                [%- IF val == option.0 +%] selected[% END %]>
                [%- option.1 -%]
        </option>
      [% END %]

</select>

[%+ END %]