Add IMP_UI_Message::returnToMailbox().
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 14 Oct 2009 16:09:02 +0000 (10:09 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 14 Oct 2009 18:01:47 +0000 (12:01 -0600)
imp/lib/UI/Message.php
imp/message.php

index fd7344e..a4a19e0 100644 (file)
@@ -453,4 +453,16 @@ class IMP_UI_Message
         return Horde_Text_Filter::filter(IMP::filterText($subject), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null, 'callback' => null));
     }
 
+    /**
+     * Redirect to mailbox after deleting a message?
+     *
+     * @return boolean  Return to mailbox?
+     */
+    public function moveAfterAction()
+    {
+        return (($_SESSION['imp']['protocol'] != 'pop') &&
+                !IMP::hideDeletedMsgs($GLOBALS['imp_mbox']['mailbox']) &&
+                !$GLOBALS['prefs']->getValue('use_trash'));
+    }
+
 }
index a963908..38572e3 100644 (file)
@@ -19,12 +19,6 @@ function _returnToMailbox($startIndex = null, $actID = null)
     $GLOBALS['start'] = $startIndex;
 }
 
-function _moveAfterAction()
-{
-    return (($_SESSION['imp']['protocol'] != 'pop') &&
-            !IMP::hideDeletedMsgs($GLOBALS['imp_mbox']['mailbox']) &&
-            !$GLOBALS['prefs']->getValue('use_trash'));
-}
 
 require_once dirname(__FILE__) . '/lib/Application.php';
 new IMP_Application(array('init' => true));
@@ -78,6 +72,7 @@ $mailbox_name = $index_array['mailbox'];
 $indices_array = array($mailbox_name => array($index));
 
 $imp_flags = IMP_Imap_Flags::singleton();
+$imp_ui = new IMP_UI_Message();
 
 switch ($actionID) {
 case 'blacklist':
@@ -101,7 +96,7 @@ case 'undelete_message':
             require IMP_BASE . '/mailbox.php';
             exit;
         }
-        if (_moveAfterAction()) {
+        if ($imp_ui->moveAfterAction()) {
             $imp_mailbox->setIndex(1, 'offset');
         }
     }
@@ -130,7 +125,7 @@ case 'notspam_report':
     $action = str_replace('_report', '', $actionID);
     switch (IMP_Spam::reportSpam($indices_array, $action)) {
     case 1:
-        if (_moveAfterAction()) {
+        if ($imp_ui->moveAfterAction()) {
             $imp_mailbox->setIndex(1, 'offset');
         }
         break;
@@ -232,9 +227,6 @@ $msgindex = $imp_mailbox->getMessageIndex();
 $message_url = Horde::applicationUrl('message.php');
 $self_link = Horde_Util::addParameter(IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $index, $mailbox_name), array('start' => $msgindex, 'message_token' => $message_token));
 
-/* Create the IMP_UI_Message:: object. */
-$imp_ui = new IMP_UI_Message();
-
 /* Develop the list of headers to display. */
 $basic_headers = $imp_ui->basicHeaders();
 $display_headers = $msgAddresses = array();