Commit 2df35fc7 authored by Guy Pyrzak's avatar Guy Pyrzak

101770

parent 8d0710ac
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* Joel Peshkin <bugreport@peshkin.net> * Joel Peshkin <bugreport@peshkin.net>
* Erik Stambaugh <erik@dasbistro.com> * Erik Stambaugh <erik@dasbistro.com>
* Marc Schumann <wurblzap@gmail.com> * Marc Schumann <wurblzap@gmail.com>
* Guy Pyrzak <guy.pyrzak@gmail.com>
*/ */
function validateAttachmentForm(theform) { function validateAttachmentForm(theform) {
...@@ -307,7 +308,7 @@ function hideElementById(id) ...@@ -307,7 +308,7 @@ function hideElementById(id)
{ {
var elm = document.getElementById(id); var elm = document.getElementById(id);
if (elm) { if (elm) {
elm.style.display = 'none'; YAHOO.util.Dom.addClass(elm, 'bz_default_hidden');
} }
} }
...@@ -315,8 +316,7 @@ function showElementById(id, val) ...@@ -315,8 +316,7 @@ function showElementById(id, val)
{ {
var elm = document.getElementById(id); var elm = document.getElementById(id);
if (elm) { if (elm) {
if (!val) val = 'inline'; YAHOO.util.Dom.removeClass(elm, 'bz_default_hidden');
elm.style.display = val;
} }
} }
...@@ -327,12 +327,24 @@ function normalizeComments() ...@@ -327,12 +327,24 @@ function normalizeComments()
var small = document.getElementById('smallCommentFrame'); var small = document.getElementById('smallCommentFrame');
var big = document.getElementById('editFrame'); var big = document.getElementById('editFrame');
if ( (small) && (small.style.display == 'none') ) if ( (small) && YAHOO.util.Dom.hasClass(small, 'bz_default_hidden') )
{ {
small.parentNode.removeChild(small); small.parentNode.removeChild(small);
} }
if ( (big) && (big.style.display == 'none') ) if ( (big) && YAHOO.util.Dom.hasClass(big, 'bz_default_hidden') )
{ {
big.parentNode.removeChild(big); big.parentNode.removeChild(big);
} }
} }
function toggle_attachment_details_visibility ( )
{
// show hide classes
var container = document.getElementById('attachment_info');
if( YAHOO.util.Dom.hasClass(container, 'read') ){
YAHOO.util.Dom.replaceClass(container, 'read', 'edit');
}else{
YAHOO.util.Dom.replaceClass(container, 'edit', 'read');
}
}
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* Joel Peshkin <bugreport@peshkin.net> * Joel Peshkin <bugreport@peshkin.net>
* Erik Stambaugh <erik@dasbistro.com> * Erik Stambaugh <erik@dasbistro.com>
* Marc Schumann <wurblzap@gmail.com> * Marc Schumann <wurblzap@gmail.com>
* Guy Pyrzak <guy.pyrzak@gmail.com>
*/ */
table.attachment_entry th { table.attachment_entry th {
...@@ -121,10 +122,6 @@ table.attachment_info td { ...@@ -121,10 +122,6 @@ table.attachment_info td {
vertical-align: middle; vertical-align: middle;
} }
#attachment_attributes {
width: 25%;
}
#attachment_attributes div { #attachment_attributes div {
padding-bottom: 0.4em; padding-bottom: 0.4em;
} }
...@@ -140,6 +137,105 @@ table.attachment_info td { ...@@ -140,6 +137,105 @@ table.attachment_info td {
display: block; display: block;
} }
#attachment_attributes table#flags { #smallCommentFrame, #attachment_flags {
padding-top: 1em; float: left;
}
#smallCommentFrame {
margin-right: 1.5em;
}
#attachment_comments_and_flags, #attachment_actions {
clear: both;
margin-bottom: 1ex;
}
#attachment_information_read_only .title {
font-weight: bold;
font-size: 1.5em;
padding: 0;
margin: 0;
}
#attachment_information_read_only .title #bz_edit {
font-size: 0.7em;
}
#attachment_information_read_only .details {
font-family: monospace;
}
#attachment_info.read #attachment_information_edit {
display: none;
}
#attachment_info.edit #attachment_information_read_only {
display: none;
}
#attachment_info.edit #attachment_view_window {
float: left;
width: 80%;
}
#attachment_info.edit #attachment_information_edit {
width: 20%;
}
#attachment_info.edit #attachment_information_edit input.text,
#attachment_info.edit #attachment_information_edit textarea {
width: 90%;
}
#attachment_isobsolete {
padding-right: 1em;
}
#attachment_information_edit {
float: left;
}
#smallCommentFrame textarea {
display: block;
}
textarea.bz_private {
border: 1px solid #F8C8BA;
}
#update {
clear: both;
padding: 1.5em 0;
display: block;
}
textarea {
font-family: monospace;
}
div#update_container {
clear: both;
}
#attachment_flags {
margin-bottom: 1em;
}
#attachment_flags p {
padding-bottom: 0;
margin-bottom: 0;
}
#editFrame, #viewDiffFrame, #viewFrame {
height: 400px;
width: 100%;
}
.details span.bz_private{
border-left: 1px solid darkred;
padding-left: 0.5em;
}
.no_javascript .bz_hide, .no_javascript .bz_edit {
display: none;
} }
\ No newline at end of file
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
title = title title = title
header = header header = header
subheader = subheader subheader = subheader
style_urls = [ 'skins/standard/create_attachment.css' ] style_urls = [ 'skins/standard/attachment.css' ]
javascript_urls = [ "js/attachment.js", "js/util.js" ] javascript_urls = [ "js/attachment.js", "js/util.js" ]
doc_section = "attachments.html" doc_section = "attachments.html"
%] %]
......
...@@ -53,11 +53,11 @@ Interdiff of #[% oldid %] and #[% newid %] for [% terms.bug %] #[% bugid %] ...@@ -53,11 +53,11 @@ Interdiff of #[% oldid %] and #[% newid %] for [% terms.bug %] #[% bugid %]
[% END %] [% END %]
[% PROCESS global/header.html.tmpl doc_section = "attachments.html#patchviewer" [% PROCESS global/header.html.tmpl doc_section = "attachments.html#patchviewer"
javascript_urls = "js/attachment.js" javascript_urls = "js/attachment.js"
style_urls = ['skins/standard/create_attachment.css'] %] style_urls = ['skins/standard/attachment.css'] %]
[% ELSE %] [% ELSE %]
<html> <html>
<head> <head>
<link href="skins/standard/create_attachment.css" rel="stylesheet" type="text/css"> <link href="skins/standard/attachment.css" rel="stylesheet" type="text/css">
<script src="js/attachment.js" type="text/javascript"></script> <script src="js/attachment.js" type="text/javascript"></script>
</head> </head>
<body onload="[% onload FILTER html %]"> <body onload="[% onload FILTER html %]">
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# #
# Contributor(s): Myk Melez <myk@mozilla.org> # Contributor(s): Myk Melez <myk@mozilla.org>
# Frédéric Buclin <LpSolit@gmail.com> # Frédéric Buclin <LpSolit@gmail.com>
# Guy Pyrzak <guy.pyrzak@gmail.com>
#%] #%]
[% PROCESS global/variables.none.tmpl %] [% PROCESS global/variables.none.tmpl %]
...@@ -37,7 +38,8 @@ ...@@ -37,7 +38,8 @@
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'] style_urls = ['skins/standard/attachment.css']
bodyclasses = "no_javascript"
%] %]
[%# 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. %]
...@@ -54,12 +56,38 @@ ...@@ -54,12 +56,38 @@
<input type="hidden" name="token" value="[% issue_hash_token([attachment.id, attachment.modification_time]) FILTER html %]"> <input type="hidden" name="token" value="[% issue_hash_token([attachment.id, attachment.modification_time]) FILTER html %]">
[% END %] [% END %]
<table class="attachment_info" width="100%"> <div id="attachment_info" class="attachment_info [% IF can_edit %] edit[% ELSE %] read[% END%]">
<div id="attachment_attributes">
<tr> <div id="attachment_information_read_only" class="[% "bz_private" IF attachment.isprivate %]">
<td id="attachment_attributes"> <div class="title">
[% "[patch]" IF attachment.ispatch%]
<span class="[% "bz_obsolete" IF attachment.isobsolete %]" title="[% "obsolete" IF attachment.isobsolete %]">
[% attachment.description FILTER html %]
</span>
[% IF can_edit %]
<span class="bz_edit">(<a href="javascript:toggle_attachment_details_visibility()">edit</a>)</span>
[% END %]
</div>
[% IF NOT attachment.isurl %]
<div class="details">
[% attachment.filename FILTER html %] ([% attachment.contenttype FILTER html %])
[% IF attachment.datasize %]
[%+ attachment.datasize FILTER unitconvert %]
[% ELSE %]
<em>deleted</em>
[% END %], created by [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
[% IF attachment.isprivate %]
<span class="bz_private">Only visible to <strong>[% Param('insidergroup') FILTER html %]</strong></span>
[% END %]
</div>
[% END %]
</div>
<div id="attachment_information_edit">
<span class="bz_hide">
(<a href="javascript:toggle_attachment_details_visibility();">hide</a>)
</span>
<div id="attachment_description"> <div id="attachment_description">
<label for="description">Description:</label> <label for="description">Description:</label>&nbsp;
[% INCLUDE global/textarea.html.tmpl [% INCLUDE global/textarea.html.tmpl
id = 'description' id = 'description'
name = 'description' name = 'description'
...@@ -69,9 +97,6 @@ ...@@ -69,9 +97,6 @@
classes = 'block' _ editable_or_hide classes = 'block' _ editable_or_hide
defaultcontent = attachment.description defaultcontent = attachment.description
%] %]
[% IF !can_edit %]
[%+ attachment.description FILTER wrap_comment(25) FILTER html %]
[% END %]
</div> </div>
[% IF attachment.isurl %] [% IF attachment.isurl %]
...@@ -82,22 +107,21 @@ ...@@ -82,22 +107,21 @@
[% ELSE %] [% ELSE %]
<div id="attachment_filename"> <div id="attachment_filename">
<label for="filename">Filename:</label> <label for="filename">Filename:</label>
<input type="text" size="20" class="block[% editable_or_hide %]" <input type="text" size="20" class="text block[% editable_or_hide %]"
id="filename" name="filename" id="filename" name="filename"
value="[% attachment.filename FILTER html %]"> value="[% attachment.filename FILTER html %]">
[% IF !can_edit %]
[%+ attachment.filename FILTER truncate(25) FILTER html %]
[% END %]
</div> </div>
<div id="attachment_mimetype"> <div id="attachment_mimetype">
<label for="contenttypeentry">MIME Type:</label> <label for="contenttypeentry">MIME Type:</label>
<input type="text" size="20" class="block[% editable_or_hide %]" <input type="text" size="20" class="text block[% editable_or_hide %]"
id="contenttypeentry" name="contenttypeentry" id="contenttypeentry" name="contenttypeentry"
value="[% attachment.contenttype FILTER html %]"> value="[% attachment.contenttype FILTER html %]">
[% IF !can_edit %] </div>
[%+ attachment.contenttype FILTER truncate(25) FILTER html %]
[% END %] <div id="attachment_creator">
<span class="label">Creator:</span>
[%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
</div> </div>
<div id="attachment_size"> <div id="attachment_size">
...@@ -109,40 +133,23 @@ ...@@ -109,40 +133,23 @@
[% END %] [% END %]
</div> </div>
<div id="attachment_creator">
<span class="label">Creator:</span>
[%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
</div>
<div id="attachment_ispatch"> <div id="attachment_ispatch">
<input type="checkbox" id="ispatch" name="ispatch" value="1" <input type="checkbox" id="ispatch" name="ispatch" value="1"
[%+ IF !can_edit %]class="bz_hidden_option"[% END %]
[%+ 'checked="checked"' IF attachment.ispatch %]> [%+ 'checked="checked"' IF attachment.ispatch %]>
[% IF can_edit %]
<label for="ispatch">patch</label> <label for="ispatch">patch</label>
[% ELSE %]
<span class="label">Is Patch:</span>
[%+ attachment.ispatch ? "yes" : "no" %]
[% END %]
</div> </div>
[% END %] [% END %]
<div class="readonly">
<div class="checkboxes">
<div id="attachment_isobsolete"> <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 %]>
[% IF can_edit %]
<label for="isobsolete">obsolete</label> <label for="isobsolete">obsolete</label>
[% ELSE %]
<span class="label">Is Obsolete:</span>
[%+ attachment.isobsolete ? "yes" : "no" %]
[% END %]
</div> </div>
[% IF user.is_insider %] [% IF user.is_insider %]
<div id="attachment_isprivate"> <div id="attachment_isprivate">
<input type="checkbox" id="isprivate" name="isprivate" value="1" <input type="checkbox" id="isprivate" name="isprivate" value="1"
[%+ IF !can_edit %]class="bz_hidden_option"[% END %]
[%+ 'checked="checked"' IF attachment.isprivate %]> [%+ 'checked="checked"' IF attachment.isprivate %]>
[% IF can_edit %] [% IF can_edit %]
<label for="isprivate">private (only visible to <label for="isprivate">private (only visible to
...@@ -154,38 +161,15 @@ ...@@ -154,38 +161,15 @@
[% END %] [% END %]
</div> </div>
[% END %] [% END %]
[% IF attachment.flag_types.size > 0 %]
<div id="attachment_flags">
[% PROCESS "flag/list.html.tmpl" bug_id = attachment.bug_id
attach_id = attachment.id
flag_types = attachment.flag_types
read_only_flags = !can_edit
%]
</div> </div>
[% END %] </div>
[% IF user.id %]
<div id="smallCommentFrame">
<label for="comment">Comment (on the [% terms.bug %]):</label>
[% INCLUDE global/textarea.html.tmpl
id = 'comment'
name = 'comment'
minrows = 5
cols = 25
wrap = 'soft'
classes = 'block'
%]
</div> </div>
<input type="submit" value="Submit" id="update"><br><br> <div id="attachment_view_window">
[% END %]
</td>
[% IF !attachment.datasize %] [% IF !attachment.datasize %]
<td width="75%"><b>The content of this attachment has been deleted.</b></td> <div><b>The content of this attachment has been deleted.</b></div>
[% ELSIF attachment.isurl %] [% ELSIF attachment.isurl %]
<td width="75%"> <div>
<a href="[% attachment.data FILTER html %]"> <a href="[% attachment.data FILTER html %]">
[% IF attachment.datasize < 120 %] [% IF attachment.datasize < 120 %]
[% attachment.data FILTER html %] [% attachment.data FILTER html %]
...@@ -195,31 +179,31 @@ ...@@ -195,31 +179,31 @@
[% attachment.data.match(".*(.{20})$").0 FILTER html %] [% attachment.data.match(".*(.{20})$").0 FILTER html %]
[% END %] [% END %]
</a> </a>
</td> </div>
[% ELSIF !Param("allow_attachment_display") %] [% ELSIF !Param("allow_attachment_display") %]
<td id="view_disabled" width="50%"> <div id="view_disabled" >
<p><b> <p><b>
The attachment is not viewable in your browser due to security The attachment is not viewable in your browser due to security
restrictions enabled by [% terms.Bugzilla %]. restrictions enabled by your [% terms.Bugzilla %] administrator.
</b></p> </b></p>
<p><b> <p><b>
In order to view the attachment, you first have to In order to view the attachment, you first have to
<a href="attachment.cgi?id=[% attachment.id %]">download it</a>. <a href="attachment.cgi?id=[% attachment.id %]">download it</a>.
</b></p> </b></p>
</td> </div>
[% ELSIF attachment.is_viewable %] [% ELSIF attachment.is_viewable %]
<td width="75%"> <div >
[% INCLUDE global/textarea.html.tmpl [% INCLUDE global/textarea.html.tmpl
id = 'editFrame' id = 'editFrame'
name = 'comment' name = 'comment'
style = 'height: 400px; width: 100%; display: none' classes = 'bz_default_hidden'
minrows = 10 minrows = 10
cols = 80 cols = 80
wrap = 'soft' wrap = 'soft'
defaultcontent = (attachment.contenttype.match('^text\/')) ? defaultcontent = (attachment.contenttype.match('^text\/')) ?
attachment.data.replace('(.*\n|.+)', '>$1') : undef attachment.data.replace('(.*\n|.+)', '>$1') : undef
%] %]
<iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]" style="height: 400px; width: 100%;"> <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]">
<b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs. <b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
<a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b> <a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b>
</iframe> </iframe>
...@@ -228,23 +212,25 @@ ...@@ -228,23 +212,25 @@
var patchviewerinstalled = 0; var patchviewerinstalled = 0;
var attachment_id = [% attachment.id %]; var attachment_id = [% attachment.id %];
if (typeof document.getElementById == "function") { if (typeof document.getElementById == "function") {
[% IF use_patchviewer %] [% IF use_patchviewer %]
var patchviewerinstalled = 1; var patchviewerinstalled = 1;
document.write('<iframe id="viewDiffFrame" style="height: 400px; width: 100%; display: none;"><\/iframe>'); document.write('<iframe id="viewDiffFrame" class="bz_default_hidden"><\/iframe>');
[% END %] [% END %]
[% IF user.id %]
document.write('<button type="button" id="editButton" onclick="editAsComment(patchviewerinstalled);">Edit Attachment As Comment<\/button>'); document.write('<button type="button" id="editButton" onclick="editAsComment(patchviewerinstalled);">Edit Attachment As Comment<\/button>');
document.write('<button type="button" id="undoEditButton" onclick="undoEditAsComment(patchviewerinstalled);" style="display: none;">Undo Edit As Comment<\/button>'); document.write('<button type="button" id="undoEditButton" onclick="undoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Undo Edit As Comment<\/button>');
document.write('<button type="button" id="redoEditButton" onclick="redoEditAsComment(patchviewerinstalled);" style="display: none;">Redo Edit As Comment<\/button>'); document.write('<button type="button" id="redoEditButton" onclick="redoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Redo Edit As Comment<\/button>');
[% IF use_patchviewer %] [% END %]
[% IF use_patchviewer %]
document.write('<button type="button" id="viewDiffButton" onclick="viewDiff(attachment_id, patchviewerinstalled);">View Attachment As Diff<\/button>'); document.write('<button type="button" id="viewDiffButton" onclick="viewDiff(attachment_id, patchviewerinstalled);">View Attachment As Diff<\/button>');
[% END %] [% END %]
document.write('<button type="button" id="viewRawButton" onclick="viewRaw(patchviewerinstalled);" style="display: none;">View Attachment As Raw<\/button>'); document.write('<button type="button" id="viewRawButton" onclick="viewRaw(patchviewerinstalled);" class="bz_default_hidden">View Attachment As Raw<\/button>');
} }
//--> //-->
</script> </script>
</td> </div>
[% ELSE %] [% ELSE %]
<td id="noview" width="50%"> <div id="noview">
<p><b> <p><b>
Attachment is not viewable in your browser because its MIME type Attachment is not viewable in your browser because its MIME type
([% attachment.contenttype FILTER html %]) is not one that your browser is ([% attachment.contenttype FILTER html %]) is not one that your browser is
...@@ -253,10 +239,42 @@ ...@@ -253,10 +239,42 @@
<p><b> <p><b>
<a href="attachment.cgi?id=[% attachment.id %]">Download the attachment</a>. <a href="attachment.cgi?id=[% attachment.id %]">Download the attachment</a>.
</b></p> </b></p>
</td> </div>
[% END %]
</div>
<div id="attachment_comments_and_flags">
[% IF user.id %]
<div id="smallCommentFrame" >
<label for="comment">Comment (on the [% terms.bug %]):</label>
[% classNames = 'block' %]
[% classNames = "$classes bz_private" IF attachment.isprivate %]
[% INCLUDE global/textarea.html.tmpl
id = 'comment'
name = 'comment'
minrows = 10
cols = 80
wrap = 'soft'
classes = classNames
%]
</div>
[% END %]
[% IF attachment.flag_types.size > 0 %]
<div id="attachment_flags">
[% PROCESS "flag/list.html.tmpl" bug_id = attachment.bug_id
attach_id = attachment.id
flag_types = attachment.flag_types
read_only_flags = !can_edit
%]
</div>
[% END %]
[% IF user.id %]
<div id="update_container">
<input type="submit" value="Submit" id="update">
</div>
[% END %] [% END %]
</tr> </div>
</table> </div>
</div>
</form> </form>
<div id="attachment_actions"> <div id="attachment_actions">
...@@ -283,7 +301,14 @@ ...@@ -283,7 +301,14 @@
[% " |" UNLESS loop.last() %] [% " |" UNLESS loop.last() %]
[% END %] [% END %]
</div> </div>
[% IF can_edit %]
<script type="text/javascript">
<!--
YAHOO.util.Dom.removeClass( document.body, "no_javascript" );
toggle_attachment_details_visibility( );
-->
</script>
[% END %]
[% Hook.process('end') %] [% Hook.process('end') %]
[% PROCESS global/footer.html.tmpl %] [% PROCESS global/footer.html.tmpl %]
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
title = title title = title
header = header header = header
subheader = filtered_summary subheader = filtered_summary
style_urls = ['skins/standard/create_attachment.css'] style_urls = ['skins/standard/attachment.css']
%] %]
<br> <br>
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
[% PROCESS global/header.html.tmpl [% PROCESS global/header.html.tmpl
title = title title = title
style_urls = [ 'skins/standard/yui/autocomplete.css', style_urls = [ 'skins/standard/yui/autocomplete.css',
'skins/standard/create_attachment.css', 'skins/standard/attachment.css',
'skins/standard/yui/calendar.css' ] 'skins/standard/yui/calendar.css' ]
javascript_urls = [ "js/yui/bz_autocomplete_bundle.js", javascript_urls = [ "js/yui/bz_autocomplete_bundle.js",
"js/attachment.js", "js/util.js", "js/yui/calendar.js", "js/attachment.js", "js/util.js", "js/yui/calendar.js",
......
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