create.html.tmpl 17.7 KB
Newer Older
1
[%# 1.0@bugzilla.org %]
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[%# 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>
20
  #                 Ville Skyttä <ville.skytta@iki.fi>
21
  #                 Shane H. W. Travis <travis@sedsystems.ca>
22
  #                 Marc Schumann <wurblzap@gmail.com>
23 24
  #%]

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

27
[% PROCESS global/header.html.tmpl
28
  title = "Enter $terms.Bug: $product.name"
29 30
  style_urls = [ 'skins/standard/create_attachment.css' ]
  javascript_urls = [ "js/attachment.js" ]
31
  onload="set_assign_to();"
32 33
%]

34
<script type="text/javascript">
35 36
<!--

37
var initialowners = new Array([% product.components.size %]);
38
var last_initialowner;
39
var components = new Array([% product.components.size %]);
40
var flags = new Array([% product.components.size %]);
41
[% IF Param("useqacontact") %]
42
    var initialqacontacts = new Array([% product.components.size %]);
43 44
    var last_initialqacontact;
[% END %]
45
[% count = 0 %]
46
[%- FOREACH c = product.components %]
47
    components[[% count %]] = "[% c.name FILTER js %]";
48
    initialowners[[% count %]] = "[% c.default_assignee.login FILTER js %]";
49 50 51 52 53 54 55 56 57 58 59
    var flag_list = new Array([% c.flag_types.bug.size + c.flag_types.attachment.size %]);
    [% flag_count = 0 %]
    [% FOREACH f = c.flag_types.bug %]
      flag_list[[% flag_count %]] = "[% f.id %]";
      [% flag_count = flag_count + 1 %]
    [% END %]
    [% FOREACH f = c.flag_types.attachment %]
      flag_list[[% flag_count %]] = "[% f.id %]";
      [% flag_count = flag_count + 1 %]
    [% END %]
    flags[[% count %]] = flag_list;
60
    [% IF Param("useqacontact") %]
61
        initialqacontacts[[% count %]] = "[% c.default_qa_contact.login FILTER js %]";
62
    [% END %]
63 64
    [% count = count + 1 %]
[%- END %]
65

66 67
function set_assign_to() {
    // Based on the selected component, fill the "Assign To:" field
68 69
    // with the default component owner, and the "QA Contact:" field
    // with the default QA Contact. It also selectively enables flags.
70
    var form = document.Create;
71
    var assigned_to = form.assigned_to.value;
72 73 74 75 76

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

77 78 79 80 81 82 83 84
    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) {
85
        var owner = initialowners[index];
86
        var component = components[index];
87
        if (assigned_to == last_initialowner
88
            || assigned_to == owner
89
            || assigned_to == '') {
90
            form.assigned_to.value = owner;
91
            last_initialowner = owner;
92
        }
93 94 95 96 97 98 99 100 101
        [% 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 %]
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

        // 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]);
            if (flagField) {
                flagField.disabled = false;
                // Re-enabling the requestee field depends on the status
                // of the flag.
                toggleRequesteeField(flagField, 1);
            }
        }
127 128
    }
}
129 130 131 132 133 134 135 136 137 138 139 140 141

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();
    }
}

142 143 144
-->
</script>

145 146
<form name="Create" id="Create" method="post" action="post_bug.cgi"
      enctype="multipart/form-data">
147
<input type="hidden" name="product" value="[% product.name FILTER html %]">
148
<input type="hidden" name="token" value="[% token FILTER html %]">
149 150 151 152

<table cellspacing="2" cellpadding="0" border="0">

  <tr>
153
    <td>&nbsp;</td>
154
    <td colspan="3">
