kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-09-16 03:05 am

[dw-free] "Mark All Read" and "Delete All" buttons at the top of the Inbox

[commit: http://hg.dwscoalition.org/dw-free/rev/c9f18e63558a]

http://bugs.dwscoalition.org/show_bug.cgi?id=1753

Displays action buttons at the top of the inbox as well as the bottom.

Patch by [personal profile] wyntarvox.

Files modified:
  • cgi-bin/LJ/Widget/InboxFolder.pm
  • htdocs/js/esn_inbox.js
--------------------------------------------------------------------------------
diff -r bd0316c164e9 -r c9f18e63558a cgi-bin/LJ/Widget/InboxFolder.pm
--- a/cgi-bin/LJ/Widget/InboxFolder.pm	Tue Sep 15 21:53:59 2009 -0500
+++ b/cgi-bin/LJ/Widget/InboxFolder.pm	Tue Sep 15 22:04:45 2009 -0500
@@ -95,11 +95,25 @@ sub render_body {
             </tr>
         };
     };
+
+    my $markdeleteall = sub {
+        my $sfx = shift;
+
+        return qq {
+            <div style="text-align: center; margin-bottom: 20px; margin-top: 20px;">
+                <input type="submit" name="markAllRead_$sfx" value="<?_ml widget.inbox.menu.mark_all_read.btn _ml?>" $disabled id="${name}_MarkAllRead_$sfx" style="margin-right: 5em; width: 12em;" />
+                <input type="submit" name="deleteAll_$sfx" value="<?_ml widget.inbox.menu.delete_all.btn _ml?>" $disabled id="${name}_DeleteAll_$sfx" style="width: 12em;" />
+            </div>
+        };
+    };
+
     # create table of messages
-    my $messagetable = qq {
-     <div id="${name}_Table" class="NotificationTable">
+    my $messagetable = $markdeleteall->(1);
+
+    $messagetable .= qq {
+        <div id="${name}_Table" class="NotificationTable">
         <table id="${name}" class="inbox" cellspacing="0" border="0" cellpadding="0">
-        };
+    };
     $messagetable .= $actionsrow->(1);
     $messagetable .= "<tbody id='${name}_Body'>";
 
@@ -197,12 +211,7 @@ sub render_body {
 
     $messagetable .= '</tbody></table></div>';
 
-    $messagetable .= qq {
-      <div style="text-align: center; margin-top: 20px;">
-        <input type="submit" name="markAllRead" value="<?_ml widget.inbox.menu.mark_all_read.btn _ml?>" $disabled id="${name}_MarkAllRead" style="margin-right: 5em; width: 12em;" />
-        <input type="submit" name="deleteAll" value="<?_ml widget.inbox.menu.delete_all.btn _ml?>" $disabled id="${name}_DeleteAll" style="width: 12em;" />
-     </div>
-    };
+    $messagetable .= $markdeleteall->(2);
 
     $msgs_body .= $messagetable;
 
diff -r bd0316c164e9 -r c9f18e63558a htdocs/js/esn_inbox.js
--- a/htdocs/js/esn_inbox.js	Tue Sep 15 21:53:59 2009 -0500
+++ b/htdocs/js/esn_inbox.js	Tue Sep 15 22:04:45 2009 -0500
@@ -163,9 +163,12 @@ ESN_Inbox.initInboxBtns = function (fold
         DOM.addEventListener($(folder + "_MarkUnread_" + i), "click", function(e) { ESN_Inbox.markUnread(e, folder) });
         DOM.addEventListener($(folder + "_Delete_" + i), "click", function(e) { ESN_Inbox.deleteItems(e, folder) });
     }
-    
-    DOM.addEventListener($(folder + "_MarkAllRead"), "click", function(e) { ESN_Inbox.markAllRead(e, folder, cur_folder) });
-    DOM.addEventListener($(folder + "_DeleteAll"), "click", function(e) { ESN_Inbox.deleteAll(e, folder, cur_folder) });
+
+    // 2 instances of mark all and delete all buttons
+    for (var i=1; i<=2; i++) {
+        DOM.addEventListener($(folder + "_MarkAllRead_" + i), "click", function(e) { ESN_Inbox.markAllRead(e, folder, cur_folder) });
+        DOM.addEventListener($(folder + "_DeleteAll_" + i), "click", function(e) { ESN_Inbox.deleteAll(e, folder, cur_folder) });
+    }
 };
 
 // set up action links
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org