From 2df35fc7a5139c4c478e1989b7122672f68f7be6 Mon Sep 17 00:00:00 2001 From: Guy Pyrzak Date: Tue, 2 Mar 2010 22:13:28 -0800 Subject: 101770 --- js/attachment.js | 22 +- skins/standard/attachment.css | 241 +++++++++++++++ skins/standard/create_attachment.css | 145 --------- template/en/default/attachment/create.html.tmpl | 2 +- .../en/default/attachment/diff-header.html.tmpl | 4 +- template/en/default/attachment/edit.html.tmpl | 327 +++++++++++---------- .../en/default/attachment/show-multiple.html.tmpl | 2 +- template/en/default/bug/create/create.html.tmpl | 2 +- 8 files changed, 439 insertions(+), 306 deletions(-) create mode 100644 skins/standard/attachment.css delete mode 100644 skins/standard/create_attachment.css diff --git a/js/attachment.js b/js/attachment.js index b62555fbe..d759248cd 100644 --- a/js/attachment.js +++ b/js/attachment.js @@ -19,6 +19,7 @@ * Joel Peshkin * Erik Stambaugh * Marc Schumann + * Guy Pyrzak */ function validateAttachmentForm(theform) { @@ -307,7 +308,7 @@ function hideElementById(id) { var elm = document.getElementById(id); if (elm) { - elm.style.display = 'none'; + YAHOO.util.Dom.addClass(elm, 'bz_default_hidden'); } } @@ -315,8 +316,7 @@ function showElementById(id, val) { var elm = document.getElementById(id); if (elm) { - if (!val) val = 'inline'; - elm.style.display = val; + YAHOO.util.Dom.removeClass(elm, 'bz_default_hidden'); } } @@ -327,12 +327,24 @@ function normalizeComments() var small = document.getElementById('smallCommentFrame'); 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); } - if ( (big) && (big.style.display == 'none') ) + if ( (big) && YAHOO.util.Dom.hasClass(big, 'bz_default_hidden') ) { 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'); + } +} + diff --git a/skins/standard/attachment.css b/skins/standard/attachment.css new file mode 100644 index 000000000..081f5ccb7 --- /dev/null +++ b/skins/standard/attachment.css @@ -0,0 +1,241 @@ + /* The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Bugzilla Bug Tracking System. + * + * Contributor(s): Myk Melez + * Joel Peshkin + * Erik Stambaugh + * Marc Schumann + * Guy Pyrzak + */ + +table.attachment_entry th { + text-align: right; + vertical-align: baseline; + white-space: nowrap; +} + +table.attachment_entry td { + text-align: left; + vertical-align: baseline; + padding-bottom: 5px; +} + +table#flags th, +table#flags td { + text-align: left; + vertical-align: baseline; + font-size: small; +} + +/* Rules used to view patches in diff mode. */ + +.file_head { + font-weight: bold; + font-size: 1em; + background-color: #c3c3c3; + border: 1px solid black; +} + +.file_head a { + text-decoration: none; + font-family: monospace; + font-size: 1.1em; +} + +.file_collapse { + display: none; +} + +.section_head { + background-color: #f0f0f0; + border: 1px solid black; + text-align: left; +} + +table.file_table { + table-layout: fixed; + width: 100%; + empty-cells: show; + border-spacing: 0px; + border-collapse: collapse; + /* draw border below last open context section in listing */ + border-bottom: 1px solid black; +} + +tbody.file pre { + display: inline; + white-space: pre-wrap; /* CSS 3 & CSS 2.1 */ + white-space: -moz-pre-wrap; /* Gecko < 1.9.1 */ + white-space: -o-pre-wrap; /* Opera 7 */ + font-size: 0.9em; +} + +tbody.file pre:empty { + display: block; +} + +.changed { + background-color: lightblue; +} + +.added { + background-color: lightgreen; +} + +.removed { + background-color: #FFCC99; +} + +.num { + background-color: #ffe9ae; + text-align:right; + padding: 0 0.3em; + width: 3em; +} + +.warning { + 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 div { + padding-bottom: 0.4em; +} + +#attachment_attributes label, +#attachment_attributes span.label, +#attachment_actions span.label +{ + font-weight: bold; +} + +#attachment_attributes .block { + display: block; +} + +#smallCommentFrame, #attachment_flags { + 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 diff --git a/skins/standard/create_attachment.css b/skins/standard/create_attachment.css deleted file mode 100644 index 0d8a2b886..000000000 --- a/skins/standard/create_attachment.css +++ /dev/null @@ -1,145 +0,0 @@ - /* The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is the Bugzilla Bug Tracking System. - * - * Contributor(s): Myk Melez - * Joel Peshkin - * Erik Stambaugh - * Marc Schumann - */ - -table.attachment_entry th { - text-align: right; - vertical-align: baseline; - white-space: nowrap; -} - -table.attachment_entry td { - text-align: left; - vertical-align: baseline; - padding-bottom: 5px; -} - -table#flags th, -table#flags td { - text-align: left; - vertical-align: baseline; - font-size: small; -} - -/* Rules used to view patches in diff mode. */ - -.file_head { - font-weight: bold; - font-size: 1em; - background-color: #c3c3c3; - border: 1px solid black; -} - -.file_head a { - text-decoration: none; - font-family: monospace; - font-size: 1.1em; -} - -.file_collapse { - display: none; -} - -.section_head { - background-color: #f0f0f0; - border: 1px solid black; - text-align: left; -} - -table.file_table { - table-layout: fixed; - width: 100%; - empty-cells: show; - border-spacing: 0px; - border-collapse: collapse; - /* draw border below last open context section in listing */ - border-bottom: 1px solid black; -} - -tbody.file pre { - display: inline; - white-space: pre-wrap; /* CSS 3 & CSS 2.1 */ - white-space: -moz-pre-wrap; /* Gecko < 1.9.1 */ - white-space: -o-pre-wrap; /* Opera 7 */ - font-size: 0.9em; -} - -tbody.file pre:empty { - display: block; -} - -.changed { - background-color: lightblue; -} - -.added { - background-color: lightgreen; -} - -.removed { - background-color: #FFCC99; -} - -.num { - background-color: #ffe9ae; - text-align:right; - padding: 0 0.3em; - width: 3em; -} - -.warning { - 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; -} diff --git a/template/en/default/attachment/create.html.tmpl b/template/en/default/attachment/create.html.tmpl index f00a0ade4..f440f4583 100644 --- a/template/en/default/attachment/create.html.tmpl +++ b/template/en/default/attachment/create.html.tmpl @@ -33,7 +33,7 @@ title = title header = header subheader = subheader - style_urls = [ 'skins/standard/create_attachment.css' ] + style_urls = [ 'skins/standard/attachment.css' ] javascript_urls = [ "js/attachment.js", "js/util.js" ] doc_section = "attachments.html" %] diff --git a/template/en/default/attachment/diff-header.html.tmpl b/template/en/default/attachment/diff-header.html.tmpl index 663d9b766..30b8e98e9 100644 --- a/template/en/default/attachment/diff-header.html.tmpl +++ b/template/en/default/attachment/diff-header.html.tmpl @@ -53,11 +53,11 @@ Interdiff of #[% oldid %] and #[% newid %] for [% terms.bug %] #[% bugid %] [% END %] [% PROCESS global/header.html.tmpl doc_section = "attachments.html#patchviewer" javascript_urls = "js/attachment.js" - style_urls = ['skins/standard/create_attachment.css'] %] + style_urls = ['skins/standard/attachment.css'] %] [% ELSE %] - + diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl index fa8a53a4a..5407c0aa2 100644 --- a/template/en/default/attachment/edit.html.tmpl +++ b/template/en/default/attachment/edit.html.tmpl @@ -17,6 +17,7 @@ # # Contributor(s): Myk Melez # Frédéric Buclin + # Guy Pyrzak #%] [% PROCESS global/variables.none.tmpl %] @@ -37,7 +38,8 @@ subheader = subheader doc_section = "attachments.html" 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. %] @@ -54,12 +56,38 @@ [% END %] - - - - - - [% IF !attachment.datasize %] - - [% ELSIF attachment.isurl %] - - [% ELSIF !Param("allow_attachment_display") %] - - [% ELSIF attachment.is_viewable %] - - [% ELSE %] - + + [% END %] + [% IF attachment.flag_types.size > 0 %] +
+ [% PROCESS "flag/list.html.tmpl" bug_id = attachment.bug_id + attach_id = attachment.id + flag_types = attachment.flag_types + read_only_flags = !can_edit + %] +
[% END %] - -
+
+
+
+
+ [% "[patch]" IF attachment.ispatch%] + + [% attachment.description FILTER html %] + + [% IF can_edit %] + (edit) + [% END %] +
+ [% IF NOT attachment.isurl %] +
+ [% attachment.filename FILTER html %] ([% attachment.contenttype FILTER html %]) + [% IF attachment.datasize %] + [%+ attachment.datasize FILTER unitconvert %] + [% ELSE %] + deleted + [% END %], created by [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %] + [% IF attachment.isprivate %] + Only visible to [% Param('insidergroup') FILTER html %] + [% END %] +
+ [% END %] +
+
+ + (hide) +
- +   [% INCLUDE global/textarea.html.tmpl id = 'description' name = 'description' @@ -68,38 +96,34 @@ wrap = 'soft' classes = 'block' _ editable_or_hide defaultcontent = attachment.description - %] - [% IF !can_edit %] - [%+ attachment.description FILTER wrap_comment(25) FILTER html %] - [% END %] + %]
[% IF attachment.isurl %] - - + + [% ELSE %]
- - [% IF !can_edit %] - [%+ attachment.filename FILTER truncate(25) FILTER html %] - [% END %] + value="[% attachment.filename FILTER html %]">
- - [% IF !can_edit %] - [%+ attachment.contenttype FILTER truncate(25) FILTER html %] - [% END %] + value="[% attachment.contenttype FILTER html %]">
- + +
+ Creator: + [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %] +
+
Size: [% IF attachment.datasize %] @@ -109,154 +133,148 @@ [% END %]
-
- Creator: - [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %] -
-
- [% IF can_edit %] - - [% ELSE %] - Is Patch: - [%+ attachment.ispatch ? "yes" : "no" %] - [% END %] +
[% END %] +
+
+
+ + +
-
- - [% IF can_edit %] - - [% ELSE %] - Is Obsolete: - [%+ attachment.isobsolete ? "yes" : "no" %] - [% END %] -
- - [% IF user.is_insider %] -
- - [% IF can_edit %] - - [% ELSE %] - Is Private: - [%+ attachment.isprivate ? "yes" : "no" %] + [% IF user.is_insider %] +
+ + [% IF can_edit %] + + [% ELSE %] + Is Private: + [%+ attachment.isprivate ? "yes" : "no" %] + [% END %] +
[% END %]
- [% END %] +
+
- [% IF attachment.flag_types.size > 0 %] -
- [% PROCESS "flag/list.html.tmpl" bug_id = attachment.bug_id - attach_id = attachment.id - flag_types = attachment.flag_types - read_only_flags = !can_edit - %] +
+ [% IF !attachment.datasize %] +
The content of this attachment has been deleted.
+ [% ELSIF attachment.isurl %] + - [% END %] - - [% IF user.id %] -
- + [% ELSIF !Param("allow_attachment_display") %] +
+

