Subject: | Display RealName in autocomplete drop-down |
Date: | Mon, 1 Mar 2010 17:18:40 -0500 |
To: | <bug-RTx-EmailCompletion [...] rt.cpan.org> |
From: | Jérôme Charaoui <jcharaoui [...] cmaisonneuve.qc.ca> |
Hi,
I think that RealName would be great to display along with the actual
email in the autocomplete drop-down.
I made a small patch that adds this feature for rdbms search, for
demonstration purposes.
If there's interest I could work on a more complete patch.
Thanks,
--
Jérôme Charaoui
Service informatique - Collège de Maisonneuve
--- a/html/SelfService/Ajax/EmailCompletion 2009-03-13 08:42:08.000000000 -0400
+++ b/html/SelfService/Ajax/EmailCompletion 2010-03-01 16:26:47.000000000 -0500
@@ -43,8 +43,11 @@
my ($emails, $ldaps) = RTx::EmailCompletion::search($Email, $CurrentUser);
my $users = qq{<ul class="contacts">};
-for my $email (@$emails) {
- $users .= qq{<li class="contact"><div class="email">$email</div></li>};
+
+foreach (@$emails) {
+ my $name = ${$_}[0];
+ my $emailaddress = ${$_}[1];
+ $users .= qq{<li class="contact"><span class="informal">$name<br /></span><div class="email">$emailaddress</div></li>};
}
for my $email (@$ldaps) {
$users .= qq{<li class="contact ldap"><div class="email">$email</div></li>};
--- a/lib/RTx/EmailCompletion.pm 2009-03-13 09:15:33.000000000 -0400
+++ b/lib/RTx/EmailCompletion.pm 2010-03-01 15:31:50.000000000 -0500
@@ -52,7 +52,7 @@
@users = ();
}
- my @email = map { $_->EmailAddress() } @users;
+ my @email = map { [ $_->RealName(), $_->EmailAddress() ] } @users;
}
# we dynamically build search function