Commit 401fb65f authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 365267: attachment.cgi should not be editable when the user is not logged in…

Bug 365267: attachment.cgi should not be editable when the user is not logged in - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=pyrzak a=LpSolit
parent f30aa492
...@@ -104,3 +104,42 @@ tbody.file pre:empty { ...@@ -104,3 +104,42 @@ tbody.file pre:empty {
.warning { .warning {
color: red color: red
} }
table.attachment_info th {
text-align: right;
vertical-align: top;
}
table.attachment_info td {
text-align: left;
vertical-align: top;
}
/* Text displayed when the attachment is not viewable by the web browser */
#noview {
text-align: left;
vertical-align: middle;
}
#attachment_attributes {
width: 25%;
}
#attachment_attributes div {
padding-bottom: 0.4em;
}
#attachment_attributes label,
#attachment_attributes span.label,
#attachment_actions span.label
{
font-weight: bold;
}
#attachment_attributes .block {
display: block;
}
#attachment_attributes table#flags {
padding-top: 1em;
}
...@@ -401,22 +401,6 @@ dl dl > dt { ...@@ -401,22 +401,6 @@ dl dl > dt {
padding-left: 1em; padding-left: 1em;
} }
table.attachment_info th {
text-align: right;
vertical-align: top;
}
table.attachment_info td {
text-align: left;
vertical-align: top;
}
/* Text displayed when the attachment is not viewable by the web browser */
#noview {
text-align: left;
vertical-align: middle;
}
/* For bug fields */ /* For bug fields */
.uneditable_textarea { .uneditable_textarea {
width: 30em; width: 30em;
......
...@@ -36,11 +36,14 @@ ...@@ -36,11 +36,14 @@
header = header header = header
subheader = subheader subheader = subheader
doc_section = "attachments.html" doc_section = "attachments.html"
javascript_urls = ['js/attachment.js']; javascript_urls = ['js/attachment.js']
style_urls = ['skins/standard/create_attachment.css']
%] %]
[%# No need to display the Diff button and iframe if the attachment is not a patch. %] [%# No need to display the Diff button and iframe if the attachment is not a patch. %]
[% use_patchviewer = (feature_enabled('patch_viewer') && attachment.ispatch) %] [% use_patchviewer = (feature_enabled('patch_viewer') && attachment.ispatch) %]
[% can_edit = attachment.validate_can_edit %]
[% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
<form method="post" action="attachment.cgi" onsubmit="normalizeComments();"> <form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
<input type="hidden" name="id" value="[% attachment.id %]"> <input type="hidden" name="id" value="[% attachment.id %]">
...@@ -54,17 +57,22 @@ ...@@ -54,17 +57,22 @@
<table class="attachment_info" width="100%"> <table class="attachment_info" width="100%">
<tr> <tr>
<td width="25%"> <td id="attachment_attributes">
<small> <div id="attachment_description">
<b><label for="description">Description</label>:</b><br> <label for="description">Description:</label>
[% INCLUDE global/textarea.html.tmpl [% INCLUDE global/textarea.html.tmpl
id = 'description' id = 'description'
name = 'description' name = 'description'
minrows = 3 minrows = 3
cols = 25 cols = 25
wrap = 'soft' wrap = 'soft'
classes = 'block' _ editable_or_hide
defaultcontent = attachment.description defaultcontent = attachment.description
%]<br> %]
[% IF !can_edit %]
[%+ attachment.description FILTER wrap_comment(25) FILTER html %]
[% END %]
</div>
[% IF attachment.isurl %] [% IF attachment.isurl %]
<input type="hidden" name="filename" <input type="hidden" name="filename"
...@@ -72,68 +80,104 @@ ...@@ -72,68 +80,104 @@
<input type="hidden" name="contenttypeentry" <input type="hidden" name="contenttypeentry"
value="[% attachment.contenttype FILTER html %]"> value="[% attachment.contenttype FILTER html %]">
[% ELSE %] [% ELSE %]
<b><label for="filename">Filename</label>:</b><br> <div id="attachment_filename">
<input type="text" size="20" id="filename" name="filename" <label for="filename">Filename:</label>
value="[% attachment.filename FILTER html %]"><br> <input type="text" size="20" class="block[% editable_or_hide %]"
<b>Size:</b> id="filename" name="filename"
[% IF attachment.datasize %] value="[% attachment.filename FILTER html %]">
[%+ attachment.datasize FILTER unitconvert %] [% IF !can_edit %]
[% ELSE %] [%+ attachment.filename FILTER truncate(25) FILTER html %]
<em>deleted</em> [% END %]
[% END %]<br> </div>
<b><label for="contenttypeentry">MIME Type</label>:</b><br> <div id="attachment_mimetype">
<input type="text" size="20" <label for="contenttypeentry">MIME Type:</label>
<input type="text" size="20" class="block[% editable_or_hide %]"
id="contenttypeentry" name="contenttypeentry" id="contenttypeentry" name="contenttypeentry"
value="[% attachment.contenttype FILTER html %]"><br> value="[% attachment.contenttype FILTER html %]">
[% IF !can_edit %]
[%+ attachment.contenttype FILTER truncate(25) FILTER html %]
[% END %]
</div>
<input type="checkbox" id="ispatch" name="ispatch" value="1" <div id="attachment_size">
[%+ 'checked="checked"' IF attachment.ispatch %]> <span class="label">Size:</span>
<label for="ispatch">patch</label> [% IF attachment.datasize %]
[%+ attachment.datasize FILTER unitconvert %]
[% ELSE %]
<em>deleted</em>
[% END %]
</div>
<div id="attachment_creator">
<span class="label">Creator:</span>
[%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
</div>
<div id="attachment_ispatch">
<input type="checkbox" id="ispatch" name="ispatch" value="1"
[%+ IF !can_edit %]class="bz_hidden_option"[% END %]
[%+ 'checked="checked"' IF attachment.ispatch %]>
[% IF can_edit %]
<label for="ispatch">patch</label>
[% ELSE %]
<span class="label">Is Patch:</span>
[%+ attachment.ispatch ? "yes" : "no" %]
[% END %]
</div>
[% END %] [% END %]
<div id="attachment_isobsolete">
<input type="checkbox" id="isobsolete" name="isobsolete" value="1" <input type="checkbox" id="isobsolete" name="isobsolete" value="1"
[%+ IF !can_edit %]class="bz_hidden_option"[% END %]
[%+ 'checked="checked"' IF attachment.isobsolete %]> [%+ 'checked="checked"' IF attachment.isobsolete %]>
<label for="isobsolete">obsolete</label> [% IF can_edit %]
[% IF user.is_insider %] <label for="isobsolete">obsolete</label>
<br> [% ELSE %]
<input type="checkbox" id="isprivate" name="isprivate" value="1" <span class="label">Is Obsolete:</span>
[% " checked" IF attachment.isprivate %]> [%+ attachment.isobsolete ? "yes" : "no" %]
<label for="isprivate">private (only visible to
<strong>[% Param('insidergroup') FILTER html %]</strong>)
</label>
[% END %] [% END %]
<br> </div>
</small>
[% IF user.is_insider %]
<div id="attachment_isprivate">
<input type="checkbox" id="isprivate" name="isprivate" value="1"
[%+ IF !can_edit %]class="bz_hidden_option"[% END %]
[%+ 'checked="checked"' IF attachment.isprivate %]>
[% IF can_edit %]
<label for="isprivate">private (only visible to
<strong>[% Param('insidergroup') FILTER html %]</strong>)
</label>
[% ELSE %]
<span class="label">Is Private:</span>
[%+ attachment.isprivate ? "yes" : "no" %]
[% END %]
</div>
[% END %]
[% IF attachment.flag_types.size > 0 %] [% IF attachment.flag_types.size > 0 %]
[% PROCESS "flag/list.html.tmpl" bug_id = attachment.bug_id <div id="attachment_flags">
attach_id = attachment.id [% PROCESS "flag/list.html.tmpl" bug_id = attachment.bug_id
flag_types = attachment.flag_types attach_id = attachment.id
%]<br> flag_types = attachment.flag_types
%]
</div>
[% END %] [% END %]
<div id="smallCommentFrame"> [% IF user.id %]
<b><small><label for="comment">Comment</label> (on the <div id="smallCommentFrame">
[%+ terms.bug %]):</small></b><br> <label for="comment">Comment (on the [% terms.bug %]):</label>
[% INCLUDE global/textarea.html.tmpl [% INCLUDE global/textarea.html.tmpl
id = 'comment' id = 'comment'
name = 'comment' name = 'comment'
minrows = 5 minrows = 5
cols = 25 cols = 25
wrap = 'soft' wrap = 'soft'
%]<br> classes = 'block'
</div> %]
</div>
<input type="submit" value="Submit" id="update"><br><br> <input type="submit" value="Submit" id="update"><br><br>
<strong>Actions:</strong>
<a href="attachment.cgi?id=[% attachment.id %]">View</a>
[% IF use_patchviewer %]
| <a href="attachment.cgi?id=[% attachment.id %]&amp;action=diff">Diff</a>
[% END %]
[% IF Param("allow_attachment_deletion")
&& user.in_group('admin')
&& attachment.datasize > 0 %]
| <a href="attachment.cgi?id=[% attachment.id %]&amp;action=delete">Delete</a>
[% END %] [% END %]
</td> </td>
...@@ -210,11 +254,24 @@ ...@@ -210,11 +254,24 @@
</b></p> </b></p>
</td> </td>
[% END %] [% END %]
</tr> </tr>
</table> </table>
</form>
<div id="attachment_actions">
<span class="label">Actions:</span>
<a href="attachment.cgi?id=[% attachment.id %]">View</a>
[% IF use_patchviewer %]
| <a href="attachment.cgi?id=[% attachment.id %]&amp;action=diff">Diff</a>
[% END %]
[% IF Param("allow_attachment_deletion")
&& user.in_group('admin')
&& attachment.datasize > 0 %]
| <a href="attachment.cgi?id=[% attachment.id %]&amp;action=delete">Delete</a>
[% END %]
</div>
<div id="attachment_list">
Attachments on [% "$terms.bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]: Attachments on [% "$terms.bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]:
[% FOREACH a = attachments %] [% FOREACH a = attachments %]
[% IF a == attachment.id %] [% IF a == attachment.id %]
...@@ -224,9 +281,6 @@ ...@@ -224,9 +281,6 @@
[% END %] [% END %]
[% " |" UNLESS loop.last() %] [% " |" UNLESS loop.last() %]
[% END %] [% END %]
</div>
</form>
<br>
[% PROCESS global/footer.html.tmpl %] [% PROCESS global/footer.html.tmpl %]
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
title = title title = title
header = header header = header
subheader = filtered_summary subheader = filtered_summary
style_urls = ['skins/standard/create_attachment.css']
%] %]
<br> <br>
......
...@@ -380,7 +380,8 @@ ...@@ -380,7 +380,8 @@
'attachment/edit.html.tmpl' => [ 'attachment/edit.html.tmpl' => [
'attachment.id', 'attachment.id',
'attachment.bug_id', 'attachment.bug_id',
'a', 'a',
'editable_or_hide',
], ],
'attachment/list.html.tmpl' => [ 'attachment/list.html.tmpl' => [
......
...@@ -192,8 +192,13 @@ ...@@ -192,8 +192,13 @@
[% ELSE %] [% ELSE %]
[%# The user is logged out. Display flags as read-only. %] [%# The user is logged out. Display flags as read-only. %]
[% header_displayed = 0 %]
[% FOREACH type = flag_types %] [% FOREACH type = flag_types %]
[% FOREACH flag = type.flags %] [% FOREACH flag = type.flags %]
[% IF !flag_no_header AND !header_displayed %]
<p><b>Flags:</b></p>
[% header_displayed = 1 %]
[% END %]
[% flag.setter.nick FILTER html %]: [% flag.setter.nick FILTER html %]:
[%+ type.name FILTER html FILTER no_break %][% flag.status %] [%+ type.name FILTER html FILTER no_break %][% flag.status %]
[% IF flag.requestee %] [% IF flag.requestee %]
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
# name: (optional) The "name"-attribute of the textarea. # name: (optional) The "name"-attribute of the textarea.
# accesskey: (optional) The "accesskey"-attribute of the textarea. # accesskey: (optional) The "accesskey"-attribute of the textarea.
# style: (optional) The "style"-attribute of the textarea. # style: (optional) The "style"-attribute of the textarea.
# classes: (optional) The "class"-attribute of the textarea.
# wrap: (deprecated; optional) The "wrap"-attribute of the textarea. # wrap: (deprecated; optional) The "wrap"-attribute of the textarea.
# minrows: (required) Number of rows the textarea shall have initially # minrows: (required) Number of rows the textarea shall have initially
# and when not having focus. # and when not having focus.
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
[% IF id %] id="[% id FILTER html %]"[% END %] [% IF id %] id="[% id FILTER html %]"[% END %]
[% IF accesskey %] accesskey="[% accesskey FILTER html %]"[% END %] [% IF accesskey %] accesskey="[% accesskey FILTER html %]"[% END %]
[% IF style %] style="[% style FILTER html %]"[% END %] [% IF style %] style="[% style FILTER html %]"[% END %]
[% IF classes %]class="[% classes FILTER html %]"[% END %]
[% IF wrap %] wrap="[% wrap FILTER html %]"[% END %] [% IF wrap %] wrap="[% wrap FILTER html %]"[% END %]
[% IF defaultrows && user.settings.zoom_textareas.value == 'off' %] [% IF defaultrows && user.settings.zoom_textareas.value == 'off' %]
rows="[% defaultrows FILTER html %]" rows="[% defaultrows FILTER html %]"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment