$new = $imptree->createMailboxName(Horde_Util::getPost('parent'), $new);
$result = $imp_folder->create($new, $prefs->getValue('subscribe'));
if ($result) {
- $result = DIMP::getFolderResponse($imptree);
+ $result = IMP_Dimp::getFolderResponse($imptree);
}
} catch (Horde_Exception $e) {
$notification->push($e, 'horde.error');
$imp_folder = IMP_Folder::singleton();
$result = $imp_folder->delete(array($mbox));
if ($result) {
- $result = DIMP::getFolderResponse($imptree);
+ $result = IMP_Dimp::getFolderResponse($imptree);
}
break;
if ($old != $new) {
$result = $imp_folder->rename($old, $new);
if ($result) {
- $result = DIMP::getFolderResponse($imptree);
+ $result = IMP_Dimp::getFolderResponse($imptree);
}
}
} catch (Horde_Exception $e) {
if (Horde_Util::getPost('unsub')) {
$mask |= IMP_Imap_Tree::FLIST_UNSUB;
}
- $result = DIMP::getFolderResponse($imptree, array('a' => $imptree->folderList($mask), 'c' => array(), 'd' => array()));
+ $result = IMP_Dimp::getFolderResponse($imptree, array('a' => $imptree->folderList($mask), 'c' => array(), 'd' => array()));
$quota = _getQuota();
if (!is_null($quota)) {
$result = new stdClass;
// Can't open read-only since we need to store the message cache id.
$result->imp_compose = $imp_compose->getCacheId();
- $result->fwd_list = DIMP::getAttachmentInfo($imp_compose);
+ $result->fwd_list = IMP_Dimp::getAttachmentInfo($imp_compose);
$result->body = $fwd_msg['body'];
$result->header = $header;
$result->format = $fwd_msg['format'];
if ($action == 'add_attachment') {
if ($_SESSION['imp']['file_upload'] &&
$imp_compose->addFilesFromUpload('file_')) {
- $info = DIMP::getAttachmentInfo($imp_compose);
+ $info = IMP_Dimp::getAttachmentInfo($imp_compose);
$result->success = 1;
$result->info = end($info);
$result->imp_compose = $imp_compose->getCacheId();
if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) {
$in_reply_to = $imp_compose->getMetadata('in_reply_to');
if (!empty($in_reply_to) &&
- ($tmp = DIMP::getMsgLogInfo($in_reply_to))) {
+ ($tmp = IMP_Dimp::getMsgLogInfo($in_reply_to))) {
$result->log = $tmp;
}
}
- $res = DIMP::getFolderResponse($imptree);
+ $res = IMP_Dimp::getFolderResponse($imptree);
if (!empty($res)) {
$result->folder = $res['a'][0];
}
/* Some actions, like adding forwards, may return error messages so explicitly
* display those messages now. */
-Horde::addInlineScript(array(DIMP::notify()), 'dom');
+Horde::addInlineScript(array(IMP_Dimp::notify()), 'dom');
/* Javascript to be run on window load. */
$compose_result['js_onload'][] = 'DimpCompose.fillForm(' . Horde_Serialize::serialize($msg, Horde_Serialize::JSON) . ', ' . Horde_Serialize::serialize($header, Horde_Serialize::JSON) . ', "' . (($type == 'new' || $type == 'forward') ? 'to' : 'message') . '", true)';
array('compose-dimp.js', 'imp', true)
);
-DIMP::header(_("Message Composition"), $scripts);
+IMP_Dimp::header(_("Message Composition"), $scripts);
echo $t->fetch('compose.html');
Horde::includeScriptFiles();
Horde::outputInlineScript();
$menu = new Horde_Mobile_card('o', _("Menu"));
$mset = &$menu->add(new Horde_Mobile_linkset());
-MIMP::addMIMPMenu($mset, 'compose');
+IMP_Mimp::addMIMPMenu($mset, 'compose');
if ($actionID == 'rc') {
require IMP_TEMPLATES . '/compose/redirect-mimp.inc';
}
Horde::addInlineScript($js_code, true);
-DIMP::header('', $scripts);
+IMP_Dimp::header('', $scripts);
/* Get application folders list. */
$application_folders = array();
-foreach (DIMP::menuList() as $app) {
+foreach (IMP_Dimp::menuList() as $app) {
if ($registry->get('status', $app) != 'inactive' &&
$registry->hasPermission($app, PERMS_SHOW)) {
$application_folders[] = array(
},
// Folder actions.
- // For format of the ob object, see DIMP::_createFolderElt().
+ // For format of the ob object, see IMP_Dimp::_createFolderElt().
createFolder: function(ob)
{
var div, f_node, ftype, li, ll, parent_e, tmp,
$GLOBALS['imp_authentication'] = 'throw';
require_once dirname(__FILE__) . '/base.php';
if (IMP::getViewMode() == 'dimp') {
- Horde::addInlineScript(array(DIMP::notify(true)), 'dom');
+ Horde::addInlineScript(array(IMP_Dimp::notify(true)), 'dom');
return;
}
} catch (Horde_Exception $e) {}
+++ /dev/null
-<?php
-/**
- * DIMP Base Class - provides dynamic view functions.
- *
- * 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.
- *
- * @author Michael Slusarz <slusarz@horde.org>
- * @package IMP
- */
-class DIMP
-{
- /**
- * Output a dimp-style action (menubar) link.
- *
- * @param array $params A list of parameters.
- * <pre>
- * 'app' - The application to load the icon from.
- * 'class' - The CSS classname to use for the link.
- * 'icon' - The icon CSS classname.
- * 'id' - The DOM ID of the link.
- * 'title' - The title string.
- * 'tooltip' - Tooltip text to use.
- * </pre>
- *
- * @return string An HTML link to $url.
- */
- static public function actionButton($params = array())
- {
- $tooltip = (empty($params['tooltip'])) ? '' : $params['tooltip'];
-
- if (empty($params['title'])) {
- $old_error = error_reporting(0);
- $tooltip = nl2br(htmlspecialchars($tooltip, ENT_QUOTES, Horde_Nls::getCharset()));
- $title = $ak = '';
- } else {
- $title = $params['title'];
- $ak = Horde::getAccessKey($title);
- }
-
- return Horde::link('', $tooltip,
- empty($params['class']) ? '' : $params['class'],
- '', '', '', $ak,
- empty($params['id']) ? array() : array('id' => $params['id']),
- !empty($title))
- . (!empty($params['icon'])
- ? '<span class="iconImg dimpaction' . $params['icon'] . '"></span>'
- : '')
- . $title . '</a>';
- }
-
- /**
- * Output everything up to but not including the <body> tag.
- *
- * @param string $title The title of the page.
- * @param array $scripts Any additional scripts that need to be loaded.
- * Each entry contains the three elements necessary
- * for a Horde::addScriptFile() call.
- */
- static public function header($title, $scripts = array())
- {
- // Need to include script files before we start output
- $core_scripts = array(
- array('effects.js', 'horde', true),
- array('horde.js', 'horde', true),
- array('DimpCore.js', 'imp', true),
- array('Growler.js', 'horde', true)
- );
- foreach (array_merge($core_scripts, $scripts) as $val) {
- call_user_func_array(array('Horde', 'addScriptFile'), $val);
- }
-
- $page_title = $GLOBALS['registry']->get('name');
- if (!empty($title)) {
- $page_title .= ' :: ' . $title;
- }
-
- $GLOBALS['imp_view'] = 'dimp';
- include IMP_BASE . '/templates/common-header.inc';
-
- // Send what we have currently output so the browser can start
- // loading CSS/JS. See:
- // http://developer.yahoo.com/performance/rules.html#flush
- flush();
- }
-
- /**
- * Return an appended IMP folder string
- */
- static private function _appendedFolderPref($folder)
- {
- return IMP::folderPref($folder, true);
- }
-
- /**
- * Return the javascript code necessary to display notification popups.
- *
- * @param boolean $parent Send notifications to parent window?
- *
- * @return string The notification JS code.
- */
- static public function notify($parent = false)
- {
- $GLOBALS['notification']->notify(array('listeners' => 'status'));
- $msgs = $GLOBALS['imp_notify']->getStack();
-
- return count($msgs)
- ? ($parent ? 'parent.' : '') . 'DimpCore.showNotifications(' . Horde_Serialize::serialize($msgs, Horde_Serialize::JSON) . ')'
- : '';
- }
-
- /**
- * Formats the response to send to javascript code when dealing with
- * folder operations.
- *
- * @param IMP_Tree $imptree An IMP_Tree object.
- * @param array $changes An array with three sub arrays - to be used
- * instead of the return from
- * $imptree->eltDiff():
- * 'a' - a list of folders/objects to add
- * 'c' - a list of changed folders
- * 'd' - a list of folders to delete
- *
- * @return array The object used by the JS code to update the folder tree.
- */
- static public function getFolderResponse($imptree, $changes = null)
- {
- if (is_null($changes)) {
- $changes = $imptree->eltDiff();
- }
- if (empty($changes)) {
- return false;
- }
-
- $result = array();
-
- if (!empty($changes['a'])) {
- $result['a'] = array();
- foreach ($changes['a'] as $val) {
- $result['a'][] = self::_createFolderElt(is_array($val) ? $val : $imptree->element($val));
- }
- }
-
- if (!empty($changes['c'])) {
- $result['c'] = array();
- foreach ($changes['c'] as $val) {
- // Skip the base element, since any change there won't ever be
- // updated on-screen.
- if ($val != IMP_Imap_Tree::BASE_ELT) {
- $result['c'][] = self::_createFolderElt($imptree->element($val));
- }
- }
- }
-
- if (!empty($changes['d'])) {
- $result['d'] = array_map('rawurlencode', array_reverse($changes['d']));
- }
-
- return $result;
- }
-
- /**
- * Create an object used by DimpCore to generate the folder tree.
- *
- * @param array $elt The output from IMP_Tree::element().
- *
- * @return stdClass The element object. Contains the following items:
- * <pre>
- * 'ch' (children) = Does the folder contain children? [boolean]
- * [DEFAULT: no]
- * 'cl' (class) = The CSS class. [string] [DEFAULT: 'base']
- * 'co' (container) = Is this folder a container element? [boolean]
- * [DEFAULT: no]
- * 'i' (icon) = A user defined icon to use. [string] [DEFAULT: none]
- * 'l' (label) = The folder display label. [string] [DEFAULT: 'm' val]
- * 'm' (mbox) = The mailbox value. [string]
- * 'pa' (parent) = The parent element. [string] [DEFAULT:
- * DIMP.conf.base_mbox]
- * 'po' (polled) = Is the element polled? [boolean] [DEFAULT: no]
- * 's' (special) = Is this a "special" element? [boolean] [DEFAULT: no]
- * 't' (title) = The title value. [string] [DEFAULT: 'm' val]
- * 'u' (unseen) = The number of unseen messages. [integer]
- * 'un' (unsubscribed) = Is this folder unsubscribed? [boolean]
- * [DEFAULT: no]
- * 'v' (virtual) = Is this a virtual folder? [boolean] [DEFAULT: no]
- * </pre>
- */
- static private function _createFolderElt($elt)
- {
- $ob = new stdClass;
-
- if ($elt['children']) {
- $ob->ch = 1;
- }
- $ob->m = $elt['value'];
- if ($ob->m != $elt['name']) {
- $ob->l = $elt['name'];
- }
- if ($elt['parent'] != IMP_Imap_Tree::BASE_ELT) {
- $ob->pa = $elt['parent'];
- }
- if ($elt['polled']) {
- $ob->po = 1;
- }
- if ($elt['vfolder']) {
- $ob->v = 1;
- }
- if (!$elt['sub']) {
- $ob->un = 1;
- }
-
- $tmp = IMP::getLabel($ob->m);
- if ($tmp != $ob->m) {
- $ob->t = $tmp;
- }
-
- if ($elt['container']) {
- $ob->co = 1;
- $ob->cl = 'exp';
- } else {
- if ($elt['polled']) {
- $ob->u = intval($elt['unseen']);
- }
-
- switch ($elt['special']) {
- case IMP_Imap_Tree::SPECIAL_INBOX:
- $ob->cl = 'inbox';
- $ob->s = 1;
- break;
-
- case IMP_Imap_Tree::SPECIAL_TRASH:
- $ob->cl = 'trash';
- $ob->s = 1;
- break;
-
- case IMP_Imap_Tree::SPECIAL_SPAM:
- $ob->cl = 'spam';
- $ob->s = 1;
- break;
-
- case IMP_Imap_Tree::SPECIAL_DRAFT:
- $ob->cl = 'drafts';
- $ob->s = 1;
- break;
-
- case IMP_Imap_Tree::SPECIAL_SENT:
- $ob->cl = 'sent';
- $ob->s = 1;
- break;
-
- default:
- if ($elt['vfolder']) {
- if ($GLOBALS['imp_search']->isVTrashFolder($elt['value'])) {
- $ob->cl = 'trash';
- } elseif ($GLOBALS['imp_search']->isVINBOXFolder($elt['value'])) {
- $ob->cl = 'inbox';
- }
- } elseif ($elt['children']) {
- $ob->cl = 'exp';
- }
- break;
- }
- }
-
- if ($elt['user_icon']) {
- $ob->cl = 'customimg';
- $dir = empty($elt['icondir'])
- ? $GLOBALS['registry']->getImageDir()
- : $elt['icondir'];
- $ob->i = empty($dir)
- ? $elt['icon']
- : $dir . '/' . $elt['icon'];
- }
-
- return $ob;
- }
-
- /**
- * Return information about the current attachments for a message
- *
- * @param IMP_Compose $imp_compose An IMP_Compose object.
- *
- * @return array An array of arrays with the following keys:
- * <pre>
- * 'number' - The current attachment number
- * 'name' - The HTML encoded attachment name
- * 'type' - The MIME type of the attachment
- * 'size' - The size of the attachment in KB (string)
- * </pre>
- */
- static public function getAttachmentInfo($imp_compose)
- {
- $fwd_list = array();
-
- if ($imp_compose->numberOfAttachments()) {
- foreach ($imp_compose->getAttachments() as $atc_num => $data) {
- $mime = $data['part'];
-
- $fwd_list[] = array(
- 'number' => $atc_num,
- 'name' => htmlspecialchars($mime->getName(true)),
- 'type' => $mime->getType(),
- 'size' => $mime->getSize()
- );
- }
- }
-
- return $fwd_list;
- }
-
- /**
- * Return a list of DIMP specific menu items.
- *
- * @return array The array of menu items.
- */
- static public function menuList()
- {
- if (isset($GLOBALS['conf']['dimp']['menu']['apps'])) {
- $apps = $GLOBALS['conf']['dimp']['menu']['apps'];
- if (is_array($apps) && count($apps)) {
- return $apps;
- }
- }
- return array();
- }
-
- /**
- * Build data structure needed by DimpCore javascript to display message
- * log information.
- *
- * @var string $msg_id The Message-ID header of the message.
- *
- * @return array An array of information that can be parsed by
- * DimpCore.updateInfoList().
- */
- static public function getMsgLogInfo($msg_id)
- {
- $ret = array();
-
- foreach (IMP_Maillog::parseLog($msg_id) as $val) {
- $ret[] = array_map('htmlspecialchars', array(
- 'm' => $val['msg'],
- 't' => $val['action']
- ));
- }
-
- return $ret;
- }
-
-}
--- /dev/null
+<?php
+/**
+ * DIMP Base Class - provides dynamic view functions.
+ *
+ * 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.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package IMP
+ */
+class IMP_Dimp
+{
+ /**
+ * Output a dimp-style action (menubar) link.
+ *
+ * @param array $params A list of parameters.
+ * <pre>
+ * 'app' - The application to load the icon from.
+ * 'class' - The CSS classname to use for the link.
+ * 'icon' - The icon CSS classname.
+ * 'id' - The DOM ID of the link.
+ * 'title' - The title string.
+ * 'tooltip' - Tooltip text to use.
+ * </pre>
+ *
+ * @return string An HTML link to $url.
+ */
+ static public function actionButton($params = array())
+ {
+ $tooltip = (empty($params['tooltip'])) ? '' : $params['tooltip'];
+
+ if (empty($params['title'])) {
+ $old_error = error_reporting(0);
+ $tooltip = nl2br(htmlspecialchars($tooltip, ENT_QUOTES, Horde_Nls::getCharset()));
+ $title = $ak = '';
+ } else {
+ $title = $params['title'];
+ $ak = Horde::getAccessKey($title);
+ }
+
+ return Horde::link('', $tooltip,
+ empty($params['class']) ? '' : $params['class'],
+ '', '', '', $ak,
+ empty($params['id']) ? array() : array('id' => $params['id']),
+ !empty($title))
+ . (!empty($params['icon'])
+ ? '<span class="iconImg dimpaction' . $params['icon'] . '"></span>'
+ : '')
+ . $title . '</a>';
+ }
+
+ /**
+ * Output everything up to but not including the <body> tag.
+ *
+ * @param string $title The title of the page.
+ * @param array $scripts Any additional scripts that need to be loaded.
+ * Each entry contains the three elements necessary
+ * for a Horde::addScriptFile() call.
+ */
+ static public function header($title, $scripts = array())
+ {
+ // Need to include script files before we start output
+ $core_scripts = array(
+ array('effects.js', 'horde', true),
+ array('horde.js', 'horde', true),
+ array('DimpCore.js', 'imp', true),
+ array('Growler.js', 'horde', true)
+ );
+ foreach (array_merge($core_scripts, $scripts) as $val) {
+ call_user_func_array(array('Horde', 'addScriptFile'), $val);
+ }
+
+ $page_title = $GLOBALS['registry']->get('name');
+ if (!empty($title)) {
+ $page_title .= ' :: ' . $title;
+ }
+
+ $GLOBALS['imp_view'] = 'dimp';
+ include IMP_BASE . '/templates/common-header.inc';
+
+ // Send what we have currently output so the browser can start
+ // loading CSS/JS. See:
+ // http://developer.yahoo.com/performance/rules.html#flush
+ flush();
+ }
+
+ /**
+ * Return an appended IMP folder string
+ */
+ static private function _appendedFolderPref($folder)
+ {
+ return IMP::folderPref($folder, true);
+ }
+
+ /**
+ * Return the javascript code necessary to display notification popups.
+ *
+ * @param boolean $parent Send notifications to parent window?
+ *
+ * @return string The notification JS code.
+ */
+ static public function notify($parent = false)
+ {
+ $GLOBALS['notification']->notify(array('listeners' => 'status'));
+ $msgs = $GLOBALS['imp_notify']->getStack();
+
+ return count($msgs)
+ ? ($parent ? 'parent.' : '') . 'DimpCore.showNotifications(' . Horde_Serialize::serialize($msgs, Horde_Serialize::JSON) . ')'
+ : '';
+ }
+
+ /**
+ * Formats the response to send to javascript code when dealing with
+ * folder operations.
+ *
+ * @param IMP_Tree $imptree An IMP_Tree object.
+ * @param array $changes An array with three sub arrays - to be used
+ * instead of the return from
+ * $imptree->eltDiff():
+ * 'a' - a list of folders/objects to add
+ * 'c' - a list of changed folders
+ * 'd' - a list of folders to delete
+ *
+ * @return array The object used by the JS code to update the folder tree.
+ */
+ static public function getFolderResponse($imptree, $changes = null)
+ {
+ if (is_null($changes)) {
+ $changes = $imptree->eltDiff();
+ }
+ if (empty($changes)) {
+ return false;
+ }
+
+ $result = array();
+
+ if (!empty($changes['a'])) {
+ $result['a'] = array();
+ foreach ($changes['a'] as $val) {
+ $result['a'][] = self::_createFolderElt(is_array($val) ? $val : $imptree->element($val));
+ }
+ }
+
+ if (!empty($changes['c'])) {
+ $result['c'] = array();
+ foreach ($changes['c'] as $val) {
+ // Skip the base element, since any change there won't ever be
+ // updated on-screen.
+ if ($val != IMP_Imap_Tree::BASE_ELT) {
+ $result['c'][] = self::_createFolderElt($imptree->element($val));
+ }
+ }
+ }
+
+ if (!empty($changes['d'])) {
+ $result['d'] = array_map('rawurlencode', array_reverse($changes['d']));
+ }
+
+ return $result;
+ }
+
+ /**
+ * Create an object used by DimpCore to generate the folder tree.
+ *
+ * @param array $elt The output from IMP_Tree::element().
+ *
+ * @return stdClass The element object. Contains the following items:
+ * <pre>
+ * 'ch' (children) = Does the folder contain children? [boolean]
+ * [DEFAULT: no]
+ * 'cl' (class) = The CSS class. [string] [DEFAULT: 'base']
+ * 'co' (container) = Is this folder a container element? [boolean]
+ * [DEFAULT: no]
+ * 'i' (icon) = A user defined icon to use. [string] [DEFAULT: none]
+ * 'l' (label) = The folder display label. [string] [DEFAULT: 'm' val]
+ * 'm' (mbox) = The mailbox value. [string]
+ * 'pa' (parent) = The parent element. [string] [DEFAULT:
+ * DIMP.conf.base_mbox]
+ * 'po' (polled) = Is the element polled? [boolean] [DEFAULT: no]
+ * 's' (special) = Is this a "special" element? [boolean] [DEFAULT: no]
+ * 't' (title) = The title value. [string] [DEFAULT: 'm' val]
+ * 'u' (unseen) = The number of unseen messages. [integer]
+ * 'un' (unsubscribed) = Is this folder unsubscribed? [boolean]
+ * [DEFAULT: no]
+ * 'v' (virtual) = Is this a virtual folder? [boolean] [DEFAULT: no]
+ * </pre>
+ */
+ static private function _createFolderElt($elt)
+ {
+ $ob = new stdClass;
+
+ if ($elt['children']) {
+ $ob->ch = 1;
+ }
+ $ob->m = $elt['value'];
+ if ($ob->m != $elt['name']) {
+ $ob->l = $elt['name'];
+ }
+ if ($elt['parent'] != IMP_Imap_Tree::BASE_ELT) {
+ $ob->pa = $elt['parent'];
+ }
+ if ($elt['polled']) {
+ $ob->po = 1;
+ }
+ if ($elt['vfolder']) {
+ $ob->v = 1;
+ }
+ if (!$elt['sub']) {
+ $ob->un = 1;
+ }
+
+ $tmp = IMP::getLabel($ob->m);
+ if ($tmp != $ob->m) {
+ $ob->t = $tmp;
+ }
+
+ if ($elt['container']) {
+ $ob->co = 1;
+ $ob->cl = 'exp';
+ } else {
+ if ($elt['polled']) {
+ $ob->u = intval($elt['unseen']);
+ }
+
+ switch ($elt['special']) {
+ case IMP_Imap_Tree::SPECIAL_INBOX:
+ $ob->cl = 'inbox';
+ $ob->s = 1;
+ break;
+
+ case IMP_Imap_Tree::SPECIAL_TRASH:
+ $ob->cl = 'trash';
+ $ob->s = 1;
+ break;
+
+ case IMP_Imap_Tree::SPECIAL_SPAM:
+ $ob->cl = 'spam';
+ $ob->s = 1;
+ break;
+
+ case IMP_Imap_Tree::SPECIAL_DRAFT:
+ $ob->cl = 'drafts';
+ $ob->s = 1;
+ break;
+
+ case IMP_Imap_Tree::SPECIAL_SENT:
+ $ob->cl = 'sent';
+ $ob->s = 1;
+ break;
+
+ default:
+ if ($elt['vfolder']) {
+ if ($GLOBALS['imp_search']->isVTrashFolder($elt['value'])) {
+ $ob->cl = 'trash';
+ } elseif ($GLOBALS['imp_search']->isVINBOXFolder($elt['value'])) {
+ $ob->cl = 'inbox';
+ }
+ } elseif ($elt['children']) {
+ $ob->cl = 'exp';
+ }
+ break;
+ }
+ }
+
+ if ($elt['user_icon']) {
+ $ob->cl = 'customimg';
+ $dir = empty($elt['icondir'])
+ ? $GLOBALS['registry']->getImageDir()
+ : $elt['icondir'];
+ $ob->i = empty($dir)
+ ? $elt['icon']
+ : $dir . '/' . $elt['icon'];
+ }
+
+ return $ob;
+ }
+
+ /**
+ * Return information about the current attachments for a message
+ *
+ * @param IMP_Compose $imp_compose An IMP_Compose object.
+ *
+ * @return array An array of arrays with the following keys:
+ * <pre>
+ * 'number' - The current attachment number
+ * 'name' - The HTML encoded attachment name
+ * 'type' - The MIME type of the attachment
+ * 'size' - The size of the attachment in KB (string)
+ * </pre>
+ */
+ static public function getAttachmentInfo($imp_compose)
+ {
+ $fwd_list = array();
+
+ if ($imp_compose->numberOfAttachments()) {
+ foreach ($imp_compose->getAttachments() as $atc_num => $data) {
+ $mime = $data['part'];
+
+ $fwd_list[] = array(
+ 'number' => $atc_num,
+ 'name' => htmlspecialchars($mime->getName(true)),
+ 'type' => $mime->getType(),
+ 'size' => $mime->getSize()
+ );
+ }
+ }
+
+ return $fwd_list;
+ }
+
+ /**
+ * Return a list of DIMP specific menu items.
+ *
+ * @return array The array of menu items.
+ */
+ static public function menuList()
+ {
+ if (isset($GLOBALS['conf']['dimp']['menu']['apps'])) {
+ $apps = $GLOBALS['conf']['dimp']['menu']['apps'];
+ if (is_array($apps) && count($apps)) {
+ return $apps;
+ }
+ }
+ return array();
+ }
+
+ /**
+ * Build data structure needed by DimpCore javascript to display message
+ * log information.
+ *
+ * @var string $msg_id The Message-ID header of the message.
+ *
+ * @return array An array of information that can be parsed by
+ * DimpCore.updateInfoList().
+ */
+ static public function getMsgLogInfo($msg_id)
+ {
+ $ret = array();
+
+ foreach (IMP_Maillog::parseLog($msg_id) as $val) {
+ $ret[] = array_map('htmlspecialchars', array(
+ 'm' => $val['msg'],
+ 't' => $val['action']
+ ));
+ }
+
+ return $ret;
+ }
+
+}
+++ /dev/null
-<?php
-/**
- * MIMP Base Class - provides minimalist view functions.
- *
- * Copyright 1999-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.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @author Michael Slusarz <slusarz@horde.org>
- * @package IMP
- */
-class MIMP
-{
- /**
- * Take a Horde_Mobile_card and add global menu items.
- *
- * @param Horde_Mobile_linkset $menu The menu linkset, with page-specific
- * options already filled in.
- * @param string $page The current page ('compose',
- * 'folders', 'mailbox', 'message').
- */
- public function addMIMPMenu($menu, $page)
- {
- $items = array();
-
- if (!in_array($page, array('mailbox', 'message')) ||
- ($GLOBALS['imp_mbox']['mailbox'] != 'INBOX')) {
- $items[IMP::generateIMPUrl('mailbox-mimp.php', 'INBOX')] = _("Inbox");
- }
-
- if (($page != 'compose') && IMP::canCompose()) {
- $items[Horde_Util::addParameter(Horde::applicationUrl('compose-mimp.php'), 'u', uniqid(mt_rand()))] = _("New Message");
- }
-
- if ($page != 'folders') {
- $items[Horde::applicationUrl('folders-mimp.php')] = _("Folders");
- }
-
- $items[Horde::getServiceLink('logout', 'imp')] = _("Log out");
-
- foreach ($items as $link => $label) {
- $menu->add(new Horde_Mobile_link($label, $link));
- }
-
- $menu = new Horde_Menu();
- foreach ($menu->getSiteLinks() as $menuitem) {
- if ($menuitem != 'separator') {
- $menu->add(new Horde_Mobile_link($menuitem['text'], $menuitem['url']));
- }
- }
- }
-
-}
--- /dev/null
+<?php
+/**
+ * MIMP Base Class - provides minimalist view functions.
+ *
+ * Copyright 1999-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.
+ *
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package IMP
+ */
+class IMP_Mimp
+{
+ /**
+ * Take a Horde_Mobile_card and add global menu items.
+ *
+ * @param Horde_Mobile_linkset $menu The menu linkset, with page-specific
+ * options already filled in.
+ * @param string $page The current page ('compose',
+ * 'folders', 'mailbox', 'message').
+ */
+ public function addMIMPMenu($menu, $page)
+ {
+ $items = array();
+
+ if (!in_array($page, array('mailbox', 'message')) ||
+ ($GLOBALS['imp_mbox']['mailbox'] != 'INBOX')) {
+ $items[IMP::generateIMPUrl('mailbox-mimp.php', 'INBOX')] = _("Inbox");
+ }
+
+ if (($page != 'compose') && IMP::canCompose()) {
+ $items[Horde_Util::addParameter(Horde::applicationUrl('compose-mimp.php'), 'u', uniqid(mt_rand()))] = _("New Message");
+ }
+
+ if ($page != 'folders') {
+ $items[Horde::applicationUrl('folders-mimp.php')] = _("Folders");
+ }
+
+ $items[Horde::getServiceLink('logout', 'imp')] = _("Log out");
+
+ foreach ($items as $link => $label) {
+ $menu->add(new Horde_Mobile_link($label, $link));
+ }
+
+ $menu = new Horde_Menu();
+ foreach ($menu->getSiteLinks() as $menuitem) {
+ if ($menuitem != 'separator') {
+ $menu->add(new Horde_Mobile_link($menuitem['text'], $menuitem['url']));
+ }
+ }
+ }
+
+}
/* Grab maillog information. */
if (!empty($GLOBALS['conf']['maillog']['use_maillog']) &&
- ($tmp = DIMP::getMsgLogInfo($envelope['message-id']))) {
+ ($tmp = IMP_Dimp::getMsgLogInfo($envelope['message-id']))) {
$result['log'] = $tmp;
}
}
}
-MIMP::addMIMPMenu($mset, 'mailbox');
+IMP_Mimp::addMIMPMenu($mset, 'mailbox');
require IMP_TEMPLATES . '/mailbox/mailbox-mimp.inc';
$show_msg_result = $show_msg->showMessage($args);
if (isset($show_msg_result['error'])) {
echo Horde::wrapInlineScript(array(
- DIMP::notify(),
+ IMP_Dimp::notify(),
'parent.close()'
));
exit;
}
Horde::addInlineScript($js_out);
-Horde::addInlineScript(array(DIMP::notify()), 'dom');
+Horde::addInlineScript(array(IMP_Dimp::notify()), 'dom');
-DIMP::header($show_msg_result['subject'], $scripts);
+IMP_Dimp::header($show_msg_result['subject'], $scripts);
echo "<body>\n";
require IMP_TEMPLATES . '/chunks/message.php';
Horde::includeScriptFiles();
$mset->add(new Horde_Mobile_link(sprintf(_("To %s"), IMP::getLabel($imp_mbox['mailbox'])), $mailbox_link));
-MIMP::addMIMPMenu($mset, 'message');
+IMP_Mimp::addMIMPMenu($mset, 'message');
$mimp_render->set('title', $display_headers['subject']);
} else {
$params['title'] = $text;
}
- echo DIMP::actionButton($params);
+ echo IMP_Dimp::actionButton($params);
}
?>
} else {
$params['tooltip'] = $text;
}
- echo DIMP::actionButton($params);
+ echo IMP_Dimp::actionButton($params);
}
?>
if ($subscribe) {
$mset->add(new Horde_Mobile_link($sub_text, $sub_link));
}
-MIMP::addMIMPMenu($mset, 'folders');
+IMP_Mimp::addMIMPMenu($mset, 'folders');
$mimp_render->add($menu);
$mimp_render->display();
} else {
$params['tooltip'] = $text;
}
- echo DIMP::actionButton($params);
+ echo IMP_Dimp::actionButton($params);
}
function _simpleButton($id, $text, $image, $imagedir = null)
$app_urls = $code = $flags = array();
-foreach (DIMP::menuList() as $app) {
+foreach (IMP_Dimp::menuList() as $app) {
$app_urls[$app] = Horde::url($GLOBALS['registry']->getInitialPage($app), true);
}