Upgrade to Bugzilla 5.0.3.
[WebKit-https.git] / Websites / bugs.webkit.org / template / en / default / attachment / edit.html.tmpl
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 [%# Define strings that will serve as the title and header of this page %]
10 [% title = BLOCK %]
11   Attachment [% attachment.id %] Details for [% terms.Bug %] [%+ attachment.bug_id %]
12   – [% attachment.description FILTER html %]
13 [% END %]
14 [% header = BLOCK %]
15   Attachment [% attachment.id %] Details for
16   [%+ "$terms.Bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]
17 [% END %]
18 [% subheader = BLOCK %][% attachment.bug.short_desc FILTER html %][% END %]
19
20 [% PROCESS global/header.html.tmpl
21   title = title
22   header = header
23   subheader = subheader
24   generate_api_token = 1
25   doc_section = "using/editing.html#attachments"
26   javascript_urls = ['js/attachment.js', 'js/field.js']
27   style_urls = ['skins/standard/bug.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) ? 1 : 0 %]
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()">edit details</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>deleted</em>
64           [% END %], created by [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %] on [%+ attachment.attached FILTER time %]
65           [% IF attachment.isprivate %];
66             <span class="bz_private">only visible to <strong>[% Param('insidergroup') FILTER html %]</strong> members</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">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">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">MIME Type:</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">Creator:</span>
103             [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
104           </div>
105
106           <div id="attachment_created">
107             <span class="label">Created:</span>
108             [%+ attachment.attached FILTER time %]
109           </div>
110
111           <div id="attachment_size">
112             <span class="label">Size:</span>
113             [% IF attachment.datasize %]
114               [%+ attachment.datasize FILTER unitconvert %]
115             [% ELSE %]
116               <em>deleted</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">patch</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">obsolete</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">private (only visible to
140                     <strong>[% Param('insidergroup') FILTER html %]</strong>)
141                   </label>
142                 [% ELSE %]
143                   <span class="label">Is Private:</span>
144                   [%+ attachment.isprivate ? "yes" : "no" %]
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>The content of this attachment has been deleted.</b></div>
155         [% ELSIF !Param("allow_attachment_display") %]
156           <div id="view_disabled">
157             <p><b>
158               The attachment is not viewable in your browser due to security
159               restrictions enabled by your [% terms.Bugzilla %] administrator.
160             </b></p>
161             <p><b>
162               In order to view the attachment, you first have to
163               <a href="attachment.cgi?id=[% attachment.id %]">download it</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 %]" sandbox>
203                 <b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
204                 <a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b>
205               </iframe>
206             [% END %]
207
208             [% IF use_patchviewer %]
209               <iframe id="viewDiffFrame" class="bz_default_hidden"></iframe>
210             [% END %]
211
212             [% IF user.id %]
213 [%# if WEBKIT_CHANGES %]
214               [% IF attachment.ispatch %]
215               <button type="button" id="viewPrettyPatchButton"
216                       onclick="viewPrettyPatch([% attachment.id %]);">View Formatted Diff</button>
217               [% END %]
218 [%# endif // WEBKIT_CHANGES %]
219               <button type="button" id="editButton" class="bz_default_hidden"
220                       onclick="editAsComment([% use_patchviewer %]);">Edit Attachment As Comment</button>
221               <button type="button" id="undoEditButton" class="bz_default_hidden"
222                       onclick="undoEditAsComment([% use_patchviewer %]);">Undo Edit As Comment</button>
223               <button type="button" id="redoEditButton" class="bz_default_hidden"
224                       onclick="redoEditAsComment([% use_patchviewer %]);">Redo Edit As Comment</button>
225             [% END %]
226
227             [% IF use_patchviewer %]
228               <button type="button" id="viewDiffButton" class="bz_default_hidden"
229                       onclick="viewDiff([% attachment.id %], [% use_patchviewer %]);">View Attachment As Diff</button>
230             [% END %]
231             <button type="button" id="viewRawButton" class="bz_default_hidden"
232                     onclick="viewRaw([% use_patchviewer %]);">View Attachment As Raw</button>
233
234             <script type="text/javascript">
235               [% IF user.id %]
236                 document.getElementById('editFrame').disabled = false;
237                 YAHOO.util.Dom.removeClass("editButton", "bz_default_hidden");
238               [% END %]
239               YAHOO.util.Dom.removeClass("viewDiffButton", "bz_default_hidden");
240             </script>
241           </div>
242         [% ELSE %]
243           <div id="noview">
244             <p><b>
245               Attachment is not viewable in your browser because its MIME type 
246               ([% attachment.contenttype FILTER html %]) is not one that your browser is 
247               able to display.
248             </b></p>
249             <p><b>
250               <a href="attachment.cgi?id=[% attachment.id %]">Download the attachment</a>.
251             </b></p>
252           </div>
253         [% END %]
254       </div>
255       <div id="attachment_comments_and_flags">
256         [% IF user.id %]
257 [%# if WEBKIT_CHANGES %]
258             [% IF attachment.ispatch %]
259         Bot Status:
260
261         <div class="statusBubble">
262           <iframe src="https://webkit-queues.webkit.org/status-bubble/[% attachment.id %]"
263                   style="width: 600px; height: 20px; border: none;" scrolling="no">
264           </iframe>
265         </div>
266         <br>
267             [% END %]
268 [%# endif // WEBKIT_CHANGES %]
269           <div id="smallCommentFrame" >
270             <label for="comment">Comment (on the [% terms.bug %]):</label>
271             [% classNames = 'block' %]
272             [% classNames = "$classes bz_private" IF attachment.isprivate %]
273             [% INCLUDE bug/comment.html.tmpl
274                bug     = attachment.bug
275                minrows = 10
276                cols    = 80
277                classes = classNames
278                wrap    = 'soft'
279             %]
280             [% IF NOT attachment.bug.cc.contains(user.login) %]
281               <input type="checkbox" id="addselfcc" name="addselfcc"
282                 [%~ ' checked="checked"'
283                     IF user.settings.state_addselfcc.value == 'always'
284                        || (!attachment.bug.user.has_any_role
285                            && user.settings.state_addselfcc.value == 'cc_unless_role') %]>
286               <label for="addselfcc">Add me to CC list</label>
287             [% END %]
288             [% Hook.process('after_comment_textarea') %]
289           </div>
290         [% END %]
291         <div id="attachment_flags">
292           [% IF attachment.flag_types.size > 0 %]
293               [% PROCESS "flag/list.html.tmpl" flag_types = attachment.flag_types
294                                                read_only_flags = !can_edit
295               %]
296      
297           [% END %]
298         </div>
299
300         [% Hook.process('form_before_submit') %]
301
302         [% IF user.id %]       
303           <div id="update_container">
304             <input type="submit" value="Submit" id="update">
305           </div>
306         [% END %]        
307       </div>        
308     </div>
309   </div>
310 </form>
311
312 <div id="attachment_actions">
313   <span class="label">Actions:</span>
314   <a href="attachment.cgi?id=[% attachment.id %]">View</a>
315 [%# if WEBKIT_CHANGES %]
316   [% IF attachment.ispatch %]
317     | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=prettypatch">Formatted Diff</a>
318   [% END %]
319 [%# endif // WEBKIT_CHANGES %]
320   [% IF use_patchviewer %]
321     | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=diff">Diff</a>
322   [% END %]
323   [% IF Param("allow_attachment_deletion")
324         && user.in_group('admin')
325         && attachment.datasize > 0 %]
326     | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=delete">Delete</a>
327   [% END %]
328   [% Hook.process('action') %]
329 </div>
330
331 <div id="attachment_list">
332   Attachments on [% "$terms.bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]:
333   [% FOREACH a = attachments %]
334     [% IF a.isobsolete %]
335       <span class="bz_obsolete">
336     [% END %]
337     [% IF a.id == attachment.id %]
338       [%+ a.id FILTER html %]
339     [% ELSE %]
340       <a href="attachment.cgi?id=[% a.id FILTER uri %]&amp;action=edit"
341          title="[% a.description FILTER html %]">[% a.id FILTER html %]</a>
342     [% END %]
343     [% IF a.isobsolete %]
344       </span>
345     [% END %]
346     [% " |" UNLESS loop.last() %]
347   [% END %]
348 </div>
349 [% IF can_edit %]
350   <script type="text/javascript">
351     <!--
352       YAHOO.util.Dom.removeClass( document.body, "no_javascript" );
353       // toggle_attachment_details_visibility( ); // WEBKIT_CHANGES
354     -->
355   </script>
356 [% END %]
357 [% Hook.process('end') %]
358
359 [% PROCESS global/footer.html.tmpl %]