queue.html.tmpl 8.15 KB
Newer Older
1 2 3
[%# 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/.
4
  #
5 6
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
7 8
  #%]

9 10 11
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]

12 13 14 15
[% PROCESS global/header.html.tmpl
  title="Request Queue"
  style = "
    table.requests th { text-align: left; }
16
    table#filtering th { text-align: right; }
17
  "
18
  onload="var f = document.request_form; selectProduct(f.product, f.component, null, null, 'Any');"
19
  javascript_urls=["js/productform.js", "js/field.js"]
20
  style_urls = ['skins/standard/buglist.css']
21
  yui = ['autocomplete']
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
<script type="text/javascript">
  var useclassification = false; // No classification level in use
  var first_load = true; // Is this the first time we load the page?
  var last_sel = []; // Caches last selection
  var cpts = new Array();
  [% n = 1 %]
  [% IF Param('useclassification') %]
    [% FOREACH clas = user.get_selectable_classifications %]
      [% FOREACH prod = user.get_selectable_products(clas.id) %]
        [%+ PROCESS js_comp %]
      [% END %]
    [% END %]
  [% ELSE %]
    [% FOREACH prod = user.get_selectable_products %]
      [%+ PROCESS js_comp %]
    [% END %]
  [% END %]
</script>

[% BLOCK js_comp %]
  cpts['[% n %]'] = [
    [%- FOREACH comp = prod.components %]'[% comp.name FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%]];
  [% n = n+1 %]
[% END %]

49 50 51 52 53 54 55
<p>
When you are logged in, only requests made by you or addressed to you
are shown by default.  You can change the criteria using the form below.
When you are logged out, all pending requests that are not restricted
to some group are shown by default.
</p>

56
<form id="request_form" name="request_form" action="request.cgi" method="get">
57 58
  <input type="hidden" name="action" value="queue">

59
  <table id="filtering">
60 61
    <tr>
      <th>Requester:</th>
62 63 64 65 66 67 68
      <td>
        [% INCLUDE global/userselect.html.tmpl
           id => "requester"
           name => "requester"
           value => cgi.param('requester')
           size => 20
           emptyok => 1
69
           field_title => "Requester's email address"
70 71
        %]
      </td>
72 73
      <th>Product:</th>
      <td>
74
        <select name="product" onchange="selectProduct(this, this.form.component, null, null, 'Any');">
75
          <option value="">Any</option>
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
          [% IF Param('useclassification') %]
            [% FOREACH c = user.get_selectable_classifications %]
              <optgroup label="[% c.name FILTER html %]">
                [% FOREACH p = user.get_selectable_products(c.id) %]
                  <option value="[% p.name FILTER html %]"
                    [% " selected" IF cgi.param('product') == p.name %]>
                    [% p.name FILTER html %]
                  </option>
                [% END %]
              </optgroup>
            [% END %]
          [% ELSE %]
            [% FOREACH p = user.get_selectable_products %]
              <option value="[% p.name FILTER html %]"
                [% " selected" IF cgi.param('product') == p.name %]>
                [% p.name FILTER html %]
              </option>
            [% END %]
94 95 96 97 98
          [% END %]
        </select>
      </td>
      <th>Flag:</th>
      <td>
99 100
        [% PROCESS "global/select-menu.html.tmpl"
                    name="type"
101
                    options=types
102
                    default=cgi.param('type') %]
103
      </td>
104

105 106 107 108
      [%# We could let people see a "queue" of non-pending requests. %]
      <!--
      <th>Status:</th>
      <td>
109 110
        [%# PROCESS "global/select-menu.html.tmpl"
                    name="status"
111
                    options=["all", "?", "+-", "+", "-"]
112
                    default=cgi.param('status') %]
113 114
      </td>
      -->
115

116 117 118
    </tr>
    <tr>
      <th>Requestee:</th>
119 120 121 122 123 124 125 126
      <td>
        [% INCLUDE global/userselect.html.tmpl
           id => "requestee"
           name => "requestee"
           value => cgi.param('requestee')
           size => 20
           emptyok => 1
           hyphenok => 1
127
           field_title => "Requestee's email address or \"-\" (hyphen) for requests with no requestee"
128 129
        %]
      </td>
130 131 132 133
      <th>Component:</th>
      <td>
        <select name="component">
          <option value="">Any</option>
134 135 136
          [% FOREACH comp = components %]
            <option value="[% comp FILTER html %]" [% "selected" IF cgi.param('component') == comp %]>
              [% comp FILTER html %]</option>
137 138 139 140 141
          [% END %]
        </select>
      </td>
      <th>Group By:</th>
      <td>
142 143 144 145 146
        [% groups = {
            "Requester" => 'requester' ,
            "Requestee" => 'requestee',
            "Flag" => 'type' ,
            "Product/Component" => 'category'
147
          } %]
148
        [% PROCESS "global/select-menu.html.tmpl" name="group" options=groups default=cgi.param('group') %]
149
      </td>
150 151 152 153 154 155 156 157 158 159
    </tr>
    <tr>
      <th></th>
      <td>
        <label><input type="radio" name="do_union" value="0" 
            [% 'checked="checked"' IF !cgi.param('do_union') %]>AND *</label>
        <label><input type="radio" name="do_union" value="1" 
            [% 'checked="checked"' IF cgi.param('do_union') %]>OR *</label>
      </td>
      <td colspan="3"></td>
160
      <td><input type="submit" id="filter" value="Filter"></td>
161 162 163
    </tr>
  </table>

164 165
  <p>(* The logical conjunction/disjunction between the requester 
          and the requestee)</p>
166
</form>
167

168 169 170 171 172
[% column_headers = {
      "type"       => "Flag" ,
      "status"     => "Status" ,
      "bug"        => "$terms.Bug" ,
      "attachment" => "Attachment" ,
173
      "requester"  => "Requester" ,
174 175
      "requestee"  => "Requestee" ,
      "created"    => "Created" ,
176 177 178 179 180 181 182
      "category"   => "Product/Component"    } %]

[% DEFAULT display_columns = ["requester", "requestee", "type", "bug", "attachment", "created"]
           group_field     = "Requestee"
           group_value     = ""
%]

183 184 185 186
[% IF debug %]
  <p>[% query FILTER html %]</p>
[% END %]

187 188 189 190 191 192
[% IF requests.size == 0 %]
  <p>
    No requests.
  </p>
[% ELSE %]
  [% FOREACH request = requests %]
193
    [% IF request.$group_field != group_value || loop.first %]
194
      [% group_value = request.$group_field %]
195 196
      [% PROCESS display_buglist UNLESS loop.first %]
      [% PROCESS start_new_table %]
197
    [% END %]
198
    [% buglist.${request.bug_id} = 1 %]
199 200 201
    <tr>
      [% FOREACH column = display_columns %]
        [% NEXT IF column == group_field || excluded_columns.contains(column) %]
202 203 204 205
        <td>
          [% PROCESS "display_$column" %]
          [% Hook.process('after_column') %]
        </td>
206 207 208
      [% END %]
    </tr>
  [% END %]
209
  [% PROCESS display_buglist %]
210
[% END %]
211 212 213 214

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

[% BLOCK start_new_table %]
215 216
  [% buglist = {} %]

217 218
  <h3>[% column_headers.$group_field %]: 
    [%+ (request.$group_field || "None") FILTER email FILTER html %]</h3>
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
  <table class="requests" cellspacing="0" cellpadding="4" border="1">
    <tr>
      [% FOREACH column = display_columns %]
        [% NEXT IF column == group_field || excluded_columns.contains(column) %]
        <th>[% column_headers.$column %]</th>
      [% END %]
    </tr>
[% END %]

[% BLOCK display_type %]
  [% request.type FILTER html %]
[% END %]

[% BLOCK display_status %]
  [% request.status %]
[% END %]

[% BLOCK display_bug %]
237 238
  <a href="show_bug.cgi?id=[% request.bug_id %]"
     [%- ' class="bz_secure"' IF request.restricted %]>
239 240 241 242 243
    [% request.bug_id %]: [%+ request.bug_summary FILTER html %]</a>
[% END %]

[% BLOCK display_attachment %]
  [% IF request.attach_id %]
244
    <a href="attachment.cgi?id=[% request.attach_id %]&amp;action=edit">
245 246 247 248 249 250 251
      [% request.attach_id %]: [%+ request.attach_summary FILTER html %]</a>
  [% ELSE %]
    N/A
  [% END %]
[% END %]

[% BLOCK display_requestee %]
252
  [% request.requestee FILTER email FILTER html %]
253 254 255
[% END %]

[% BLOCK display_requester %]
256
  [% request.requester FILTER email FILTER html %]
257 258 259
[% END %]

[% BLOCK display_created %]
260
  [% request.created FILTER time %]
261 262
[% END %]

263 264 265
[% BLOCK display_buglist %]
  </table>
  [% NEXT UNLESS buglist.keys.size %]
266 267 268
  <a href="buglist.cgi?bug_id=
           [%- buglist.keys.nsort.join(",") FILTER html %]">(view as
  [%+ terms.bug %] list)</a>
269
[% END %]