First batch of DIMP/IMP fixes.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 1 Dec 2008 06:58:25 +0000 (23:58 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 1 Dec 2008 22:28:05 +0000 (15:28 -0700)
imp/compose-dimp.php
imp/compose.php
imp/imp-dimp.php
imp/index-dimp.php
imp/lib/UI/Compose.php
imp/lib/Views/Compose.php
imp/lib/Views/ListMessages.php
imp/lib/Views/ShowMessage.php
imp/message-dimp.php

index bcd6741..236cc5a 100644 (file)
@@ -7,8 +7,6 @@
  *             opened from a page other than the base DIMP page.
  *   TODO
  *
- * $Horde: dimp/compose.php,v 1.118 2008/08/05 05:48:48 slusarz Exp $
- *
  * Copyright 2005-2008 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -23,16 +21,12 @@ function _removeAutoSaveDraft($index)
     if (empty($index)) {
         return;
     }
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     $idx_array = array($index . IMP_IDX_SEP . IMP::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true));
     $imp_message->delete($idx_array, true);
 }
 
-$load_imp = true;
-@define('DIMP_BASE', dirname(__FILE__));
-require_once DIMP_BASE . '/lib/base.php';
-require_once 'Horde/Identity.php';
+require_once dirname(__FILE__) . '/lib/base.php';
 
 /* The headers of the message. */
 $header = array();
@@ -44,6 +38,7 @@ $action = Util::getFormData('action');
 $get_sig = true;
 $msg = '';
 
