summaryrefslogtreecommitdiffstats
path: root/template/en/default/search/boolean-charts.html.tmpl
blob: b90f5f1b6ea4213d1803d5152e4cfca1eb85ce7c (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
[%# 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>
  #%]

[% PROCESS "global/field-descs.none.tmpl" %]
  
[% types = [
  "noop",
  "equals",
  "notequals",
  "anyexact",
  "substring",
  "casesubstring",
  "notsubstring",
  "anywordssubstr",
  "allwordssubstr",
  "nowordssubstr",
  "regexp",
  "notregexp",
  "lessthan",
  "lessthaneq",
  "greaterthan",
  "greaterthaneq",
  "anywords",
  "allwords",
  "nowords",
  "changedbefore",
  "changedafter",
  "changedfrom",
  "changedto",
  "changedby",
  "matches",
  "notmatches",
] %]

<div class="bz_section_title" id="custom_search_filter">
  <div id="custom_search_query_controller" class="arrow">&#9660;</div>
  <a id="chart" href="javascript:TUI_toggle_class('custom_search_query')" >
    Custom Search</a> <span class="section_help">Didn't find what 
      you're looking for above? This area allows for ANDs, ORs, 
      and other more complex searches.</span>
</div>
<div id="custom_search_filter_section" 
     class="bz_search_section custom_search_query">
  [% SET indent_level = 0 %]
  [% SET cond_num = 0 %]
  [% FOREACH condition = default.custom_search %]
    [% SET cond_num = loop.count - 1 %]
    [% PROCESS one_condition with_buttons = 0 %]
  [% END %]
  [% PROCESS one_condition
    with_buttons = 1
    condition = { f => 'noop' }
    cond_num = cond_num + 1 %]
  <script type="text/javascript">
    TUI_alternates['custom_search_query'] = '&#9658;';
    TUI_hide_default('custom_search_query');
    TUI_alternates['custom_search_advanced'] = "Show Advanced Features";
    TUI_hide_default('custom_search_advanced');
  </script>
  <script type="text/javascript" src="js/custom-search.js"></script>
</div>


[% BLOCK one_condition %]
  [%# Skip any conditions that don't have a field defined. %]
  [% RETURN IF !condition.f %]
  
  [% IF !top_level_any_shown %]
    [% INCLUDE any_all_select
      name = "j_top" selected = default.j_top.0
      with_advanced_link = 1 %]
    [% top_level_any_shown = 1 %]
  [% END %]

  [% IF condition.f == "CP" %]
    [% indent_level = indent_level - 1 %]
  [% END %]

  <div class="custom_search_condition"
       [% ' style="margin-left: ' _ (indent_level * 2) _ 'em"' IF indent_level %]
       [% ' id="custom_search_last_row"' IF with_buttons %]>
    
    [% IF previous_condition.f == "OP" %]
      [% INCLUDE any_all_select
        name = "j" _ (cond_num - 1) 
        selected = previous_condition.j %]
    [% END %]

    [% IF with_buttons %]
      <button id="op_button" type="button" class="custom_search_advanced"
              title="Start a new group of criteria, including this row"
              onclick="custom_search_open_paren()">(</button>
    [% END %]

    [% UNLESS condition.f == "CP" %]
      [%# This only gets hidden via custom_search_advanced if it isn't set. %]
      <span id="custom_search_not_container_[% cond_num FILTER html %]"
            class="custom_search_not_container
                   [%- ' custom_search_advanced' UNLESS condition.n %]"
            title="Search for the opposite of the criteria here">
        <input type="checkbox" id="n[% cond_num FILTER html %]"
               class="custom_search_form_field"
               name="n[% cond_num FILTER html %]" value="1"
               onclick="custom_search_not_changed([% cond_num FILTER js %])"
               [% ' checked="checked"' IF condition.n %]>
        <label for="n[% cond_num FILTER html %]">Not</label>
      </span>
    [% END %]

    [% IF condition.f == "OP" %]
      <input type="hidden" name="f[% cond_num FILTER html %]"
             id="f[% cond_num FILTER html %]" value="OP">
      (
      [% indent_level = indent_level + 1 %]
    [% ELSIF condition.f == "CP" %]
      <input type="hidden" name="f[% cond_num FILTER html %]" value="CP">
      )
    [% ELSE %]
      <select name="f[% cond_num FILTER html %]" title="Field"
              id="f[% cond_num FILTER html %]"
              class="custom_search_form_field">
        [% FOREACH field = fields %]
          <option value="[% field.name FILTER html %]"
                  [%~ ' selected="selected"' IF field.name == condition.f %]>
            [% field_descs.${field.name} || field.description FILTER html %]
          </option>
        [% END %]
      </select>
    
      [% INCLUDE "search/type-select.html.tmpl"
         name = "o${cond_num}", class = "custom_search_form_field"
         types = types, selected = condition.o %]
    
      <input name="v[% cond_num FILTER html %]" title="Value"
             class="custom_search_form_field"
             value="[% condition.v FILTER html %]">
    [% END %]
    
    [% IF with_buttons %]
      <button class="custom_search_add_button" type="button"
              id="add_button" title="Add a new row"
              onclick="custom_search_new_row()">+</button>
      <span id="cp_container" [% ' class="bz_default_hidden"' IF !indent_level %]>
        <button id="cp_button" type="button"
                title="End this group of criteria"
                onclick="custom_search_close_paren()">)</button>
      </span>
    [% END %]
  </div>
  
  [% previous_condition = condition %]
[% END %]

[% BLOCK any_all_select %]
  <div class="any_all_select">
    <select name="[% name FILTER html %]" id="[% name FILTER html %]">
      <option value="AND">Match ALL of the following:</option>
      <option value="OR" [% ' selected="selected"' IF selected == "OR" %]>
        Match ANY of the following:</option>
    </select>
    [% IF with_advanced_link %]
      <a id="custom_search_advanced_controller"
         href="javascript:TUI_toggle_class('custom_search_advanced')">
        Hide Advanced Features
      </a>
    [% END %]
  </div>
[% END %]