1[%# This Source Code Form is subject to the terms of the Mozilla Public
2  # License, v. 2.0. If a copy of the MPL was not distributed with this
3  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4  #
5  # This Source Code Form is "Incompatible With Secondary Licenses", as
6  # defined by the Mozilla Public License, v. 2.0.
7  #%]
8
9[%# INTERFACE:
10  # product: object; the new product.
11  # versions: array; versions for the new product.
12  # components: array; components for the new product.
13  # milestones: array; milestones for the new product.
14  # defaults: hash; keys are names of fields, values are defaults for
15  #   those fields
16  #
17  # verify_bug_groups: If groups need to be confirmed in addition to fields.
18  #%]
19
20[% PROCESS global/variables.none.tmpl %]
21
22[% PROCESS global/header.html.tmpl
23  title = 'Изменения при смене продукта...' %]
24
25<form action="process_bug.cgi" method="post">
26
27[% SET exclude_items = ['version', 'component', 'target_milestone'] %]
28[% IF verify_bug_groups %]
29  [% exclude_items.push('groups', 'defined_groups') %]
30[% END %]
31[% Hook.process('exclude') %]
32
33[% PROCESS "global/hidden-fields.html.tmpl"
34     exclude = '^' _ exclude_items.join('|') _ '$' %]
35
36<input type="hidden" name="confirm_product_change" value="1">
37
38[%# Verify the version, component, and target milestone fields. %]
39<h3>Подтвердите версию, компонент
40  [%- ", план"
41      IF Param("usetargetmilestone")
42         && bug.check_can_change_field('target_milestone', 0, 1) %]</h3>
43
44<p>
45[% IF Param("usetargetmilestone")
46   && bug.check_can_change_field('target_milestone', 0, 1)
47%]
48  Вы перемещаете [% terms.bug_acc %] в продукт
49  <b>[% product.name FILTER html %]</b>,
50  в результате версия, компонент и/или план должны быть приведены
51  в соответствие.  Установите значения для нового продукта:
52[% ELSE %]
53  Вы перемещаете [% terms.bug_acc %] в продукт
54  <b>[% product.name FILTER html %]</b>,
55  в результате версия и компонент должны быть приведены
56  в соответствие.  Установите значения для нового продукта:
57[% END %]
58</p>
59
60<table>
61  <tr>
62    <td>
63      <b>Версия:</b><br>
64      [% IF versions.size == 1 %]
65        [% SET default_version = versions.0 %]
66      [% ELSE %]
67        [% SET default_version = defaults.version %]
68      [% END %]
69      [% PROCESS "global/select-menu.html.tmpl"
70                 name="version"
71                 options=versions
72                 default=default_version
73                 size=10 %]
74    </td>
75    <td>
76      <b>Компонент:</b><br>
77      [% IF components.size == 1 %]
78        [% SET default_component = components.0 %]
79      [% ELSE %]
80        [% SET default_component = defaults.component %]
81      [% END %]
82      [% PROCESS "global/select-menu.html.tmpl"
83                 name="component"
84                 options=components
85                 default=default_component
86                 size=10 %]
87    </td>
88    [% IF Param("usetargetmilestone")
89          && bug.check_can_change_field('target_milestone', 0, 1)
90    %]
91      <td>
92        <b>Запланировано:</b><br>
93      [% PROCESS "global/select-menu.html.tmpl"
94                 name="target_milestone"
95                 options=milestones
96                 default=defaults.milestone
97                 size=10 %]
98      </td>
99    [% END %]
100    [% Hook.process('field') %]
101  </tr>
102</table>
103
104[% IF verify_bug_groups %]
105  [% mandatory_groups = [] %]
106  [% optional_groups = [] %]
107
108  [% FOREACH gid = product.group_controls.keys %]
109    [% group = product.group_controls.$gid %]
110    [% NEXT UNLESS group.group.is_active %]
111
112    [% IF group.membercontrol == constants.CONTROLMAPMANDATORY
113          || (group.othercontrol ==  constants.CONTROLMAPMANDATORY && !user.in_group(group.group.name)) %]
114      [% mandatory_groups.push(group) %]
115    [% ELSIF (group.membercontrol != constants.CONTROLMAPNA && user.in_group(group.group.name))
116              || group.othercontrol != constants.CONTROLMAPNA %]
117      [% optional_groups.push(group) %]
118    [% END %]
119  [% END %]
120
121  [% IF old_groups.size || optional_groups.size || mandatory_groups.size %]
122    <h3>Подтвердите права доступа</h3>
123  [% END %]
124
125  [% IF old_groups.size %]
126    <p>Перечисленные группы недопустимы для продукта '[% product.name FILTER html %]'
127    или недостаточно прав доступа для назначения этих групп [% terms.bugs_acc -%].
128    Доступ к [%+ terms.bugs_dat %] не будет в дальнейшем ограничен этими группами, [%+ terms.bugs %]
129    могут стать общедоступными, если не будут указаны другие группы:
130    [% FOREACH group = old_groups %]
131      <input type="checkbox" id="group_[% group.id FILTER html %]"
132             name="groups" disabled="disabled" value="[% group.name FILTER html %]">
133      <label for="group_[% group.id FILTER html %]">
134        [% group.name FILTER html %]: [% group.description FILTER html %]
135      </label>
136      <br>
137    [% END %]
138    </p>
139  [% END %]
140
141
142  [% IF optional_groups.size %]
143    <p>Следующие группы не обязательны. Вы можете ограничить видимость [% terms.bugs_gen %]
144    членами следующих групп:<br>
145    [% IF multiple_bugs %]
146      <script type="text/javascript">
147        function turn_off(myself, id) {
148            var other_checkbox = document.getElementById(id);
149            if (myself.checked && other_checkbox) {
150                other_checkbox.checked = false;
151            }
152        }
153      </script>
154
155      <table border="1">
156        <tr>
157          <th>Удалить<br>[% terms.bugs_acc %]<br>из этой<br>группы</th>
158          <th>Добавить<br>[% terms.bugs_acc %]<br>в эту<br>группу</th>
159          <th>Имя группы:</th>
160        </tr>
161
162        [% FOREACH group = optional_groups %]
163        <tr>
164          <td align="center">
165            <input type="checkbox" name="defined_groups"
166                   id="defined_group_[% group.group.id FILTER html %]"
167                   value="[% group.group.name FILTER html %]"
168                   [% IF cgi.param("defined_groups").contains(group.group.name) %] checked="checked"[% END %]
169                   onchange="turn_off(this, 'group_[% group.group.id FILTER html %]')">
170          </td>
171          <td align="center">
172            <input type="checkbox" name="groups"
173                   id="group_[% group.group.id FILTER html %]"
174                   value="[% group.group.name FILTER html %]"
175                   [% IF cgi.param("groups").contains(group.group.name) %] checked="checked"[% END %]
176                   onchange="turn_off(this, 'defined_group_[% group.group.id FILTER html %]')">
177          </td>
178          <td>
179            [% group.group.description FILTER html %]
180          </td>
181        </tr>
182        [% END %]
183      </table>
184    [% ELSE %]
185      [% FOREACH group = optional_groups %]
186        <input type="hidden" name="defined_groups"
187               value="[% group.group.name FILTER html %]">
188        <input type="checkbox" id="group_[% group.group.id FILTER html %]"
189               name="groups"
190               [% ' checked="checked"' IF ((group.membercontrol == constants.CONTROLMAPDEFAULT && user.in_group(group.group.name))
191                   || (group.othercontrol == constants.CONTROLMAPDEFAULT && !user.in_group(group.group.name))
192                   || cgi.param("groups").contains(group.group.name)) %]
193               value="[% group.group.name FILTER html %]">
194        <label for="group_[% group.group.id FILTER html %]">
195          [% group.group.name FILTER html %]: [% group.group.description FILTER html %]
196        </label>
197        <br>
198      [% END %]
199    [% END %]
200    </p>
201  [% END %]
202
203  [% IF mandatory_groups.size %]
204    <p>Следующие группы обязательны. Видимость [% terms.bugs_gen %] автоматически
205    ограничена членами следующих групп:<br>
206    [% FOREACH group = mandatory_groups %]
207      <input type="checkbox" id="group_[% group.group.id FILTER html %]"
208              checked="checked" disabled="disabled"
209             name="groups" value="[% group.group.name FILTER html %]">
210      <label for="group_[% group.group.id FILTER html %]">
211        [% group.group.name FILTER html %]: [% group.group.description FILTER html %]
212      </label>
213      <br>
214    [% END %]
215    </p>
216  [% END %]
217[% END %]
218
219<input type="submit" id="change_product" value="Сохранить">
220
221</form>
222<hr>
223
224[%# If 'id' is defined, then we are editing a single bug.
225  # Else we are editing several bugs at once. %]
226
227[% IF cgi.param('id') AND cgi.param('id').match('^\d+$') %]
228  [% id = cgi.param('id') %]
229  Отменить и вернуться к [% "$terms.bug_dat $id" FILTER bug_link(id) FILTER none %]
230[% ELSE %]
231  Отменить и вернуться к <a href="buglist.cgi?regetlastlist=1">результатам поиска</a>
232[% END %]
233
234[% PROCESS global/footer.html.tmpl %]
235