summaryrefslogtreecommitdiffstats
path: root/template/en/default/global/per-bug-queries.html.tmpl
blob: 71723c178e0ab3a327f0c2cd405444a46b2d9836 (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
[%# 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.
  #
  # Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
  #%]

[% IF user.id && user.settings.per_bug_queries.value == "on" %]
  <li id="links-special">
    <script [% script_nonce FILTER none %] type="text/javascript">
      <!--
      function update_text() {
        // 'lob' means list_of_bugs.
        var lob_action = document.getElementById('lob_action');
        var action = lob_action.options[lob_action.selectedIndex].value;
        var text = document.getElementById('lob_direction');
        var new_query_text = document.getElementById('lob_new_query_text');

        if (action == "add") {
          text.innerHTML = "to";
          new_query_text.style.display = 'inline';
        }
        else {
          text.innerHTML = "from";
          new_query_text.style.display = 'none';
        }
      }

      function manage_old_lists() {
        var old_lists = document.getElementById('lob_oldqueryname');
        // If there is no saved searches available, returns.
        if (!old_lists) return;

        var new_query = document.getElementById('lob_newqueryname').value;

        if (new_query != "") {
          old_lists.disabled = true;
        }
        else {
          old_lists.disabled = false;
        }
      }
      $(function() {
        $("#lob_action").on("change", update_text);
        $("#lob_newqueryname").on("keyup", manage_old_lists);
      });
      //-->
    </script>

    <div class="label"></div>
    <ul class="links"><li class="form">
      <form id="list_of_bugs" action="buglist.cgi" method="get">
        <input type="hidden" name="cmdtype" value="doit">
        <input type="hidden" name="remtype" value="asnamed">
        <input type="hidden" name="list_of_bugs" value="1">
        <input type="hidden" name="token" value="[% issue_hash_token(['savedsearch']) FILTER html %]">
        <select id="lob_action" name="action" >
          <option value="add">Add</option>
          [% IF user.tags.size %]
            <option value="remove">Remove</option>
          [% END %]
        </select>

        [% IF Param('docs_urlbase') %]
          <a href="[% docs_urlbase FILTER html %]query.html#individual-buglists">the named tag</a>
        [% ELSE %]
          the named tag
        [% END %]

        [% IF user.tags.size %]
          <select id="lob_oldqueryname" name="oldqueryname">
            [% FOREACH tag = user.tags.keys %]
              <option value="[% tag FILTER html %]">[% tag FILTER html %]</option>
            [% END %]
          </select>
        [% END %]
        <span id="lob_new_query_text">
          [% " or create and add the tag" IF user.tags.size %]
          <input class="txt" type="text" id="lob_newqueryname"
                 size="20" maxlength="64" name="newqueryname">
        </span>
        <span id="lob_direction">to</span>
        [%+ terms.bugs %]
        <input type="text" name="bug_ids" size="12" maxlength="80"
         [%- " value=\"$bugids\"" IF bugids %]>
        <input type="submit" value="Commit" id="commit_list_of_bugs">
      </form>
    </li></ul>
  </li>
[% END %]