summaryrefslogtreecommitdiffstats
path: root/template/en/default/bug/create/create.html.tmpl
blob: 0815f36009496097715311f4430fed12bfec7260 (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
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
[%# 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.
  #%]

[% title = BLOCK %]Enter [% terms.Bug %]: [% product.name FILTER html %][% END %]
[% use_qa_contact = Param("useqacontact") %]

[% PROCESS global/header.html.tmpl
  title = title
  yui = [ 'autocomplete', 'calendar', 'datatable', 'button' ]
  style_urls = ['skins/standard/bug.css']
  javascript_urls = [ "js/attachment.js", "js/util.js",
                      "js/field.js", "js/TUI.js", "js/bug.js" ]
  onload = "set_assign_to($use_qa_contact); hideElementById('attachment_true');
            showElementById('attachment_false'); showElementById('btn_no_attachment');"
%]

<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 %]
    [% NEXT IF NOT c.is_active %]
    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 %]

var status_comment_required = new Array();
[% FOREACH status = bug_status %]
  status_comment_required['[% status.name FILTER js %]'] = 
    [% status.comment_required_on_change_from() ? 'true' : 'false' %]
[% END %]

TUI_alternates['expert_fields'] = 'Show Advanced Fields';
// Hide the Advanced Fields by default, unless the user has a cookie
// that specifies otherwise.
TUI_hide_default('expert_fields');
// Also hide the "Paste text as attachment" textarea by default.
TUI_hide_default('attachment_text_field');
-->
</script>

<form name="Create" id="Create" method="post" action="post_bug.cgi"
      class="enter_bug_form" enctype="multipart/form-data"
      onsubmit="return validateEnterBug(this)">
