diff options
-rwxr-xr-x | attachment.cgi | 5 | ||||
-rw-r--r-- | skins/standard/attachment.css | 7 | ||||
-rw-r--r-- | template/en/default/attachment/list.html.tmpl | 8 | ||||
-rw-r--r-- | template/en/default/attachment/show-multiple.html.tmpl | 7 |
4 files changed, 25 insertions, 2 deletions
diff --git a/attachment.cgi b/attachment.cgi index 8117131b3..8f8004b07 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -381,6 +381,11 @@ sub viewall { # Ignore deleted 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. $vars->{'bug'} = $bug; $vars->{'attachments'} = $attachments; diff --git a/skins/standard/attachment.css b/skins/standard/attachment.css index dbf136730..c05cfe2da 100644 --- a/skins/standard/attachment.css +++ b/skins/standard/attachment.css @@ -239,4 +239,11 @@ div#update_container { .no_javascript .bz_hide, .no_javascript .bz_edit { display: none; +} + +#hidden_obsolete_message { + text-align: left; + width: 75%; + margin: 0 auto; + font-weight: bold }
\ No newline at end of file diff --git a/template/en/default/attachment/list.html.tmpl b/template/en/default/attachment/list.html.tmpl index 33d9a6c04..4ad5e528a 100644 --- a/template/en/default/attachment/list.html.tmpl +++ b/template/en/default/attachment/list.html.tmpl @@ -25,6 +25,8 @@ <!-- function toggle_display(link) { 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 var originalHeight = table.offsetHeight; var rows = YAHOO.util.Dom.getElementsByClassName( @@ -36,9 +38,11 @@ function toggle_display(link) { if (YAHOO.util.Dom.hasClass(rows[0], 'bz_default_hidden')) { link.innerHTML = "Show Obsolete"; + view_all.href = view_all.href + hide_obsolete_url_parameter } else { link.innerHTML = "Hide Obsolete"; + view_all.href = view_all.href.replace(hide_obsolete_url_parameter,""); } var newHeight = table.offsetHeight; @@ -150,7 +154,9 @@ function toggle_display(link) { Obsolete</a> ([% obsolete_attachments %]) [% END %] [% IF Param("allow_attachment_display") %] - <a href="attachment.cgi?bugid=[% bugid %]&action=viewall">View All</a> + <a id="view_all" href="attachment.cgi?bugid= + [%- bugid %]&action=viewall + [%- "&hide_obsolete=1" IF obsolete_attachments %]">View All</a> [% END %] </span> [% END %] diff --git a/template/en/default/attachment/show-multiple.html.tmpl b/template/en/default/attachment/show-multiple.html.tmpl index 15e20e894..e238e5f49 100644 --- a/template/en/default/attachment/show-multiple.html.tmpl +++ b/template/en/default/attachment/show-multiple.html.tmpl @@ -33,7 +33,12 @@ subheader = filtered_summary 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 %]&action=viewall">click here</a>. + </div> +[% END %] <br> [% FOREACH a = attachments %] |