155 156 157 158
    [%# Migration note: The following file corresponds to the old Param
      # 'entryheaderhtml'
      #%]
    [% INCLUDE 'bug/create/user-message.html.tmpl' %]
159 160
    </td>
  </tr>
161

162
  <tr>
163 164
    <td>&nbsp;</td>
    <td colspan="3">&nbsp;</td>
165 166 167 168
  </tr>

  <tr>
    <td align="right" valign="top"><strong>Reporter:</strong></td>
169
    <td valign="top">[% user.login FILTER html %]</td>
170

171
    <td align="right" valign="top"><strong>Product:</strong></td>
172
    <td valign="top">[% product.name FILTER html %]</td>
173
  </tr>
174

175 176 177 178 179 180 181 182 183 184 185 186 187
  [%# We can't use the select block in these two cases for various reasons. %]
  <tr>
    <td align="right" valign="top">
      <strong>Version:</strong>
    </td>
    <td>
      <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>
188 189
    </td>

190 191
    <td align="right" valign="top">
      <strong>
192
        <a href="describecomponents.cgi?product=[% product.name FILTER url_quote %]">
193
          Component</a>:
194 195 196
      </strong>
    </td>
    <td>
197
      <select name="component" onchange="set_assign_to();" size="5">
198
        [%- FOREACH c = product.components %]
199 200 201
          <option value="[% c.name FILTER html %]"
            [% " selected=\"selected\"" IF c.name == default.component_ %]>
            [% c.name FILTER html -%]
202 203 204
          </option>
        [%- END %]
      </select>
205
    </td>
206
  </tr>
207

208 209
  <tr>
    <td>&nbsp;</td>
210
    <td colspan="3">&nbsp;</td>
211
  </tr>
212

213 214 215
  <tr>
    [% sel = { description => 'Platform', name => 'rep_platform' } %]
    [% INCLUDE select %]
216

217 218 219
    [% sel = { description => 'OS', name => 'op_sys' } %]
    [% INCLUDE select %]
  </tr>
220 221

  <tr>
222 223 224 225 226 227 228 229
    [% 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 %]
230

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

235 236
  [% IF Param('usetargetmilestone') && Param('letsubmitterchoosemilestone') %]
    <tr>
237 238 239
      [% sel = { description => 'Target Milestone', name => 'target_milestone' } %]
      [% INCLUDE select %]
      <td colspan="2">&nbsp;</td>
240 241 242
    </tr>
  [% END %]

243 244
  <tr>
    <td>&nbsp;</td>
245
    <td colspan="3">&nbsp;</td>
246 247 248
  </tr>

  <tr>
249 250 251 252
[% IF bug_status.size <= 1 %]
  <input type="hidden" name="bug_status" 
         value="[% default.bug_status FILTER html %]">
    <td align="right" valign="top"><strong>Initial State:</strong></td>
253
    <td valign="top">[% status_descs.${default.bug_status} FILTER html %]</td>
254
[% ELSE %]
255 256
    [% sel = { description => 'Initial State', name => 'bug_status' } %]
    [% INCLUDE select %]
257
[% END %]
258 259 260 261 262 263 264 265 266 267
    <td>&nbsp;</td>
    [%# Calculate the number of rows we can use for flags %]
    [% num_rows = 6 + (Param("useqacontact") ? 1 : 0) +
                      (UserInGroup(Param('timetrackinggroup')) ? 3 : 0) +
                      (Param("usebugaliases") ? 1 : 0)
    %]
    <td rowspan="[% num_rows FILTER html %]" valign="top">
      [% IF product.flag_types.bug.size > 0 %]
        [% PROCESS "flag/list.html.tmpl" flag_types = product.flag_types.bug
                                         any_flags_requesteeble = 1
268
                                         flag_table_id = "bug_flags"
269 270 271
        %]
      [% END %]
    </td>
272 273 274 275 276
  </tr>

  <tr>
    <td align="right">
      <strong>
277
        <a href="page.cgi?id=fields.html#assigned_to">Assign To</a>:
278 279
      </strong>
    </td>
280
    <td colspan="2">
281 282 283
      [% INCLUDE global/userselect.html.tmpl
         name => "assigned_to"
         value => assigned_to
284
         disabled => assigned_to_disabled
285 286 287
         size => 32
         emptyok => 1
       %]
288
      <noscript>(Leave blank to assign to component's default assignee)</noscript>
289 290 291
    </td>
  </tr>
  
292 293 294
[% IF Param("useqacontact") %]
    <tr>
      <td align="right"><strong>QA Contact:</strong></td>
295
      <td colspan="2">
296 297 298 299 300 301 302 303 304 305 306 307
      [% 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 %]

308 309
  <tr>
    <td align="right"><strong>Cc:</strong></td>
310
    <td colspan="2">
311 312 313
      [% INCLUDE global/userselect.html.tmpl
         name => "cc"
         value => cc
314
         disabled => cc_disabled
315
         size => 45
316
         multiple => 5
317
       %]
318 319 320 321 322
    </td>
  </tr>
  
  <tr>
    <td>&nbsp;</td>
323
    <td colspan="2"></td>
324 325
  </tr>

326 327 328
[% IF UserInGroup(Param('timetrackinggroup')) %]
  <tr>
    <td align="right"><strong>Estimated Hours:</strong></td>
329
    <td colspan="2">
330
      <input name="estimated_time" size="6" maxlength="6" value="0.0">
331 332
    </td>
  </tr>
333 334
  <tr>
    <td align="right"><strong>Deadline:</strong></td>
335
    <td colspan="2">
336
      <input name="deadline" size="10" maxlength="10" value="[% deadline FILTER html %]">
337 338 339
      <small>(YYYY-MM-DD)</small>
    </td>
  </tr>
340 341 342

  <tr>
    <td>&nbsp;</td>
343
    <td colspan="2"></td>
344 345 346
  </tr>
[% END %]

347 348 349
[% IF Param("usebugaliases") %]
  <tr>
    <td align="right"><strong>Alias:</strong></td>
350
    <td colspan="2">
351 352 353 354 355
      <input name="alias" size="20">
    </td>
  </tr>
[% END %]

356
  <tr>
357
    <td align="right"><strong>URL:</strong></td>
358
    <td colspan="2">
359
      <input name="bug_file_loc" size="60"
360
             value="[% bug_file_loc FILTER html %]">
361 362
    </td>
  </tr>
363

364 365 366 367 368
  [% USE Bugzilla %]
  [% FOREACH field = Bugzilla.get_fields({ obsolete => 0, custom => 1, 
                                           enter_bug => 1 }) %]
    [% SET value = ${field.name} IF ${field.name}.defined %]
    <tr>
369
      [% PROCESS bug/field.html.tmpl editable=1 value_span=2 %]
370 371 372
    </tr>
  [% END %]

373 374
  <tr>
    <td align="right"><strong>Summary:</strong></td>
375
    <td colspan="2">
376 377
      <input name="short_desc" size="60" value="[% short_desc FILTER html %]"
             maxlength="255">
378 379
    </td>
  </tr>
380

381 382
  <tr><td align="right" valign="top"><strong>Description:</strong></td>
    <td colspan="3">
383
      [% defaultcontent = BLOCK %]
384 385 386 387 388
        [% IF cloned_bug_id %]
+++ This [% terms.bug %] was initially created as a clone of [% terms.Bug %] #[% cloned_bug_id %] +++


        [% END %]
389 390 391 392
        [% comment FILTER html %]
      [%- END %]
      [% INCLUDE global/textarea.html.tmpl
         name           = 'comment'
393
         id             = 'comment'
394 395
         minrows        = 10
         maxrows        = 25
396
         cols           = constants.COMMENT_COLS
397 398
         defaultcontent = defaultcontent
       %]
399 400 401
      <br>
    </td>
  </tr>
402

403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
  [% IF Param("insidergroup") && UserInGroup(Param("insidergroup")) %]
    <tr>
      <td></td>
      <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>
  [% ELSE %]
    <input type="hidden" name="commentprivacy" value="0">
  [% END %]

419 420 421 422 423 424 425 426 427 428
  <tr>
    <th align="right" valign="top">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 '
429 430
                      +   'not support CSS or does not use it.<\/em>'
                      + '<\/div>'
431 432 433 434 435 436 437 438 439
                      + '<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">
440
            [% PROCESS attachment/createformcontents.html.tmpl
441 442
                       flag_types = product.flag_types.attachment
                       flag_table_id ="attachment_flags" %]
443 444 445 446
          </table>
        </fieldset>
      <script type="text/javascript">
        <!--
447
        document.write('<\/div>');
448 449 450 451 452
        //-->
      </script>
    </td>
  </tr>

453
  [% IF UserInGroup('editbugs') %]
454 455 456 457 458 459 460 461
    [% IF use_keywords %]
      <tr>
        <td align="right" valign="top">
          <strong>
            <a href="describekeywords.cgi">Keywords</a>:
          </strong>
        </td>
        <td colspan="3">
462
          <input name="keywords" size="60" value="[% keywords FILTER html %]"> (optional)
463 464 465
        </td>
      </tr>
    [% END %]
466 467 468 469 470
    <tr>
      <td align="right">
        <strong>Depends on:</strong>
      </td>
      <td>
471
        <input name="dependson" accesskey="d" value="[% dependson FILTER html %]">
472 473 474 475 476 477 478
      </td>
    </tr>
    <tr>
      <td align="right">
        <strong>Blocks:</strong>
      </td>
      <td>
479
        <input name="blocked" accesskey="b" value="[% blocked FILTER html %]">
480 481
      </td>
    </tr>
482
  [% END %]
483

484 485 486 487 488 489
  <tr>
    <td></td>
    <td colspan="3">
    [% IF group.size %]
      <br>
        <strong>
490
          Only users in all of the selected groups can view this [% terms.bug %]:
491 492 493
        </strong>
      <br>
      <font size="-1">
494
        (Leave all boxes unchecked to make this a public [% terms.bug %].)
495 496 497 498 499 500 501
      </font>
      <br>
      <br>

      <!-- Checkboxes -->
      [% FOREACH g = group %]
        &nbsp;&nbsp;&nbsp;&nbsp;
502 503 504 505
        <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 %]</label><br>
506 507 508 509 510
      [% END %]
      <br>
    [% END %]
    </td>
  </tr>
511

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

515 516 517
  <tr>
    <td></td>
    <td colspan="3">
518
      <input type="submit" id="commit" value="    Commit    "
519 520
             onclick="if (this.form.short_desc.value == '')
             { alert('Please enter a summary sentence for this [% terms.bug %].');
521 522
               return false; } return true;">
      &nbsp;&nbsp;&nbsp;&nbsp;
523
      <input type="submit" name="maketemplate" id="maketemplate"
524
             value="Remember values as bookmarkable template">
525 526 527
    </td>
  </tr>

528
[% UNLESS (Param('defaultplatform') && Param('defaultopsys')) %]
529 530 531 532
  <tr>
    <td></td>
    <td colspan="3">
      <br>
533 534 535 536 537 538 539 540 541
      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
542
      [%+ Param('maintainer') %].
543 544 545 546 547 548 549 550
    </td>
  </tr>
[% END %]

  </table>
  <input type="hidden" name="form_name" value="enter_bug">
</form>

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

554
[% PROCESS global/footer.html.tmpl %]
555 556 557 558 559 560 561 562 563

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

[% BLOCK select %]
  [% IF sel.description %]
  <td align="right">
    <strong>
564 565
      <a href="page.cgi?id=fields.html#[% sel.name %]">
        [% sel.description %]</a>:
566 567 568
    </strong>
  </td>
  [% END %]
569

570 571 572 573
  <td>
    <select name="[% sel.name %]">
    [%- FOREACH x = ${sel.name} %]
      <option value="[% x FILTER html %]"
574 575 576 577 578 579 580
        [% " selected=\"selected\"" IF x == default.${sel.name} %]>
        [% IF sel.name == "bug_status" %]
          [% status_descs.$x FILTER html %]
        [% ELSE %]
          [% x FILTER html %]
        [% END %]</option>
    [% END %]
581 582 583
    </select>
  </td>
[% END %]