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[% PROCESS global/variables.none.tmpl %]
10
11[%# Define strings that will serve as the title and header of this page %]
12[% title = BLOCK %]
13  Свойства приложения [% attachment.id %] для [% terms.bug_gen %] [%+ attachment.bug_id %]
14[% END %]
15[% header = BLOCK %]
16  Свойства приложения [% attachment.id %] для
17  [%+ "$terms.bug_gen ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]
18[% END %]
19[% subheader = BLOCK %][% attachment.bug.short_desc FILTER html %][% END %]
20
21[% PROCESS global/header.html.tmpl
22  title = title
23  header = header
24  subheader = subheader
25  doc_section = "attachments.html"
26  javascript_urls = ['js/attachment.js', 'js/field.js']
27  style_urls = ['skins/standard/attachment.css']
28  yui = [ 'autocomplete' ]
29  bodyclasses = "no_javascript"
30%]
31
32[%# No need to display the Diff button and iframe if the attachment is not a patch. %]
33[% use_patchviewer = (feature_enabled('patch_viewer') && attachment.ispatch) %]
34[% can_edit = attachment.validate_can_edit %]
35[% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
36
37<form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
38  <input type="hidden" name="id" value="[% attachment.id %]">
39  <input type="hidden" name="action" value="update">
40  <input type="hidden" name="contenttypemethod" value="manual">
41  <input type="hidden" name="delta_ts" value="[% attachment.modification_time FILTER html %]">
42  [% IF user.id %]
43    <input type="hidden" name="token" value="[% issue_hash_token([attachment.id, attachment.modification_time]) FILTER html %]">
44  [% END %]
45
46  <div id="attachment_info" class="attachment_info [% IF can_edit %] edit[% ELSE %] read[% END%]">
47    <div id="attachment_attributes">
48      <div id="attachment_information_read_only" class="[% "bz_private" IF attachment.isprivate %]">
49        <div class="title">
50          [% "[patch]" IF attachment.ispatch%]
51          <span class="[% "bz_obsolete" IF attachment.isobsolete %]" title="[% "obsolete" IF attachment.isobsolete %]">
52            [% attachment.description FILTER html %]
53          </span>
54          [% IF can_edit %]
55            <span class="bz_edit">(<a href="javascript:toggle_attachment_details_visibility()">изменить информацию</a>)</span>
56          [% END %]
57        </div>
58        <div class="details">
59          [% attachment.filename FILTER html %] ([% attachment.contenttype FILTER html %]),
60          [% IF attachment.datasize %]
61            [%+ attachment.datasize FILTER unitconvert %]
62          [% ELSE %]
63            <em>удалено</em>
64          [% END %], создано [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %] в [%+ attachment.attached FILTER time %]
65          [% IF attachment.isprivate %];
66            <span class="bz_private">видимо только для <strong>[% Param('insidergroup') FILTER html %]</strong> членов группы</span>
67          [% END %]
68        </div>
69      </div>
70      <div id="attachment_information_edit">
71        <span class="bz_hide">
72          (<a href="javascript:toggle_attachment_details_visibility();">hide</a>)
73        </span>
74        <div id="attachment_description">
75          <label for="description">Описание:</label>&nbsp;
76          [% INCLUDE global/textarea.html.tmpl
77            id             = 'description'
78            name           = 'description'
79            minrows        = 3
80            cols           = 25
81            wrap           = 'soft'
82            classes        = 'block' _ editable_or_hide
83            defaultcontent = attachment.description
84          %]
85        </div>
86
87          <div id="attachment_filename">
88            <label for="filename">Имя файла:</label>
89            <input type="text" size="20"  class="text block[% editable_or_hide %]"
90                   id="filename" name="filename"
91                   value="[% attachment.filename FILTER html %]">
92          </div>
93
94          <div id="attachment_mimetype">
95            <label for="contenttypeentry">Тип файла:</label>
96            <input type="text" size="20" class="text block[% editable_or_hide %]"
97                   id="contenttypeentry" name="contenttypeentry"
98                   value="[% attachment.contenttype FILTER html %]">
99          </div>
100
101          <div id="attachment_creator">
102            <span class="label">Автор:</span>
103            [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
104          </div>
105
106          <div id="attachment_created">
107            <span class="label">Дата создания:</span>
108            [%+ attachment.attached FILTER time %]
109          </div>
110
111          <div id="attachment_size">
112            <span class="label">Размер:</span>
113            [% IF attachment.datasize %]
114              [%+ attachment.datasize FILTER unitconvert %]
115            [% ELSE %]
116              <em>удалено</em>
117            [% END %]
118          </div>
119
120          <div id="attachment_ispatch">
121            <input type="checkbox" id="ispatch" name="ispatch" value="1"
122                   [%+ 'checked="checked"' IF attachment.ispatch %]>
123              <label for="ispatch">патч</label>
124          </div>
125
126        <div class="readonly">
127          <div class="checkboxes">
128            <div id="attachment_isobsolete">
129              <input type="checkbox" id="isobsolete" name="isobsolete" value="1"
130                     [%+ 'checked="checked"' IF attachment.isobsolete %]>
131                <label for="isobsolete">неактуально</label>
132            </div>
133
134            [% IF user.is_insider %]
135              <div id="attachment_isprivate">
136                <input type="checkbox" id="isprivate" name="isprivate" value="1"
137                       [%+ 'checked="checked"' IF attachment.isprivate %]>
138                [% IF can_edit %]
139                  <label for="isprivate">конфиденциально (видимо только членам группы
140                    <strong>[% Param('insidergroup') FILTER html %]</strong>)
141                  </label>
142                [% ELSE %]
143                  <span class="label">Конфиденциально:</span>
144                  [%+ attachment.isprivate ? "да" : "нет" %]
145                [% END %]
146              </div>
147            [% END %]
148          </div>
149        </div>
150      </div>
151
152      <div id="attachment_view_window">
153        [% IF !attachment.datasize %]
154          <div><b>Содержание приложения удалено.</b></div>
155        [% ELSIF !Param("allow_attachment_display") %]
156          <div id="view_disabled">
157            <p><b>
158              Приложение недоступно для просмотра в целях безопасности
159            согласно ограничениям установленным администратором [% terms.Bugzilla %].
160            </b></p>
161            <p><b>
162              Для просмотра содержимого приложения следует
163              <a href="attachment.cgi?id=[% attachment.id %]">его загрузить</a>.
164            </b></p>
165          </div>
166        [% ELSIF attachment.is_viewable %]
167          <div>
168            [% INCLUDE global/textarea.html.tmpl
169              id      = 'editFrame'
170              name    = 'comment'
171              classes   = 'bz_default_hidden'
172              minrows = 10
173              cols    = 80
174              wrap    = 'soft'
175              disabled = 'disabled'
176              defaultcontent = (attachment.contenttype.match('^text\/')) ?
177                                 attachment.data.replace('(.*\n|.+)', '>$1') : undef
178            %]
179            [% IF attachment.contenttype == 'text/plain' AND is_safe_url(attachment.data) %]
180              <p>
181                <a href="[% attachment.data FILTER html %]">
182                  [% IF attachment.datasize < 120 %]
183                    [% attachment.data FILTER html %]
184                  [% ELSE %]
185                    [% attachment.data FILTER truncate(80) FILTER html %]
186                    ...
187                    [% attachment.data.match('.*(.{20})$').0 FILTER html %]
188                  [% END %]
189                </a>
190              </p>
191            [% ELSIF attachment.contenttype == "text/html" %]
192              [%# For security reasons (clickjacking, embedded scripts), we never
193                # render HTML pages from here. The source code is displayed instead. %]
194              [% INCLUDE global/textarea.html.tmpl
195                 id      = 'viewFrame'
196                 minrows = 10
197                 cols    = 80
198                 defaultcontent = attachment.data
199                 readonly = 'readonly'
200              %]
201            [% ELSE %]
202              <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]">
203                <b>Вы не можете одновременно редактировать и просматривать сообщения, потому что ваш браузер не поддерживает IFRAME.
204                <a href="attachment.cgi?id=[% attachment.id %]">Просмотреть приложение на отдельной странице</a>.</b>
205              </iframe>
206            [% END %]
207            <script type="text/javascript">
208              <!--
209              var patchviewerinstalled = 0;
210              var attachment_id = [% attachment.id %];
211              if (typeof document.getElementById == "function") {
212                [% IF use_patchviewer %]
213                  var patchviewerinstalled = 1;
214                  document.write('<iframe id="viewDiffFrame" class="bz_default_hidden"><\/iframe>');
215                [% END %]
216                [% IF user.id %]
217                  document.write('<button type="button" id="editButton" onclick="editAsComment(patchviewerinstalled);">Изменить приложение как текст<\/button>');
218                  document.write('<button type="button" id="undoEditButton" onclick="undoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Отменить изменения<\/button>');
219                  document.write('<button type="button" id="redoEditButton" onclick="redoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Вернуть изменения<\/button>');
220                  var editFrame = document.getElementById('editFrame');
221                  if (editFrame) {
222                    editFrame.disabled = false;
223                  }
224                [% END %]
225                [% IF use_patchviewer %]
226                  document.write('<button type="button" id="viewDiffButton" onclick="viewDiff(attachment_id, patchviewerinstalled);">Просмотр в режиме сравнения<\/button>');
227                [% END %]
228                document.write('<button type="button" id="viewRawButton" onclick="viewRaw(patchviewerinstalled);" class="bz_default_hidden">Просмотр в исходном виде<\/button>');
229              }
230              //-->
231            </script>
232          </div>
233        [% ELSE %]
234          <div id="noview">
235            <p><b>
236            Просмотр приложения невозможен, потому что
237            ваш браузер не поддерживает тип файлов
238            ([% attachment.contenttype FILTER html %]).
239            </b></p>
240            <p><b>
241              <a href="attachment.cgi?id=[% attachment.id %]">Загрузить приложение</a>.
242          </b></p>
243          </div>
244        [% END %]
245      </div>
246      <div id="attachment_comments_and_flags">
247        [% IF user.id %]
248          <div id="smallCommentFrame" >
249            <label for="comment">Комментарий (на [% terms.bug_acc %]):</label>
250            [% classNames = 'block' %]
251            [% classNames = "$classes bz_private" IF attachment.isprivate %]
252            [% INCLUDE global/textarea.html.tmpl
253              id      = 'comment'
254              name    = 'comment'
255              minrows = 10
256              cols    = 80
257              wrap    = 'soft'
258              classes = classNames
259            %]
260            [% IF NOT attachment.bug.cc.contains(user.login) %]
261              <input type="checkbox" id="addselfcc" name="addselfcc"
262                [%~ ' checked="checked"'
263                    IF user.settings.state_addselfcc.value == 'always'
264                       || (!attachment.bug.user.has_any_role
265                           && user.settings.state_addselfcc.value == 'cc_unless_role') %]>
266              <label for="addselfcc">Добавить меня в список подписанных пользователей</label>
267            [% END %]
268          </div>
269        [% END %]
270        <div id="attachment_flags">
271          [% IF attachment.flag_types.size > 0 %]
272              [% PROCESS "flag/list.html.tmpl" flag_types = attachment.flag_types
273                                               read_only_flags = !can_edit
274              %]
275
276          [% END %]
277        </div>
278
279        [% Hook.process('form_before_submit') %]
280
281        [% IF user.id %]
282          <div id="update_container">
283            <input type="submit" value="Отправить" id="update">
284          </div>
285        [% END %]
286      </div>
287    </div>
288  </div>
289</form>
290
291<div id="attachment_actions">
292  <span class="label">Действия:</span>
293  <a href="attachment.cgi?id=[% attachment.id %]">Просмотреть</a>
294  [% IF use_patchviewer %]
295    | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=diff">Сравнить</a>
296  [% END %]
297  [% IF Param("allow_attachment_deletion")
298        && user.in_group('admin')
299        && attachment.datasize > 0 %]
300    | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=delete">Удалить</a>
301  [% END %]
302  [% Hook.process('action') %]
303</div>
304
305<div id="attachment_list">
306  Приложения к этой [% "$terms.bug_dat ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]:
307  [% FOREACH a = attachments %]
308    [% IF a.isobsolete %]
309      <span class="bz_obsolete">
310    [% END %]
311    [% IF a.id == attachment.id %]
312      [%+ a.id FILTER html %]
313    [% ELSE %]
314      <a href="attachment.cgi?id=[% a.id FILTER uri %]&amp;action=edit"
315         title="[% a.description FILTER html %]">[% a.id FILTER html %]</a>
316    [% END %]
317    [% IF a.isobsolete %]
318      </span>
319    [% END %]
320    [% " |" UNLESS loop.last() %]
321  [% END %]
322</div>
323[% IF can_edit %]
324  <script type="text/javascript">
325    <!--
326      YAHOO.util.Dom.removeClass( document.body, "no_javascript" );
327      toggle_attachment_details_visibility( );
328    -->
329  </script>
330[% END %]
331[% Hook.process('end') %]
332
333[% PROCESS global/footer.html.tmpl %]
334