+require_once 'Horde/Identity.php';
 $identity = &Identity::singleton(array('imp', 'imp'));
 if (!$prefs->isLocked('default_identity')) {
     $identity_id = Util::getFormData('identity');
@@ -56,11 +51,9 @@ if (!$prefs->isLocked('default_identity')) {
 NLS::setTimeZone();
 
 /* Initialize the IMP_Compose:: object. */
-require_once IMP_BASE . '/lib/Compose.php';
 $imp_compose = &IMP_Compose::singleton(Util::getFormData('composeCache'));
 
 /* Init IMP_UI_Compose:: object. */
-require_once IMP_BASE . '/lib/UI/Compose.php';
 $imp_ui = new IMP_UI_Compose();
 
 if (count($_POST)) {
@@ -75,7 +68,7 @@ if (count($_POST)) {
             $info = DIMP::getAttachmentInfo($imp_compose);
             $result->success = true;
             $result->info = end($info);
-            $result->imp_compose = $imp_compose->getMessageCacheId();
+            $result->imp_compose = $imp_compose->getCacheId();
         }
         IMP::sendHTTPResponse(DIMP::prepareResponse($result, true, false), 'js-json');
         exit;
@@ -144,14 +137,9 @@ if (count($_POST)) {
 
         /* Use IMP_Tree to determine whether the sent mail folder was
          * created. */
-        require_once IMP_BASE . '/lib/IMAP/Tree.php';
-        $imptree = &IMP_Tree::singleton();
+        $imptree = &IMP_IMAP_Tree::singleton();
         $imptree->eltDiffStart();
 
-        /* Create the DIMP User-Agent string. */
-        require_once DIMP_BASE . '/lib/version.php';
-        $useragent = 'Dynamic Internet Messaging Program (DIMP) ' . DIMP_VERSION;
-
         $options = array(
             'save_sent' => (($prefs->isLocked('save_sent_mail'))
                             ? $identity->getValue('save_sent_mail')
@@ -160,8 +148,7 @@ if (count($_POST)) {
             'save_attachments' => Util::getFormData('save_attachments_select'),
             'reply_type' => $result->reply_type,
             'reply_index' => $result->index . IMP_IDX_SEP . $result->reply_folder,
-            'readreceipt' => Util::getFormData('request_read_receipt'),
-            'useragent' => $useragent
+            'readreceipt' => Util::getFormData('request_read_receipt')
         );
         $sent = $imp_compose->buildAndSendMessage($message, $header, $charset, $html, $options);
 
@@ -193,8 +180,7 @@ if (count($_POST)) {
 }
 
 /* Attach spellchecker & auto completer. */
-require_once DIMP_BASE . '/lib/Dimple.php';
-$imp_ui->attachAutoCompleter('Dimple', array('to', 'cc', 'bcc'));
+$imp_ui->attachAutoCompleter(array('to', 'cc', 'bcc'));
 $imp_ui->attachSpellChecker('dimp');
 
 $type = Util::getFormData('type');
@@ -208,7 +194,6 @@ if (in_array($type, array('reply', 'reply_all', 'reply_list', 'forward_all', 'fo
         $type = 'new';
     }
 
-    require_once IMP_BASE . '/lib/MIME/Contents.php';
     $imp_contents = &IMP_Contents::singleton($index . IMP_IDX_SEP . $folder);
     if (is_a($imp_contents, 'PEAR_Error')) {
         $notification->push(_("Requested message not found."), 'horde.error');
@@ -310,13 +295,12 @@ $args = array(
     'qreply' => false,
 );
 
-require_once IMP_BASE . '/lib/Template.php';
-$t = new IMP_Template(DIMP_TEMPLATES . '/imp/');
+$t = new IMP_Template(IMP_TEMPLATES . '/imp/');
 $t->setOption('gettext', true);
 $t->set('title', $title);
 $t->set('closelink', Horde::img('close.png', 'X', array('id' => 'compose_close'), $registry->getImageDir('horde')));
 
-$compose_result = DIMP_Views_Compose::showCompose($args);
+$compose_result = IMP_Views_Compose::showCompose($args);
 $t->set('compose_html', $compose_result['html']);
 
 /* Javscript variables to be set immediately. */
@@ -331,7 +315,6 @@ IMP::addInlineScript($compose_result['js']);
 IMP::addInlineScript(array(DIMP::notify()), 'dom');
 
 /* Javascript to be run on window load. */
-require_once 'Horde/Serialize.php';
 $compose_result['js_onload'][] = 'DimpCompose.fillForm(' . Horde_Serialize::serialize($msg, SERIALIZE_JSON) . ', ' . Horde_Serialize::serialize($header, SERIALIZE_JSON) . ', "' . (($type == 'new' || $type == 'forward') ? 'to' : 'message') . '", true)';
 IMP::addInlineScript($compose_result['js_onload'], 'load');
 
index c71bdf8..60ca2ed 100644 (file)
@@ -618,7 +618,7 @@ $redirect = in_array($actionID, array('redirect_compose', 'redirect_expand_addr'
 $spellcheck = false;
 if ($has_js) {
     if ($redirect) {
-        $imp_ui->attachAutoCompleter('IMP_Imple', array('to'));
+        $imp_ui->attachAutoCompleter(array('to'));
     } else {
         $auto_complete = array('to');
         foreach (array('cc', 'bcc') as $val) {
@@ -626,7 +626,7 @@ if ($has_js) {
                 $auto_complete[] = $val;
             }
         }
-        $imp_ui->attachAutoCompleter('IMP_Imple', $auto_complete);
+        $imp_ui->attachAutoCompleter($auto_complete);
         if (!empty($conf['spell']['driver'])) {
             if (Horde_SpellChecker::factory($conf['spell']['driver'], array()) !== false) {
                 $spellcheck = true;
index 6807f12..3b5ae37 100644 (file)
@@ -3,8 +3,6 @@
  * imp.php - performs an AJAX-requested action and returns the DIMP-specific
  * JSON object
  *
- * $Horde: dimp/imp.php,v 1.234 2008/09/05 17:42:13 slusarz Exp $
- *
  * Copyright 2005-2008 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -34,7 +32,6 @@ function _generateDeleteResult($folder, $indices, $change)
 
 function _cacheID($folder)
 {
-    require_once IMP_BASE . '/lib/Mailbox.php';
     $imp_mailbox = &IMP_Mailbox::singleton($folder);
     return $imp_mailbox->getCacheId();
 }
@@ -54,7 +51,6 @@ function _threadUidChanged($folder, $indices)
 {
     $sort = IMP::getSort($folder);
     if ($sort['by'] == SORTTHREAD) {
-        require_once IMP_BASE . '/lib/Mailbox.php';
         foreach ($indices as $mbox => $mbox_array) {
             $imp_mailbox = &IMP_Mailbox::singleton($mbox);
             $threadob = $imp_mailbox->getThreadOb();
@@ -81,7 +77,6 @@ function _getListMessages($folder, $change)
 
     $search = Util::getPost('search');
     if (!empty($search)) {
-        require_once 'Horde/Serialize.php';
         $search = Horde_Serialize::unserialize($search, SERIALIZE_JSON);
         $args += array(
             'search_uid' => $search->imapuid,
@@ -96,8 +91,7 @@ function _getListMessages($folder, $change)
         );
     }
 
-    require_once DIMP_BASE . '/lib/Views/ListMessages.php';
-    $list_msg = new DIMP_Views_ListMessages();
+    $list_msg = new IMP_Views_ListMessages();
     $res = $list_msg->ListMessages($args);
     // TODO: This can potentially be optimized for arrival time sort - if the
     // cache ID changes, we know the changes must occur at end of mailbox.
@@ -116,8 +110,7 @@ function _getIdxString($indices)
 
 function _getPollInformation($mbox)
 {
-    require_once IMP_BASE . '/lib/IMAP/Tree.php';
-    $imptree = &IMP_Tree::singleton();
+    $imptree = &IMP_IMAP_Tree::singleton();
     $elt = $imptree->get($mbox);
     if ($imptree->isPolled($elt)) {
         $info = $imptree->getElementInfo($mbox);
@@ -147,11 +140,9 @@ if (in_array($action, array('chunkContent', 'Html2Text', 'Text2Html', 'GetReplyD
 
 $authentication = 'none';
 $dimp_logout = ($action == 'LogOut');
-$load_imp = true;
 $session_timeout = 'json';
 @define('AUTH_HANDLER', true);
-@define('DIMP_BASE', dirname(__FILE__));
-require_once DIMP_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/base.php';
 
 // Process common request variables.
 $folder = Util::getPost('folder');
@@ -176,11 +167,9 @@ case 'CreateSubfolder':
         break;
     }
 
-    require_once IMP_BASE . '/lib/IMAP/Tree.php';
-    $imptree = &IMP_Tree::singleton();
+    $imptree = &IMP_IMAP_Tree::singleton();
     $imptree->eltDiffStart();
 
-    require_once IMP_BASE . '/lib/Folder.php';
     $imp_folder = &IMP_Folder::singleton();
 
     $new = String::convertCharset($folder, NLS::getCharset(), 'UTF7-IMAP');
@@ -201,11 +190,9 @@ case 'DeleteFolder':
         break;
     }
 
-    require_once IMP_BASE . '/lib/IMAP/Tree.php';
-    $imptree = &IMP_Tree::singleton();
+    $imptree = &IMP_IMAP_Tree::singleton();
     $imptree->eltDiffStart();
 
-    require_once IMP_BASE . '/lib/Folder.php';
     $imp_folder = &IMP_Folder::singleton();
     $result = $imp_folder->delete(array($folder));
     if ($result) {
@@ -221,11 +208,9 @@ case 'RenameFolder':
         break;
     }
 
-    require_once IMP_BASE . '/lib/IMAP/Tree.php';
-    $imptree = &IMP_Tree::singleton();
+    $imptree = &IMP_IMAP_Tree::singleton();
     $imptree->eltDiffStart();
 
-    require_once IMP_BASE . '/lib/Folder.php';
     $imp_folder = &IMP_Folder::singleton();
 
     $new = $imptree->createMailboxName($new_parent, $new);
@@ -249,7 +234,6 @@ case 'EmptyFolder':
         break;
     }
 
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     $imp_message->emptyMailbox(array($folder));
     $result = new stdClass;
@@ -262,7 +246,6 @@ case 'MarkFolderUnseen':
         break;
     }
 
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     $result = $imp_message->flagAllInMailbox(array('seen'),
                                              array($folder),
@@ -279,23 +262,20 @@ case 'MarkFolderUnseen':
     break;
 
 case 'ListFolders':
-    require_once IMP_BASE . '/lib/IMAP/Tree.php';
-    $imptree = &IMP_Tree::singleton();
-    $result = DIMP::getFolderResponse($imptree, array('a' => $imptree->folderList(IMPTREE_FLIST_CONTAINER | IMPTREE_FLIST_VFOLDER), 'c' => array(), 'd' => array()));
+    $imptree = &IMP_IMAP_Tree::singleton();
+    $result = DIMP::getFolderResponse($imptree, array('a' => $imptree->folderList(IMP_IMAP_TREE::FLIST_CONTAINER | IMP_IMAP_TREE::FLIST_VFOLDER), 'c' => array(), 'd' => array()));
     break;
 
 case 'PollFolders':
     $result = new stdClass;
 
-    require_once IMP_BASE . '/lib/Fetchmail.php';
     $fm_account = new IMP_Fetchmail_Account();
     $fm_count = $fm_account->count();
     if (!empty($fm_count)) {
         IMP_Fetchmail::fetchMail(range(0, $fm_count - 1));
     }
 
-    require_once IMP_BASE . '/lib/IMAP/Tree.php';
-    $imptree = &IMP_Tree::singleton();
+    $imptree = &IMP_IMAP_Tree::singleton();
 
     $result->poll = array();
     foreach ($imptree->getPollList(true) as $val) {
@@ -332,8 +312,7 @@ case 'ListMessages':
     $result = new stdClass;
 
     if (Util::getPost('rangeslice')) {
-        require_once DIMP_BASE . '/lib/Views/ListMessages.php';
-        $list_msg = new DIMP_Views_ListMessages();
+        $list_msg = new IMP_Views_ListMessages();
         $result->viewport = $list_msg->getSlice($folder, intval(Util::getPost('start')) - 1, intval(Util::getPost('length')));
         $result->viewport->request_id = Util::getPost('request_id');
         $result->viewport->type = 'slice';
@@ -356,12 +335,11 @@ case 'CopyMessage':
         $change = _changed($folder, $cacheid, $indices);
     }
 
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     $result = $imp_message->copy($to,
                                  $action == 'MoveMessage'
-                                     ? IMP_MESSAGE_MOVE
-                                     : IMP_MESSAGE_COPY,
+                                     ? IMP_MESSAGE::MOVE
+                                     : IMP_MESSAGE::COPY,
                                  $indices);
     if ($result) {
         if ($action == 'MoveMessage') {
@@ -396,7 +374,6 @@ case 'MarkMessage':
         $set = true;
     }
 
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     $result = $imp_message->flag(array($flag), $indices, $set);
     if ($result) {
@@ -410,7 +387,6 @@ case 'UndeleteMessage':
         break;
     }
 
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     if ($action == 'DeleteMessage') {
         $change = _changed($folder, $cacheid, $indices, !$prefs->getValue('hide_deleted') && !$prefs->getValue('use_trash'));
@@ -447,7 +423,6 @@ case 'AddContact':
 case 'ReportSpam':
 case 'ReportHam':
     $change = _changed($folder, $cacheid, $indices);
-    require_once IMP_BASE . '/lib/Spam.php';
     $spam = new IMP_Spam();
     $result = $spam->reportSpam($indices,
                                 $action == 'ReportSpam' ? 'spam' : 'notspam');
@@ -465,7 +440,6 @@ case 'Whitelist':
         break;
     }
 
-    require_once IMP_BASE . '/lib/Filter.php';
     $imp_filter = new IMP_Filter();
     if ($action == 'Whitelist') {
         $imp_filter->whitelistMessage($indices, false);
@@ -489,8 +463,7 @@ case 'ShowPreview':
         'preview' => true,
     );
 
-    require_once DIMP_BASE . '/lib/Views/ShowMessage.php';
-    $show_msg = new DIMP_Views_ShowMessage();
+    $show_msg = new IMP_Views_ShowMessage();
     $result = (object) $show_msg->showMessage($args);
     break;
 
@@ -509,10 +482,6 @@ case 'Text2Html':
     break;
 
 case 'GetForwardData':
-    require_once IMP_BASE . '/lib/Compose.php';
-    require_once IMP_BASE . '/lib/MIME/Contents.php';
-    require_once IMP_BASE . '/lib/UI/Compose.php';
-    require_once 'Horde/MIME/Message.php';
     $header = array();
     $msg = $header = null;
     $idx_string = _getIdxString($indices);
@@ -526,7 +495,7 @@ case 'GetForwardData':
 
     $result = new stdClass;
     // Can't open read-only since we need to store the message cache id.
-    $result->imp_compose = $imp_compose->getMessageCacheId();
+    $result->imp_compose = $imp_compose->getCacheId();
     $result->fwd_list = DIMP::getAttachmentInfo($imp_compose);
     $result->body = $fwd_msg['body'];
     $result->header = $header;
@@ -535,8 +504,6 @@ case 'GetForwardData':
     break;
 
 case 'GetReplyData':
-    require_once IMP_BASE . '/lib/Compose.php';
-    require_once IMP_BASE . '/lib/MIME/Contents.php';
     $imp_compose = &IMP_Compose::singleton(Util::getPost('imp_compose'));
     $imp_contents = &IMP_Contents::singleton(_getIdxString($indices));
     $reply_msg = $imp_compose->replyMessage(Util::getPost('type'), $imp_contents);
@@ -555,7 +522,6 @@ case 'DeleteDraft':
     if (empty($indices)) {
         break;
     }
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     $idx_array = array($index . IMP_IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true));
     $imp_message->delete($idx_array, true);
@@ -564,7 +530,6 @@ case 'DeleteDraft':
 case 'DeleteAttach':
     $atc = Util::getPost('atc_indices');
     if (!is_null($atc)) {
-        require_once IMP_BASE . '/lib/Compose.php';
         $imp_compose = &IMP_Compose::singleton(Util::getPost('imp_compose'));
         $imp_compose->deleteAttachment($atc);
     }
@@ -573,7 +538,7 @@ case 'DeleteAttach':
 case 'ShowPortal':
     // Load the block list. Blocks are located in $dimp_block_list.
     // KEY: Block label  VALUE: Horde_Block object
-    require DIMP_BASE . '/config/portal.php';
+    require IMP_BASE . '/config/portal.php';
 
     $blocks = $linkTags = array();
     $css_load = array('dimp' => true);
@@ -623,8 +588,7 @@ case 'ShowPortal':
     $result = new stdClass;
     $result->portal = '';
     if (!empty($blocks)) {
-        require_once IMP_BASE . '/lib/Template.php';
-        $t = new IMP_Template(DIMP_TEMPLATES . '/imp/');
+        $t = new IMP_Template(IMP_TEMPLATES . '/imp/');
         $t->set('block', $blocks);
         $result->portal = $t->fetch('portal.html');
     }
@@ -635,7 +599,7 @@ case 'chunkContent':
     $chunk = basename(Util::getPost('chunk'));
     if (!empty($chunk)) {
         $result = new stdClass;
-        $result->chunk = Util::bufferOutput('include', DIMP_TEMPLATES . '/chunks/' . $chunk . '.php');
+        $result->chunk = Util::bufferOutput('include', IMP_TEMPLATES . '/chunks/' . $chunk . '.php');
     }
     break;
 
@@ -645,7 +609,6 @@ case 'PurgeDeleted':
         $sort = IMP::getSort($folder);
         $change = ($sort['by'] == SORTTHREAD);
     }
-    require_once IMP_BASE . '/lib/Message.php';
     $imp_message = &IMP_Message::singleton();
     $expunged = $imp_message->expungeMailbox(array($folder => 1));
     if (!empty($expunged[$folder])) {
@@ -670,8 +633,7 @@ case 'ModifyPollFolder':
 
     $add = Util::getPost('add');
 
-    require_once IMP_BASE . '/lib/IMAP/Tree.php';
-    $imptree = &IMP_Tree::singleton();
+    $imptree = &IMP_IMAP_Tree::singleton();
 
     $result = new stdClass;
     $result->add = (bool) $add;
@@ -694,7 +656,7 @@ case 'SendMDN':
     }
 
     /* Get the IMP_Headers:: object. */
-    require_once IMP_BASE . '/lib/IMAP/MessageCache.php';
+    // TODO
     $msg_cache = &IMP_MessageCache::singleton();
     $cache_entry = $msg_cache->retrieve($folder, array($index), 32);
     $ob = reset($cache_entry);
@@ -702,7 +664,6 @@ case 'SendMDN':
         break;
     }
 
-    require_once IMP_BASE . '/lib/UI/Message.php';
     $imp_ui = new IMP_UI_Message();
     $imp_ui->MDNCheck($ob->header, true);
     break;
index 21062f2..ebb6640 100644 (file)
@@ -1,46 +1,32 @@
 <?php
 /**
- * $Horde: dimp/index.php,v 1.72 2008/09/29 17:30:19 chuck Exp $
- *
  * Copyright 2005-2008 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  *
  * @author Jan Schneider <jan@horde.org>
+ * @author Michael Slusarz <slusarz@horde.org>
  */
 
-@define('DIMP_BASE', dirname(__FILE__));
-$dimp_configured = (is_readable(DIMP_BASE . '/config/conf.php') &&
-                    is_readable(DIMP_BASE . '/config/portal.php') &&
-                    is_readable(DIMP_BASE . '/config/prefs.php'));
-
-if (!$dimp_configured) {
-    require DIMP_BASE . '/../lib/Test.php';
-    Horde_Test::configFilesMissing('DIMP', DIMP_BASE,
-                                   array('conf.php', 'prefs.php'),
-                                   array('portal.php' => 'This file controls the blocks that appear in DIMP\'s portal'));
-}
-
-$load_imp = true;
-require_once DIMP_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/base.php';
 
 $scripts = array(
-    array('DimpBase.js', 'dimp', true),
-    array('ContextSensitive.js', 'dimp', true),
-    array('ViewPort.js', 'dimp', true),
-    array('dragdrop.js', 'dimp', true),
+    array('DimpBase.js', 'imp', true),
+    array('ContextSensitive.js', 'imp', true),
+    array('ViewPort.js', 'imp', true),
+    array('dragdrop.js', 'imp', true),
     array('dhtmlHistory.js', 'horde', true),
     array('redbox.js', 'horde', true),
-    array('mailbox.js', 'dimp'),
-    array('DimpSlider.js', 'dimp', true),
+    array('mailbox-dimp.js', 'imp'),
+    array('DimpSlider.js', 'imp', true),
     array('unblockImages.js', 'imp', true)
 );
 
 /* Get site specific menu items. */
 $js_code = $site_menu = array();
-if (is_readable(DIMP_BASE . '/config/menu.php')) {
-    include DIMP_BASE . '/config/menu.php';
+if (is_readable(IMP_BASE . '/config/menu.php')) {
+    include IMP_BASE . '/config/menu.php';
 }
 
 /* Add the site specific javascript now. */
@@ -71,7 +57,7 @@ foreach (DIMP::menuList() as $app) {
 }
 
 echo "<body>\n";
-require DIMP_TEMPLATES . '/index/index.inc';
+require IMP_TEMPLATES . '/index/index.inc';
 IMP::includeScriptFiles();
 IMP::outputInlineScript();
 $notification->notify(array('listeners' => array('javascript')));
index 9a82b4e..b79047c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * The IMP_UI_Compose:: class is designed to provide a place to dump common
+ * The IMP_UI_Compose:: class is designed to provide a place to store common
  * code shared among IMP's various UI views for the compose page.
  *
  * Copyright 2006-2008 The Horde Project (http://www.horde.org/)
@@ -11,8 +11,8 @@
  * @author  Michael Slusarz <slusarz@horde.org>
  * @package IMP
  */
-class IMP_UI_Compose {
-
+class IMP_UI_Compose
+{
     /**
      */
     function expandAddresses($input, &$imp_compose)
@@ -28,11 +28,9 @@ class IMP_UI_Compose {
             $list = $error->getUserInfo();
             if (is_array($list)) {
                 foreach ($list as $entry) {
-                    if (is_object($entry)) {
-                        $result[] = $entry->getUserInfo();
-                    } else {
-                        $result[] = $entry;
-                    }
+                    $result[] = is_object($entry)
+                        ? $entry->getUserInfo()
+                        : $entry;
                 }
             }
             $GLOBALS['notification']->push($error, 'horde.warning');
@@ -55,12 +53,6 @@ class IMP_UI_Compose {
         $identity = &Identity::singleton(array('imp', 'imp'));
         $from_addr = $identity->getFromAddress();
 
-        /* We need to rebuild the headers ourselves to ensure that all MIME
-         * decoding stays as-is. */
-        require_once IMP_BASE . '/lib/MIME/Headers.php';
-        $imp_imap = &IMP_IMAP::singleton();
-        $imp_imap->changeMbox($contents->getMailbox(), IMP_IMAP_AUTO);
-
         $headers = $contents->getHeaderOb();
         $headers->addResentHeaders($from_addr, $recip['header']['to']);
 
@@ -81,7 +73,6 @@ class IMP_UI_Compose {
 
         /* Store history information. */
         if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) {
-            require_once IMP_BASE . '/lib/Maillog.php';
             IMP_Maillog::log('redirect', $headers->getValue('message-id'), $recipients);
         }
 
@@ -95,7 +86,6 @@ class IMP_UI_Compose {
         Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
 
         if ($GLOBALS['conf']['sentmail']['driver'] != 'none') {
-            require_once IMP_BASE . '/lib/Sentmail.php';
             $sentmail = IMP_Sentmail::factory();
             $sentmail->log('redirect', $headers->getValue('message-id'), $recipients);
         }
@@ -124,11 +114,11 @@ class IMP_UI_Compose {
 
     /**
      */
-    function attachAutoCompleter($lib, $fields)
+    function attachAutoCompleter($fields)
     {
         /* Attach autocompleters to the compose form elements. */
         foreach ($fields as $val) {
-            call_user_func_array(array($lib, 'factory'), array('ContactAutoCompleter', array('triggerId' => $val)));
+            call_user_func_array(array('IMP_Imple', 'factory'), array('ContactAutoCompleter', array('triggerId' => $val)));
         }
     }
 
@@ -151,7 +141,7 @@ class IMP_UI_Compose {
                 'Error' => $spell_img . $br . _("Spell Check Failed")
             )
         );
-        call_user_func_array(array($mode == 'dimp' ? 'Dimple' : 'IMP_Imple', 'factory'), array('SpellChecker', $args));
+        call_user_func_array(array('IMP_Imple', 'factory'), array('SpellChecker', $args));
     }
 
     /**
@@ -163,7 +153,6 @@ class IMP_UI_Compose {
         if (!empty($to)) {
             // Although we allow ';' to delimit addresses in the UI, need to
             // convert to RFC-compliant ',' delimiter for processing.
-            require_once 'Horde/String.php';
             $clean_to = '';
             foreach (Horde_Mime_Address::explode($to, ',;') as $val) {
                 $val = trim($val);
@@ -172,7 +161,6 @@ class IMP_UI_Compose {
             if ($expand) {
                return $clean_to;
             } else {
-               require_once IMP_BASE . '/lib/Compose.php';
                return IMP_Compose::formatAddr($clean_to);
             }
         }
@@ -202,7 +190,6 @@ class IMP_UI_Compose {
      */
     function initRTE($mode = 'imp')
     {
-        require_once 'Horde/Editor.php';
         $editor = &Horde_Editor::singleton('fckeditor', array('id' => 'message', 'no_notify' => true));
 
         $fck_buttons = $GLOBALS['prefs']->getValue('fckeditor_buttons');
index ef98717..8ba3e01 100644 (file)
@@ -9,7 +9,7 @@
  *
  * @package IMP
  */
-class DIMP_Views_Compose
+class IMP_Views_Compose
 {
     /**
      * Create content needed to output the compose screen.
index 842b8f3..e197c9a 100644 (file)
@@ -10,7 +10,7 @@
  *
  * @package IMP
  */
-class DIMP_Views_ListMessages
+class IMP_Views_ListMessages
 {
     /**
      * Returns a list of messages for use with ViewPort.
index dcdb420..c7da4d7 100644 (file)
@@ -9,7 +9,7 @@
  *
  * @package IMP
  */
-class DIMP_Views_ShowMessage
+class IMP_Views_ShowMessage
 {
     /**
      * Builds a list of addresses from header information.
index d9d1a55..bac7e06 100644 (file)
@@ -1,18 +1,15 @@
 <?php
 /**
- * $Horde: dimp/message.php,v 1.73 2008/09/05 06:38:48 slusarz Exp $
- *
  * Copyright 2005-2008 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  *
  * @author Jan Schneider <jan@horde.org>
+ * @author Michael Slusarz <slusarz@horde.org>
  */
 
-$load_imp = true;
-@define('DIMP_BASE', dirname(__FILE__));
-require_once DIMP_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/base.php';
 
 $folder = Util::getFormData('folder');
 $index = Util::getFormData('uid');
@@ -20,7 +17,6 @@ if (!$index || !$folder) {
     exit;
 }
 
-require_once IMP_BASE . '/lib/UI/Message.php';
 $imp_ui = new IMP_UI_Message();
 
 $args = array(
@@ -30,8 +26,7 @@ $args = array(
     'preview' => false,
 );
 
-require_once DIMP_BASE . '/lib/Views/ShowMessage.php';
-$show_msg = new DIMP_Views_ShowMessage();
+$show_msg = new IMP_Views_ShowMessage();
 $show_msg_result = $show_msg->ShowMessage($args);
 if (isset($show_msg_result['error'])) {
     echo IMP::wrapInlineScript(array(
@@ -48,7 +43,7 @@ $compose_args = array(
     'popup' => false,
     'qreply' => true,
 );
-$compose_result = DIMP_Views_Compose::showCompose($compose_args);
+$compose_result = IMP_Views_Compose::showCompose($compose_args);
 
 /* Need the Header object to check for list information. */
 $msg_cache = &IMP_MessageCache::singleton();
@@ -56,12 +51,10 @@ $cache_entry = $msg_cache->retrieve($folder, array($index), 32);
 $ob = reset($cache_entry);
 
 /* Init IMP_UI_Compose:: object. */
-require_once IMP_BASE . '/lib/UI/Compose.php';
 $imp_ui = new IMP_UI_Compose();
 
 /* Attach spellchecker & auto completer. */
-require_once DIMP_BASE . '/lib/Dimple.php';
-$imp_ui->attachAutoCompleter('Dimple', array('to', 'cc', 'bcc'));
+$imp_ui->attachAutoCompleter(array('to', 'cc', 'bcc'));
 $imp_ui->attachSpellChecker('dimp');
 
 $compose_result['js'] = array_merge($compose_result['js'], array(
@@ -69,7 +62,6 @@ $compose_result['js'] = array_merge($compose_result['js'], array(
     'DIMP.conf.msg_folder = "' . $show_msg_result['folder'] . '"'
 ));
 
-require_once 'Horde/Serialize.php';
 foreach (array('from', 'to', 'cc', 'bcc', 'replyTo') as $val) {
     if (!empty($show_msg_result[$val])) {
         $compose_result['js'][] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], SERIALIZE_JSON);
@@ -80,15 +72,15 @@ IMP::addInlineScript($compose_result['jsonload'], 'load');
 IMP::addInlineScript(array(DIMP::notify()), 'dom');
 
 $scripts = array(
-    array('ContextSensitive.js', 'dimp', true),
-    array('fullmessage.js', 'dimp', true),
-    array('compose.js', 'dimp', true),
+    array('ContextSensitive.js', 'imp', true),
+    array('fullmessage-dimp.js', 'imp', true),
+    array('compose-dimp.js', 'imp', true),
     array('unblockImages.js', 'imp', true)
 );
 
 DIMP::header($show_msg_result['subject'], $scripts);
 echo "<body>\n";
-require DIMP_TEMPLATES . '/chunks/message.php';
+require IMP_TEMPLATES . '/chunks/message.php';
 IMP::includeScriptFiles();
 IMP::outputInlineScript();
 echo $compose_result['jsappend'];