From e8afe33dd1f80eb684d16332451696f23be5fedf Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 16 Nov 2009 12:49:04 -0700 Subject: [PATCH] Add mimp_download_confirm pref Determines at what size an attachment download in mimp should trigger the download confirmation page. --- imp/config/prefs.php.dist | 10 +++++++++- imp/message-mimp.php | 10 ++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/imp/config/prefs.php.dist b/imp/config/prefs.php.dist index 6272ffa4b..da4b1d418 100644 --- a/imp/config/prefs.php.dist +++ b/imp/config/prefs.php.dist @@ -197,7 +197,7 @@ $prefGroups['mimp'] = array( 'label' => _("Minimalist View Options"), 'desc' => _("Configure options for the minimalist view."), 'members' => array('mimp_preview_msg', 'mimp_max_from_chars', - 'mimp_max_subj_chars') + 'mimp_max_subj_chars', 'mimp_download_confirm') ); $prefGroups['standard'] = array( @@ -1611,6 +1611,14 @@ $_prefs['mimp_max_subj_chars'] = array( 'desc' => _("In the mailbox view, how many characters of Subject: lines should we show before truncating?") ); +$_prefs['mimp_download_confirm'] = array( + 'value' => 0, + 'locked' => true, + 'shared' => false, + 'type' => 'number', + 'desc' => _("Only show download confirmation page if message part is greater than this size, in bytes. Set to 0 to always require the confirmation page.") +); + // End Minimalist View Options // Standard View Options diff --git a/imp/message-mimp.php b/imp/message-mimp.php index cd528b6fe..a7655c8fa 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -395,12 +395,18 @@ foreach ($display_headers as $head => $val) { } foreach ($atc_parts as $key) { - $summary = $imp_contents->getSummary($key, IMP_Contents::SUMMARY_SIZE | IMP_Contents::SUMMARY_DESCRIP_NOLINK_NOHTMLSPECCHARS | IMP_Contents::SUMMARY_DOWNLOAD_NOJS); + $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 { - $hb->add(new Horde_Mobile_link($summary['description'], Horde_Util::addParameter($self_link, array('a' => 'c', 'atc' => $key)))); + /* Preference: if set, only show download confirmation screen if + * attachment over a certain size. */ + $download_link = ($summary['bytes'] > $prefs->getValue('mimp_download_confirm')) + ? Horde_Util::addParameter($self_link, 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); -- 2.11.0