<input type="hidden" name="product" value="[% product.name FILTER html %]">
<input type="hidden" name="token" value="[% token FILTER html %]">

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

  <tr>
    <td colspan="2">
      <a id="expert_fields_controller" class="controller bz_default_hidden"
         href="javascript:TUI_toggle_class('expert_fields')">Hide
        Advanced Fields</a>
      [%# Show the link if the browser supports JS %]
      <script type="text/javascript">
        YAHOO.util.Dom.removeClass('expert_fields_controller', 
                                   'bz_default_hidden');
      </script>
    </td>
    <td colspan="2">
      (<span class="required_star">*</span> =
      <span class="required_explanation">Required Field</span>)
   </td>
  </tr>

  <tr>
    [% INCLUDE bug/field.html.tmpl
      bug = default, field = bug_fields.product, editable = 0,
      value = product.name %]
    [% INCLUDE bug/field.html.tmpl
      bug = default, field = bug_fields.reporter, editable = 0,
      value = user.login %]
  </tr>

  [%# We can't use the select block in these two cases for various reasons. %]
  <tr>
    [% component_desc_url = BLOCK -%]
      describecomponents.cgi?product=[% product.name FILTER uri %]
    [% END %]
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.component editable = 1
      desc_url = component_desc_url
    %]      
    <td id="field_container_component">
      <select name="component" id="component" onchange="set_assign_to([% Param("useqacontact") %]);"
              size="7" aria-required="true" class="required">
        [%# Build the lists of assignees and QA contacts if "usemenuforusers" is enabled. %]
        [% IF Param("usemenuforusers") %]
          [% assignees_list = user.get_userlist.clone %]
          [% qa_contacts_list = user.get_userlist.clone %]
        [% END %]

        [%- FOREACH c = product.components %]
          [% NEXT IF NOT c.is_active %]
          <option value="[% c.name FILTER html %]"
                  id="v[% c.id FILTER html %]_component"
            [% IF c.name.lower == default.component_.lower %]
              [%# This is for bug/field.html.tmpl, for visibility-related
                # controls. %]
              [% default.component_id = c.id %]
              selected="selected"
            [% END %]>
            [% c.name FILTER html -%]
          </option>
          [% IF Param("usemenuforusers") %]
            [% INCLUDE build_userlist default_user = c.default_assignee,
                                      userlist = assignees_list %]
            [% INCLUDE build_userlist default_user = c.default_qa_contact,
                                      userlist = qa_contacts_list %]
          [% END %]
        [%- END %]
      </select>

      <script type="text/javascript">
       <!--
         [%+ INCLUDE "bug/field-events.js.tmpl" 
                     field = bug_fields.component, product = product %]
       //-->
       </script>
    </td>

    <td colspan="2" id="comp_desc_container">
      [%# 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>
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.version editable = 1 rowspan = 4
    %]
    <td rowspan="4">
      <select name="version" id="version" size="5" aria-required="true"
              class="required">
        [%- FOREACH v = version %]
          [% NEXT IF NOT v.is_active %]
          <option value="[% v.name FILTER html %]"
            [% ' selected="selected"' IF v.name == default.version %]>[% v.name FILTER html -%]
          </option>
        [%- END %]
      </select>
    </td>

    [% INCLUDE bug/field.html.tmpl
      bug = default, field = bug_fields.bug_severity, editable = 1, 
      value = default.bug_severity %]
  </tr>

  <tr class="expert_fields">
    [% IF Param('letsubmitterchoosepriority') %]
      [% INCLUDE bug/field.html.tmpl
        bug = default, field = bug_fields.priority, editable = 1, 
        value = default.priority %]
    [% ELSE %]
      <td colspan="2">&nbsp;</td>
    [% END %]
  </tr>

  <tr>
    [% INCLUDE bug/field.html.tmpl
      bug = default, field = bug_fields.rep_platform, editable = 1,
      value = default.rep_platform %]
  </tr>

  <tr>
    [% INCLUDE bug/field.html.tmpl 
       bug = default, field = bug_fields.op_sys, editable = 1, 
       value = default.op_sys %]
  </tr>
  [% IF (!Param('defaultplatform') || !Param('defaultopsys')) && !cloned_bug_id %]
    <tr>
      <td colspan="2" class="expert_fields">&nbsp;</td>
      <td>&nbsp;</td>
      <td id="os_guess_note" class="comment">
        <div>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 make any corrections if necessary.</div>
      </td>
    </tr>
  [% END %]
</tbody>

<tbody class="expert_fields">
  <tr>
    [% IF Param('usetargetmilestone') && Param('letsubmitterchoosemilestone') %]
      [% INCLUDE select field = bug_fields.target_milestone %]
    [% ELSE %]
      <td colspan="2">&nbsp;</td>
    [% END %]

    <td colspan="2">&nbsp;</td>
  </tr>
</tbody>

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

  <tr>
    [% INCLUDE bug/field.html.tmpl
      bug = default, field = bug_fields.bug_status,
      editable = (bug_status.size > 1), value = default.bug_status
      override_legal_values = bug_status %]

    <td>&nbsp;</td>
    [%# Calculate the number of rows we can use for flags %]
    [% num_rows = 6 + (Param("useqacontact") ? 1 : 0) +
                      (user.is_timetracker ? 3 : 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>
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.assigned_to editable = 1
    %]
    <td colspan="2">
      [% INCLUDE global/userselect.html.tmpl
         id => "assigned_to"
         name => "assigned_to"
         value => assigned_to
         disabled => assigned_to_disabled
         size => 30
         emptyok => 1
         custom_userlist => assignees_list
       %]
      <noscript>(Leave blank to assign to component's default assignee)</noscript>
    </td>
  </tr>
  
[% IF Param("useqacontact") %]
    <tr>
      [% INCLUDE "bug/field-label.html.tmpl"
        field = bug_fields.qa_contact editable = 1
      %]
      <td colspan="2">
      [% INCLUDE global/userselect.html.tmpl
         id => "qa_contact"
         name => "qa_contact"
         value => qa_contact
         disabled => qa_contact_disabled
         size => 30
         emptyok => 1
         custom_userlist => qa_contacts_list
       %]
        <noscript>(Leave blank to assign to default qa contact)</noscript>
      </td>
    </tr>
[% END %]

  <tr>
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.cc editable = 1 
    %]
    <td colspan="2">
      [% INCLUDE global/userselect.html.tmpl
         id => "cc"
         name => "cc"
         value => cc
         disabled => cc_disabled
         size => 30
         multiple => 5
       %]
    </td>
  </tr>

  <tr>
    <th>Default [% field_descs.cc FILTER html %]:</th>
    <td colspan="2">
      <div id="initial_cc">
      </div>
   </td>
  </tr>
  
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>

[% IF user.is_timetracker %]
  <tr>
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.estimated_time editable = 1
    %]
    <td colspan="2">
      <input name="estimated_time" size="6" maxlength="6" value="[% estimated_time FILTER html %]">
    </td>
  </tr>
  <tr>
    [% INCLUDE bug/field.html.tmpl
      bug = default, field = bug_fields.deadline, value = deadline,
      editable = 1, value_span = 2 %] 
  </tr>

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

  <tr>
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.alias editable = 1
    %]
    <td colspan="2">
      <input name="alias" size="20" value="[% alias FILTER html %]">
    </td>
  </tr>

  <tr>
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.bug_file_loc editable = 1
    %]
    <td colspan="3" class="field_value">
      <input name="bug_file_loc" id="bug_file_loc" class="text_input"
             size="40" 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}.defined ? ${field.name} : "" %]
    <tr [% 'class="expert_fields"' IF !field.is_mandatory %]>
      [% INCLUDE bug/field.html.tmpl 
        bug = default, field = field, value = value, editable = 1, 
        value_span = 3 %]
    </tr>
  [% END %]
