From: Michael M Slusarz
- * 'mobile' - (Horde_Mobile) The mobile object to send status lines to.
- *
+ * @param array $options An array of options. Not used.
*/
public function notify($events, $options = array())
{
Horde::addInlineScript(array(
- 'var ajax_dc = window.DimpCore || parent.DimpCore',
- 'if (ajax_dc) { ajax_dc.showNotifications(' . Horde_Serialize::serialize($events, Horde_Serialize::JSON) . ') }'
+ 'if (window.DimpCore || parent.DimpCore) { (window.DimpCore || parent.DimpCore).showNotifications(' . Horde_Serialize::serialize($events, Horde_Serialize::JSON) . ') }'
), 'dom');
}
diff --git a/imp/lib/Ui/Mimp.php b/imp/lib/Ui/Mimp.php
new file mode 100644
index 000000000..b5882ebe3
--- /dev/null
+++ b/imp/lib/Ui/Mimp.php
@@ -0,0 +1,56 @@
+
+ * @author Michael Slusarz ';
+ foreach ($items as $val) {
+ $out .= '
';
+ }
+
+}
diff --git a/imp/mailbox-mimp.php b/imp/mailbox-mimp.php
index 9de9bcda1..489996494 100644
--- a/imp/mailbox-mimp.php
+++ b/imp/mailbox-mimp.php
@@ -24,20 +24,21 @@ require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('imp', array('impmode' => 'mimp'));
Horde_Nls::setTimeZone();
+$imp_ui_mimp = $injector->getInstance('IMP_Ui_Mimp');
+$vars = Horde_Variables::getDefaultVariables();
+
+/* Initialize Horde_Template. */
+$t = $injector->createInstance('Horde_Template');
+$t->setOption('gettext', true);
/* Determine if mailbox is readonly. */
$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']);
-/* Need Horde_Mobile init here for autoloading purposes. */
-$mimp_render = new Horde_Mobile();
-
-/* Create mailbox menu. */
-$menu = new Horde_Mobile_card('o', _("Menu"));
-$mset = $menu->add(new Horde_Mobile_linkset());
+/* Get the base URL for this page. */
+$mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']);
/* Run through the action handlers */
-$actionID = Horde_Util::getFormData('a');
-switch ($actionID) {
+switch ($vars->a) {
// 'm' = message missing
case 'm':
$notification->push(_("There was an error viewing the requested message."), 'horde.error');
@@ -52,58 +53,60 @@ case 'e':
// 'c' = change sort
case 'c':
- IMP::setSort(Horde_Util::getFormData('sb'), Horde_Util::getFormData('sd'));
+ IMP::setSort($vars->sb, $vars->sd);
break;
// 's' = search
case 's':
- IMP_Mimp::addMIMPMenu($mset, 'search');
- require IMP_TEMPLATES . '/mailbox/search-mimp.inc';
+ $title = sprintf(_("Search %s"), IMP::getLabel($imp_mbox['mailbox']));
+
+ $t->set('mailbox', $imp_mbox['mailbox']);
+ $t->set('menu', $imp_ui_mimp->getMenu('search'));
+ $t->set('title', $title);
+ $t->set('url', $mailbox_url);
+
+ require_once IMP_TEMPLATES . '/common-header.inc';
+ IMP::status();
+ echo $t->fetch(IMP_TEMPLATES . '/mailbox/search-mimp.html');
exit;
// 'rs' = run search
case 'rs':
- $search_query = Horde_Util::getFormData('search');
- if (!empty($search_query) &&
+ if (!empty($vars->search) &&
($_SESSION['imp']['protocol'] == 'imap')) {
$query = new Horde_Imap_Client_Search_Query();
- $query->text($search_query, false);
+ $query->text($vars->search, false);
/* Create the search query and reset the global $imp_mbox variable. */
- $sq = $imp_search->createSearchQuery($query, array(Horde_Util::getFormData('mailbox')), array(), _("Search Results"));
+ $sq = $imp_search->createSearchQuery($query, array($imp_mbox['mailbox']), array(), _("Search Results"));
IMP::setCurrentMailboxInfo($imp_search->createSearchID($sq));
- /* Need to re-calculate the read-only value. */
+ /* Need to re-calculate these values. */
$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']);
+ $mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']);
}
break;
}
-/* Get the base URL for this page. */
-$mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']);
-
/* Build the list of messages in the mailbox. */
$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox']);
-$pageOb = $imp_mailbox->buildMailboxPage(Horde_Util::getFormData('p'), Horde_Util::getFormData('s'));
+$pageOb = $imp_mailbox->buildMailboxPage($vars->p, $vars->s);
-/* Generate page links. */
-$pages_first = $pages_prev = $pages_last = $pages_next = null;
-if ($pageOb['page'] != 1) {
- $pages_first = new Horde_Mobile_link(_("First Page"), $mailbox_url->copy()->add('p', 1));
- $pages_prev = new Horde_Mobile_link(_("Previous Page"), $mailbox_url->copy()->add('p', $pageOb['page'] - 1));
-}
-if ($pageOb['page'] != $pageOb['pagecount']) {
- $pages_next = new Horde_Mobile_link(_("Next Page"), $mailbox_url->copy()->add('p', $pageOb['page'] + 1));
- $pages_last = new Horde_Mobile_link(_("Last Page"), $mailbox_url->copy()->add('p', $pageOb['pagecount']));
-}
-
-/* Generate mailbox summary string. */
+/* Generate page title. */
$title = IMP::getLabel($imp_mbox['mailbox']);
-$mimp_render->set('title', $title);
+
+/* Modify title for display on page. */
if ($pageOb['msgcount']) {
- $msgcount = $pageOb['msgcount'];
$unseen = $imp_mailbox->unseenMessages(Horde_Imap_Client::SORT_RESULTS_COUNT);
+ $title .= ' (' . $unseen . '/' . $pageOb['msgcount'] . ')';
+}
+if ($pageOb['pagecount'] > 1) {
+ $title .= ' - ' . $pageOb['page'] . ' ' . _("of") . ' ' . $pageOb['pagecount'];
}
+if ($readonly) {
+ $title .= ' [' . _("Read-Only") . ']';
+}
+$t->set('title', $title);
$curr_time = time();
$curr_time -= $curr_time % 60;
@@ -128,15 +131,12 @@ while (list(,$ob) = each($mbox_info['overview'])) {
/* Initialize the header fields. */
$msg = array(
'status' => '',
- 'subject' => $imp_ui->getSubject($ob['envelope']['subject'])
+ 'subject' => trim($imp_ui->getSubject($ob['envelope']['subject']))
);
/* Format the from header. */
$getfrom = $imp_ui->getFrom($ob['envelope']);
- $msg['from'] = $getfrom['from'];
- if (Horde_String::length($msg['from']) > $prefs->getValue('mimp_max_from_chars')) {
- $msg['from'] = Horde_String::substr($msg['from'], 0, $prefs->getValue('mimp_max_from_chars')) . '...';
- }
+ $msg['from'] = Horde_String::truncate($getfrom['from'], 20);
/* Get flag information. */
$flag_parse = $injector->getInstance('IMP_Imap_Flags')->parse(array(
@@ -149,22 +149,16 @@ while (list(,$ob) = each($mbox_info['overview'])) {
if (isset($val['abbrev'])) {
$msg['status'] .= $val['abbrev'];
} elseif ($val['type'] == 'imapp') {
- $msg['subject'] = '*' .
- ((Horde_String::length($val['label']) > 8)
- ? Horde_String::substr($val['label'], 0, 5) . '...'
- : $val['label']
- ) .
- '* ' . $msg['subject'];
+ $msg['subject'] = '*' . Horde_String::truncate($val['label'], 8) . '* ' . $msg['subject'];
}
}
- if (!empty($threadtree[$ob['uid']])) {
- $msg['subject'] = $threadtree[$ob['uid']] . trim($msg['subject']);
- }
+ $msg['subject'] = Horde_String::truncate($msg['subject'], 30);
- if (Horde_String::length($msg['subject']) > $prefs->getValue('mimp_max_subj_chars')) {
- $msg['subject'] = Horde_String::substr($msg['subject'], 0, $prefs->getValue('mimp_max_subj_chars')) . '...';
- }
+ /* Thread display. */
+ $msg['thread'] = empty($threadtree[$ob['uid']])
+ ? ''
+ : $threadtree[$ob['uid']];
/* Generate the target link. */
$msg['target'] = in_array('\\draft', $ob['flags'])
@@ -173,65 +167,74 @@ while (list(,$ob) = each($mbox_info['overview'])) {
$msgs[] = $msg;
}
+$t->set('msgs', $msgs);
$mailbox = $mailbox_url->copy()->add('p', $pageOb['page']);
-$items = array(array(_("Refresh"), $mailbox));
+$menu = array(array(_("Refresh"), $mailbox));
$search_mbox = $imp_search->isSearchMbox($imp_mbox['mailbox']);
/* Determine if we are going to show the Purge Deleted link. */
if (!$readonly &&
!$prefs->getValue('use_trash') &&
!$imp_search->isVINBOXFolder()) {
- $items[] = array(_("Purge Deleted"), $mailbox->copy()->add('a', 'e'));
+ $menu[] = array(_("Purge Deleted"), $mailbox->copy()->add('a', 'e'));
}
-/* Create sorting links. */
-$sort = array();
-$sort_list = array(
- Horde_Imap_Client::SORT_ARRIVAL => '#',
- Horde_Imap_Client::SORT_FROM => _("From"),
- Horde_Imap_Client::SORT_SUBJECT => _("Subject")
+/* Create header links. */
+$hdr_list = array(
+ 'hdr_arrival' => array('#', Horde_Imap_Client::SORT_ARRIVAL),
+ 'hdr_from' => array(_("From"), Horde_Imap_Client::SORT_FROM),
+ 'hdr_subject' => array(_("Subject"), Horde_Imap_Client::SORT_SUBJECT),
+ 'hdr_thread' => array(_("Thread"), Horde_Imap_Client::SORT_THREAD)
);
-foreach ($sort_list as $key => $val) {
- if ($sortpref['limit']) {
- $sort[$key] = (($key == Horde_Imap_Client::SORT_ARRIVAL) ? '*' : '') . $val;
+foreach ($hdr_list as $key => $val) {
+ if ($search_mbox ||
+ $sortpref['limit'] && ($key != 'hdr_arrival')) {
+ $t->set($key, $val[0]);
} else {
- $sortdir = $sortpref['dir'];
- $sortkey = $key;
- if (($key == Horde_Imap_Client::SORT_SUBJECT) &&
- IMP::threadSortAvailable($mailbox) &&
- !$search_mbox) {
- if (is_null($imp_thread)) {
- $items[] = array(_("Sort by Thread"), $mailbox->copy()->add(array('a' => 'c', 'sb' => Horde_Imap_Client::SORT_THREAD, 'sd' => $sortdir)));
- } else {
- $sortkey = Horde_Imap_Client::SORT_THREAD;
- $items[] = array(_("Do Not Sort by Thread"), $mailbox->copy()->add(array('a' => 'c', 'sb' => Horde_Imap_Client::SORT_SUBJECT, 'sd' => $sortdir)));
- }
- }
- if ($sortpref['by'] == $key) {
- $val = '*' . $val;
- $sortdir = !$sortdir;
+ $sort_link = $mailbox->copy()->add(array('a' => 'c', 'sb' => $val[1]));
+ if ($sortpref['by'] == $val[1]) {
+ $t->set($key, $val[0] . ' ' . ($sortpref['dir'] ? '^' : 'v') . '');
+ } else {
+ $t->set($key, '' . $val[0] . '');
}
- $sort[$key] = new Horde_Mobile_link($val, $mailbox->copy()->add(array('a' => 'c', 'sb' => $sortkey, 'sd' => $sortdir)));
}
}
-/* Add search link. */
+/* Add thread header entry. */
if (!$search_mbox &&
- ($_SESSION['imp']['protocol'] == 'imap')) {
- $items[] = array(_("Search"), $mailbox_url->copy()->add('a', 's'));
+ !$sortpref['limit'] &&
+ IMP::threadSortAvailable($mailbox)) {
+ if (is_null($imp_thread)) {
+ $t->set('hdr_subject_minor', $t->get('hdr_thread'));
+ } else {
+ $t->set('hdr_subject_minor', $t->get('hdr_subject'));
+ $t->set('hdr_subject', $t->get('hdr_thread'));
+ }
}
-foreach ($items as $val) {
- $mset->add(new Horde_Mobile_link($val[0], $val[1]));
+/* Add search link. */
+if ($_SESSION['imp']['protocol'] == 'imap') {
+ if ($search_mbox) {
+ $orig_mbox = reset($imp_search->getSearchFolders());
+ $menu[] = array(sprintf(_("New Search in %s"), IMP::getLabel($orig_mbox)), IMP::generateIMPUrl('mailbox-mimp.php', $orig_mbox)->add('a', 's'));
+ } else {
+ $menu[] = array(_("Search"), $mailbox_url->copy()->add('a', 's'));
+ }
}
-$nav = array('pages_first', 'pages_prev', 'pages_next', 'pages_last');
-foreach ($nav as $n) {
- if (Horde_Util::nonInputVar($n)) {
- $mset->add($$n);
- }
+/* Generate page links. */
+if ($pageOb['page'] != 1) {
+ $menu[] = array(_("First Page"), $mailbox_url->copy()->add('p', 1));
+ $menu[] = array(_("Previous Page"), $mailbox_url->copy()->add('p', $pageOb['page'] - 1));
+}
+if ($pageOb['page'] != $pageOb['pagecount']) {
+ $menu[] = array(_("Next Page"), $mailbox_url->copy()->add('p', $pageOb['page'] + 1));
+ $menu[] = array(_("Last Page"), $mailbox_url->copy()->add('p', $pageOb['pagecount']));
}
-IMP_Mimp::addMIMPMenu($mset, 'mailbox');
-require IMP_TEMPLATES . '/mailbox/mailbox-mimp.inc';
+$t->set('menu', $imp_ui_mimp->getMenu('mailbox', $menu));
+
+require_once IMP_TEMPLATES . '/common-header.inc';
+IMP::status();
+echo $t->fetch(IMP_TEMPLATES . '/mailbox/mailbox-mimp.html');
diff --git a/imp/message-mimp.php b/imp/message-mimp.php
index 27fd70753..ed4dffed1 100644
--- a/imp/message-mimp.php
+++ b/imp/message-mimp.php
@@ -22,6 +22,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('imp', array('impmode' => 'mimp'));
Horde_Nls::setTimeZone();
+$vars = Horde_Variables::getDefaultVariables();
/* Make sure we have a valid index. */
$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['uid'] . IMP::IDX_SEP . $imp_mbox['thismailbox']);
@@ -38,9 +39,8 @@ $imp_ui = new IMP_Ui_Message();
$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']);
/* Run through action handlers */
-$actionID = Horde_Util::getFormData('a');
$msg_delete = false;
-switch ($actionID) {
+switch ($vars->a) {
// 'd' = delete message
// 'u' = undelete message
case 'd':
@@ -51,13 +51,14 @@ case 'u':
/* Get mailbox/UID of message. */
$index_array = $imp_mailbox->getIMAPIndex();
+ $index_array = $imp_mailbox->getIMAPIndex();
$indices_array = array($index_array['mailbox'] => array($index_array['uid']));
- if ($actionID == 'u') {
+ if ($vars->a == 'u') {
$imp_message->undelete($indices_array);
} else {
try {
- Horde::checkRequestToken('imp.message-mimp', Horde_Util::getFormData('mt'));
+ Horde::checkRequestToken('imp.message-mimp', $vars->mt);
$imp_message->delete($indices_array);
$msg_delete = false;
} catch (Horde_Exception $e) {
@@ -70,10 +71,8 @@ case 'u':
// 'ri' = report innocent
case 'rs':
case 'ri':
- if (IMP_Spam::reportSpam(array($index_array['mailbox'] => array($index_array['uid'])), $actionID == 'rs' ? 'spam' : 'innocent') === 1) {
- $msg_delete = true;
- break;
- }
+ $index_array = $imp_mailbox->getIMAPIndex();
+ $msg_delete = (IMP_Spam::reportSpam(array($index_array['mailbox'] => array($index_array['uid'])), $vars->a == 'rs' ? 'spam' : 'innocent') === 1);
break;
// 'c' = confirm download
@@ -133,31 +132,28 @@ $msgindex = $imp_mailbox->getMessageIndex();
$msgcount = $imp_mailbox->getMessageCount();
/* Generate the mailbox link. */
-$mailbox_link = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->add('s', $msgindex));
+$mailbox_link = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->add('s', $msgindex);
$self_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $uid, $mailbox_name);
-/* Init render object. */
-$mimp_render = new Horde_Mobile();
+/* Initialize Horde_Template. */
+$t = $injector->createInstance('Horde_Template');
+$t->setOption('gettext', true);
/* Output download confirmation screen. */
-$atc_id = Horde_Util::getFormData('atc');
-if (($actionID == 'c') && !is_null($atc_id)) {
- $summary = $imp_contents->getSummary($atc_id, IMP_Contents::SUMMARY_SIZE | IMP_Contents::SUMMARY_DESCRIP_NOLINK_NOHTMLSPECCHARS | IMP_Contents::SUMMARY_DOWNLOAD_NOJS);
-
- $mimp_render->set('title', _("Verify Download"));
+if (($vars->a == 'c') && isset($vars->atc)) {
+ $summary = $imp_contents->getSummary($vars->atc, IMP_Contents::SUMMARY_SIZE | IMP_Contents::SUMMARY_DESCRIP_NOLINK_NOHTMLSPECCHARS | IMP_Contents::SUMMARY_DOWNLOAD_NOJS);
- $null = null;
- $hb = $mimp_render->add(new Horde_Mobile_block($null));
+ $title = _("Verify Download");
- $hb->add(new Horde_Mobile_text(_("Click to verify download of attachment") . ': '));
- $hb->add(new Horde_Mobile_link($summary['description'], $summary['download']));
- $t = $hb->add(new Horde_Mobile_text(sprintf(' [%s] %s', $summary['type'], $summary['size']) . "\n"));
- $t->set('linebreaks', true);
+ $t->set('descrip', $summary['description']);
+ $t->set('download', $summary['download']);
+ $t->set('self_link', $self_link);
+ $t->set('size', $summary['size']);
+ $t->set('type', $summary['type']);
- $hb = $mimp_render->add(new Horde_Mobile_block($null));
- $hb->add(new Horde_Mobile_link(_("Return to message view"), $self_link));
+ require IMP_TEMPLATES . '/common-header.inc';
+ echo $t->fetch(IMP_TEMPLATES . '/message/download-mimp.html');
- $mimp_render->display();
exit;
}
@@ -188,12 +184,7 @@ foreach (array('to', 'cc', 'bcc') as $val) {
/* Process the subject now. */
if (($subject = $mime_headers->getValue('subject'))) {
/* Filter the subject text, if requested. */
- $subject = IMP::filterText($subject);
-
- /* Generate the shortened subject text. */
- if (Horde_String::length($subject) > $conf['mimp']['mailbox']['max_subj_chars']) {
- $subject = Horde_String::substr($subject, 0, $conf['mimp']['mailbox']['max_subj_chars']) . '...';
- }
+ $subject = Horde_String::truncate(IMP::filterText($subject), 30);
} else {
$subject = _("[No Subject]");
}
@@ -239,16 +230,6 @@ foreach ($flag_parse as $val) {
}
}
-/* Generate previous/next links. */
-$prev_msg = $imp_mailbox->getIMAPIndex(-1);
-if ($prev_msg) {
- $prev_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $prev_msg['uid'], $prev_msg['mailbox']);
-}
-$next_msg = $imp_mailbox->getIMAPIndex(1);
-if ($next_msg) {
- $next_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $next_msg['uid'], $next_msg['mailbox']);
-}
-
/* Create the body of the message. */
$parts_list = $imp_contents->getContentTypeMap();
$atc_parts = $display_ids = array();
@@ -293,25 +274,13 @@ foreach ($parts_list as $mime_id => $mime_type) {
/* Display the first 250 characters, or display the entire message? */
if ($prefs->getValue('mimp_preview_msg') &&
- !Horde_Util::getFormData('fullmsg') &&
+ !isset($vars->fullmsg) &&
(strlen($msg_text) > 250)) {
$msg_text = Horde_String::substr(trim($msg_text), 0, 250) . " [...]\n";
- $fullmsg_link = new Horde_Mobile_link(_("View Full Message"), $self_link->copy()->add('fullmsg', 1));
-} else {
- $fullmsg_link = null;
+ $t->set('fullmsg_link', $self_link->copy()->add('fullmsg', 1));
}
-/* Create message menu. */
-$menu = new Horde_Mobile_card('o', _("Menu"));
-$mset = $menu->add(new Horde_Mobile_linkset());
-
-if (!$readonly) {
- if (in_array('\\deleted', $flags)) {
- $mset->add(new Horde_Mobile_link(_("Undelete"), $self_link->copy()->add('a', 'u')));
- } else {
- $mset->add(new Horde_Mobile_link(_("Delete"), $self_link->copy()->add(array('a' => 'd', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
- }
-}
+$t->set('msg', nl2br(Horde_Text_Filter::filter($msg_text, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true))));
$compose_params = array(
'identity' => $identity,
@@ -319,101 +288,95 @@ $compose_params = array(
'uid' => $uid,
);
+$menu = array();
+if (!$readonly) {
+ $menu[] = in_array('\\deleted', $flags)
+ ? array(_("Undelete"), $self_link->copy()->add('a', 'u'))
+ : array(_("Delete"), $self_link->copy()->add(array('a' => 'd', 'mt' => Horde::getRequestToken('imp.message-mimp'))));
+}
+
/* Add compose actions (Reply, Reply List, Reply All, Forward, Redirect). */
if (IMP::canCompose()) {
- $items = array(IMP::composeLink(array(), array('a' => 'r') + $compose_params) => _("Reply"));
+ $menu[] = array(_("Reply"), IMP::composeLink(array(), array('a' => 'r') + $compose_params));
if ($list_info['reply_list']) {
- $items[IMP::composeLink(array(), array('a' => 'rl') + $compose_params)] = _("Reply to List");
+ $menu[] = array(_("Reply to List"), IMP::composeLink(array(), array('a' => 'rl') + $compose_params));
}
if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
- $items[IMP::composeLink(array(), array('a' => 'ra') + $compose_params)] = _("Reply All");
+ $menu[] = array(_("Reply All"), IMP::composeLink(array(), array('a' => 'ra') + $compose_params));
}
- $items[IMP::composeLink(array(), array('a' => 'f') + $compose_params)] = _("Forward");
- $items[IMP::composeLink(array(), array('a' => 'rc') + $compose_params)] = _("Redirect");
-}
-
-foreach ($items as $link => $label) {
- $mset->add(new Horde_Mobile_link($label, $link));
+ $menu[] = array(_("Forward"), IMP::composeLink(array(), array('a' => 'f') + $compose_params));
+ $menu[] = array(_("Redirect"), IMP::composeLink(array(), array('a' => 'rc') + $compose_params));
}
-if (isset($next_link)) {
- $mset->add(new Horde_Mobile_link(_("Next Message"), $next_link));
+/* Generate previous/next links. */
+if ($prev_msg = $imp_mailbox->getIMAPIndex(-1)) {
+ $menu[] = array(_("Previous Message"), IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $prev_msg['uid'], $prev_msg['mailbox']));
}
-if (isset($prev_link)) {
- $mset->add(new Horde_Mobile_link(_("Previous Message"), $prev_link));
+if ($next_msg = $imp_mailbox->getIMAPIndex(1)) {
+ $menu[] = array(_("Next Message"), IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $next_msg['uid'], $next_msg['mailbox']));
}
-$mset->add(new Horde_Mobile_link(sprintf(_("To %s"), IMP::getLabel($imp_mbox['mailbox'])), $mailbox_link));
+$menu[] = array(sprintf(_("To %s"), IMP::getLabel($imp_mbox['mailbox'])), $mailbox_link);
if ($conf['spam']['reporting'] &&
($conf['spam']['spamfolder'] ||
($mailbox_name != IMP::folderPref($prefs->getValue('spam_folder'), true)))) {
- $mset->add(new Horde_Mobile_link(_("Report as Spam"), $self_link->copy()->add(array('a' => 'rs', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
+ $menu[] = array(_("Report as Spam"), $self_link->copy()->add(array('a' => 'rs', 'mt' => Horde::getRequestToken('imp.message-mimp'))));
}
if ($conf['notspam']['reporting'] &&
(!$conf['notspam']['spamfolder'] ||
($mailbox_name == IMP::folderPref($prefs->getValue('spam_folder'), true)))) {
- $mset->add(new Horde_Mobile_link(_("Report as Innocent"), $self_link->copy()->add(array('a' => 'ri', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
+ $menu[] = array(_("Report as Innocent"), $self_link->copy()->add(array('a' => 'ri', 'mt' => Horde::getRequestToken('imp.message-mimp'))));
}
-IMP_Mimp::addMIMPMenu($mset, 'message');
-
-$mimp_render->set('title', $display_headers['subject']);
-
-$c = $mimp_render->add(new Horde_Mobile_card('m', ($status ? $status . ' | ' : '') . $display_headers['subject'] . ' ' . sprintf(_("(%d of %d)"), $msgindex, $msgcount)));
-$c->softkey('#o', _("Menu"));
-
-$notification->notify(array('listeners' => 'status', 'mobile' => $c));
-
-$null = null;
-$hb = $c->add(new Horde_Mobile_block($null));
-
-$allto_param = Horde_Util::getFormData('allto');
+$t->set('menu', $injector->getInstance('IMP_Ui_Mimp')->getMenu('message', $menu));
+$hdrs = array();
foreach ($display_headers as $head => $val) {
- $all_to = false;
- $hb->add(new Horde_Mobile_text($basic_headers[$head] . ': ', array('b')));
+ $tmp = array(
+ 'label' => htmlspecialchars($basic_headers[$head])
+ );
if ((Horde_String::lower($head) == 'to') &&
- !$allto_param &&
+ !isset($vars->allto) &&
(($pos = strpos($val, ',')) !== false)) {
$val = Horde_String::substr($val, 0, strpos($val, ','));
- $all_to = true;
+ $tmp['all_to'] = $self_link->copy()->add('allto', 1);
}
- $t = $hb->add(new Horde_Mobile_text($val . (($all_to) ? ' ' : "\n")));
- if ($all_to) {
- $hb->add(new Horde_Mobile_link('[' . _("Show All") . ']', $self_link->copy()->add('allto', 1)));
- $t = $hb->add(new Horde_Mobile_text("\n"));
- }
- $t->set('linebreaks', true);
+ $tmp['val'] = $val;
+ $hdrs[] = $tmp;
}
+$t->set('hdrs', $hdrs);
+$atc = array();
foreach ($atc_parts as $key) {
$summary = $imp_contents->getSummary($key, IMP_Contents::SUMMARY_BYTES | IMP_Contents::SUMMARY_SIZE | IMP_Contents::SUMMARY_DESCRIP_NOLINK_NOHTMLSPECCHARS | IMP_Contents::SUMMARY_DOWNLOAD_NOJS);
- $hb->add(new Horde_Mobile_text(_("Attachment") . ': ', array('b')));
- if (empty($summary['download'])) {
- $hb->add(new Horde_Mobile_text($summary['description']));
- } else {
+
+ $tmp = array(
+ 'descrip' => $summary['description'],
+ 'size' => $summary['size'],
+ 'type' => $summary['type']
+ );
+
+ if (!empty($summary['download'])) {
/* Preference: if set, only show download confirmation screen if
* attachment over a certain size. */
- $download_link = ($summary['bytes'] > $prefs->getValue('mimp_download_confirm'))
+ $tmp['download'] = ($summary['bytes'] > $prefs->getValue('mimp_download_confirm'))
? $self_link->copy()->add(array('a' => 'c', 'atc' => $key))
: $summary['download'];
- $hb->add(new Horde_Mobile_link($summary['description'], $download_link));
}
- $t = $hb->add(new Horde_Mobile_text(sprintf(' [%s] %s', $summary['type'], $summary['size']) . "\n"));
- $t->set('linebreaks', true);
+
+ $atc[] = $tmp;
}
+$t->set('atc', $atc);
-$t = $c->add(new Horde_Mobile_text($msg_text));
-$t->set('linebreaks', true);
+$title = $display_headers['subject'];
+$t->set('title', ($status ? $status . ' | ' : '') . $display_headers['subject'] . ' ' . sprintf(_("(%d of %d)"), $msgindex, $msgcount));
-if (!is_null($fullmsg_link)) {
- $c->add($fullmsg_link);
-}
+require IMP_TEMPLATES . '/common-header.inc';
+IMP::status();
+echo $t->fetch(IMP_TEMPLATES . '/message/message-mimp.html');
-$mimp_render->add($menu);
-$mimp_render->display();
diff --git a/imp/templates/common-header.inc b/imp/templates/common-header.inc
index 5f26ca5f0..8205e7af5 100644
--- a/imp/templates/common-header.inc
+++ b/imp/templates/common-header.inc
@@ -9,6 +9,10 @@ case 'dimp':
include IMP_TEMPLATES . '/javascript_defs_dimp.php';
break;
+case 'mimp':
+ // Nothing
+ break;
+
default:
include IMP_TEMPLATES . '/javascript_defs.php';
break;
@@ -38,6 +42,10 @@ case 'dimp':
Horde::includeStylesheetFiles(array('sub' => 'dimp'));
break;
+case 'mimp':
+ // Nothing
+ break;
+
default:
Horde::includeStylesheetFiles();
Horde::includeScriptFiles();
@@ -45,10 +53,14 @@ default:
}
?>
+