Replace Google App Engine with AppScale
[WebKit-https.git] / Websites / bugs.webkit.org / template / en / default / attachment / edit.html.tmpl
1 [%# The contents of this file are subject to the Mozilla Public
2   # License Version 1.1 (the "License"); you may not use this file
3   # except in compliance with the License. You may obtain a copy of
4   # the License at http://www.mozilla.org/MPL/
5   #
6   # Software distributed under the License is distributed on an "AS
7   # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8   # implied. See the License for the specific language governing
9   # rights and limitations under the License.
10   #
11   # The Original Code is the Bugzilla Bug Tracking System.
12   #
13   # The Initial Developer of the Original Code is Netscape Communications
14   # Corporation. Portions created by Netscape are
15   # Copyright (C) 1998 Netscape Communications Corporation. All
16   # Rights Reserved.
17   #
18   # Contributor(s): Myk Melez <myk@mozilla.org>
19   #                 Frédéric Buclin <LpSolit@gmail.com>
20   #                 Guy Pyrzak <guy.pyrzak@gmail.com>
21   #%]
22
23 [% PROCESS global/variables.none.tmpl %]
24
25 [%# Define strings that will serve as the title and header of this page %]
26 [% title = BLOCK %]
27   Attachment [% attachment.id %] Details for [% terms.Bug %] [%+ attachment.bug_id %]
28 [% END %]
29 [% header = BLOCK %]
30   Attachment [% attachment.id %] Details for
31   [%+ "$terms.Bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]
32 [% END %]
33 [% subheader = BLOCK %][% attachment.bug.short_desc FILTER html %][% END %]
34
35 [% PROCESS global/header.html.tmpl
36   title = title
37   header = header
38   subheader = subheader
39   doc_section = "attachments.html"
40   javascript_urls = ['js/attachment.js', 'js/field.js']
41   style_urls = ['skins/standard/attachment.css']
42   yui = [ 'autocomplete' ]
43   bodyclasses = "no_javascript"
44 %]
45
46 [%# No need to display the Diff button and iframe if the attachment is not a patch. %]
47 [% use_patchviewer = (feature_enabled('patch_viewer') && attachment.ispatch) %]
48 [% can_edit = attachment.validate_can_edit %]
49 [% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
50
51 <form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
52   <input type="hidden" name="id" value="[% attachment.id %]">
53   <input type="hidden" name="action" value="update">
54   <input type="hidden" name="contenttypemethod" value="manual">
55   <input type="hidden" name="delta_ts" value="[% attachment.modification_time FILTER html %]">
56   [% IF user.id %]
57     <input type="hidden" name="token" value="[% issue_hash_token([attachment.id, attachment.modification_time]) FILTER html %]">
58   [% END %]
59
60   <div id="attachment_info" class="attachment_info [% IF can_edit %] edit[% ELSE %] read[% END%]">
61     <div id="attachment_attributes">
62       <div id="attachment_information_read_only" class="[% "bz_private" IF attachment.isprivate %]">
63         <div class="title">
64           [% "[patch]" IF attachment.ispatch%] 
65           <span class="[% "bz_obsolete" IF attachment.isobsolete %]" title="[% "obsolete" IF attachment.isobsolete %]">              
66             [% attachment.description FILTER html %]
67           </span>
68           [% IF can_edit %]
69             <span class="bz_edit">(<a href="javascript:toggle_attachment_details_visibility()">edit details</a>)</span>
70           [% END %]
71         </div>
72         <div class="details">
73           [% attachment.filename FILTER html %] ([% attachment.contenttype FILTER html %]),
74           [% IF attachment.datasize %]
75             [%+ attachment.datasize FILTER unitconvert %]
76           [% ELSE %]
77             <em>deleted</em>
78           [% END %], created by [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
79           [% IF attachment.isprivate %];
80             <span class="bz_private">only visible to <strong>[% Param('insidergroup') FILTER html %]</strong> members</span>
81           [% END %]
82         </div>
83       </div>
84       <div id="attachment_information_edit">
85         <span class="bz_hide">
86           (<a href="javascript:toggle_attachment_details_visibility();">hide</a>)
87         </span>
88         <div id="attachment_description">
89           <label for="description">Description:</label>&nbsp;
90           [% INCLUDE global/textarea.html.tmpl
91             id             = 'description'
92             name           = 'description'
93             minrows        = 3
94             cols           = 25
95             wrap           = 'soft'
96             classes        = 'block' _ editable_or_hide
97             defaultcontent = attachment.description
98           %]          
99         </div>
100
101           <div id="attachment_filename">
102             <label for="filename">Filename:</label>
103             <input type="text" size="20"  class="text block[% editable_or_hide %]"
104                    id="filename" name="filename"
105                    value="[% attachment.filename FILTER html %]">     
106           </div>
107
108           <div id="attachment_mimetype">
109             <label for="contenttypeentry">MIME Type:</label>
110             <input type="text" size="20" class="text block[% editable_or_hide %]"
111                    id="contenttypeentry" name="contenttypeentry"
112                    value="[% attachment.contenttype FILTER html %]">                   
113           </div>
114           
115           <div id="attachment_creator">
116             <span class="label">Creator:</span>
117             [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
118           </div>
119           
120           <div id="attachment_size">
121             <span class="label">Size:</span>
122             [% IF attachment.datasize %]
123               [%+ attachment.datasize FILTER unitconvert %]
124             [% ELSE %]
125               <em>deleted</em>
126             [% END %]
127           </div>
128
129           <div id="attachment_ispatch">
130             <input type="checkbox" id="ispatch" name="ispatch" value="1"
131                    [%+ 'checked="checked"' IF attachment.ispatch %]>
132                    <label for="ispatch">patch</label>
133           </div>
134
135         <div class="readonly">
136           <div class="checkboxes">
137             <div id="attachment_isobsolete">
138               <input type="checkbox" id="isobsolete" name="isobsolete" value="1"                     
139                      [%+ 'checked="checked"' IF attachment.isobsolete %]>
140                 <label for="isobsolete">obsolete</label>
141             </div>
142
143             [% IF user.is_insider %]
144               <div id="attachment_isprivate">
145                 <input type="checkbox" id="isprivate" name="isprivate" value="1"
146                        [%+ 'checked="checked"' IF attachment.isprivate %]>
147                 [% IF can_edit %]
148                   <label for="isprivate">private (only visible to
149                     <strong>[% Param('insidergroup') FILTER html %]</strong>)
150                   </label>
151                 [% ELSE %]
152                   <span class="label">Is Private:</span>
153                   [%+ attachment.isprivate ? "yes" : "no" %]
154                 [% END %]
155               </div>
156             [% END %]
157           </div>
158         </div>                    
159       </div>
160
161       <div id="attachment_view_window">
162         [% IF !attachment.datasize %]
163           <div><b>The content of this attachment has been deleted.</b></div>
164         [% ELSIF !Param("allow_attachment_display") %]
165           <div id="view_disabled">
166             <p><b>
167               The attachment is not viewable in your browser due to security
168               restrictions enabled by your [% terms.Bugzilla %] administrator.
169             </b></p>
170             <p><b>
171               In order to view the attachment, you first have to
172               <a href="attachment.cgi?id=[% attachment.id %]">download it</a>.
173             </b></p>
174           </div>
175         [% ELSIF attachment.is_viewable %]
176           <div>
177             [% INCLUDE global/textarea.html.tmpl
178               id      = 'editFrame'
179               name    = 'comment'
180               classes   = 'bz_default_hidden'
181               minrows = 10
182               cols    = 80
183               wrap    = 'soft'
184               disabled = 'disabled'
185               defaultcontent = (attachment.contenttype.match('^text\/')) ?
186                                  attachment.data.replace('(.*\n|.+)', '>$1') : undef
187             %]
188             [% IF attachment.contenttype == 'text/plain' AND is_safe_url(attachment.data) %]
189               <p>
190                 <a href="[% attachment.data FILTER html %]">
191                   [% IF attachment.datasize < 120 %]
192                     [% attachment.data FILTER html %]
193                   [% ELSE %]
194                     [% attachment.data FILTER truncate(80) FILTER html %]
195                     ...
196                     [% attachment.data.match('.*(.{20})$').0 FILTER html %]
197                   [% END %]
198                 </a>
199               </p>
200             [% ELSIF attachment.contenttype == "text/html" %]
201               [%# For security reasons (clickjacking, embedded scripts), we never
202                 # render HTML pages from here. The source code is displayed instead. %]
203               [% INCLUDE global/textarea.html.tmpl
204                  id      = 'viewFrame'
205                  minrows = 10
206                  cols    = 80
207                  defaultcontent = attachment.data
208                  readonly = 'readonly'
209               %]
210             [% ELSE %]
211               <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]">
212                 <b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
213                 <a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b>
214               </iframe>
215             [% END %]
216             <script type="text/javascript">
217               <!--
218               var patchviewerinstalled = 0;
219               var attachment_id = [% attachment.id %];
220               if (typeof document.getElementById == "function") {
221                 [% IF use_patchviewer %]
222                   var patchviewerinstalled = 1;
223                   document.write('<iframe id="viewDiffFrame" class="bz_default_hidden"><\/iframe>');
224                 [% END %]
225                 [% IF user.id %]
226 [%# if WEBKIT_CHANGES %]
227                   [% IF attachment.ispatch %]
228                   document.write('<button type="button" id="viewPrettyPatchButton" onclick="viewPrettyPatch(attachment_id);">View Formatted Diff<\/button>');
229                   [% END %]
230 [%# endif // WEBKIT_CHANGES %]
231                   document.write('<button type="button" id="editButton" onclick="editAsComment(patchviewerinstalled);">Edit Attachment As Comment<\/button>');
232                   document.write('<button type="button" id="undoEditButton" onclick="undoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Undo Edit As Comment<\/button>');
233                   document.write('<button type="button" id="redoEditButton" onclick="redoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Redo Edit As Comment<\/button>');
234                   var editFrame = document.getElementById('editFrame');
235                   if (editFrame) {
236                     editFrame.disabled = false;
237                   }
238                 [% END %]
239                 [% IF use_patchviewer %]
240                   document.write('<button type="button" id="viewDiffButton" onclick="viewDiff(attachment_id, patchviewerinstalled);">View Attachment As Diff<\/button>');
241                 [% END %]
242                 document.write('<button type="button" id="viewRawButton" onclick="viewRaw(patchviewerinstalled);" class="bz_default_hidden">View Attachment As Raw<\/button>');
243               }
244               //-->
245             </script>
246           </div>
247         [% ELSE %]
248           <div id="noview">
249             <p><b>
250               Attachment is not viewable in your browser because its MIME type 
251               ([% attachment.contenttype FILTER html %]) is not one that your browser is 
252               able to display.
253             </b></p>
254             <p><b>
255               <a href="attachment.cgi?id=[% attachment.id %]">Download the attachment</a>.
256             </b></p>
257           </div>
258         [% END %]
259       </div>
260       <div id="attachment_comments_and_flags">
261         [% IF user.id %]
262 [%# if WEBKIT_CHANGES %]
263             [% IF attachment.ispatch %]
264         Bot Status:
265
266         <div class="statusBubble">
267           <iframe src="https://webkit-queues.webkit.org/status-bubble/[% attachment.id %]"
268                   style="width: 400px; height: 40px; border: none;" scrolling="no">
269           </iframe>
270         </div>
271         <br>
272             [% END %]
273 [%# endif // WEBKIT_CHANGES %]
274           <div id="smallCommentFrame" >
275             <label for="comment">Comment (on the [% terms.bug %]):</label>
276             [% classNames = 'block' %]
277             [% classNames = "$classes bz_private" IF attachment.isprivate %]
278             [% INCLUDE global/textarea.html.tmpl
279               id      = 'comment'
280               name    = 'comment'
281               minrows = 10
282               cols    = 80
283               wrap    = 'soft'
284               classes = classNames          
285             %]
286           </div>
287         [% END %]             
288         <div id="attachment_flags">
289           [% IF attachment.flag_types.size > 0 %]
290               [% PROCESS "flag/list.html.tmpl" flag_types = attachment.flag_types
291                                                read_only_flags = !can_edit
292               %]
293      
294           [% END %]
295         </div>
296
297         [% Hook.process('form_before_submit') %]
298
299         [% IF user.id %]       
300           <div id="update_container">
301             <input type="submit" value="Submit" id="update">
302           </div>
303         [% END %]        
304       </div>        
305     </div>
306   </div>
307 </form>
308
309 <div id="attachment_actions">
310   <span class="label">Actions:</span>
311   <a href="attachment.cgi?id=[% attachment.id %]">View</a>
312 [%# if WEBKIT_CHANGES %]
313   [% IF attachment.ispatch %]
314     | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=prettypatch">Formatted Diff</a>
315   [% END %]
316 [%# endif // WEBKIT_CHANGES %]
317   [% IF use_patchviewer %]
318     | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=diff">Diff</a>
319   [% END %]
320   [% IF Param("allow_attachment_deletion")
321         && user.in_group('admin')
322         && attachment.datasize > 0 %]
323     | <a href="attachment.cgi?id=[% attachment.id %]&amp;action=delete">Delete</a>
324   [% END %]
325   [% Hook.process('action') %]
326 </div>
327
328 <div id="attachment_list">
329   Attachments on [% "$terms.bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]:
330   [% FOREACH a = attachments %]
331     [% IF a == attachment.id %]
332       [%+ a %]
333     [% ELSE %]
334       <a href="attachment.cgi?id=[% a %]&amp;action=edit">[% a %]</a>
335     [% END %]
336     [% " |" UNLESS loop.last() %]
337   [% END %]
338 </div>
339 [% IF can_edit %]
340   <script type="text/javascript">
341     <!--
342       YAHOO.util.Dom.removeClass( document.body, "no_javascript" );
343       // toggle_attachment_details_visibility( ); // WEBKIT_CHANGES
344     -->
345   </script>
346 [% END %]
347 [% Hook.process('end') %]
348
349 [% PROCESS global/footer.html.tmpl %]