</tbody>

<tbody>

  <tr>
    [% INCLUDE "bug/field-label.html.tmpl"
      field = bug_fields.short_desc editable = 1
    %]
    <td colspan="3" class="field_value">
      <input name="short_desc" size="70" value="[% short_desc FILTER html %]"
             maxlength="255" spellcheck="true" aria-required="true"
             class="required text_input" id="short_desc">
    </td>
  </tr>

  [% IF feature_enabled('jsonrpc') AND !cloned_bug_id
        AND user.settings.possible_duplicates.value == 'on' %]
    <tr id="possible_duplicates_container" class="bz_default_hidden">
      <th>Possible<br>Duplicates:</th>
      <td colspan="3">
        <div id="possible_duplicates"></div>
        <script type="text/javascript">
          var dt_columns = [ 
              { key: "id", label: "[% field_descs.bug_id FILTER js %]",
                formatter: YAHOO.bugzilla.dupTable.formatBugLink },
              { key: "summary", 
                label: "[% field_descs.short_desc FILTER js %]",
                formatter: "text" },
              { key: "status",
                label: "[% field_descs.bug_status FILTER js %]",
                formatter: YAHOO.bugzilla.dupTable.formatStatus },
              { key: "update_token", label: '',
                formatter: YAHOO.bugzilla.dupTable.formatCcButton }
          ];
          YAHOO.bugzilla.dupTable.addCcMessage = "Add Me to the CC List";
          YAHOO.bugzilla.dupTable.init({
            container: 'possible_duplicates',
            columns: dt_columns,
            product_name: '[% product.name FILTER js %]',
            summary_field: 'short_desc',
            options: {
              MSG_LOADING: 'Searching for possible duplicates...',
              MSG_EMPTY:   'No possible duplicates found.',
              SUMMARY:     'Possible Duplicates'
            }
          });
        </script>
      </td>
    </tr>
  [% END %]

  <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 bug/comment.html.tmpl
         minrows        = 10
         maxrows        = 25
         cols           = constants.COMMENT_COLS
         defaultcontent = defaultcontent
       %]
      <br>
    </td>
  </tr>

  [% IF user.is_insider %]
    <tr class="expert_fields">
      <th>&nbsp;</th>
      <td colspan="3">
        &nbsp;&nbsp;
        <input type="checkbox" id="comment_is_private" name="comment_is_private"
          [% ' checked="checked"' IF comment_is_private %]
               onClick="updateCommentTagControl(this, 'comment')">
        <label for="comment_is_private">
          Make description and any new attachment private (visible only to members 
          of the <strong>[% Param('insidergroup') FILTER html %]</strong> group)
        </label>
      </td>
    </tr>
    <script>
      updateCommentTagControl(document.getElementById('comment_is_private'), 'comment');
    </script>
  [% END %]

  [% IF Param("maxattachmentsize") || Param("maxlocalattachment") %]
  <tr>
    <th>Attachment:</th>
    <td colspan="3">
      <div id="attachment_false" class="bz_default_hidden">
        <input type="button" value="Add an attachment" onClick="handleWantsAttachment(true)">
      </div>

      <div id="attachment_true">
        <input type="button" id="btn_no_attachment" value="Don't add an attachment"
               class="bz_default_hidden"  onClick="handleWantsAttachment(false)">
        <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>
      </div>
    </td>
  </tr>
  [% END %]
