From: Michael M Slusarz Date: Mon, 1 Dec 2008 10:32:01 +0000 (-0700) Subject: More DIMP -> IMP fixes. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f57fff57a77605a927783ed85ec7e43331c359a7;p=horde.git More DIMP -> IMP fixes. --- diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index 236cc5a6d..de042bcca 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -18,12 +18,10 @@ function _removeAutoSaveDraft($index) { - if (empty($index)) { - return; + if (!empty($index)) { + $imp_message = &IMP_Message::singleton(); + $imp_message->delete(array($index . IMP::IDX_SEP . IMP::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true)), true); } - $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); } require_once dirname(__FILE__) . '/lib/base.php'; @@ -42,7 +40,7 @@ require_once 'Horde/Identity.php'; $identity = &Identity::singleton(array('imp', 'imp')); if (!$prefs->isLocked('default_identity')) { $identity_id = Util::getFormData('identity'); - if ($identity_id !== null) { + if (!is_null($identity_id)) { $identity->setDefault($identity_id); } } @@ -147,7 +145,7 @@ if (count($_POST)) { 'sent_folder' => $identity->getValue('sent_mail_folder'), 'save_attachments' => Util::getFormData('save_attachments_select'), 'reply_type' => $result->reply_type, - 'reply_index' => $result->index . IMP_IDX_SEP . $result->reply_folder, + 'reply_index' => $result->index . IMP::IDX_SEP . $result->reply_folder, 'readreceipt' => Util::getFormData('request_read_receipt') ); $sent = $imp_compose->buildAndSendMessage($message, $header, $charset, $html, $options); @@ -194,7 +192,7 @@ if (in_array($type, array('reply', 'reply_all', 'reply_list', 'forward_all', 'fo $type = 'new'; } - $imp_contents = &IMP_Contents::singleton($index . IMP_IDX_SEP . $folder); + $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'); $index = $folder = null; @@ -232,7 +230,7 @@ case 'reply_list': case 'forward_all': case 'forward_body': case 'forward_attachments': - $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $type, $index . IMP_IDX_SEP . $folder); + $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $type, $index . IMP::IDX_SEP . $folder); if ($type == 'forward_all') { $msg = ''; } else { @@ -252,7 +250,7 @@ case 'forward_attachments': break; case 'resume': - $result = $imp_compose->resumeDraft($index . IMP_IDX_SEP . $folder); + $result = $imp_compose->resumeDraft($index . IMP::IDX_SEP . $folder); if (is_a($result, 'PEAR_Error')) { $notification->push($result->getMessage(), 'horde.error'); } else { @@ -319,7 +317,7 @@ $compose_result['js_onload'][] = 'DimpCompose.fillForm(' . Horde_Serialize::seri IMP::addInlineScript($compose_result['js_onload'], 'load'); $scripts = array( - array('compose.js', 'dimp', true) + array('compose-dimp.js', 'imp', true) ); DIMP::header(_("Message Composition"), $scripts); diff --git a/imp/config/portal.php.dist b/imp/config/portal.php.dist index ab5d29102..b65348ce9 100644 --- a/imp/config/portal.php.dist +++ b/imp/config/portal.php.dist @@ -14,12 +14,8 @@ * 'domid' => A DOM ID to assign to the containing block * 'tag' => A tag name to add to the template array. Allows * the use of in custom template files. - * - * $Horde: dimp/config/portal.php.dist,v 1.7 2008/08/22 04:19:29 slusarz Exp $ */ -require_once 'Horde/Block.php'; -require_once 'Horde/Block/Collection.php'; $collection = new Horde_Block_Collection(); $dimp_block_list = array(); diff --git a/imp/imp-dimp.php b/imp/imp-dimp.php index 3b5ae3738..bd18d538c 100644 --- a/imp/imp-dimp.php +++ b/imp/imp-dimp.php @@ -7,6 +7,8 @@ * * 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 Michael Slusarz */ function _generateDeleteResult($folder, $indices, $change) @@ -50,7 +52,7 @@ function _changed($folder, $compare, $indices = array(), $nothread = false) function _threadUidChanged($folder, $indices) { $sort = IMP::getSort($folder); - if ($sort['by'] == SORTTHREAD) { + if ($sort['by'] == Horde_Imap_Client::SORT_THREAD) { foreach ($indices as $mbox => $mbox_array) { $imp_mailbox = &IMP_Mailbox::singleton($mbox); $threadob = $imp_mailbox->getThreadOb(); @@ -105,7 +107,7 @@ function _getListMessages($folder, $change) function _getIdxString($indices) { $i = each($indices); - return reset($i['value']) . IMP_IDX_SEP . $i['key']; + return reset($i['value']) . IMP::IDX_SEP . $i['key']; } function _getPollInformation($mbox) @@ -523,7 +525,7 @@ case 'DeleteDraft': break; } $imp_message = &IMP_Message::singleton(); - $idx_array = array($index . IMP_IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true)); + $idx_array = array($index . IMP::IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true)); $imp_message->delete($idx_array, true); break; @@ -656,16 +658,16 @@ case 'SendMDN': } /* Get the IMP_Headers:: object. */ - // TODO - $msg_cache = &IMP_MessageCache::singleton(); - $cache_entry = $msg_cache->retrieve($folder, array($index), 32); - $ob = reset($cache_entry); - if ($ob === false) { + try { + $fetch_ret = $imp_imap->ob->fetch($folder, array( + Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) + ), array('ids' => array($index))); + } catch (Horde_Imap_Client_Exception $e) { break; } $imp_ui = new IMP_UI_Message(); - $imp_ui->MDNCheck($ob->header, true); + $imp_ui->MDNCheck(reset($fetch_ret[$index]['headertext']), true); break; } diff --git a/imp/lib/Block/newmail.php b/imp/lib/Block/newmail.php index 11c4d5482..3badbad1f 100644 --- a/imp/lib/Block/newmail.php +++ b/imp/lib/Block/newmail.php @@ -36,7 +36,6 @@ class Horde_Block_dimp_newmail extends Horde_Block $html .= '' . _("No unread messages") . ''; } else { require_once 'Horde/Identity.php'; - require_once 'Horde/Text.php'; $charset = NLS::getCharset(); $identity = &Identity::singleton(array('imp', 'imp')); @@ -53,7 +52,7 @@ class Horde_Block_dimp_newmail extends Horde_Block $html .= '' . '' . htmlspecialchars($from_res['from'], ENT_QUOTES, $charset) . '
' . - str_replace(' ', ' ', Text::htmlSpaces($subject)) . '' . + $subject . '' . '' . htmlspecialchars($date, ENT_QUOTES, $charset) . ''; } diff --git a/imp/lib/UI/Mailbox.php b/imp/lib/UI/Mailbox.php index 504f86bb0..d4f48ca8c 100644 --- a/imp/lib/UI/Mailbox.php +++ b/imp/lib/UI/Mailbox.php @@ -202,9 +202,14 @@ class IMP_UI_Mailbox { function getSubject($subject) { $subject = Horde_Mime::decode($subject, $this->_charset); - return empty($subject) + $subject = empty($subject) ? _("[No Subject]") : IMP::filterText(preg_replace("/\s+/", ' ', $subject)); + if ($_SESSION['imp']['view'] == 'dimp') { + require_once 'Horde/Text.php'; + $subject = str_replace(' ', ' ', Text::htmlSpaces($subject)); + } + return $subject; } } diff --git a/imp/lib/Views/ListMessages.php b/imp/lib/Views/ListMessages.php index e197c9a9f..570847d45 100644 --- a/imp/lib/Views/ListMessages.php +++ b/imp/lib/Views/ListMessages.php @@ -188,9 +188,10 @@ class IMP_Views_ListMessages $md->unseen = $info['unseen']; } - if ($sortpref['by'] == SORTTHREAD) { + if ($sortpref['by'] == Horde_Imap_Client::SORT_THREAD) { $threadob = $imp_mailbox->getThreadOb(); - $md->thread = array_filter($threadob->getThreadTreeOb($msglist, $sortpref['dir'])); + $imp_thread = new IMP_IMAP_Thread($threadob); + $md->thread = array_filter($imp_thread->getThreadTreeOb($msglist, $sortpref['dir'])); } } else { $result->search = true; @@ -236,10 +237,10 @@ class IMP_Views_ListMessages /** * Obtains IMAP overview data for a given set of message UIDs. * - * @var object IMP_Mailbox $imp_mailbox An IMP_Mailbox:: object. - * @var string $folder The current folder. - * @var array $msglist The list of message sequence - * numbers to process. + * @param object IMP_Mailbox $imp_mailbox An IMP_Mailbox:: object. + * @param string $folder The current folder. + * @param array $msglist The list of message sequence + * numbers to process. * * @return array TODO */ @@ -252,7 +253,6 @@ class IMP_Views_ListMessages } require_once 'Horde/Identity.php'; - require_once 'Horde/Text.php'; /* Get mailbox information. */ $overview = $imp_mailbox->getMailboxArray($msglist, false, array('list-post')); @@ -325,7 +325,7 @@ class IMP_Views_ListMessages $msg['from'] = htmlspecialchars($getfrom['from'], ENT_QUOTES, $charset); /* Format the Subject: Header. */ - $msg['subject'] = str_replace(' ', ' ', Text::htmlSpaces($imp_ui->getSubject($ob['envelope']['subject']))); + $msg['subject'] = $imp_ui->getSubject($ob['envelope']['subject']); if (!empty($GLOBALS['conf']['hooks']['mailboxarray'])) { $result = Horde::callHook('_dimp_hook_mailboxarray', array($msg, $ob), 'dimp'); diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index c7da4d71a..902c8bdb4 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -125,10 +125,12 @@ class IMP_Views_ShowMessage /* Get envelope/flag/header information. */ try { + $flags_ret = $GLOBALS['imp_imap']->ob->fetch($folder, array( + Horde_Imap_Client::FETCH_FLAGS => true, + ), array('ids' => array($index))); $fetch_ret = $GLOBALS['imp_imap']->ob->fetch($folder, array( Horde_Imap_Client::FETCH_ENVELOPE => true, - Horde_Imap_Client::FETCH_FLAGS => true, - Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => true)) + Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) ), array('ids' => array($index))); $ob = $fetch_ret[$index]; } catch (Horde_Imap_Client_Exception $e) { @@ -138,9 +140,8 @@ class IMP_Views_ShowMessage } /* Parse MIME info and create the body of the message. */ - $imp_contents = &IMP_Contents::singleton($index . IMP_IDX_SEP . $folder); - if (is_a($imp_contents, 'PEAR_Error') || - !$imp_contents->buildMessage()) { + $imp_contents = &IMP_Contents::singleton($index . IMP::IDX_SEP . $folder); + if (is_a($imp_contents, 'PEAR_Error')) { $result['error'] = $error_msg; $result['errortype'] = 'horde.error'; return $result; @@ -149,25 +150,8 @@ class IMP_Views_ShowMessage /* Get the IMP_UI_Message:: object. */ $imp_ui = new IMP_UI_Message(); - /* Update the message flag, if necessary. */ - if (($_SESSION['imp']['protocol'] == 'imap') && - !in_array('\\seen', $ob['flags'])) { - $imp_mailbox = &IMP_Mailbox::singleton($folder, $index); - $imp_message = &IMP_Message::singleton(); - $imp_message->flag(array('\\seen'), array($folder => array($index)), true); - } - - /* Determine if we should generate the attachment strip links or - * not. */ - if ($GLOBALS['prefs']->getValue('strip_attachments')) { - $imp_contents->setStripLink(true); - } - - /* Show summary links. */ - $imp_contents->showSummaryLinks(true); - - $attachments = $imp_contents->getAttachments(); - $result['msgtext'] = $imp_contents->getMessage(); + // TODO - Create message text and attachments. + //$result['msgtext'] = $imp_contents->getMessage(); /* Develop the list of Headers to display now. Deal with the 'basic' * header information first since there are various manipulations @@ -254,7 +238,6 @@ class IMP_Views_ShowMessage /* Get X-Priority/ */ $result['priority'] = $imp_headers->getXpriority(); - /* Add attachment info. */ $atc_display = $GLOBALS['prefs']->getValue('attachment_display'); $show_parts = (!empty($attachments) && (($atc_display == 'list') || ($atc_display == 'both'))); diff --git a/imp/message.php b/imp/message.php index 870acda3d..234b74eb8 100644 --- a/imp/message.php +++ b/imp/message.php @@ -234,7 +234,7 @@ try { $envelope = $fetch_ret[$index]['envelope']; $flags = $flags_ret[$index]['flags']; -$mime_headers = $fetch_ret[$index]['headertext'][0]; +$mime_headers = reset($fetch_ret[$index]['headertext']); $use_pop = ($_SESSION['imp']['protocol'] == 'pop'); /* Parse the message. */ diff --git a/imp/templates/chunks/compose.php b/imp/templates/chunks/compose.php index 83bdbe3d2..e87679e38 100644 --- a/imp/templates/chunks/compose.php +++ b/imp/templates/chunks/compose.php @@ -15,7 +15,7 @@ $d_read = $GLOBALS['prefs']->getValue('disposition_request_read'); $save_attach = $GLOBALS['prefs']->getValue('save_attachments'); -$loading_img = Horde::img('loading.gif', _("Loading..."), array(), $GLOBALS['registry']->getImageDir('dimp')); +$loading_img = Horde::img('loading.gif', _("Loading...")); // Small utility function to simplify creating dimpactions buttons. // As of right now, we don't show text only links. @@ -132,7 +132,7 @@ function _createDAcompose($text, $image, $id) - + - + - +
getImageDir('imp')) . ': ' ?> diff --git a/imp/templates/chunks/message.php b/imp/templates/chunks/message.php index 057755a02..5af8088c5 100644 --- a/imp/templates/chunks/message.php +++ b/imp/templates/chunks/message.php @@ -1,19 +1,16 @@ getImageDir('dimp'); $horde_img = $registry->getImageDir('horde'); $menu_view = $prefs->getValue('menu_view'); $show_text = ($menu_view == 'text' || $menu_view == 'both'); -$attachment = Horde::img('attachment.png', '', array('class' => 'attachmentImage'), $dimp_img); +$attachment = Horde::img('attachment.png', '', array('class' => 'attachmentImage')); // Small utility function to simplify creating dimpactions buttons. // As of right now, we don't show text only links. @@ -56,7 +53,7 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
-
+
@@ -74,7 +71,7 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
'partlist_col'), $dimp_img) . Horde::img('arrow_expanded.png', '', array('id' => 'partlist_exp', 'style' => 'display:none'), $dimp_img) . ' ' . $attachment ?> 'partlist_col')) . Horde::img('arrow_expanded.png', '', array('id' => 'partlist_exp', 'style' => 'display:none')) . ' ' . $attachment ?> @@ -126,4 +123,4 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
- 'popdown', 'id' => 'popdown_img', 'style' => 'display:none'), $dimp_img) ?> + 'popdown', 'id' => 'popdown_img', 'style' => 'display:none')) ?> diff --git a/imp/templates/index/index.inc b/imp/templates/index/index.inc index 9a9326ec3..efea5e488 100644 --- a/imp/templates/index/index.inc +++ b/imp/templates/index/index.inc @@ -1,28 +1,23 @@ getImageDir('dimp'); $hordeimg = $registry->getImageDir('horde'); $mailseen = Horde::img('mail_seen.png'); $mailunseen = Horde::img('mail_unseen.png'); -$delete = Horde::img('delete.png', '', '', $imagedir); +$delete = Horde::img('delete.png'); $folder_create = Horde::img('folders/folder_create.png'); $folder_edit = Horde::img('folders/folder_edit.png'); -$forward = Horde::img('forward.png', '', '', $imagedir); +$forward = Horde::img('forward.png'); $flagged = Horde::img('mail_flagged.png'); $clearflag = Horde::img('mail_clearflag.png'); -$preview = Horde::img('preview.png', '', '', $imagedir); -$tick = Horde::img('tick.png', '', '', $imagedir); -$newwin = Horde::img('newwin.png', _("Open in new window"), '', $imagedir); +$preview = Horde::img('preview.png'); +$tick = Horde::img('tick.png'); +$newwin = Horde::img('newwin.png', _("Open in new window")); $attachment = Horde::img('attachment.png', '', array('class' => 'attachmentImage')); // Thread images -require_once IMP_BASE . '/lib/IMAP/Thread.php'; $thread_imgs = IMP_Thread::getImageUrls(); // Attachment images -require_once IMP_BASE . '/lib/UI/Mailbox.php'; $imp_ui = new IMP_UI_Mailbox(); $atc_imgs = array(); foreach ($imp_ui->getAttachmentAltList() as $k => $v) { @@ -44,7 +39,7 @@ $sidebar_width = max((int)$prefs->getValue('sidebar_width') - 50, 150) . 'px'; if (isset($_SESSION['imp']['quota']) && is_array($_SESSION['imp']['quota'])) { $quotadata = IMP::quotaData(false); if (!empty($quotadata)) { - $quota_img = Horde::img('quotauncover.gif', '', array('width' => round(99 - $quotadata['percent']), 'height' => 10), $imagedir); + $quota_img = Horde::img('quotauncover.gif', '', array('width' => round(99 - $quotadata['percent']), 'height' => 10)); } } @@ -82,7 +77,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
    - + @@ -188,7 +183,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
    - 'folderLoading', 'style' => 'display:none'), $imagedir) ?> + 'folderLoading', 'style' => 'display:none')) ?>
    @@ -247,26 +242,26 @@ function _simpleButton($id, $text, $image, $imagedir = null)
     
    @@ -279,12 +274,12 @@ function _simpleButton($id, $text, $image, $imagedir = null)