</configtab>
<configtab name="mimp" desc="Mobile View (mimp) Options">
- <configsection name="mailbox">
- <configheader>Mailbox Settings</configheader>
- <configinteger name="max_from_chars" desc="In the mailbox view, how many
- characters of From: addresses should we show before truncating
- them?">10</configinteger>
- <configinteger name="max_subj_chars" desc="In the mailbox view, how many
- characters of Subject: lines should we show before truncating
- them?">20</configinteger>
+ <configsection name="mimp">
+ <configsection name="mailbox">
+ <configheader>Mailbox Settings</configheader>
+ <configinteger name="max_from_chars" desc="In the mailbox view, how many
+ characters of From: addresses should we show before truncating
+ them?">10</configinteger>
+ <configinteger name="max_subj_chars" desc="In the mailbox view, how many
+ characters of Subject: lines should we show before truncating
+ them?">20</configinteger>
+ </configsection>
</configsection>
</configtab>
<configtab name="dimp" desc="Dynamic View (dimp) Options">
<configheader>Custom Hooks</configheader>
- <configsection name="hooks">
- <configboolean name="mailboxarray" required="false" desc="Should we
- run a custom function in which array elements can be added to use in the
- template file, while processing the message lists? If so, make sure
- you define _dimp_hook_mailboxarray() in config/hooks.php. The elements
- will be available as template tags in the dimp/templates/imp/mailbox.html
- template file.">false</configboolean>
- <configboolean name="previewview" required="false" desc="Should we
- run a custom function in which array elements can be modified, and javascript
- code be provided to dynamically update page elements in the preview pane?
- If so, make sure you define _dimp_hook_previewview() in config/hooks.php. The
- sample documentation in that file can better explain what can be accomplished
- with this hook.">false</configboolean>
- <configboolean name="messageview" required="false" desc="Should we
- run a custom function in which array elements can be added to use in the
- template file, while displaying the message text? If so, make sure
- you define _dimp_hook_messageview() in config/hooks.php. The elements
- will be available as template tags in the dimp/templates/imp/message.html
- template file.">false</configboolean>
- <configboolean name="addressformatting" required="false" desc="Should we
- run a custom function that is used to format email addresses in message
- headers? If so, make sure you define _dimp_hook_addressformatting() in
- config/hooks.php.">false</configboolean>
- <configboolean name="msglist_format" required="false" desc="Should we use
- a custom function to provide additional information/custom formatting of
- messages in the mailbox message list? If so, make sure you define
- _dimp_hook_msglist_format() in config/hooks.php.">false</configboolean>
- </configsection>
+ <configsection name="dimp">
+ <configsection name="hooks">
+ <configboolean name="mailboxarray" required="false" desc="Should we
+ run a custom function in which array elements can be added to use in the
+ template file, while processing the message lists? If so, make sure
+ you define _imp_hook_dimp_mailboxarray() in config/hooks.php. The elements
+ will be available as template tags in the dimp/templates/imp/mailbox.html
+ template file.">false</configboolean>
+ <configboolean name="previewview" required="false" desc="Should we
+ run a custom function in which array elements can be modified, and
+ javascript code be provided to dynamically update page elements in the
+ preview pane? If so, make sure you define _dimp_hook_previewview() in
+ config/hooks.php. The sample documentation in that file can better explain
+ what can be accomplished with this hook.">false</configboolean>
+ <configboolean name="messageview" required="false" desc="Should we
+ run a custom function in which array elements can be added to use in the
+ template file, while displaying the message text? If so, make sure
+ you define _dimp_hook_messageview() in config/hooks.php. The elements
+ will be available as template tags in the dimp/templates/imp/message.html
+ template file.">false</configboolean>
+ <configboolean name="addressformatting" required="false" desc="Should we
+ run a custom function that is used to format email addresses in message
+ headers? If so, make sure you define _dimp_hook_addressformatting() in
+ config/hooks.php.">false</configboolean>
+ <configboolean name="msglist_format" required="false" desc="Should we use
+ a custom function to provide additional information/custom formatting of
+ messages in the mailbox message list? If so, make sure you define
+ _dimp_hook_msglist_format() in config/hooks.php.">false</configboolean>
+ </configsection>
- <configlist name="css_files" required="false" desc="A list of additional CSS
- files to load from the dimp/themes/ directory."/>
+ <configlist name="css_files" required="false" desc="A list of additional CSS
+ files to load from the dimp/themes/ directory."/>
- <configheader>JavaScript Settings</configheader>
- <configsection name="js">
- <configboolean name="debug" required="false" desc="Turn on javascript
- debugging? Will cause popup alert windows to appear on various errors.
- This should be turned off for all production servers.">false</configboolean>
- </configsection>
+ <configheader>JavaScript Settings</configheader>
+ <configsection name="js">
+ <configboolean name="debug" required="false" desc="Turn on javascript
+ debugging? Will cause popup alert windows to appear on various errors.
+ This should be turned off for all production servers.">false</configboolean>
+ </configsection>
- <configheader>ViewPort Settings</configheader>
- <configsection name="viewport">
- <configinteger name="buffer_pages" desc="The number of viewable pages to
- send to the browser per server access when listing
- messages.">5</configinteger>
- <configinteger name="limit_factor" desc="When browsing through a message
- list, if a user comes within this percentage of the end of the current
- cached viewport, the browser will send a background request to the server
- to retrieve the next slice of the message list.">35</configinteger>
- <configinteger name="viewport_wait" desc="How long, in seconds, to wait
- before displaying an informational message to users that the message list is
- still being built. Set to 0 to disable messages.">12</configinteger>
- <configboolean name="background_inbox" required="false" desc="On initial
- login to the portal page, load the INBOX in the
- background?">true</configboolean>
- </configsection>
+ <configheader>ViewPort Settings</configheader>
+ <configsection name="viewport">
+ <configinteger name="buffer_pages" desc="The number of viewable pages to
+ send to the browser per server access when listing
+ messages.">5</configinteger>
+ <configinteger name="limit_factor" desc="When browsing through a message
+ list, if a user comes within this percentage of the end of the current
+ cached viewport, the browser will send a background request to the server
+ to retrieve the next slice of the message list.">35</configinteger>
+ <configinteger name="viewport_wait" desc="How long, in seconds, to wait
+ before displaying an informational message to users that the message list is
+ still being built. Set to 0 to disable messages.">12</configinteger>
+ <configboolean name="background_inbox" required="false" desc="On initial
+ login to the portal page, load the INBOX in the
+ background?">true</configboolean>
+ </configsection>
- <configheader>Search Settings</configheader>
- <configsection name="search">
- <configboolean name="search_all" desc="Allow user to search all mailboxes at
- a single time? Unless your mail server is optimized to perform searches,
- enabling this can cause massive server load if a user has a large
- mailbox.">false</configboolean>
- </configsection>
+ <configheader>Search Settings</configheader>
+ <configsection name="search">
+ <configboolean name="search_all" desc="Allow user to search all mailboxes
+ at a single time? Unless your mail server is optimized to perform searches,
+ enabling this can cause massive server load if a user has a large
+ mailbox.">false</configboolean>
+ </configsection>
- <configsection name="menu" desc="Menu Settings">
- <configheader>Menu Settings</configheader>
- <configmultienum name="apps" desc="Select any applications that should be
- linked in DIMP's menu">
- <values>
- <configspecial name="list-horde-apps" />
- </values>
- </configmultienum>
+ <configsection name="menu" desc="Menu Settings">
+ <configheader>Menu Settings</configheader>
+ <configmultienum name="apps" desc="Select any applications that should be
+ linked in DIMP's menu">
+ <values>
+ <configspecial name="list-horde-apps" />
+ </values>
+ </configmultienum>
+ </configsection>
</configsection>
</configtab>
</configuration>
// }
// }
-// This is an example for a post-sending hook that automatically prints all
-// messages that have been sent successfully.
+// This is an example for a post-sending hook that performs an action after
+// a message has been sent successfully.
+// $message = Base Horde_Mime_part object.
+// $headers = Horde_Mime_Headers object.
// if (!function_exists('_imp_hook_postsent')) {
// function _imp_hook_postsent($message, $headers)
// {
-// require_once IMP_BASE . '/lib/MIME/Contents.php';
-// require_once IMP_BASE . '/lib/UI/Message.php';
-//
-// IMP::$printMode = true;
-// $contents = new IMP_Contents($message);
-// $contents->showSummaryLinks(false);
-// $contents->buildMessage();
-// $attachments = $contents->getAttachments();
-// $msgText = $contents->getMessage();
-//
-// // @todo this is no longer good code.
-// $imp_ui = new IMP_UI_Message();
-// $basic_headers = $imp_ui->basicHeaders();
-// $headers->setValueByFunction('date', array('nl2br', array($headers, 'addLocalTime'), 'htmlspecialchars'));
-// if (($subject = $headers->getValue('subject'))) {
-// $subject = IMP::filterText($subject);
-// require_once 'Horde/Text.php';
-// $headers->setValue('subject', Text::htmlSpaces($subject));
-// } else {
-// $headers->addHeader('Subject', _("[No Subject]"));
-// }
-// $headers->buildAddressLinks('from', null, true, false);
-// foreach (array('to', 'cc', 'bcc') as $val) {
-// $headers->buildAddressLinks($val, null, true, false);
-// }
-// if ($reply_to = $headers->buildAddressLinks('reply-to', null, false, false)) {
-// if (!($from = $headers->getValue('from')) || ($from != $reply_to)) {
-// $headers->setValue('Reply-to', $reply_to);
-// } else {
-// $headers->removeHeader('reply-to');
-// }
-// }
-// $hdrs = array();
-// foreach ($basic_headers as $head => $str) {
-// if ($val = $headers->getValue($head)) {
-// $hdrs[] = array('name' => $str, 'val' => $val, 'i' => 0);
-// }
-// }
-// if ($val = $headers->getValue('priority')) {
-// $hdrs[] = array('name' => _("Priority"), 'val' => $val, 'i' => 0);
-// }
-// if (!empty($attachments)) {
-// $hdrs[] = array('name' => _("Part(s)"), 'val' => '<table cellspacing="2">' . $attachments . '</table>', 'i' => 0);
-// }
-//
-// require_once IMP_BASE . '/lib/Template.php';
-// $template = new IMP_Template();
-// $template->set('headers', $hdrs);
-// $template->set('msgtext', $msgText);
-// $printer_friendly = true;
-// require IMP_TEMPLATES . '/common-header.inc';
-// echo $template->fetch(IMP_TEMPLATES . '/message/message.html');
-// require $GLOBALS['registry']->get('templates', 'horde') . '/javascript/print.js';
-// require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc';
-// exit;
+// // Do entire action here -- no return value from this hook.
// }
// }
// if (!function_exists('_imp_hook_trailer')) {
// function _imp_hook_trailer($trailer)
// {
-// $vdomain = getenv('HTTP_HOST');
-// $vdomain = preg_replace('|^.*?\.|i', '', $vdomain);
-// $vdomain = String::lower($vdomain);
+// $vdomain = String::lower(preg_replace('|^.*?\.|i', '', getenv('HTTP_HOST')));
// $ldapServer = 'localhost';
// $ldapPort = '389';
// $searchBase = 'ispmanDomain=' . $vdomain . ",o=ispman";
//
-// $ds = @ldap_connect($ldapServer, $ldapPort);
-// $searchResult = @ldap_search($ds, $searchBase, 'uid=' . $vdomain);
-// $information = @ldap_get_entries($ds, $searchResult);
+// $old_error = error_reporting(0);
+// $ds = ldap_connect($ldapServer, $ldapPort);
+// $searchResult = ldap_search($ds, $searchBase, 'uid=' . $vdomain);
+// $information = ldap_get_entries($ds, $searchResult);
// $trailer= $information[0]['ispmandomainsignature'][0];
// ldap_close($ds);
+// error_reporting($old_error);
//
// return $trailer;
// }
// if (!function_exists('_imp_hook_vinfo')) {
// function _imp_hook_vinfo($type = 'username', $data = null)
// {
-// $vdomain = getenv('HTTP_HOST');
-// $vdomain = preg_replace('|^mail\.|i', '', $vdomain);
-// $vdomain = String::lower($vdomain);
+// $vdomain = String::lower(preg_replace('|^mail\.|i', '', getenv('HTTP_HOST')));
//
// switch ($type) {
// case 'username':
// // for preferences?
// $cmd = '/usr/local/bin/spamc';
// $username = Auth::getAuth();
+//
// // If you use the _sam_hook_username() hook, uncomment the next line
// //$username = _sam_hook_username($username);
// $username = escapeshellarg($username);
// // Read the new message from the temporary file
// $message = file_get_contents($file);
// unlink($file);
+//
// return $message;
// }
// }
// information in the message listing screen for a mailbox. This example hook
// will add a icon if the message contains attachments and will change the
// display of the message entry based on the X-Priority header.
+//
+// INPUT:
+// $uids - (array) A list of UIDs/mailboxes. Mailboxes are the keys; values
+// are the list of UIDs in the mailbox.
+// $mbox - (string) The current mailbox string (may be a search mailbox
+// string).
+// $mode - (string) Either 'imp' or 'dimp'.
+//
+// OUTPUT:
+// An array with Mailboxes as the keys, and an array of arrays as the value.
+// Each array consists of the UID (key) and the following array values:
+//
+// For IMP:
+// 'class' - (array) CSS classnames that will be added to the row.
+// 'flagbits' - (integer) Flag mask which will be OR'd with the current flags
+// set for the row. The flag constants used in IMP can be
+// found at the top of lib/IMP.php.
+// 'status' - (string) HTML code to add to the status column for the row.
+//
+// For DIMP:
+// 'atc' - (string) Attachment type (either 'signed', 'encrypted', or
+// 'attachment').
+// 'class' - (array) CSS classnames that will be added to the row.
// if (!function_exists('_imp_hook_msglist_format')) {
-// function _imp_hook_msglist_format($mailbox, $uid)
+// function _imp_hook_msglist_format($uids, $mbox, $mode)
// {
-// // Required return (array):
-// // 'class' - An array of CSS classnames that will be added to
-// // the row.
-// // 'flagbits' - An integer value which will be OR'd with the
-// // current flags set for the row. The IMAP flag
-// // constants used in IMP can be found at the top
-// // of lib/IMP.php.
-// // 'status' - HTML code to add to the status column for the row.
-// $ret = array('class' => array(), 'flagbits' => 0, 'status' => '');
-//
-// require_once IMP_BASE . '/lib/IMAP/MessageCache.php';
-// $cache = &IMP_MessageCache::singleton();
-// $cache_entry = $cache->retrieve($mailbox, array($uid), 8 | 32);
-// $ob = reset($cache_entry);
-//
-// // Add attachment information
-// $imp_ui = new IMP_UI_Mailbox($mailbox);
-// if (($attachment = $imp_ui->getAttachmentType($MIMETYPE))) {
-// $alt_list = IMP_UI_Mailbox::getAttachmentAltList();
-// $alt_text = (isset($list[$attachment])) ? $list[$attachment] : $list['attachment'];
-// $ret['status'] = Horde::img($attachment . '.png', $alt_text, array('title' => $alt_text));
-// }
+// $ret = array();
+//
+// $alt_list = IMP_UI_Mailbox::getAttachmentAltList();
+// $imp_ui = new IMP_UI_Mailbox($mbox);
+// $imp_msg_ui = new IMP_UI_Messsage();
+//
+// foreach ($uids as $mailbox => $uid_list) {
+// try {
+// $imap_res = $GLOBALS['imp_imap']->ob->fetch($mailbox, array(
+// Horde_Imap_Client::FETCH_HEADERS => array('headers' => array('x-priority'), 'label' => 'hdr_search', 'parse' => true, 'peek' => false),
+// Horde_Imap_Client::FETCH_STRUCTURE => array('parse' => true)
+// ), array('ids' => array_values($uid_list)));
+// } catch (Horde_Imap_Client_Exception $e) {
+// continue;
+// }
//
-// // Add xpriority information
-// switch ($ob->header->getXpriority()) {
-// case 'high':
-// $ret['flagbits'] = IMP_FLAGGED;
-// $ret['status'] .= Horde::img('mail_priority_high.png', _("High Priority"), array('title' => _("High Priority")));
-// $ret['class'][] = 'important';
-// break;
-//
-// case 'low':
-// $ret['status'] .= Horde::img('mail_priority_low.png', _("Low Priority"), array('title' => _("Low Priority")));
-// $ret['class'][] = 'unimportant';
-// break;
+// $ret[$mailbox] = array();
+//
+// foreach ($uid_list as $uid) {
+// $ret[$mailbox][$uid] = array();
+// $ptr = &$ret[$mailbox][$uid];
+// $res_ptr = &$imap_res[$uid];
+//
+// // Add attachment information
+// if (($attachment = $imp_ui->getAttachmentType($res_ptr['structure']->getType()))) {
+// switch ($mode) {
+// case 'imp':
+// $alt_text = (isset($list[$attachment]))
+// ? $list[$attachment]
+// : $list['attachment'];
+// $ptr['status'] = Horde::img($attachment . '.png', $alt_text, array('title' => $alt_text));
+// break;
+//
+// case 'dimp':
+// $ptr['atc'] = $attachment;
+// break;
+// }
+// }
+//
+// // Add X-Priority information
+// switch ($imp_msg_ui->getXpriority($res_ptr['headers']['hdr_search']->getValue('x-priority'))) {
+// case 'high':
+// if ($mode == 'imp') {
+// $ptr['flagbits'] = IMP::FLAG_FLAGGED;
+// $ptr['status'] .= Horde::img('mail_priority_high.png', _("High Priority"), array('title' => _("High Priority")));
+// }
+// $ptr['class'][] = 'important';
+// break;
+//
+// case 'low':
+// if ($mode == 'imp') {
+// $ptr['status'] .= Horde::img('mail_priority_low.png', _("Low Priority"), array('title' => _("Low Priority")));
+// }
+// $ptr['class'][] = 'unimportant';
+// break;
+// }
+// }
// }
//
// return $ret;
// if (!function_exists('_imp_hook_mbox_redirect')) {
// function _imp_hook_mbox_redirect($mailbox)
// {
-// require_once 'Horde/Kolab.php';
-//
-// if (strpos($mailbox, "INBOX/Calendar") !== false
-// || preg_match("!^user/[^/]+/Calendar!", $mailbox)) {
+// if ((strpos($mailbox, "INBOX/Calendar") !== false) ||
+// preg_match("!^user/[^/]+/Calendar!", $mailbox)) {
// return $GLOBALS['registry']->get('webroot', 'kronolith');
-// } elseif (strpos($mailbox, "INBOX/Tasks") !== false
-// || preg_match("!^user/[^/]+/Tasks!", $mailbox)) {
+// } elseif ((strpos($mailbox, "INBOX/Tasks") !== false) ||
+// preg_match("!^user/[^/]+/Tasks!", $mailbox)) {
// return $GLOBALS['registry']->get('webroot', 'nag');
-// } elseif (strpos($mailbox, "INBOX/Notes") !== false
-// || preg_match("!^user/[^/]+/Notes!", $mailbox)) {
+// } elseif ((strpos($mailbox, "INBOX/Notes") !== false) ||
+// preg_match("!^user/[^/]+/Notes!", $mailbox)) {
// return $GLOBALS['registry']->get('webroot', 'mnemo');
-// } elseif (strpos($mailbox, "INBOX/Contacts") !== false
-// || preg_match("!^user/[^/]+/Contacts!", $mailbox)) {
+// } elseif ((strpos($mailbox, "INBOX/Contacts") !== false) ||
+// preg_match("!^user/[^/]+/Contacts!", $mailbox)) {
// return $GLOBALS['registry']->get('webroot', 'turba');
// }
//
// trash folders.)
// If a mailbox name doesn't appear in the below list, the default mailbox
// icon is displayed.
-// Note that in IMP 4.2.x, the expected return value from this hook has
-// changed. See the below examples for more information.
// if (!function_exists('_imp_hook_mbox_icons')) {
// function _imp_hook_mbox_icons()
//
// foreach ($mailboxes as $box) {
// $box = preg_replace("/^{[^}]+}/", "", $box);
-// if (strpos($box, "INBOX/Calendar") !== false
-// || preg_match("!^user/[^/]+/Calendar!", $box)) {
-// $newmailboxes[$box] = Horde::img(
-// $GLOBALS['registry']->get('icon', 'kronolith'),
-// _("Calendar"),
-// 'width="16" height="16" style="vertical-align:middle"',
-// ''
-// );
+// if ((strpos($box, "INBOX/Calendar") !== false) ||
+// preg_match("!^user/[^/]+/Calendar!", $box)) {
// // Use this example for IMP 4.2.x+.
-// // $newmailboxes[$box] = array(
-// // 'icon' => 'kronolith.png',
-// // 'icondir' => $GLOBALS['registry']->getImageDir('kronolith')
-// // 'alt' => _("Calendar")
-// // );
-// } elseif (strpos($box, "INBOX/Tasks") !== false
-// || preg_match("!^user/[^/]+/Tasks!", $box)) {
-// $newmailboxes[$box] = Horde::img(
-// $GLOBALS['registry']->get('icon', 'nag'),
-// _("Tasks"),
-// 'width="16" height="16" style="vertical-align:middle"',
-// ''
+// $newmailboxes[$box] = array(
+// 'icon' => 'kronolith.png',
+// 'icondir' => $GLOBALS['registry']->getImageDir('kronolith')
+// 'alt' => _("Calendar")
// );
+// } elseif ((strpos($box, "INBOX/Tasks") !== false) ||
+// preg_match("!^user/[^/]+/Tasks!", $box)) {
// // Use this example for IMP 4.2.x+.
-// // $newmailboxes[$box] = array(
-// // 'icon' => 'nag.png',
-// // 'icondir' => $GLOBALS['registry']->getImageDir('nag')
-// // 'alt' => _("Tasks")
-// // );
-// } elseif (strpos($box, "INBOX/Notes") !== false
-// || preg_match("!^user/[^/]+/Notes!", $box)) {
-// $newmailboxes[$box] = Horde::img(
-// $GLOBALS['registry']->get('icon', 'mnemo'),
-// _("Notes"),
-// 'width="16" height="16" style="vertical-align:middle"',
-// ''
+// $newmailboxes[$box] = array(
+// 'icon' => 'nag.png',
+// 'icondir' => $GLOBALS['registry']->getImageDir('nag')
+// 'alt' => _("Tasks")
// );
+// } elseif ((strpos($box, "INBOX/Notes") !== false) ||
+// preg_match("!^user/[^/]+/Notes!", $box)) {
// // Use this example for IMP 4.2.x+.
-// // $newmailboxes[$box] = array(
-// // 'icon' => 'mnemo.png',
-// // 'icondir' => $GLOBALS['registry']->getImageDir('mnemo')
-// // 'alt' => _("Notes")
-// // );
-// } elseif (strpos($box, "INBOX/Contacts") !== false
-// || preg_match("!^user/[^/]+/Contacts!", $box)) {
-// $newmailboxes[$box] = Horde::img(
-// $GLOBALS['registry']->get('icon', 'turba'),
-// _("Contacts"),
-// 'width="16" height="16" style="vertical-align:middle"',
-// ''
+// $newmailboxes[$box] = array(
+// 'icon' => 'mnemo.png',
+// 'icondir' => $GLOBALS['registry']->getImageDir('mnemo')
+// 'alt' => _("Notes")
// );
+// } elseif ((strpos($box, "INBOX/Contacts") !== false) ||
+// preg_match("!^user/[^/]+/Contacts!", $box)) {
// // Use this example for IMP 4.2.x+.
-// // $newmailboxes[$box] = array(
-// // 'icon' => 'turba.png',
-// // 'icondir' => $GLOBALS['registry']->getImageDir('turba')
-// // 'alt' => _("Contacts")
-// // );
+// $newmailboxes[$box] = array(
+// 'icon' => 'turba.png',
+// 'icondir' => $GLOBALS['registry']->getImageDir('turba')
+// 'alt' => _("Contacts")
+// );
// }
// }
//
// Default Kolab hooks:
if (!empty($GLOBALS['conf']['kolab']['enabled'])) {
require_once 'Horde/Kolab.php';
+
if (!function_exists('_imp_hook_mbox_redirect')) {
function _imp_hook_mbox_redirect($mailbox)
{
}
-
-// This is an example hook function for the DIMP mailbox view. This function
-// is called for every message and allows additional information to be added
-// to the array that is passed to the mailbox display template -
+// This is an example hook function for the dynamic (dimp) mailbox view. This
+// function is allows additional information to be added to the array that is
+// is passed to the mailbox display template -
// dimp/templates/javascript/mailbox.js. The current entry array is passed
// in, the value returned should be the altered array to use in the
// template. If you are going to add new columns, you also have to update
// dimp/templates/index/index.inc to contain the new field in the header and
// dimp/themes/screen.css to specify the column width.
-// if (!function_exists('_dimp_hook_mailboxarray')) {
-// function _dimp_hook_mailboxarray($msg, $ob) {
-// $msg['foo'] = true;
+// if (!function_exists('_imp_hook_dimp_mailboxarray')) {
+// function _imp_hook_dimp_mailboxarray($msgs) {
+// foreach (array_keys($msgs) as $key) {
+// $msgs[$key]['foo'] = true;
+// }
+//
// return $msg;
// }
// }
-// This is an example hook function for the DIMP message view. This function
-// allows additional information to be added to the array that is passed to
-// the message text display template - dimp/templates/chunks/message.html.
-// The current entry array is passed in (see the showMessage() function in
-// dimp/lib/Views/ShowMessage.php for the format). The value returned should
-// be the altered array to use in the template. See the showMessage() function
-// in dimp/lib/Views/ShowMessage for the base values contained in the original
-// passed-in array.
-
-// if (!function_exists('_dimp_hook_messageview')) {
-// function _dimp_hook_messageview($msg) {
+// This is an example hook function for the dynamic (dimp) message view. This
+// function allows additional information to be added to the array that is
+// passed to the message text display template -
+// dimp/templates/chunks/message.html. The current entry array is passed in
+// (see the showMessage() function in lib/Views/ShowMessage.php for the
+// format). The value returned should be the altered array to use in the
+// template.
+
+// if (!function_exists('_imp_hook_dimp_messageview')) {
+// function _imp_hook_dimp_messageview($msg) {
// // Ex.: Add a new foo variable
// $msg['foo'] = '<div class="foo">BAR</div>';
// return $msg;
// }
// }
-// This is an example hook function for the DIMP preview view. This function
-// allows additional information to be added to the preview view and its
-// corresponding template - dimp/templates/index/index.inc. The current entry
-// array is passed in (see the showMessage() function in
-// dimp/lib/Views/ShowMessage.php for the format). Since the preview pane is
+
+// This is an example hook function for the dynamic (dimp) preview view. This
+// function allows additional information to be added to the preview view and
+// its corresponding template - dimp/templates/index/index.inc. The current
+// entry array is passed in (see the showMessage() function in
+// lib/Views/ShowMessage.php for the format). Since the preview pane is
// dynamically updated via javascript, all updates other than the base
// entries must be provided in javascript code to be run at update time. The
// expected return is a 2 element array - the first element is the original
// array with any changes made to the initial data. The second element is an
// array of javascript commands, one command per array value.
-// if (!function_exists('_dimp_hook_previewview')) {
-// function _dimp_hook_previewview($msg) {
+// if (!function_exists('_imp_hook_dimp_previewview')) {
+// function _imp_hook_dimp_previewview($msg) {
// // Ex.: Alter the subject
// $msg['subject'] .= 'test';
//
// This is an example hook function for the address formatting in email
// message headers. The argument passed to the function is an object with the
// following possible properties:
-// 'address' - Full address
-// 'display' - Display address
-// 'host' - Host name
-// 'inner' - Trimmed, bare address
-// 'personal' - Personal string
+// 'address' - Full address
+// 'display' - Display address
+// 'host' - Host name
+// 'inner' - Trimmed, bare address
+// 'personal' - Personal string
// The return value is the raw string to display for that address. This value
// must be properly escaped (i.e. htmlspecialchars() used on the portions of
// the string where appropriate).
-// if (!function_exists('_dimp_hook_addressformatting')) {
+// if (!function_exists('_imp_hook_dimp_addressformatting')) {
// function _dimp_hook_addressformatting($ob) {
-// return empty($ob->personal) ? $ob->address : $ob->personal;
-// }
-// }
-
-// This is an example hook function for displaying additional message
-// information in the message listing screen for a mailbox. This example hook
-// will add a icon if the message contains attachments and will change the
-// display of the message entry based on the X-Priority header.
-
-// if (!function_exists('_dimp_hook_msglist_format')) {
-// function _dimp_hook_msglist_format($mailbox, $uid)
-// {
-// // Required return (array):
-// // 'atc' - Attachment type (either 'signed', 'encrypted', or
-// // 'attachment').
-// // 'class' - An array of CSS classnames that will be added to
-// // the row.
-// $ret = array('atc' => '', 'class' => array());
-//
-// require_once IMP_BASE . '/lib/IMAP/MessageCache.php';
-// $cache = &IMP_MessageCache::singleton();
-// $cache_entry = $cache->retrieve($mailbox, array($uid), 8 | 32);
-// $ob = reset($cache_entry);
-//
-// // Add attachment information
-// $imp_ui = new IMP_UI_Mailbox($mailbox);
-// $ret['atc'] = $imp_ui->getAttachmentType($MIMETYPE);
-//
-// // Add xpriority information
-// switch ($ob->header->getXpriority()) {
-// case 'high':
-// $ret['class'][] = 'important';
-// break;
-//
-// case 'low':
-// $ret['class'][] = 'unimportant';
-// break;
-// }
-//
-// return $ret;
+// return empty($ob['personal']) ? $ob['address'] : $ob['personal'];
// }
// }
* imp_hook_vinfo has changed
* alternative_display, attachment_display pref is gone.
* imp_hook_spam_bounce -> imp_hook_spam_email
+* imp_hook_msglist_format input has changed.
Upgrading IMP From 4.1.x To 4.2.x
/* Call post-sent hook. */
if (!empty($conf['hooks']['postsent'])) {
- Horde::callHook('_imp_hook_postsent', array($save_msg['msg'], $msg_headers), 'imp', null);
+ Horde::callHook('_imp_hook_postsent', array($save_msg['msg'], $headers), 'imp', null);
}
return $sent_saved;
'ham_reporting' => (int) !empty($conf['notspam']['reporting']),
'ham_spamfolder' => (int) !empty($conf['notspam']['spamfolder']),
'refresh_time' => (int) $prefs->getValue('refresh_time'),
- 'search_all' => (int) !empty($conf['search']['search_all']),
+ 'search_all' => (int) !empty($conf['dimp']['search']['search_all']),
'fixed_folders' => empty($conf['server']['fixed_folders'])
? array()
'is_ie6' => ($browser->isBrowser('msie') && ($browser->getMajor() < 7)),
- 'buffer_pages' => intval($conf['viewport']['buffer_pages']),
- 'limit_factor' => intval($conf['viewport']['limit_factor']),
- 'viewport_wait' => intval($conf['viewport']['viewport_wait']),
+ 'buffer_pages' => intval($conf['dimp']['viewport']['buffer_pages']),
+ 'limit_factor' => intval($conf['dimp']['viewport']['limit_factor']),
+ 'viewport_wait' => intval($conf['dimp']['viewport']['viewport_wait']),
'login_view' => $prefs->getValue('login_view'),
- 'background_inbox' => !empty($conf['viewport']['background_inbox']),
+ 'background_inbox' => !empty($conf['dimp']['viewport']['background_inbox']),
// Turn debugging on?
- 'debug' => !empty($conf['js']['debug']),
+ 'debug' => !empty($conf['dimp']['js']['debug']),
);
/* Gettext strings used in core javascript files. */
*/
public function menuList()
{
- if (isset($GLOBALS['conf']['menu']['apps'])) {
- $apps = $GLOBALS['conf']['menu']['apps'];
+ if (isset($GLOBALS['conf']['dimp']['menu']['apps'])) {
+ $apps = $GLOBALS['conf']['dimp']['menu']['apps'];
if (is_array($apps) && count($apps)) {
return $apps;
}
}
if (!isset($mbox_icons)) {
- $mbox_icons = Horde::callHook('_imp_hook_mbox_icons', array(),
- 'imp', false);
+ $mbox_icons = Horde::callHook('_imp_hook_mbox_icons', array(), 'imp', false);
if (!$mbox_icons) {
return false;
}
if ($app == 'dimp') {
// Load custom stylesheets.
- if (!empty($conf['css_files'])) {
+ if (!empty($conf['dimp']['css_files'])) {
foreach ($conf['css_files'] as $css_file) {
$css[] = array('u' => $themesuri . '/' . $css_file,
'f' => $themesfs . '/' . $css_file);
* @return array An array with the following keys:
* <pre>
* 'overview' - (array) The overview information.
- * 'uids' - (array) The array of UIDs.
+ * 'uids' - (array) The array of UIDs. It is in the same format as used
+ * for IMP::parseIndicesList().
* </pre>
*/
public function getMailboxArray($msgnum, $preview = false,
{
$this->_buildMailbox();
- $mboxes = $overview = $uids = array();
+ $overview = $to_process = $uids = array();
/* Build the list of mailboxes and messages. */
foreach ($msgnum as $i) {
example, there may be gaps here. */
if (isset($this->_sorted[$i - 1])) {
$mboxname = ($this->_searchmbox) ? $this->_sortedInfo[$i - 1]['m'] : $this->_mailbox;
- if (!isset($mboxes[$mboxname])) {
- $mboxes[$mboxname] = array();
+ if (!isset($to_process[$mboxname])) {
+ $to_process[$mboxname] = array();
}
- // $mboxes - KEY: UID, VALUE: sequence number
- $mboxes[$mboxname][$this->_sorted[$i - 1]] = $i;
+ // $uids - KEY: UID, VALUE: sequence number
+ $to_process[$mboxname][$this->_sorted[$i - 1]] = $i;
}
}
$cacheob = $preview ? $GLOBALS['imp_imap']->ob->getCacheOb() : null;
/* Retrieve information from each mailbox. */
- foreach ($mboxes as $mbox => $ids) {
+ foreach ($to_process as $mbox => $ids) {
try {
$fetch_res = $GLOBALS['imp_imap']->ob->fetch($mbox, $fetch_criteria, array('ids' => array_keys($ids)));
$overview[$ids[$k]] = $v;
}
- $uids = array_merge($uids, array_keys($fetch_res));
+ $uids[$mbox] = array_keys($fetch_res);
if (!is_null($cacheob) && !empty($tostore)) {
$cacheob->set($mbox, $tostore);
/**
* Determines the X-Priority of the message based on the headers.
*
- * @param Horde_Mime_Headers $headers Horde_Mime_Headers object.
+ * @param string $header The X-Priority header.
*
* @return string 'high', 'low', or 'normal'.
*/
- public function getXpriority($headers)
+ public function getXpriority($header)
{
- if (($priority = $headers->getValue('x-priority')) &&
- preg_match('/\s*(\d+)\s*/', $priority, $matches)) {
+ if ($header && preg_match('/\s*(\d+)\s*/', $header, $matches)) {
if (in_array($matches[1], array(1, 2))) {
return 'high';
} elseif (in_array($matches[1], array(4, 5))) {
}
}
- $attachment = '';
- if (!empty($GLOBALS['conf']['hooks']['msglist_format'])) {
- $ob_f = Horde::callHook('_dimp_hook_msglist_format', array($ob['mailbox'], $ob['uid']), 'dimp');
- if (is_a($ob_f, 'PEAR_Error')) {
- Horde::logMessage($ob_f, __FILE__, __LINE__, PEAR_LOG_ERR);
- } else {
- $attachment = empty($ob_f['atc']) ? '' : $ob_f['atc'];
- if (!empty($ob_f['class'])) {
- $bg = array_merge($bg, $ob_f['class']);
- }
- }
- }
-
$msg['bg'] = $bg;
- /* Format attachment information. */
- if (!empty($attachment)) {
- $msg['atc'] = $attachment;
- }
-
/* Format size information. */
$msg['size'] = htmlspecialchars($imp_ui->getSize($ob['size']), ENT_QUOTES, $charset);
/* Format the Subject: Header. */
$msg['subject'] = $imp_ui->getSubject($ob['envelope']['subject']);
- if (!empty($GLOBALS['conf']['hooks']['mailboxarray'])) {
- $result = Horde::callHook('_dimp_hook_mailboxarray', array($msg, $ob), 'dimp');
- if (is_a($result, 'PEAR_Error')) {
- Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
- } else {
- $msg = $result;
- }
- }
-
/* Check to see if this is a list message. Namely, we want to
* check for 'List-Post' information because that is the header
* that gives the e-mail address to reply to, which is all we
}
}
+ /* Add user supplied information from hook. */
+ if (!empty($GLOBALS['conf']['dimp']['hooks']['msglist_format'])) {
+ $ob_f = Horde::callHook('_imp_hook_msglist_format', array($ob['mailbox'], $ob['uid']), 'dimp');
+
+ foreach ($ob_f as $mbox => $uids) {
+ foreach ($uids as $uid => $val) {
+ $ptr =& $search ? ($uid . $mbox) : $uid;
+
+ if (!empty($val['atc'])) {
+ $ptr['atc'] = $val['atc'];
+ }
+
+ if (!empty($val['class'])) {
+ $ptr['bg'] = array_merge($ptr['bg'], $val['class']);
+ }
+ }
+ }
+ }
+
+ /* Allow user to alter template array. */
+ if (!empty($GLOBALS['conf']['dimp']['hooks']['mailboxarray'])) {
+ $msgs = Horde::callHook('_imp_hook_dimp_mailboxarray', array($msgs), 'imp');
+ }
+
return $msgs;
}
}
}
$addr_array = array();
- $call_hook = !empty($GLOBALS['conf']['hooks']['addressformatting']);
+ $call_hook = !empty($GLOBALS['conf']['dimp']['hooks']['addressformatting']);
foreach (Horde_Mime_Address::getAddressesFromObject($addrlist) as $ob) {
if (empty($ob['address']) || empty($ob['inner'])) {
/* If this is an incomplete e-mail address, don't link to
* anything. */
if ($call_hook) {
- $result = Horde::callHook('_dimp_hook_addressformatting', array($ob), 'imp');
- if (is_a($result, 'PEAR_Error')) {
- Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
- } else {
- $addr_array[] = array('raw' => $result);
- }
+ $addr_array[] = array('raw' => Horde::callHook('_imp_hook_dimp_addressformatting', array($ob), 'imp'));
} else {
$tmp = array();
foreach (array('address', 'display', 'inner', 'personal') as $val) {
}
/* Get X-Priority. */
- $result['priority'] = $imp_ui->getXpriority($mime_headers);
+ $result['priority'] = $imp_ui->getXpriority($mime_headers->getValue('x-priority'));
// Create message text and attachment list.
$parts_list = $imp_contents->getContentTypeMap();
$result['atc_list'] = '<table>' . $tmp . '</table>';
}
- // TODO: Hooks
- if ($preview && !empty($GLOBALS['conf']['hooks']['previewview'])) {
- $res = Horde::callHook('_dimp_hook_previewview', array($result), 'dimp');
- if (is_a($res, 'PEAR_Error')) {
- Horde::logMessage($res, __FILE__, __LINE__, PEAR_LOG_ERR);
- } else {
+ if ($preview && !empty($GLOBALS['conf']['dimp']['hooks']['previewview'])) {
+ $res = Horde::callHook('_imp_hook_dimp_previewview', array($result), 'imp');
+ if (!empty($res)) {
$result = $res[0];
$result['js'] = $res[1];
}
- } elseif (!$preview && !empty($GLOBALS['conf']['hooks']['messageview'])) {
- $res = Horde::callHook('_dimp_hook_messageview', array($result), 'dimp');
- if (is_a($res, 'PEAR_Error')) {
- Horde::logMessage($res, __FILE__, __LINE__, PEAR_LOG_ERR);
- } else {
- $result = $res;
- }
+ } elseif (!$preview && !empty($GLOBALS['conf']['dimp']['hooks']['messageview'])) {
+ $result = Horde::callHook('_imp_hook_dimp_messageview', array($result), 'imp');
}
/* Retrieve any history information for this message. */
/* Format the from header. */
$getfrom = $imp_ui->getFrom($ob['envelope'], false);
$msg['from'] = $getfrom['from'];
- if (String::length($msg['from']) > $conf['mimp']['max_from_chars']) {
- $msg['from'] = String::substr($msg['from'], 0, $conf['mimp']['max_from_chars']) . '...';
+ if (String::length($msg['from']) > $conf['mimp']['mailbox']['max_from_chars']) {
+ $msg['from'] = String::substr($msg['from'], 0, $conf['mimp']['mailbox']['max_from_chars']) . '...';
}
$msg['subject'] = $imp_ui->getSubject($ob['envelope']['subject']);
$msg['subject'] = '>> ' . ltrim($msg['subject']);
}
- if (String::length($msg['subject']) > $conf['mimp']['max_subj_chars']) {
- $msg['subject'] = String::substr($msg['subject'], 0, $conf['mimp']['max_subj_chars']) . '...';
+ if (String::length($msg['subject']) > $conf['mimp']['mailbox']['max_subj_chars']) {
+ $msg['subject'] = String::substr($msg['subject'], 0, $conf['mimp']['mailbox']['max_subj_chars']) . '...';
}
/* Generate the target link. */
/* Get thread object, if necessary. */
if ($sortpref['by'] == Horde_Imap_Client::SORT_THREAD) {
$imp_thread = new IMP_IMAP_Thread($imp_mailbox->getThreadOb());
- $threadtree = $imp_thread->getThreadImageTree($mbox_info['uids'], $sortpref['dir']);
+ $threadtree = $imp_thread->getThreadImageTree(reset($mbox_info['uids']), $sortpref['dir']);
}
/* Don't show header row if this is a search mailbox or if no messages in the
require_once 'Horde/Text.php';
$ids = $msgs = array();
$search_template = null;
-while (list(,$ob) = each($mbox_info['overview'])) {
+while (list($seq, $ob) = each($mbox_info['overview'])) {
if ($search_mbox) {
if (empty($lastMbox) || ($ob['mailbox'] != $lastMbox)) {
if (!empty($lastMbox)) {
}
$folder_link = Horde::url(Util::addParameter('mailbox.php', 'mailbox', $ob['mailbox']));
$folder_link = Horde::link($folder_link, sprintf(_("View messages in %s"), IMP::displayFolder($ob['mailbox'])), 'smallheader') . IMP::displayFolder($ob['mailbox']) . '</a>';
- if ($search_template === null) {
+ if (is_null($search_template)) {
$search_template = new IMP_Template();
}
$search_template->set('lastMbox', $lastMbox);
'bg' => '',
'color' => '',
'date' => htmlspecialchars($imp_ui->getDate($ob['envelope']['date'])),
+ 'number' => $seq,
'preview' => '',
'size' => htmlspecialchars($imp_ui->getSize($ob['size'])),
'status' => '',
}
}
- if (!empty($conf['hooks']['msglist_format'])) {
- $ob_f = Horde::callHook('_imp_hook_msglist_format', array($ob['mailbox'], $ob['uid']), 'imp');
- if (!empty($ob_f['class'])) {
- $bg = array_merge($bg, $ob_f['class']);
- }
- if (!empty($ob_f['flagbits'])) {
- $flagbits |= $ob_f['flagbits'];
- }
- if (!empty($ob_f['status'])) {
- $msg['status'] .= $ob_f['status'];
- }
- }
-
$ids[$msg['id']] = $flagbits;
$msg['bg'] = implode(' ', $bg);
$msg['preview'] = $ptext;
}
- /* Set the message number. */
- $msg['number'] = $ob['seq'];
-
/* Format the From: Header. */
$getfrom = $imp_ui->getFrom($ob['envelope']);
$msg['from'] = htmlspecialchars($getfrom['from']);
}
}
- $msgs[] = $msg;
+ $msgs[$ob['uid'] . $ob['mailbox']] = $msg;
+}
+
+/* Add user supplied information from hook. */
+if (!empty($conf['hooks']['msglist_format'])) {
+ $ob_f = Horde::callHook('_imp_hook_msglist_format', array($mbox_info['uids'], $imp_mbox['mailbox'], 'imp'), 'imp');
+
+ foreach ($ob_f as $mbox => $uids) {
+ foreach ($uids as $uid => $val) {
+ $ptr = &$msgs[$uid . $mbox];
+
+ if (!empty($val['class'])) {
+ $ptr['bg'] = array_merge($ptr['bg'], $val['class']);
+ }
+
+ if (!empty($val['flagbits'])) {
+ $ids[$ptr['id']] |= $val['flagbits'];
+ }
+
+ if (!empty($val['status'])) {
+ $ptr['status'] .= $val['status'];
+ }
+ }
+ }
}
_outputSummaries($msgs);
$list_info = $imp_ui->getListInformation($mime_headers);
/* See if the 'X-Priority' header has been set. */
-switch ($imp_ui->getXpriority($mime_headers)) {
+$xpriority = $mime_headers->getValue('x-priority');
+switch ($imp_ui->getXpriority($xpriority)) {
case 'high':
case 'low':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = $mime_headers->getValue('x-priority');
+ $display_headers['priority'] = $xpriority;
break;
}
}
/* See if the 'X-Priority' header has been set. */
-switch ($imp_ui->getXpriority($mime_headers)) {
+$xpriority = $mime_headers->getValue('x-priority');
+switch ($imp_ui->getXpriority($xpriority)) {
case 'high':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = Horde::img('mail_priority_high.png', _("High Priority")) . ' ' . $mime_headers->getValue('x-priority');
+ $display_headers['priority'] = Horde::img('mail_priority_high.png', _("High Priority")) . ' ' . $xpriority;
break;
case 'low':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = Horde::img('mail_priority_low.png', _("Low Priority")) . ' ' . $mime_headers->getValue('x-priority');
+ $display_headers['priority'] = Horde::img('mail_priority_low.png', _("Low Priority")) . ' ' . $xpriority;
break;
}
<div id="qoptions">
<span class="qclose"><a>x</a></span>
<span class="qlabel"><?php echo _("Folders: ") ?></span>
-<?php if (!empty($conf['search']['search_all'])): ?>
+<?php if (!empty($conf['dimp']['search']['search_all'])): ?>
<a id="sf_all"><?php echo _("All") ?></a>
<?php endif; ?>
<a id="sf_current"></a>