[dev] imp "empty trash" modifications

Marcus I. Ryan marcus@riboflavin.net
Wed, 27 Mar 2002 13:48:34 -0600


If use_trash is set, this adds an icon to the IMP menu for emptying the
trash (with cofirmation).  It also makes the Hide Deleted | Purge
Deleted disappear in the mailbox view.  It maintains the "Empty Trash
folder" view if you are in your trash folder.  Since they are now
mutually exclusive I removed the seperating pipe.  NOTE: I got the
trashcan icon from Chuck (empty_trash.gif).

Only in imp/graphics: empty_trash.gif
diff -ru imp.orig/templates/mailbox/actions.inc
imp/templates/mailbox/actions.inc
--- imp.orig/templates/mailbox/actions.inc      Wed Mar 27 09:05:41 2002
+++ imp/templates/mailbox/actions.inc   Wed Mar 27 13:44:09 2002
@@ -17,7 +17,7 @@
     <?php endif; ?>
     </td>
     <td align="right">
-    <?php if (strstr($imp['protocol'], 'imap')): ?>
+    <?php if (strstr($imp['protocol'], 'imap') &&
!$prefs->getValue('use_trash')): ?>
         <a class="widget" href="<?= Horde::purl('mailbox.php?actionID='
. HIDE_DELETED . "&page=$page") ?>"
          onmouseover="status='<?= addslashes($deleted_prompt) ?>';
return true;"
          onmouseout="status='';"><?= $deleted_prompt ?></a> |
@@ -25,7 +25,7 @@
          onmouseover="status='<?= addslashes(_("Purge Deleted")) ?>';
return true;"
          onmouseout="status='';"><?= _("Purge Deleted") ?></a>
     <?php endif; ?>
-    <?php if ($prefs->getValue('use_trash') && $imp['mailbox'] ==
IMP::preambleString() . $prefs->getValue('trash_folder')): ?> |
+    <?php if ($prefs->getValue('use_trash') && $imp['mailbox'] ==
IMP::preambleString() . $prefs->getValue('trash_folder')): ?>
         <a class="widget" href="<?= Horde::url('mailbox.php?actionID='
. EMPTY_MAILBOX . "&uniq=" . uniqid(rand())) ?>"
          onmouseover="status='<?= addslashes(_("Empty Trash folder"))
?>'; return true;"
          onmouseout="status='';"
diff -ru imp.orig/templates/menu/menu.inc imp/templates/menu/menu.inc
--- imp.orig/templates/menu/menu.inc    Wed Mar 27 09:05:41 2002
+++ imp/templates/menu/menu.inc Wed Mar 27 13:42:48 2002
@@ -14,6 +14,9 @@

 /* IMP menu items */
 Menu::printItem(Horde::applicationUrl('mailbox.php?mailbox=INBOX'),
_("INBOX"), 'folders/inbox.gif');
+if ($prefs->getValue('use_trash') && $prefs->getValue('trash_folder')
!== null) {
+    Menu::printItem(Horde::applicationUrl('mailbox.php?mailbox=' .
IMP::preambleString() . $prefs->getValue('trash_folder')) . "&actionID="
. EMPTY_MAILBOX . "&uniq=" . uniqid(rand()), addslashes(_("Empty
Trash")), 'empty_trash.gif', NULL, NULL, "if (!confirm('" .
addslashes(_("Are you sure you wish to empty this folder?")) . "'))
return false;");
+}
 Menu::printItem(IMP::composeLink(), _("Compose"), 'compose.gif');
 if ($conf['user']['allow_folders']) {
     Menu::printItem(Horde::applicationUrl('folders.php'), _("Folders"),
'folders.gif');


-- 
Marcus I. Ryan, marcus@riboflavin.net
-----------------------------------------------------------------------
 "Love is a snowmobile racing across the tundra and then suddenly it
 flips over, pinning you underneath.  At night, the ice weasels come."
                 -- Matt Groening
-----------------------------------------------------------------------