[Tickets #3028] NEW: Hiding addresses of multiple recipients

bugs@bugs.horde.org bugs at bugs.horde.org
Wed Nov 23 12:51:44 PST 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=3028
-----------------------------------------------------------------------
 Ticket             | 3028
 Created By         | flachapelle at inverse.ca
 Summary            | Hiding addresses of multiple recipients
 Queue              | IMP
 Version            | HEAD
 State              | New
 Priority           | 1. Low
 Type               | Enhancement
 Owners             | 
-----------------------------------------------------------------------


flachapelle at inverse.ca (2005-11-23 12:51) wrote:

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]"




More information about the bugs mailing list