$dimp_block_list = array();
// Show a folder summary of the mailbox. All polled folders are displayed.
-require_once IMP_BASE . '/lib/Block/foldersummary.php';
$dimp_block_list[_("Folder Summary")] = array(
- 'ob' => new Horde_Block_imp_foldersummary(array())
+ 'ob' => new IMP_Block_Foldersummary(array())
);
// Alternate DIMP block - shows details of 'msgs_shown' number of the most
// recent unseen messages.
-//require_once IMP_BASE . '/lib/Block/newmail.php';
//$dimp_block_list[_("Newest Unseen Messages")] = array(
-// 'ob' => new Horde_Block_imp_newmail(array('msgs_shown' => 3))
+// 'ob' => new IMP_Block_Newmail(array('msgs_shown' => 3))
//);
// Show a contact search box.
--- /dev/null
+<?php
+/**
+ * Copyright 2005-2009 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.
+ *
+ * @package Horde_Block
+ */
+
+class IMP_Block_Foldersummary extends Horde_Block
+{
+ var $_app = 'imp';
+
+ function _content()
+ {
+ if (!IMP::checkAuthentication(true)) {
+ return '';
+ }
+
+ /* Filter on INBOX display, if requested. */
+ if ($GLOBALS['prefs']->getValue('filter_on_display')) {
+ IMP_Filter::filter('INBOX');
+ }
+
+ /* Get list of mailboxes to poll. */
+ $imptree = &IMP_IMAP_Tree::singleton();
+ $folders = $imptree->getPollList(true, true);
+
+ $anyUnseen = false;
+ $newmsgs = array();
+ $html = '<table cellspacing="0" width="100%">';
+
+ foreach ($folders as $folder) {
+ if (($folder == 'INBOX') ||
+ ($_SESSION['imp']['protocol'] != 'pop')) {
+ $info = $imptree->getElementInfo($folder);
+ if (!empty($info)) {
+ if (empty($this->_params['show_unread']) ||
+ !empty($info['unseen'])) {
+ if (!empty($info['newmsg'])) {
+ $newmsgs[$folder] = $info['newmsg'];
+ }
+ $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'folder:' . htmlspecialchars($folder) . '\');return false;"><td>';
+ if (!empty($info['unseen'])) {
+ $html .= '<strong>';
+ $anyUnseen = true;
+ }
+ $html .= '<a>' . IMP::displayFolder($folder) . '</a>';
+ if (!empty($info['unseen'])) {
+ $html .= '</strong>';
+ }
+ $html .= '</td><td>' .
+ (!empty($info['unseen']) ? '<strong>' . $info['unseen'] . '</strong>' : '0') .
+ (!empty($this->_params['show_total']) ? '</td><td>(' . $info['messages'] . ')' : '') .
+ '</td></tr>';
+ }
+ }
+ }
+ }
+
+ $html .= '</table>';
+
+ if (count($newmsgs) == 0 && !empty($this->_params['show_unread'])) {
+ if (count($folders) == 0) {
+ $html = _("No folders are being checked for new mail.");
+ } elseif (!$anyUnseen) {
+ $html = '<em>' . _("No folders with unseen messages") . '</em>';
+ } elseif ($GLOBALS['prefs']->getValue('nav_popup')) {
+ $html = '<em>' . _("No folders with new messages") . '</em>';
+ }
+ }
+
+ return $html;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Copyright 2007-2009 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.
+ *
+ * @package Horde_Block
+ * @author Michael Slusarz <slusarz@curecanti.org>
+ */
+class IMP_Block_Newmail extends Horde_Block
+{
+ var $_app = 'imp';
+
+ function _content()
+ {
+ $GLOBALS['authentication'] = 'none';
+ require_once dirname(__FILE__) . '/../base.php';
+
+ if (!IMP::checkAuthentication(true)) {
+ return '';
+ }
+
+ /* Filter on INBOX display, if requested. */
+ if ($GLOBALS['prefs']->getValue('filter_on_display')) {
+ IMP_Filter::filter('INBOX');
+ }
+
+ $query = new Horde_Imap_Client_Search_Query();
+ $query->flag('\\seen', false);
+ $ids = $GLOBALS['imp_search']->runSearchQuery($query, 'INBOX', Horde_Imap_Client::SORT_ARRIVAL, 1);
+
+ $html = '<table cellspacing="0" width="100%">';
+ if (empty($ids)) {
+ $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
+ } else {
+ require_once 'Horde/Identity.php';
+
+ $charset = NLS::getCharset();
+ $imp_ui = new IMP_UI_Mailbox('INBOX');
+ $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
+
+ try {
+ $fetch_ret = $GLOBALS['imp_imap']->ob->fetch('INBOX', array(
+ Horde_Imap_Client::FETCH_ENVELOPE => true
+ ), array('ids' => array_slice($ids, 0, $shown)));
+ reset($fetch_ret);
+ } catch (Horde_Imap_Client_Exception $e) {
+ $fetch_ret = array();
+ }
+
+ while (list($uid, $ob) = each($fetch_ret)) {
+ $date = $imp_ui->getDate($ob['envelope']['date']);
+ $from = $imp_ui->getFrom($ob, array('specialchars' => $charset));
+ $subject = $imp_ui->getSubject($ob['envelope']['subject'], true);
+
+ $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'msg:INBOX:' . $uid . '\');return false;"><td>' .
+ '<strong>' . $from['from'] . '</strong><br />' .
+ $subject . '</td>' .
+ '<td>' . htmlspecialchars($date, ENT_QUOTES, $charset) . '</td></tr>';
+ }
+
+ $more_msgs = count($ids) - $shown;
+ $text = ($more_msgs > 0)
+ ? sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs)
+ : _("Go to your Inbox...");
+ $html .= '<tr><td colspan="2" style="cursor:pointer" align="right" onclick="DimpBase.go(\'folder:INBOX\');return false;">' . $text . '</td></tr>';
+ }
+
+ return $html . '</table>';
+ }
+
+}
+++ /dev/null
-<?php
-/**
- * Copyright 2005-2009 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.
- *
- * @package Horde_Block
- */
-
-class Horde_Block_imp_foldersummary extends Horde_Block
-{
- var $_app = 'imp';
-
- function _content()
- {
- if (!IMP::checkAuthentication(true)) {
- return '';
- }
-
- /* Filter on INBOX display, if requested. */
- if ($GLOBALS['prefs']->getValue('filter_on_display')) {
- IMP_Filter::filter('INBOX');
- }
-
- /* Get list of mailboxes to poll. */
- $imptree = &IMP_IMAP_Tree::singleton();
- $folders = $imptree->getPollList(true, true);
-
- $anyUnseen = false;
- $newmsgs = array();
- $html = '<table cellspacing="0" width="100%">';
-
- foreach ($folders as $folder) {
- if (($folder == 'INBOX') ||
- ($_SESSION['imp']['protocol'] != 'pop')) {
- $info = $imptree->getElementInfo($folder);
- if (!empty($info)) {
- if (empty($this->_params['show_unread']) ||
- !empty($info['unseen'])) {
- if (!empty($info['newmsg'])) {
- $newmsgs[$folder] = $info['newmsg'];
- }
- $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'folder:' . htmlspecialchars($folder) . '\');return false;"><td>';
- if (!empty($info['unseen'])) {
- $html .= '<strong>';
- $anyUnseen = true;
- }
- $html .= '<a>' . IMP::displayFolder($folder) . '</a>';
- if (!empty($info['unseen'])) {
- $html .= '</strong>';
- }
- $html .= '</td><td>' .
- (!empty($info['unseen']) ? '<strong>' . $info['unseen'] . '</strong>' : '0') .
- (!empty($this->_params['show_total']) ? '</td><td>(' . $info['messages'] . ')' : '') .
- '</td></tr>';
- }
- }
- }
- }
-
- $html .= '</table>';
-
- if (count($newmsgs) == 0 && !empty($this->_params['show_unread'])) {
- if (count($folders) == 0) {
- $html = _("No folders are being checked for new mail.");
- } elseif (!$anyUnseen) {
- $html = '<em>' . _("No folders with unseen messages") . '</em>';
- } elseif ($GLOBALS['prefs']->getValue('nav_popup')) {
- $html = '<em>' . _("No folders with new messages") . '</em>';
- }
- }
-
- return $html;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * Re
- * Copyright 2007-2009 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.
- *
- * @package Horde_Block
- * @author Michael Slusarz <slusarz@curecanti.org>
- */
-class Horde_Block_imp_newmail extends Horde_Block
-{
- var $_app = 'imp';
-
- function _content()
- {
- $GLOBALS['authentication'] = 'none';
- require_once dirname(__FILE__) . '/../base.php';
-
- if (!IMP::checkAuthentication(true)) {
- return '';
- }
-
- /* Filter on INBOX display, if requested. */
- if ($GLOBALS['prefs']->getValue('filter_on_display')) {
- IMP_Filter::filter('INBOX');
- }
-
- $query = new Horde_Imap_Client_Search_Query();
- $query->flag('\\seen', false);
- $ids = $GLOBALS['imp_search']->runSearchQuery($query, 'INBOX', Horde_Imap_Client::SORT_ARRIVAL, 1);
-
- $html = '<table cellspacing="0" width="100%">';
- if (empty($ids)) {
- $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
- } else {
- require_once 'Horde/Identity.php';
-
- $charset = NLS::getCharset();
- $imp_ui = new IMP_UI_Mailbox('INBOX');
- $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
-
- try {
- $fetch_ret = $GLOBALS['imp_imap']->ob->fetch('INBOX', array(
- Horde_Imap_Client::FETCH_ENVELOPE => true
- ), array('ids' => array_slice($ids, 0, $shown)));
- reset($fetch_ret);
- } catch (Horde_Imap_Client_Exception $e) {
- $fetch_ret = array();
- }
-
- while (list($uid, $ob) = each($fetch_ret)) {
- $date = $imp_ui->getDate($ob['envelope']['date']);
- $from = $imp_ui->getFrom($ob, array('specialchars' => $charset));
- $subject = $imp_ui->getSubject($ob['envelope']['subject'], true);
-
- $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'msg:INBOX:' . $uid . '\');return false;"><td>' .
- '<strong>' . $from['from'] . '</strong><br />' .
- $subject . '</td>' .
- '<td>' . htmlspecialchars($date, ENT_QUOTES, $charset) . '</td></tr>';
- }
-
- $more_msgs = count($ids) - $shown;
- $text = ($more_msgs > 0)
- ? sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs)
- : _("Go to your Inbox...");
- $html .= '<tr><td colspan="2" style="cursor:pointer" align="right" onclick="DimpBase.go(\'folder:INBOX\');return false;">' . $text . '</td></tr>';
- }
-
- return $html . '</table>';
- }
-
-}