From 04c2127680133db05d06b4ddd66a9361548164aa Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 15 Mar 2010 22:52:09 -0600 Subject: [PATCH] Add ability to add attachments for advanced mobile browsers --- imp/compose-mimp.php | 20 ++++++++++++++++++++ imp/config/hooks.php.dist | 4 ++++ imp/docs/CHANGES | 6 ++++-- imp/templates/mimp/compose/compose.html | 13 ++++++++++++- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index e4ed60310..90d8dcf3d 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -91,6 +91,13 @@ foreach (array_keys($display_hdrs) as $val) { } } +/* Add attachment. */ +if ($_SESSION['imp']['file_upload'] && + !$imp_compose->addFilesFromUpload('upload_', $vars->a == _("Expand Names")) && + ($vars->a != _("Expand Names"))) { + $vars->a = null; +} + /* Run through the action handlers. */ switch ($vars->a) { // 'd' = draft @@ -346,6 +353,19 @@ foreach ($display_hdrs as $key => $val) { $t->set('hdrs', $hdrs); $t->set('title', $title); +/* Activate advanced compose attachments UI? */ +if ($_SESSION['imp']['file_upload']) { + try { + if (Horde::callHook('mimp_advanced', array('compose_attach'), 'imp')) { + $t->set('attach', true); + if ($atc_list = $imp_compose->getAttachments()) { + $imp_ui_mbox = new IMP_Ui_Mailbox(); + $t->set('attach_data', sprintf("%s [%s] - %s", htmlspecialchars($atc_list[0]['part']->getName()), htmlspecialchars($atc_list[0]['part']->getType()), $imp_ui_mbox->getSize($atc_list[0]['part']->getBytes()))); + } + } + } catch (Horde_Exception_HookNotSet $e) {} +} + require IMP_TEMPLATES . '/common-header.inc'; IMP::status(); echo $t->fetch(IMP_TEMPLATES . '/mimp/compose/compose.html'); diff --git a/imp/config/hooks.php.dist b/imp/config/hooks.php.dist index 1bd35a58f..3287a713a 100644 --- a/imp/config/hooks.php.dist +++ b/imp/config/hooks.php.dist @@ -773,6 +773,10 @@ class IMP_Hooks // case 'checkbox': // // Activate the mailbox checkbox interface. // return true; +// +// case 'compose_attach': +// // Activate the compose attachment interface. +// return true; // } // // return false; diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 89483b052..e802fa3ea 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,8 +2,10 @@ v5.0-git -------- -[mms] Add checkbox interface to mailbox page for advanced mobile browsers - (MIMP). +[mms] Add ability to add attachments to composed messages for advanced mobile + browsers - disabled by default (MIMP). +[mms] Add checkbox interface to mailbox page for advanced mobile browsers - + disabled by default (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. diff --git a/imp/templates/mimp/compose/compose.html b/imp/templates/mimp/compose/compose.html index 80f34ab6e..7b96c78b1 100644 --- a/imp/templates/mimp/compose/compose.html +++ b/imp/templates/mimp/compose/compose.html @@ -1,6 +1,6 @@

-
+ enctype="multipart/form-data"> @@ -55,6 +55,17 @@

+ +
+

+ Attach: + + + + + +

+

Menu
-- 2.11.0