+ The attachment is not viewable in your browser due to security + restrictions enabled by your [% terms.Bugzilla %] administrator. +

+

+ In order to view the attachment, you first have to + download it. +

+
+ [% ELSIF attachment.is_viewable %] +
[% INCLUDE global/textarea.html.tmpl - id = 'comment' + id = 'editFrame' name = 'comment' - minrows = 5 - cols = 25 + classes = 'bz_default_hidden' + minrows = 10 + cols = 80 wrap = 'soft' - classes = 'block' + defaultcontent = (attachment.contenttype.match('^text\/')) ? + attachment.data.replace('(.*\n|.+)', '>$1') : undef %] + + +
+ [% ELSE %] +
+

+ Attachment is not viewable in your browser because its MIME type + ([% attachment.contenttype FILTER html %]) is not one that your browser is + able to display. +

+

+ Download the attachment. +

- -

[% END %] -
The content of this attachment has been deleted. - - [% IF attachment.datasize < 120 %] - [% attachment.data FILTER html %] - [% ELSE %] - [% attachment.data FILTER truncate(80) FILTER html %] -  ... - [% attachment.data.match(".*(.{20})$").0 FILTER html %] - [% END %] - - -

- The attachment is not viewable in your browser due to security - restrictions enabled by [% terms.Bugzilla %]. -

