Remove DIMP.conf.msg_index and msg_folder vars
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 26 Jun 2009 22:28:42 +0000 (16:28 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 26 Jun 2009 22:28:42 +0000 (16:28 -0600)
imp/ajax.php
imp/js/src/DimpBase.js
imp/js/src/DimpCore.js
imp/js/src/fullmessage-dimp.js
imp/lib/Views/ShowMessage.php
imp/lib/base.php
imp/message-dimp.php

index dfaed6e..2ac83a8 100644 (file)
@@ -475,8 +475,8 @@ case 'ShowPreview':
 
     $ptr = each($indices);
     $args = array(
-        'folder' => $ptr['key'],
         'index' => intval(reset($ptr['value'])),
+        'mailbox' => $ptr['key'],
         'preview' => true,
     );
 
@@ -541,6 +541,7 @@ case 'DeleteDraft':
         $idx_array = array($imp_compose->getMetadata('draft_index') . IMP::IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true));
         $imp_message->delete($idx_array, array('nuke' => true));
     }
+    $result = true;
     break;
 
 case 'DeleteAttach':
index 5cde799..bcdd47d 100644 (file)
@@ -962,7 +962,7 @@ var DimpBase = {
             t = $('msgHeadersContent').down('THEAD');
 
         if (!r.error) {
-            search = this.viewport.getSelection().search({ imapuid: { equal: [ r.index ] }, view: { equal: [ r.folder ] } });
+            search = this.viewport.getSelection().search({ imapuid: { equal: [ r.index ] }, view: { equal: [ r.mailbox ] } });
             if (search.size()) {
                 row = search.get('dataob').first();
                 this.updateSeenUID(row, 1);
@@ -971,7 +971,7 @@ var DimpBase = {
 
         if (this.pp &&
             (this.pp.imapuid != r.index ||
-             this.pp.view != r.folder)) {
+             this.pp.view != r.mailbox)) {
             return;
         }
 
@@ -984,16 +984,13 @@ var DimpBase = {
         }
 
         // Store in cache.
-        ppuid = this._getPPId(r.index, r.folder);
+        ppuid = this._getPPId(r.index, r.mailbox);
         this._expirePPCache([ ppuid ]);
         this.ppcache[ppuid] = resp;
         this.ppfifo.push(ppuid);
 
         DimpCore.removeAddressLinks(pm);
 
-        DIMP.conf.msg_index = r.index;
-        DIMP.conf.msg_folder = r.folder;
-
         // Add subject
         tmp = pm.select('.subject');
         tmp.invoke('update', r.subject === null ? '[' + DIMP.text.badsubject + ']' : r.subject);
@@ -1625,10 +1622,14 @@ var DimpBase = {
 
             case 'msg_newwin':
             case 'msg_newwin_options':
-                this.msgWindow(this.viewport.getSelection().search({ imapuid: { equal: [ DIMP.conf.msg_index ] } , view: { equal: [ DIMP.conf.msg_folder ] } }).get('dataob').first());
+                this.msgWindow(this.viewport.getSelection().search({ imapuid: { equal: [ this.pp.imapuid ] } , view: { equal: [ this.pp.view ] } }).get('dataob').first());
                 e.stop();
                 return;
 
+            case 'msg_view_source':
+                DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { uid: this.pp.imapuid, mailbox: this.pp.view, actionID: 'view_source', id: 0 }, true), DIMP.conf.msg_index + '|' + DIMP.conf.msg_folder);
+                break;
+
             case 'applicationfolders':
                 tmp = e.element();
                 if (!tmp.hasClassName('custom')) {
index c781f76..f63c3cf 100644 (file)
@@ -404,10 +404,6 @@ var DimpCore = {
                 window.print();
                 break;
 
-            case 'msg_view_source':
-                this.popupWindow(this.addURLParam(DIMP.conf.URI_VIEW, { uid: DIMP.conf.msg_index, mailbox: DIMP.conf.msg_folder, actionID: 'view_source', id: 0 }, true), DIMP.conf.msg_index + '|' + DIMP.conf.msg_folder);
-                break;
-
             case 'alertsloglink':
                 $('alertsloglink').down('A').update(this.Growler.toggleLog() ? DIMP.text.hidealog : DIMP.text.showalog);
                 break;
index a6a516e..9d7956c 100644 (file)
@@ -7,10 +7,12 @@
 
 var DimpFullmessage = {
 
+    // Variables defaulting to empty/false:
+    //  index, mailbox
     quickreply: function(type)
     {
         var func, ob = {};
-        ob[$F('folder')] = [ $F('index') ];
+        ob[this.mailbox] = [ this.index ];
 
         $('msgData').hide();
         $('qreply').show();
@@ -92,14 +94,18 @@ var DimpFullmessage = {
             case 'button_ham':
             case 'button_spam':
                 if (id == 'button_deleted') {
-                    DIMP.baseWindow.DimpBase.deleteMsg({ index: DIMP.conf.msg_index, mailbox: DIMP.conf.msg_folder });
+                    DIMP.baseWindow.DimpBase.deleteMsg({ index: this.index, mailbox: this.mailbox });
                 } else {
-                    DIMP.baseWindow.DimpBase.reportSpam(id == 'button_spam', { index: DIMP.conf.msg_index, mailbox: DIMP.conf.msg_folder });
+                    DIMP.baseWindow.DimpBase.reportSpam(id == 'button_spam', { index: this.index, mailbox: this.mailbox });
                 }
                 window.close();
                 e.stop();
                 return;
 
+            case 'msg_view_source':
+                DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { uid: this.index, mailbox: this.mailbox, actionID: 'view_source', id: 0 }, true), DIMP.conf.msg_index + '|' + DIMP.conf.msg_folder);
+                break;
+
             case 'qreply':
                 if (orig.match('DIV.headercloseimg IMG')) {
                     DimpCompose.confirmCancel();
index 11e7eb4..93d3eb0 100644 (file)
@@ -52,8 +52,8 @@ class IMP_Views_ShowMessage
      * <pre>
      * 'headers' - The headers desired in the returned headers array (only used
      *             with non-preview view)
-     * 'folder' - The folder name
-     * 'index' - The folder index
+     * 'index' - The UID of the message
+     * 'mailbox' - The mailbox name
      * 'preview' - Is this the preview view?
      * </pre>
      *
@@ -67,9 +67,9 @@ class IMP_Views_ShowMessage
      * 'error' - Contains an error message (only on error)
      * 'errortype' - Contains the error type (only on error)
      * 'from' - The From addresses
-     * 'folder' - The IMAP folder
      * 'index' - The IMAP UID
      * 'log' - Log information
+     * 'mailbox' - The IMAP mailbox
      * 'msgtext' - The text of the message
      * 'to' - The To addresses
      *
@@ -91,13 +91,13 @@ class IMP_Views_ShowMessage
     public function showMessage($args)
     {
         $preview = !empty($args['preview']);
-        $mailbox = $args['folder'];
+        $mailbox = $args['mailbox'];
         $index = $args['index'];
         $error_msg = _("Requested message not found.");
 
         $result = array(
-            'folder' => $mailbox,
-            'index' => $index
+            'index' => $index,
+            'mailbox' => $mailbox
         );
 
         /* Set the current time zone. */
index 6d51b6e..8f626a3 100644 (file)
@@ -99,7 +99,7 @@ $viewmode = isset($_SESSION['imp']['view'])
 
 $authentication = Horde_Util::nonInputVar('authentication', 0);
 if ($authentication !== 'none') {
-    // If we've gotten to this point and have valid login credentials
+    // If we've reached this point and have valid login credentials
     // but don't actually have an IMP session, then we need to go
     // through redirect.php to ensure that everything gets set up
     // properly. Single-signon and transparent authentication setups
@@ -129,6 +129,7 @@ if ($authentication !== 'none') {
             case 'json':
                 $GLOBALS['notification']->push(null, 'dimp.timeout');
                 Horde::sendHTTPResponse(Horde::prepareResponse(), 'json');
+                // Fall through
 
             case 'none':
                 exit;
@@ -144,9 +145,7 @@ if ($authentication !== 'none') {
     /* Some stuff that only needs to be initialized if we are
      * authenticated. */
     // Initialize some message parsing variables.
-    if (!empty($GLOBALS['conf']['mailformat']['brokenrfc2231'])) {
-        Horde_Mime::$brokenRFC2231 = true;
-    }
+    Horde_Mime::$brokenRFC2231 = !empty($GLOBALS['conf']['mailformat']['brokenrfc2231']);
 
     // Set default message character set, if necessary
     if ($def_charset = $GLOBALS['prefs']->getValue('default_msg_charset')) {
index 7548a0f..2106951 100644 (file)
@@ -23,8 +23,8 @@ $readonly = $imp_imap->isReadOnly($folder);
 
 $args = array(
     'headers' => array_diff(array_keys($imp_ui->basicHeaders()), array('subject')),
-    'folder' => $folder,
     'index' => $index,
+    'mailbox' => $folder,
     'preview' => false,
 );
 
@@ -44,12 +44,8 @@ $scripts = array(
     array('imp.js', 'imp', true)
 );
 
-$js_out = array(
-    'DIMP.conf.msg_index = "' . $show_msg_result['index'] . '"',
-    'DIMP.conf.msg_folder = "' . $show_msg_result['folder'] . '"'
-);
-
-foreach (array('from', 'to', 'cc', 'bcc', 'replyTo', 'log') as $val) {
+$js_out = array();
+foreach (array('from', 'to', 'cc', 'bcc', 'replyTo', 'log', 'index', 'mailbox') as $val) {
     if (!empty($show_msg_result[$val])) {
         $js_out[] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], Horde_Serialize::JSON);
     }