6.0.0-beta1
9/24/25

[#3028] Hiding addresses of multiple recipients
Summary Hiding addresses of multiple recipients
Queue IMP
Queue Version HEAD
Type Enhancement
State Resolved
Priority 1. Low
Owners
Requester flachapelle (at) inverse (dot) ca
Created 11/23/2005 (7245 days ago)
Due
Updated 11/24/2005 (7244 days ago)
Assigned
Resolved 11/24/2005 (7244 days ago)
Milestone
Patch No

History
11/24/2005 06:30:20 AM Michael Slusarz Comment #2
State ⇒ Resolved
Reply to this comment
What timing - this just made it onto my TODO list about a week ago 
when someone sent me a message with 1100 recipients listed in the To: 
field.



The patches have been committed to HEAD and IMP 4.1.  Thanks for the 
submissions, although we ask that you attach diffs as attachments next 
time instead of inline.
11/23/2005 08:51:42 PM flachapelle (at) inverse (dot) ca Comment #1
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Hiding addresses of multiple recipients
Queue ⇒ IMP
Reply to this comment
When viewing one message with multiple recipients in the TO or CC 
field, the user may have to scroll down to see the body of the 
message, the recipient addresses taking too much space.



I propose to make it possible to hide the recipient addresses with CSS 
as it is currently possible for quoted text.



Here's a patch for "imp/lib/MIME/Headers.php" that will replace the 
addresses by a link if there are more than 20 recipients:



--- Headers.php.orig    2005-11-22 16:59:40.549264024 -0500

+++ Headers.php 2005-11-23 15:28:19.416656176 -0500

@@ -212,9 +212,19 @@

              $ret = _("Undisclosed Recipients");

          } else {

              /* Build the address line. */

-            $ret = '<span class="nowrap">' . implode(',</span> <span 
class="nowrap">', $addr_array) . '</span>';

+            if (count($addr_array) > 20) {

+                Horde::addScriptFile('hideable.js', 'horde', true);

+                Horde::addScriptFile('addressesBlocks.js', 'imp');

+

+                $ret = '<div id="at_' . $field . '">' .

+                    Horde::link('#', '', 'widget', '', 
'toggleAddressesBlock(\'' . $field . '\', \'' . count($addr_array) . 
'\'); return false;', '', '') .

+                    sprintf(_('[Show addresses - %s recipients]'), 
count($addr_array)) . '</a></div>' .

+                    '<div id="ab_' . $field . '" style="display: 
none;"><span class="nowrap">' . implode(',</span> <span 
class="nowrap">', $addr_array) . '</span></div>';

+            } else {

+                $ret = '<span class="nowrap">' . implode(',</span> 
<span class="nowrap">', $addr_array) . '</span>';

+            }

          }



The javascript file "imp/templates/javascript/addressesBlocks.js" must 
be created with the following content:



function toggleAddressesBlock(field, count)

{

     var block = new Horde_Hideable('ab_' + field);



     block.toggle();

     text = document.createTextNode(block.shown() ?

                                    '<?php echo _("[Hide Addresses]") ?>' :

                                    '<?php echo _("[Show Addresses -") 
?> ' + count + ' <?php echo _("recipients]") ?>');

     link = document.createElement('A');

     link.href = '';

     link.className = 'widget';

     link.onclick = function() {

         toggleAddressesBlock(field, count);

         return false;

     }

     link.appendChild(text);



     var toggle = document.getElementById('at_' + field);

     if (toggle.firstChild) {

         toggle.removeChild(toggle.firstChild);

     }

     toggle.appendChild(link);

}



Finally, the following strings will have to be localized:



"[Show Addresses -"

"recipients]"

"[Hide Addresses]"

"[Show addresses - %s recipients]"

Saved Queries