From: Michael M Slusarz Date: Fri, 14 Nov 2008 19:44:26 +0000 (-0700) Subject: Replace attachment_display pref with parts_display X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=768c4d6e988a80adcd134bffb42231269502faec;p=horde.git Replace attachment_display pref with parts_display Gives the option to choose between showing all parts by default, only attachments, or no parts. All inline parts remain always displayed. --- diff --git a/imp/config/prefs.php.dist b/imp/config/prefs.php.dist index d228137d1..9f7dc99d5 100644 --- a/imp/config/prefs.php.dist +++ b/imp/config/prefs.php.dist @@ -97,7 +97,7 @@ $prefGroups['viewing'] = array( 'html_image_replacement', 'html_image_addrbook', 'highlight_text', 'highlight_simple_markup', 'show_quoteblocks', 'dim_signature', 'emoticons', - 'attachment_display', 'mail_hdr', 'default_msg_charset') + 'parts_display', 'mail_hdr', 'default_msg_charset') ); if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) { $prefGroups['viewing']['members'] = array_merge($prefGroups['viewing']['members'], array('disposition_send_mdn')); @@ -870,16 +870,16 @@ $_prefs['emoticons'] = array( 'type' => 'checkbox', 'desc' => _("Convert textual emoticons into graphical ones?")); -// how do we display attachments? -$_prefs['attachment_display'] = array( - 'value' => 'list', +// how do we display message parts? +$_prefs['parts_display'] = array( + 'value' => 'atc', 'locked' => false, 'shared' => false, 'type' => 'enum', - 'enum' => array('list' => _("Listing in the Header"), - 'inline' => _("Display in Body of Message"), - 'both' => _("Both Header Listing and Body of Message")), - 'desc' => _("How do you want to display attachments?")); + 'enum' => array('all' => _("Show all parts"), + 'atc' => _("Show attachments only"), + 'none' => _("Don't show any parts")), + 'desc' => _("How do you want to display the parts of a message by default?")); // Display custom headers (configured via the identity screen) when viewing // messages? diff --git a/imp/docs/UPGRADING b/imp/docs/UPGRADING index 9178094b6..74a7a28c5 100644 --- a/imp/docs/UPGRADING +++ b/imp/docs/UPGRADING @@ -25,7 +25,7 @@ supported. * servers.php has changed * imp_hook_vinfo has changed -* alternative_display pref is gone. +* alternative_display, attachment_display pref is gone. Upgrading IMP From 4.1.x To 4.2.x diff --git a/imp/message.php b/imp/message.php index 77396a6d8..156307349 100644 --- a/imp/message.php +++ b/imp/message.php @@ -260,7 +260,10 @@ $self_link = Util::addParameter(IMP::generateIMPUrl('message.php', $imp_mbox['ma $basic_headers = $imp_ui->basicHeaders(); $display_headers = $msgAddresses = array(); -$display_headers['date'] = $imp_ui->addLocalTime(nl2br($envelope['date'])); +$format_date = $imp_ui->addLocalTime(nl2br($envelope['date'])); +if (!empty($format_date)) { + $display_headers['date'] = $format_date; +} /* Build From address links. */ $display_headers['from'] = $imp_ui->buildAddressLinks($envelope['from'], $self_link, !$printer_friendly); @@ -632,12 +635,12 @@ if ($printer_friendly) { /* Determine the fields that will appear in the MIME info entries. */ $part_info = array('icon', 'description', 'type', 'size', 'download', 'download_zip', 'img_save', 'strip'); -$show_all_parts = Util::getFormData('show_all_parts'); $parts_list = $imp_contents->getContentTypeMap(); $atc_parts = $display_ids = array(); $msgtext = ''; -if ($show_all_parts) { +$show_parts = Util::getFormData('show_parts', $prefs->getValue('parts_display')); +if ($show_parts == 'all') { $atc_parts = array_keys($parts_list); } @@ -649,7 +652,7 @@ foreach ($parts_list as $mime_id => $mime_type) { } if (!($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO))) { - if (!$show_all_parts && $imp_contents->isAttachment($mime_type)) { + if (($show_parts == 'atc') && $imp_contents->isAttachment($mime_type)) { $atc_parts[] = $mime_id; } continue; @@ -659,7 +662,7 @@ foreach ($parts_list as $mime_id => $mime_type) { 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. */ - if (!$show_all_parts) { + if ($show_parts == 'atc') { $atc_parts[] = $mime_id; } continue; @@ -693,10 +696,11 @@ foreach ($parts_list as $mime_id => $mime_type) { /* Build the Attachments menu. */ if (!$printer_friendly) { $a_template->set('atc', Horde::widget('#', _("Attachments"), 'widget hasmenu', '', '', _("Attachments"), true)); - if ($show_all_parts) { - $a_template->set('switch_atc_view', Horde::widget(Util::removeParameter($headersURL, array('show_all_parts')), _("Show Attachments Only"), 'widget', '', '', _("Show Attachments Only"), true)); - } else { - $a_template->set('switch_atc_view', Horde::widget(Util::addParameter($headersURL, array('show_all_parts' => 1)), _("Show All Message Parts"), 'widget', '', '', _("Show All Message Parts"), true)); + if ($show_parts != 'all') { + $a_template->set('show_parts_all', Horde::widget(Util::addParameter($headersURL, array('show_parts' => 'all')), _("Show All Message Parts"), 'widget', '', '', _("Show All Message Parts"), true)); + } + if ($show_parts != 'atc') { + $a_template->set('show_parts_atc', Horde::widget(Util::addParameter($headersURL, array('show_parts' => 'atc')), _("Show Attachments Only"), 'widget', '', '', _("Show Attachments Only"), true)); } if (count($atc_parts) || (count($display_ids) > 2)) { $a_template->set('download_all', Horde::widget($imp_contents->urlView($imp_contents->getMIMEMessage(), 'download_all', array('params' => array('download_ids' => serialize($atc_parts)))), _("Download All Attachments (in .zip file)"), 'widget', '', '', _("Download All Attachments (in .zip file)"), true)); @@ -707,20 +711,10 @@ if (!$printer_friendly) { } /* Show attachment information in headers? */ -$show_atc = false; -if (!empty($atc_parts)) { - if ($show_all_parts) { - $show_atc = true; - } else { - $atc_display = $prefs->getValue('attachment_display'); - $show_atc = (($atc_display == 'list') || ($atc_display == 'both')); - } -} - -if ($show_atc) { +if ($show_parts != 'none') { $tmp = array(); - if ($show_all_parts) { + if ($show_parts == 'all') { array_unshift($part_info, 'id'); } @@ -733,7 +727,7 @@ if ($show_atc) { $tmp[] = ''; } - $hdrs[] = array('name' => $show_all_parts ? _("Parts") : _("Attachments"), 'val' => '' . implode('', $tmp) . '
', 'i' => (++$i % 2)); + $hdrs[] = array('name' => ($show_parts == 'all') ? _("Parts") : _("Attachments"), 'val' => '' . implode('', $tmp) . '
', 'i' => (++$i % 2)); } if ($printer_friendly && !empty($conf['print']['add_printedby'])) { diff --git a/imp/templates/message/navbar_actions.html b/imp/templates/message/navbar_actions.html index 72a671a26..cd64353a8 100644 --- a/imp/templates/message/navbar_actions.html +++ b/imp/templates/message/navbar_actions.html @@ -45,7 +45,8 @@
    • -
    • +
    • +