</tbody>

<tbody class="expert_fields">
  [% IF use_keywords %]
    <tr>
      [% INCLUDE bug/field.html.tmpl
        bug = default, field = bug_fields.keywords, editable = 1,
        value = keywords, possible_values = all_keywords,
        desc_url = "describekeywords.cgi", value_span = 3
      %]
    </tr>
  [% END %]
  
  [% IF user.in_group('editbugs', product.id) %]
    <tr>
      [% INCLUDE "bug/field-label.html.tmpl"
        field = bug_fields.dependson editable = 1
      %]
      <td colspan="3">
        <input name="dependson" accesskey="d" value="[% dependson FILTER html %]">
      </td>
    </tr>
    <tr>
      [% INCLUDE "bug/field-label.html.tmpl"
        field = bug_fields.blocked editable = 1
      %]
      <td colspan="3">
        <input name="blocked" accesskey="b" value="[% blocked FILTER html %]">
      </td>
    </tr>
  [% END %]

  [% IF Param('use_see_also') %]
    <tr>
      [% INCLUDE bug/field.html.tmpl
         bug            = default
         field          = bug_fields.see_also
         editable       = 1
         value          = see_also
      %]
    </tr>
  [% END %]
</tbody>

<tbody class="expert_fields">
  [% IF product.groups_available.size %]
  <tr>
    <th>&nbsp;</th>
    <td colspan="3">
      <br>
        <strong>
          Only users in [%+ IF Param('or_groups') %]at least one[% ELSE %]all[% END %] of the selected groups can view this 
          [%+ terms.bug %]:
        </strong>
      <br>
      <span class="bz_info">
        (Leave all boxes unchecked to make this a public [% terms.bug %].)
      </span>
      <br>
      <br>

      <!-- Checkboxes -->
      <input type="hidden" name="defined_groups" value="1">
      [% FOREACH group = product.groups_available %]
        <input type="checkbox" id="group_[% group.id FILTER html %]"
               name="groups" value="[% group.name FILTER html %]"
               [% ' checked="checked"' IF default.groups.contains(group.name)
                                          OR group.is_default %]>
        <label for="group_[% group.id FILTER html %]">
          [%- group.description FILTER html_light %]</label><br>
      [% END %]
    </td>
  </tr>
  [% END %]
</tbody>

<tbody>
  [%# 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="Submit [% terms.Bug %]">
      &nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" name="maketemplate" id="maketemplate"
             value="Remember values as bookmarkable template"
             onclick="bz_no_validate_enter_bug=true" class="expert_fields">
    </td>
  </tr>
</tbody>
  </table>
  <input type="hidden" name="form_name" value="enter_bug">
</form>

[%# 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 %]

  [% INCLUDE "bug/field-label.html.tmpl"
    field = field editable = 1
  %]
  <td>
    <select name="[% field.name FILTER html %]" 
            id="[% field.name FILTER html %]">
    [%- FOREACH x = ${field.name} %]
      [% NEXT IF NOT x.is_active %]
      <option value="[% x.name FILTER html %]"
        [% " selected=\"selected\"" IF x.name == default.${field.name} %]>
        [% display_value(field.name, x.name) FILTER html %]
      </option>
    [% END %]
    </select>
  </td>
[% END %]

[% BLOCK build_userlist %]
  [% user_found = 0 %]
  [% default_login = default_user.login %]
  [% RETURN UNLESS default_login %]

  [% FOREACH user = userlist %]
    [% IF user.login == default_login %]
      [% user_found = 1 %]
      [% LAST %]
    [% END %]
  [% END %]

  [% userlist.push({login    => default_login,
                    identity => default_user.identity,
                    visible  => 1})
     UNLESS user_found %]
[% END %]