-

- In order to view the attachment, you first have to - download it. -

-
+ +
+ [% IF user.id %] +
+ + [% classNames = 'block' %] + [% classNames = "$classes bz_private" IF attachment.isprivate %] [% INCLUDE global/textarea.html.tmpl - id = 'editFrame' + id = 'comment' name = 'comment' - style = 'height: 400px; width: 100%; display: none' minrows = 10 cols = 80 wrap = 'soft' - defaultcontent = (attachment.contenttype.match('^text\/')) ? - attachment.data.replace('(.*\n|.+)', '>$1') : undef + classes = classNames %] - - -
-

- Attachment is not viewable in your browser because its MIME type - ([% attachment.contenttype FILTER html %]) is not one that your browser is - able to display. -

-

- Download the attachment. -

-
+ [% IF user.id %] +
+ +
+ [% END %] + + +
@@ -283,7 +301,14 @@ [% " |" UNLESS loop.last() %] [% END %]
- +[% IF can_edit %] + +[% END %] [% Hook.process('end') %] [% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/attachment/show-multiple.html.tmpl b/template/en/default/attachment/show-multiple.html.tmpl index bcc297713..15e20e894 100644 --- a/template/en/default/attachment/show-multiple.html.tmpl +++ b/template/en/default/attachment/show-multiple.html.tmpl @@ -31,7 +31,7 @@ title = title header = header subheader = filtered_summary - style_urls = ['skins/standard/create_attachment.css'] + style_urls = ['skins/standard/attachment.css'] %]
diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index fe5f130d8..a5bfb0739 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -31,7 +31,7 @@ [% PROCESS global/header.html.tmpl title = title style_urls = [ 'skins/standard/yui/autocomplete.css', - 'skins/standard/create_attachment.css', + 'skins/standard/attachment.css', 'skins/standard/yui/calendar.css' ] javascript_urls = [ "js/yui/bz_autocomplete_bundle.js", "js/attachment.js", "js/util.js", "js/yui/calendar.js", -- cgit v1.2.3-24-g4f1b