Commit c465a2a3 authored by Guy Pyrzak's avatar Guy Pyrzak

Bug 414509: offer View All (non obsolete) attachments

r=LpSolit, a=LpSolit
parent 45071f40
...@@ -381,6 +381,11 @@ sub viewall { ...@@ -381,6 +381,11 @@ sub viewall {
# Ignore deleted attachments. # Ignore deleted attachments.
@$attachments = grep { $_->datasize } @$attachments; @$attachments = grep { $_->datasize } @$attachments;
if ($cgi->param('hide_obsolete')) {
@$attachments = grep { !$_->isobsolete } @$attachments;
$vars->{'hide_obsolete'} = 1;
}
# Define the variables and functions that will be passed to the UI template. # Define the variables and functions that will be passed to the UI template.
$vars->{'bug'} = $bug; $vars->{'bug'} = $bug;
$vars->{'attachments'} = $attachments; $vars->{'attachments'} = $attachments;
......
...@@ -239,4 +239,11 @@ div#update_container { ...@@ -239,4 +239,11 @@ div#update_container {
.no_javascript .bz_hide, .no_javascript .bz_edit { .no_javascript .bz_hide, .no_javascript .bz_edit {
display: none; display: none;
}
#hidden_obsolete_message {
text-align: left;
width: 75%;
margin: 0 auto;
font-weight: bold
} }
\ No newline at end of file
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
<!-- <!--
function toggle_display(link) { function toggle_display(link) {
var table = document.getElementById("attachment_table"); var table = document.getElementById("attachment_table");
var view_all = document.getElementById("view_all");
var hide_obsolete_url_parameter = "&hide_obsolete=1";
// Store current height for scrolling later // Store current height for scrolling later
var originalHeight = table.offsetHeight; var originalHeight = table.offsetHeight;
var rows = YAHOO.util.Dom.getElementsByClassName( var rows = YAHOO.util.Dom.getElementsByClassName(
...@@ -36,9 +38,11 @@ function toggle_display(link) { ...@@ -36,9 +38,11 @@ function toggle_display(link) {
if (YAHOO.util.Dom.hasClass(rows[0], 'bz_default_hidden')) { if (YAHOO.util.Dom.hasClass(rows[0], 'bz_default_hidden')) {
link.innerHTML = "Show Obsolete"; link.innerHTML = "Show Obsolete";
view_all.href = view_all.href + hide_obsolete_url_parameter
} }
else { else {
link.innerHTML = "Hide Obsolete"; link.innerHTML = "Hide Obsolete";
view_all.href = view_all.href.replace(hide_obsolete_url_parameter,"");
} }
var newHeight = table.offsetHeight; var newHeight = table.offsetHeight;
...@@ -150,7 +154,9 @@ function toggle_display(link) { ...@@ -150,7 +154,9 @@ function toggle_display(link) {
Obsolete</a> ([% obsolete_attachments %]) Obsolete</a> ([% obsolete_attachments %])
[% END %] [% END %]
[% IF Param("allow_attachment_display") %] [% IF Param("allow_attachment_display") %]
<a href="attachment.cgi?bugid=[% bugid %]&amp;action=viewall">View All</a> <a id="view_all" href="attachment.cgi?bugid=
[%- bugid %]&amp;action=viewall
[%- "&amp;hide_obsolete=1" IF obsolete_attachments %]">View All</a>
[% END %] [% END %]
</span> </span>
[% END %] [% END %]
......
...@@ -33,7 +33,12 @@ ...@@ -33,7 +33,12 @@
subheader = filtered_summary subheader = filtered_summary
style_urls = ['skins/standard/attachment.css'] style_urls = ['skins/standard/attachment.css']
%] %]
[% IF hide_obsolete %]
<div id="hidden_obsolete_message">
Obsolete attachments are hidden. To view all attachments (including obsolete)
<a href="attachment.cgi?bugid=[% bug.id FILTER html %]&amp;action=viewall">click here</a>.
</div>
[% END %]
<br> <br>
[% FOREACH a = attachments %] [% FOREACH a = attachments %]
......
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