// return empty($ob['personal']) ? $ob['address'] : $ob['personal'];
// }
+
+ /**
+ * MIMP: Activate various advanced features in the minimal view.
+ *
+ * The combination of the rapid pace of development for both mobile
+ * devices and their browsers, coupled with the limited resources of an
+ * open source project to test and track these developments, make it
+ * near impossible to accurately identify a list of mobile browsers
+ * that can handle a interface with more features than the base
+ * minimal view. Therefore, this hook provides a wait for a site
+ * administrator to best decide when (and if) they want to allow this
+ * advanced functionality to be available in the minimal view.
+ *
+ * @param string $feature The advanced feature. One of the following:
+ * <pre>
+ * 'checkbox' - Adds a checkbox interface to selecting messages on the
+ * mailbox listing page.
+ * </pre>
+ *
+ * @return boolean If true, activates the feature. By default, these
+ * advanced features are NOT active.
+ */
+// function mimp_advanced($feature)
+// {
+// switch ($feature) {
+// case 'checkbox':
+// // Activate the mailbox checkbox interface.
+// return true;
+// }
+//
+// return false;
+// }
+
}
v5.0-git
--------
+[mms] Add checkbox interface to mailbox page for advanced mobile browsers
+ (MIMP).
[mms] Add preference to allow viewing of all inline parts by default (MIMP).
[mms] Add hook to alter composed message details before sending.
[mms] DIMP now honors the 'allow_resume_all' configuration option.
return $out . '</ol>';
}
+ /**
+ * [Un]Delete message(s).
+ *
+ * @param string $action Either 'delete' or 'undelete'.
+ * @param mixed $uids See IMP::parseIndicesList().
+ * @param string $token Mailbox action token.
+ *
+ * @return boolean True if messages were removed from the mailbox.
+ */
+ public function delete($action, $uids, $token)
+ {
+ switch ($action) {
+ case 'delete':
+ try {
+ Horde::checkRequestToken('imp.message-mimp', $token);
+ return (bool)$GLOBALS['injector']->getInstance('IMP_Message')->delete($uids);
+ } catch (Horde_Exception $e) {
+ $GLOBALS['notification']->push($e);
+ }
+ break;
+
+ case 'undelete':
+ $imp_message->undelete($uids);
+ break;
+ }
+
+ return false;
+ }
+
}
/* Get the base URL for this page. */
$mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']);
+/* Perform message actions (via advanced UI). */
+switch ($vars->checkbox) {
+// 'd' = delete message
+// 'u' = undelete message
+case 'd':
+case 'u':
+ if ($readonly) {
+ break;
+ }
+
+ $imp_message = $injector->getInstance('IMP_Message');
+
+ if ($vars->checkbox == 'd') {
+ try {
+ Horde::checkRequestToken('imp.message-mimp', $vars->mt);
+ $imp_message->delete($vars->indices);
+ } catch (Horde_Exception $e) {
+ $notification->push($e);
+ }
+ } else {
+ $imp_message->undelete($vars->indices);
+ }
+ break;
+
+// 'rs' = report spam
+// 'ri' = report innocent
+case 'rs':
+case 'ri':
+ IMP_Spam::reportSpam($vars->indices, $vars->a == 'rs' ? 'spam' : 'innocent');
+ break;
+}
+
/* Run through the action handlers */
switch ($vars->a) {
// 'm' = message missing
/* Initialize the header fields. */
$msg = array(
'status' => '',
- 'subject' => trim($imp_ui->getSubject($ob['envelope']['subject']))
+ 'subject' => trim($imp_ui->getSubject($ob['envelope']['subject'])),
+ 'uid' => $ob['uid'] . IMP::IDX_SEP . $ob['mailbox']
);
/* Format the from header. */
/* Generate the target link. */
$msg['target'] = in_array('\\draft', $ob['flags'])
? IMP::composeLink(array(), array('a' => 'd', 'thismailbox' => $imp_mbox['mailbox'], 'uid' => $ob['uid'], 'bodypart' => 1))
- : IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $ob['uid'], $ob['mailbox']);
+ : IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $ob['uid'], $ob['mailbox']);
$msgs[] = $msg;
}
$t->set('menu', $imp_ui_mimp->getMenu('mailbox', $menu));
+/* Activate advanced checkbox UI? */
+try {
+ if (Horde::callHook('mimp_advanced', array('checkbox'), 'imp')) {
+ $t->set('checkbox', $mailbox_url->copy()->add('p', $pageOb['page']));
+ $t->set('forminput', Horde_Util::formInput());
+ $t->set('mt', Horde::getRequestToken('imp.message-mimp'));
+ }
+} catch (Horde_Exception_HookNotSet $e) {}
+
require_once IMP_TEMPLATES . '/common-header.inc';
IMP::status();
echo $t->fetch(IMP_TEMPLATES . '/mailbox/mailbox-mimp.html');
exit;
}
-$imp_message = $injector->getInstance('IMP_Message');
+$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']);
+
+$imp_mimp = $injector->getInstance('IMP_Ui_Mimp');
$imp_hdr_ui = new IMP_Ui_Headers();
$imp_ui = new IMP_Ui_Message();
-/* Determine if mailbox is readonly. */
-$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']);
-
/* Run through action handlers */
$msg_delete = false;
switch ($vars->a) {
if ($readonly) {
break;
}
+ $index_ob = $imp_mailbox->getIMAPIndex();
+ $index_array = array($index_ob['mailbox'] => array($index_ob['uid']));
+ $imp_message = $injector->getInstance('IMP_Message');
- /* Get mailbox/UID of message. */
- $index_array = $imp_mailbox->getIMAPIndex();
- $indices_array = array($index_array['mailbox'] => array($index_array['uid']));
-
- if ($vars->a == 'u') {
- $imp_message->undelete($indices_array);
- } else {
+ if ($vars->a == 'd') {
try {
Horde::checkRequestToken('imp.message-mimp', $vars->mt);
- $imp_message->delete($indices_array);
- $msg_delete = false;
+ $msg_delete = (bool)$imp_message->delete($index_array);
} catch (Horde_Exception $e) {
$notification->push($e);
}
+ } else {
+ $imp_message->undelete($index_array);
}
break;
$menu[] = array(_("Report as Innocent"), $self_link->copy()->add(array('a' => 'ri', 'mt' => Horde::getRequestToken('imp.message-mimp'))));
}
-$t->set('menu', $injector->getInstance('IMP_Ui_Mimp')->getMenu('message', $menu));
+$t->set('menu', $imp_mimp->getMenu('message', $menu));
$hdrs = array();
foreach ($display_headers as $head => $val) {
<div><tag:title /></div>
<hr />
+<if:checkbox>
+ <form action="<tag:checkbox />" method="post">
+ <input type="hidden" name="mt" value="<tag:mt />" />
+ <tag:forminput />
+</if:checkbox>
<if:msgs>
<table>
<tr>
+<if:checkbox>
+ <th></th>
+</if:checkbox>
<th><tag:hdr_arrival /></th>
<th><tag:hdr_from /></th>
<th><tag:hdr_subject /><if:hdr_subject_minor> <small>[<tag:hdr_subject_minor />]</small></if:hdr_subject_minor></th>
</tr>
<loop:msgs>
<tr>
+<if:checkbox>
+ <td><input type="checkbox" name="indices[]" value="<tag:msgs.uid />" /></td>
+</if:checkbox>
<td><tag:msgs.status /></td>
<td><tag:msgs.from /></td>
<td><tag:msgs.thread /> <a href="<tag:msgs.target />"><tag:msgs.subject /></a></td>
<div><gettext>No messages.</gettext></div>
</else:msgs></if:msgs>
<hr />
+<if:checkbox>
+ <div>
+ <select name="checkbox">
+ <option value="" selected="selected"><gettext>Action:</gettext></option>
+ <option value="d"> <gettext>Delete</gettext></option>
+ <option value="u"> <gettext>Undelete</gettext></option>
+ <option value="s"> <gettext>Report As Spam</gettext></option>
+ <option value="i"> <gettext>Report As Innocent</gettext></option>
+ </select>
+ <input type="submit" value="<gettext>Do Action</gettext>" />
+ </div>
+ </form>
+ <hr />
+</if:checkbox>
<div><gettext>Menu</gettext></div>
<tag:menu />
</body>