summaryrefslogtreecommitdiffstats
path: root/template/en/default/bug/create/create.html.tmpl
blob: 24b6ec959dcb7bb9a8c9203c9215631676944cc0 (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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
  # except in compliance with the License. You may obtain a copy of
  # the License at http://www.mozilla.org/MPL/
  #
  # Software distributed under the License is distributed on an "AS
  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  # implied. See the License for the specific language governing
  # rights and limitations under the License.
  #
  # The Original Code is the Bugzilla Bug Tracking System.
  #
  # The Initial Developer of the Original Code is Netscape Communications
  # Corporation. Portions created by Netscape are
  # Copyright (C) 1998 Netscape Communications Corporation. All
  # Rights Reserved.
  #
  # Contributor(s): Gervase Markham <gerv@gerv.net>
  #                 Ville Skyttä <ville.skytta@iki.fi>
  #                 Shane H. W. Travis <travis@sedsystems.ca>
  #                 Marc Schumann <wurblzap@gmail.com>
  #                 Akamai Technologies <bugzilla-dev@akamai.com>
  #                 Max Kanat-Alexander <mkanat@bugzilla.org>
  #                 Frédéric Buclin <LpSolit@gmail.com>
  #%]

[% PROCESS "global/field-descs.none.tmpl" %]

[% title = BLOCK %]Enter [% terms.Bug %]: [% product.name FILTER html %][% END %]

[% PROCESS global/header.html.tmpl
  title = title
  style_urls = [ 'skins/standard/create_attachment.css',
                 'skins/standard/yui/calendar.css' ]
  javascript_urls = [ "js/attachment.js", "js/util.js", "js/keyword-chooser.js",
                      "js/yui/yahoo-dom-event.js", "js/yui/calendar.js",
                      "js/field.js" ]
%]

<script type="text/javascript">
<!--

var initialowners = new Array([% product.components.size %]);
var last_initialowner;
var initialccs = new Array([% product.components.size %]);
var components = new Array([% product.components.size %]);
var comp_desc = new Array([% product.components.size %]);
var flags = new Array([% product.components.size %]);
[% IF Param("useqacontact") %]
    var initialqacontacts = new Array([% product.components.size %]);
    var last_initialqacontact;
[% END %]
[% count = 0 %]
[%- FOREACH c = product.components %]
    components[[% count %]] = "[% c.name FILTER js %]";
    comp_desc[[% count %]] = "[% c.description FILTER html_light FILTER js %]";
    initialowners[[% count %]] = "[% c.default_assignee.login FILTER js %]";
    [% flag_list = [] %]
    [% FOREACH f = c.flag_types.bug %]
      [% NEXT UNLESS f.is_active %]
      [% flag_list.push(f.id) %]
    [% END %]
    [% FOREACH f = c.flag_types.attachment %]
      [% NEXT UNLESS f.is_active %]
      [% flag_list.push(f.id) %]
    [% END %]
    flags[[% count %]] = [[% flag_list.join(",") FILTER js %]];
    [% IF Param("useqacontact") %]
        initialqacontacts[[% count %]] = "[% c.default_qa_contact.login FILTER js %]";
    [% END %]

    [% SET initial_cc_list = [] %]
    [% FOREACH cc_user = c.initial_cc %]
      [% initial_cc_list.push(cc_user.login) %]
    [% END %]
    initialccs[[% count %]] = "[% initial_cc_list.join(', ') FILTER js %]";

    [% count = count + 1 %]
[%- END %]

function set_assign_to() {
    // Based on the selected component, fill the "Assign To:" field
    // with the default component owner, and the "QA Contact:" field
    // with the default QA Contact. It also selectively enables flags.
    var form = document.Create;
    var assigned_to = form.assigned_to.value;

[% IF Param("useqacontact") %]
    var qa_contact = form.qa_contact.value;
[% END %]

    var index = -1;
    if (form.component.type == 'select-one') {
        index = form.component.selectedIndex;
    } else if (form.component.type == 'hidden') {
        // Assume there is only one component in the list
        index = 0;
    }
    if (index != -1) {
        var owner = initialowners[index];
        var component = components[index];
        if (assigned_to == last_initialowner
            || assigned_to == owner
            || assigned_to == '') {
            form.assigned_to.value = owner;
            last_initialowner = owner;
        }

        document.getElementById('initial_cc').innerHTML = initialccs[index];
        document.getElementById('comp_desc').innerHTML = comp_desc[index];

        [% IF Param("useqacontact") %]
            var contact = initialqacontacts[index];
            if (qa_contact == last_initialqacontact
                || qa_contact == contact
                || qa_contact == '') {
                  form.qa_contact.value = contact;
                  last_initialqacontact = contact;
            }
        [% END %]

        // First, we disable all flags. Then we re-enable those
        // which are available for the selected component.
        var inputElements = document.getElementsByTagName("select");
        var inputElement, flagField;
        for ( var i=0 ; i<inputElements.length ; i++ ) {
            inputElement = inputElements.item(i);
            if (inputElement.name.search(/^flag_type-(\d+)$/) != -1) {
                var id = inputElement.name.replace(/^flag_type-(\d+)$/, "$1");
                inputElement.disabled = true;
                // Also disable the requestee field, if it exists.
                inputElement = document.getElementById("requestee_type-" + id);
                if (inputElement) inputElement.disabled = true;
            }
        }
        // Now enable flags available for the selected component.
        for (var i = 0; i < flags[index].length; i++) {
            flagField = document.getElementById("flag_type-" + flags[index][i]);
            // Do not enable flags the user cannot set nor request.
            if (flagField && flagField.options.length > 1) {
                flagField.disabled = false;
                // Re-enabling the requestee field depends on the status
                // of the flag.
                toggleRequesteeField(flagField, 1);
            }
        }
    }
}

function handleWantsAttachment(wants_attachment) {
    if (wants_attachment) {
        document.getElementById('attachment_false').style.display = 'none';
        document.getElementById('attachment_true').style.display = 'block';
    }
    else {
        document.getElementById('attachment_false').style.display = 'block';
        document.getElementById('attachment_true').style.display = 'none';
        clearAttachmentFields();
    }
}

-->
</script>

<form name="Create" id="Create" method="post" action="post_bug.cgi"
      enctype="multipart/form-data">
<input type="hidden" name="product" value="[% product.name FILTER html %]">
<input type="hidden" name="token" value="[% token FILTER html %]">

<table cellspacing="4" cellpadding="2" border="0">
<tbody>
  <tr>
    <td colspan="4">
    [%# Migration note: The following file corresponds to the old Param
      # 'entryheaderhtml'
      #%]
    [% INCLUDE 'bug/create/user-message.html.tmpl' %]
    </td>
  </tr>

  <tr>
    <td colspan="4">&nbsp;</td>
  </tr>

  <tr>
    <th>Product:</th>
    <td width="10%">[% product.name FILTER html %]</td>

    <th>Reporter:</th>
    <td width="100%">[% user.login FILTER html %]</td>
  </tr>

  [%# We can't use the select block in these two cases for various reasons. %]
  <tr>
    <th>
      <a href="describecomponents.cgi?product=[% product.name FILTER url_quote %]">
      Component</a>:
    </th>
    <td>
      <select name="component" onchange="set_assign_to();" size="5">
        [%- FOREACH c = product.components %]
          <option value="[% c.name FILTER html %]"
            [% " selected=\"selected\"" IF c.name == default.component_ %]>
            [% c.name FILTER html -%]
          </option>
        [%- END %]
      </select>
    </td>

    <td colspan="2">
      [%# Enclose the fieldset in a nested table so that its width changes based
        # on the length on the component description. %]
      <table>
        <tr>
          <td>
            <fieldset>
              <legend>Component Description</legend>
              <div id="comp_desc" class="comment">Select a component to read its description.</div>
            </fieldset>
          </td>
        </tr>
      </table>
    </td>
  </tr>

  <tr>
    <th rowspan="3">Version:</th>
    <td rowspan="3">
      <select name="version" size="5">
        [%- FOREACH v = version %]
          <option value="[% v FILTER html %]"
            [% ' selected="selected"' IF v == default.version %]>[% v FILTER html -%]
          </option>
        [%- END %]
      </select>
    </td>

    [% sel = { description => 'Severity', name => 'bug_severity' } %]
    [% INCLUDE select %]
  </tr>

  <tr>
    [% sel = { description => 'Platform', name => 'rep_platform' } %]
    [% INCLUDE select %]
  </tr>

  <tr>
    [% sel = { description => 'OS', name => 'op_sys' } %]
    [% INCLUDE select %]
  </tr>
</tbody>

<tbody class="expert_fields">
  <tr>
    [% IF Param('usetargetmilestone') && Param('letsubmitterchoosemilestone') %]
      [% sel = { description => 'Target Milestone', name => 'target_milestone' } %]
      [% INCLUDE select %]
    [% ELSE %]
      <td colspan="2">&nbsp;</td>
    [% END %]

    [% IF Param('letsubmitterchoosepriority') %]
      [% sel = { description => 'Priority', name => 'priority' } %]
      [% INCLUDE select %]
    [% ELSE %]
      <td colspan="2">
        <input type="hidden" name="priority" value="[% default.priority FILTER html %]">
      </td>
    [% END %]
  </tr>
</tbody>

[% IF !Param('defaultplatform') || !Param('defaultopsys') %]
  <tbody>
    <tr>
      <th>&nbsp;</th>
      <td colspan="3" class="comment">
        We've made a guess at your
        [% IF Param('defaultplatform') %]
          operating system. Please check it
        [% ELSIF Param('defaultopsys') %]
          platform. Please check it
        [% ELSE %]
          operating system and platform. Please check them
        [% END %]
        and, if we got it wrong, email [% Param('maintainer') %].
      </td>
    </tr>
  </tbody>
[% END %]

<tbody class="expert_fields">
  <tr>
    <td colspan="4">&nbsp;</td>
  </tr>

  <tr>
[% IF bug_status.size <= 1 %]
  <input type="hidden" name="bug_status" 
         value="[% default.bug_status FILTER html %]">
    <th>Initial State:</th>
    <td>[% get_status(default.bug_status) FILTER html %]</td>
[% ELSE %]
    [% sel = { description => 'Initial State', name => 'bug_status' } %]
    [% INCLUDE select %]
[% END %]

    <td>&nbsp;</td>
    [%# Calculate the number of rows we can use for flags %]
    [% num_rows = 6 + (Param("useqacontact") ? 1 : 0) +
                      (user.in_group(Param('timetrackinggroup')) ? 3 : 0) +
                      (Param("usebugaliases") ? 1 : 0)
    %]

    <td rowspan="[% num_rows FILTER html %]">
      [% IF product.flag_types.bug.size > 0 %]
        [% display_flag_headers = 0 %]
        [% any_flags_requesteeble = 0 %]

        [% FOREACH flag_type = product.flag_types.bug %]
          [% NEXT UNLESS flag_type.is_active %]
          [% display_flag_headers = 1 %]
          [% SET any_flags_requesteeble = 1 IF flag_type.is_requestable && flag_type.is_requesteeble %]
        [% END %]

        [% IF display_flag_headers %]
          [% PROCESS "flag/list.html.tmpl" flag_types = product.flag_types.bug
                                           any_flags_requesteeble = any_flags_requesteeble
                                           flag_table_id = "bug_flags"
          %]
        [% END %]
      [% END %]
    </td>
  </tr>

  <tr>
    <th><a href="page.cgi?id=fields.html#assigned_to">Assign To</a>:</th>
    <td colspan="2">
      [% INCLUDE global/userselect.html.tmpl
         name => "assigned_to"
         value => assigned_to
         disabled => assigned_to_disabled
         size => 32
         emptyok => 1
       %]
      <noscript>(Leave blank to assign to component's default assignee)</noscript>
    </td>
  </tr>
  
[% IF Param("useqacontact") %]
    <tr>
      <th>QA Contact:</th>
      <td colspan="2">
      [% INCLUDE global/userselect.html.tmpl
         name => "qa_contact"
         value => qa_contact
         disabled => qa_contact_disabled
         size => 32
         emptyok => 1
       %]
        <noscript>(Leave blank to assign to default qa contact)</noscript>
      </td>
    </tr>
[% END %]

  <tr>
    <th>CC:</th>
    <td colspan="2">
      [% INCLUDE global/userselect.html.tmpl
         name => "cc"
         value => cc
         disabled => cc_disabled
         size => 45
         multiple => 5
       %]
    </td>
  </tr>

  <tr>
    <th>Default CC:</th>
    <td colspan="2">
      <div id="initial_cc">
          <!-- This has to happen after everything above renders,
               and onload doesn't work. So this is as good a place
               as any to put it. -->
          <script type="text/javascript">set_assign_to();</script>
      </div>
   </td>
  </tr>
  
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>

[% IF user.in_group(Param('timetrackinggroup')) %]
  <tr>
    <th>Estimated Hours:</th>
    <td colspan="2">
      <input name="estimated_time" size="6" maxlength="6" value="0.0">
    </td>
  </tr>
  <tr>
    <th>Deadline:</th>
    <td colspan="2">
      <input name="deadline" size="10" maxlength="10" value="[% deadline FILTER html %]">
      <small>(YYYY-MM-DD)</small>
    </td>
  </tr>

  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
[% END %]

[% IF Param("usebugaliases") %]
  <tr>
    <th>Alias:</th>
    <td colspan="2">
      <input name="alias" size="20">
    </td>
  </tr>
[% END %]

  <tr>
    <th>URL:</th>
    <td colspan="2">
      <input name="bug_file_loc" size="60"
             value="[% bug_file_loc FILTER html %]">
    </td>
  </tr>
</tbody>

<tbody>
  [% USE Bugzilla %]

  [% FOREACH field = Bugzilla.active_custom_fields %]
    [% NEXT UNLESS field.enter_bug %]
    [% SET value = ${field.name} IF ${field.name}.defined %]
    <tr>
      [% PROCESS bug/field.html.tmpl editable=1 value_span=3 %]
    </tr>
  [% END %]

  <tr>
    <th>Summary:</th>
    <td colspan="2">
      <input name="short_desc" size="60" value="[% short_desc FILTER html %]"
             maxlength="255" spellcheck="true">
    </td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <th>Description:</th>
    <td colspan="3">
      [% defaultcontent = BLOCK %]
        [% IF cloned_bug_id %]
+++ This [% terms.bug %] was initially created as a clone of [% terms.Bug %] #[% cloned_bug_id %] +++


        [% END %]
        [%-# We are within a BLOCK. The comment will be correctly HTML-escaped
          # by global/textarea.html.tmpl. So we must not escape the comment here. %]
        [% comment FILTER none %]
      [%- END %]
      [% INCLUDE global/textarea.html.tmpl
         name           = 'comment'
         id             = 'comment'
         minrows        = 10
         maxrows        = 25
         cols           = constants.COMMENT_COLS
         defaultcontent = defaultcontent
       %]
      <br>
    </td>
  </tr>

  [% IF Param("insidergroup") && user.in_group(Param("insidergroup")) %]
    <tr>
      <th>&nbsp;</th>
      <td colspan="3">
        &nbsp;&nbsp;
        <input type="checkbox" id="commentprivacy" name="commentprivacy"
          [% " checked=\"checked\"" IF commentprivacy %]>
        <label for="commentprivacy">
          Initial Description is Private
        </label>
      </td>
    </tr>
  [% END %]
</tbody>

<tbody class="expert_fields">
  <tr>
    <th>Attachment:</th>
    <td colspan="3">
      <script type="text/javascript">
        <!--
        document.write( '<div id="attachment_false">'
                      +   '<input type="button" value="Add an attachment" '
                      +          'onClick="handleWantsAttachment(true)"> '
                      +   '<em style="display: none">This button has no '
                      +   'functionality for you because your browser does '
                      +   'not support CSS or does not use it.<\/em>'
                      + '<\/div>'
                      + '<div id="attachment_true" style="display: none">'
                      +   '<input type="button" '
                      +          'value="Don\'t add an attachment " '
                      +          'onClick="handleWantsAttachment(false)">');
        //-->
      </script>
        <fieldset>
          <legend>Add an attachment</legend>
          <table class="attachment_entry">
            [% PROCESS attachment/createformcontents.html.tmpl
                       flag_types = product.flag_types.attachment
                       any_flags_requesteeble = 1
                       flag_table_id ="attachment_flags" %]
          </table>
        </fieldset>
      <script type="text/javascript">
        <!--
        document.write('<\/div>');
        //-->
      </script>
    </td>
  </tr>

  [% IF user.in_group('editbugs', product.id) %]
    [% IF use_keywords %]
      <tr>
        <th><a href="describekeywords.cgi">Keywords</a>:</th>
        <td colspan="3">
          <input id="keywords" name="keywords" size="60" value="[% keywords FILTER html %]" onfocus="this.chooser.open();"> (optional)
        </td>
      </tr>
    [% END %]

    <tr>
      <th>Depends on:</th>
      <td colspan="3">
        <input name="dependson" accesskey="d" value="[% dependson FILTER html %]">
      </td>
    </tr>
    <tr>
      <th>Blocks:</th>
      <td colspan="3">
        <input name="blocked" accesskey="b" value="[% blocked FILTER html %]">
      </td>
    </tr>
  [% END %]
</tbody>

<tbody>
  [% IF group.size %]
  <tr>
    <th>&nbsp;</th>
    <td colspan="3">
      <br>
        <strong>
          Only users in all of the selected groups can view this [% terms.bug %]:
        </strong>
      <br>
      <font size="-1">
        (Leave all boxes unchecked to make this a public [% terms.bug %].)
      </font>
      <br>
      <br>

      <!-- Checkboxes -->
      [% FOREACH g = group %]
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="checkbox" id="bit-[% g.bit %]"
          name="bit-[% g.bit %]" value="1"
          [% " checked=\"checked\"" IF g.checked %]>
          <label for="bit-[% g.bit %]">[% g.description FILTER html_light %]</label><br>
      [% END %]
    </td>
  </tr>
  [% END %]

  [%# Form controls for entering additional data about the bug being created. %]
  [% Hook.process("form") %]

  <tr>
    <th>&nbsp;</th>
    <td colspan="3">
      <input type="submit" id="commit" value="Commit"
             onclick="if (this.form.short_desc.value == '')
             { alert('Please enter a summary sentence for this [% terms.bug %].');
               return false; } return true;">
      &nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" name="maketemplate" id="maketemplate"
             value="Remember values as bookmarkable template"
             class="expert_fields">
    </td>
  </tr>
</tbody>
  </table>
  <input type="hidden" name="form_name" value="enter_bug">
</form>

[% IF use_keywords %]
  [% PROCESS "bug/keyword-chooser.html.tmpl"
    sel_keywords = keywords.split(', ')
  %]
[% END %]

[%# Links or content with more information about the bug being created. %]
[% Hook.process("end") %]

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

[%############################################################################%]
[%# Block for SELECT fields                                                  #%]
[%############################################################################%]

[% BLOCK select %]
  [% IF sel.description %]
    <th>
      <a href="page.cgi?id=fields.html#[% sel.name %]">[% sel.description %]</a>:
    </th>
  [% END %]

  <td>
    <select name="[% sel.name %]">
    [%- FOREACH x = ${sel.name} %]
      <option value="[% x FILTER html %]"
        [% " selected=\"selected\"" IF x == default.${sel.name} %]>
        [% IF sel.name == "bug_status" %]
          [% get_status(x) FILTER html %]
        [% ELSE %]
          [% x FILTER html %]
        [% END %]</option>
    [% END %]
    </select>
  </td>
[% END %]