summaryrefslogtreecommitdiffstats
path: root/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl
blob: 516ec008755f6fb8aca3590d5176d511f898b9aa (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
[%# 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.
  #%]

[% show_needinfo      = 0 %]
[% needinfo_requested = 0 %]
[% needinfo_from      = "" %]
[% needinfo_from_any  = 0 %]

[% FOREACH type = bug.flag_types %]
  [% IF type.name == 'needinfo' %]
    [% show_needinfo = 1 %]
    [% FOREACH flag = type.flags %]
      [% IF flag.status == '?' %]
        [% needinfo_requested = 1 %]
        [% IF flag.requestee.login %]
          [% needinfo_from = flag.requestee.login %]
        [% ELSE %]
          [% needinfo_from_any = 1 %]
        [% END %]
      [% END %]
    [% END %]
  [% END %]
[% END %]

[% IF show_needinfo %]
  [%# Displays NEEDINFO tag in bug header %]
  [% IF needinfo_requested %]
    <script>
      var summary_container = document.getElementById('static_bug_status');
      summary_container.appendChild(document.createTextNode('[NEEDINFO]'));
    </script>
  [% END %]

  <div id="needinfo_container">
    [% IF needinfo_requested %]
      [% IF needinfo_from == user.login || needinfo_from_any %]
        Adding comment will automatically clear needinfo request.
      [% ELSE %]
        <input type="checkbox" id="needinfo_override" name="needinfo_override" value="1">
        <label for="needinfo_override">
          I am providing the requested information for this [% terms.bug %] (this will clear needinfo request).
        </label>
      [% END %]
    [% END %]

    [% IF user.in_group('canconfirm') && !is_attachment 
       && !needinfo_requested && bug.status.is_open %]
      <script>
        function needinfoRole (select) {
          YAHOO.util.Dom.get('needinfo').checked = true;
          if (select.value == 'other') {
            YAHOO.util.Dom.removeClass('needinfo_from_container', 'bz_default_hidden');
            YAHOO.util.Dom.get('needinfo_from').focus();
          }
          else {
            YAHOO.util.Dom.addClass('needinfo_from_container', 'bz_default_hidden');
          }
        }
      </script>
      <input type="checkbox" name="needinfo" value="1" id="needinfo">
      <label for="needinfo">Need additional information from</label>
      <select name="needinfo_role" id="needinfo_role" onchange="needinfoRole(this);">
        <option value="">anyone</option>
        <option value="reporter">reporter</option>
        <option value="assigned_to">assignee</option>
        [% IF Param('useqacontact') && bug.qa_contact.login != "" %]
          <option value="qa_contact">qa contact</option>
        [% END %]
        <option value="other">other</option>
      </select>
      <span id="needinfo_from_container" class="bz_default_hidden">
        [%+ INCLUDE global/userselect.html.tmpl
                    id       => "needinfo_from"
                    name     => "needinfo_from"
                    size     => 30
                    value    => ""
        %]
      </span>
    [% END %]
  </div>
  <script>
    // HACK: Shift the needinfo container to a different location
    // below commit button but before status drop down. This allows
    // for better tab navigation
    YAHOO.util.Event.onDOMReady(function() {
      var needinfo = YAHOO.util.Dom.get('needinfo_container');
      var status = YAHOO.util.Dom.get('bug_status_bottom');
      status.parentNode.insertBefore(needinfo, status);
    });
  </script>
[% END %]