]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 414509: offer View All (non obsolete) attachments
authorGuy Pyrzak <guy.pyrzak@gmail.com>
Sat, 2 Oct 2010 23:50:02 +0000 (16:50 -0700)
committerGuy Pyrzak <guy.pyrzak@gmail.com>
Sat, 2 Oct 2010 23:50:02 +0000 (16:50 -0700)
r=LpSolit, a=LpSolit

attachment.cgi
skins/standard/attachment.css
template/en/default/attachment/list.html.tmpl
template/en/default/attachment/show-multiple.html.tmpl

index 8117131b37a5943a668c48073e993d86c633f54f..8f8004b071abf891c8f9bfb2845bf07f5cf5895b 100755 (executable)
@@ -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;
index dbf136730c1965c87a7f43e338776d9e613eb250..c05cfe2dacebf712f25a606d4bb8c058f91fef62 100644 (file)
@@ -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
index 33d9a6c044fbb868f8a4d8f45b27b676e8e19075..4ad5e528af1914bf57d80aab2696bff4ba987d52 100644 (file)
@@ -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 %]&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 %]
         </span>
       [% END %]
index 15e20e894c5ff4d9a015ad784b65c644aa23f719..e238e5f49a24dc061f952c9806ee098b86e9a63f 100644 (file)
   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 %]&amp;action=viewall">click here</a>.
+  </div>
+[% END %]
 <br>
 
 [% FOREACH a = attachments %]