? $this->linkViewJS($mime_part, 'view_attach', htmlspecialchars($description), array('jstext' => sprintf(_("View %s [%s]"), $description, $mime_type), 'params' => $param_array))
: htmlspecialchars($description);
} elseif ($mask & self::SUMMARY_DESCRIP_NOLINK) {
- $part['description'] = htmlspecialchars($description);
+ $part['description'] = $description;
}
/* Download column. */
$text = preg_replace('/(\n+)> ?From(\s+)/', "$1From$2", $text);
}
+ $text = IMP::filterText($text);
+
/* Done processing if in mimp mode. */
if ($_SESSION['imp']['view'] == 'mimp') {
return array(
$mime_id => array(
- 'data' => IMP::filterText($text),
+ 'data' => $text,
'status' => array(),
'type' => $type
)
$filters['dimsignature'] = array();
}
- // Filter bad language.
- if ($prefs->getValue('filtering')) {
- $filters['words'] = array(
- 'words_file' => $conf['msgsettings']['filtering']['words'],
- 'replacement' => $conf['msgsettings']['filtering']['replacement']
- );
- }
-
if ($prefs->getValue('emoticons')) {
$filters['emoticons'] = array('entities' => true);
}
$date_str = strftime($GLOBALS['prefs']->getValue('date_format'), $ltime);
$time_str = strftime($GLOBALS['prefs']->getValue('time_format'), $ltime);
$tz = strftime('%Z');
+
if ((date('Y') != @date('Y', $ltime)) ||
(date('M') != @date('M', $ltime)) ||
(date('d') != @date('d', $ltime))) {
/* Not today, use the date. */
- $date .= ' <small>' . htmlspecialchars(sprintf('[%s %s %s]', $date_str, $time_str, $tz)) . '</small>';
+ $local_date = sprintf('[%s %s %s]', $date_str, $time_str, $tz);
} else {
/* Else, it's today, use the time only. */
- $date .= ' <small>' . htmlspecialchars(sprintf('[%s %s]', $time_str, $tz)) . '</small>';
+ $local_date = sprintf('[%s %s]', $time_str, $tz);
}
+
+ $date .= ($_SESSION['imp']['view'] == 'mimp')
+ ? ' ' . $local_date
+ : ' <small>' . htmlspecialchars($local_date) . '</small>';
}
return $date;
{
global $prefs, $registry;
- $add_link = null;
-
/* Make sure this is a valid object address field. */
if (empty($addrlist) || !is_array($addrlist)) {
return null;
}
+ $add_link = null;
+ $addr_array = array();
+ $mimp_view = ($_SESSION['imp']['view'] == 'mimp');
+
/* Set up the add address icon link if contact manager is
* available. */
if (!is_null($addURL) && $link && $prefs->getValue('add_source')) {
$add_link = $registry->link('contacts/add', array('source' => $prefs->getValue('add_source')));
if (is_a($add_link, 'PEAR_Error')) {
- if ($registry->hasMethod('contacts/import')) {
- $add_link = Util::addParameter($addURL, 'actionID', 'add_address');
- } else {
- $add_link = null;
- }
+ $add_link = $registry->hasMethod('contacts/import')
+ ? Util::addParameter($addURL, 'actionID', 'add_address')
+ : null;
}
}
- $addr_array = array();
-
foreach (Horde_Mime_Address::getAddressesFromObject($addrlist) as $ob) {
if (isset($ob['groupname'])) {
$group_array = array();
continue;
}
- $ret = htmlspecialchars($ad->display);
+ $ret = $mimp_view
+ ? $ad->display
+ : htmlspecialchars($ad->display);
/* If this is an incomplete e-mail address, don't link to
* anything. */
$group_array[] = $ret;
}
- $addr_array[] = htmlspecialchars($ob['groupname']) . ':' . (count($group_array) ? ' ' . implode(', ', $group_array) : '');
+ if (!$mimp_view) {
+ $ob['groupname'] = htmlspecialchars($ob['groupname']);
+ }
+
+ $addr_array[] = $ob['groupname'] . ':' . (count($group_array) ? ' ' . implode(', ', $group_array) : '');
} elseif (!empty($ob['address']) && !empty($ob['inner'])) {
- $ret = htmlspecialchars($ob['display']);
+ $ret = $mimp_view
+ ? $ob['display']
+ : htmlspecialchars($ob['display']);
/* If this is an incomplete e-mail address, don't link to
* anything. */
}
}
+ if ($_SESSION['imp']['view'] == 'mimp') {
+ return implode(', ', $addr_array);
+ }
+
/* If left with an empty address list ($ret), inform the user that the
* recipient list is purposely "undisclosed". */
if (empty($addr_array)) {
*/
function _imp_batchCompose($args = array(), $extra = array())
{
- // TODO: Fix
- if (isset($_SESSION['imp']['view']) &&
- $_SESSION['imp']['view'] != 'imp') {
- return $GLOBALS['registry']->callByPackage($_SESSION['imp']['view'], 'batchCompose', array($args, $extra));
- }
-
$GLOBALS['authentication'] = 'none';
$GLOBALS['noset_view'] = true;
require_once dirname(__FILE__) . '/base.php';
/* Set the status information of the message. */
$status = '';
$identity = null;
-$addresses = array();
if (!$use_pop) {
if (!empty($msgAddresses)) {
$identity = $user_identity->getMatchingIdentity($msgAddresses);
}
$next_msg = $imp_mailbox->getIMAPIndex(1);
if ($next_msg) {
- $next_link = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $next_msg['index'], $next_msg['mailbox']);
+ $next_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $next_msg['index'], $next_msg['mailbox']);
}
/* Create the body of the message. */
-// TODO
-//$msgText = $mimp_contents->getMessage();
-$msgText = 'TODO';
+$parts_list = $imp_contents->getContentTypeMap();
+$atc_parts = $display_ids = array();
+$body_shown = false;
+$msg_text = '';
+
+foreach ($parts_list as $mime_id => $mime_type) {
+ if (in_array($mime_id, $display_ids, true)) {
+ continue;
+ }
+
+ if ($body_shown ||
+ !($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO))) {
+ if ($imp_contents->isAttachment($mime_type)) {
+ $atc_parts[] = $mime_id;
+ }
+ continue;
+ }
+
+ $render_part = $imp_contents->renderMIMEPart($mime_id, $render_mode);
+ if (($render_mode & IMP_Contents::RENDER_INLINE) && empty($render_part)) {
+ /* This meant that nothing was rendered - allow this part to appear
+ * in the attachment list instead. */
+ $atc_parts[] = $mime_id;
+ continue;
+ }
+
+ while (list($id, $info) = each($render_part)) {
+ if ($body_shown) {
+ $atc_parts[] = $id;
+ continue;
+ }
+
+ if (empty($info)) {
+ continue;
+ }
+
+ $body_shown = true;
+ $msg_text = $info['data'];
+ }
+}
/* Display the first 250 characters, or display the entire message? */
if ($prefs->getValue('mimp_preview_msg') && !Util::getFormData('fullmsg')) {
- $msgText = String::substr($msgText, 0, 250) . " [...]\n";
+ $msg_text = String::substr($msg_text, 0, 250) . " [...]\n";
$fullmsg_link = new Horde_Mobile_link(_("View Full Message"), Util::addParameter($self_link, array('fullmsg' => 1)));
} else {
$fullmsg_link = null;
$t->set('linebreaks', true);
}
-/* TODO
-foreach (array_keys($this->_atc) as $key) {
-$part = $this->_message->getPart($key);
-if ($part !== false) {
-$hb->add(new Horde_Mobile_text(_("Attachment") . ': ', array('b')));
-$t = &$hb->add(new Horde_Mobile_text(sprintf('%s (%s KB)', $part->getName(true, true), $part->getSize()) . "\n"));
-$t->set('linebreaks', true);
-}
+foreach ($atc_parts as $key) {
+ $summary = $imp_contents->getSummary($key, IMP_Contents::SUMMARY_SIZE | IMP_Contents::SUMMARY_DESCRIP_NOLINK);
+ $hb->add(new Horde_Mobile_text(_("Attachment") . ': ', array('b')));
+ $t = &$hb->add(new Horde_Mobile_text(sprintf('%s %s', $summary['description'], $summary['size']) . "\n"));
+ $t->set('linebreaks', true);
}
- */
-$t = &$c->add(new Horde_Mobile_text($msgText));
+$t = &$c->add(new Horde_Mobile_text($msg_text));
$t->set('linebreaks', true);
if (!is_null($fullmsg_link)) {