[Rt-commit] r6798 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Tue Jan 23 19:11:36 EST 2007


Author: ruz
Date: Tue Jan 23 19:11:31 2007
New Revision: 6798

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowUserEntry

Log:
 r4431 at cubic-pc:  cubic | 2007-01-24 03:16:37 +0300
 ShowUserEntry
 * switch to Mail::Address for formatting, so result would be a correct
   email string to copy and paste into other places.
 * show as "Real Name" <email at address> (name) by default
 * don't show real name or name if it's equal to the email address
 * don't show name if it's equal to 'user' part of the address
 * don't show real name if 'user' part of the address is combination
   of parts of the real name field


Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowUserEntry
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowUserEntry	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowUserEntry	Tue Jan 23 19:11:31 2007
@@ -44,12 +44,20 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 %# Released under the terms of version 2 of the GNU Public License
-
-<%$User->Name%>
-% if ($User->EmailAddress && $User->EmailAddress ne $User->Name) {
-&lt;<%$User->EmailAddress%>&gt;
-% }
-
+<% $obj->format %>\
+<%INIT>
+my ($phrase, $address, $comment);
+$address = $User->EmailAddress;
+$phrase = $User->RealName
+    if $User->RealName && lc $User->RealName ne lc $address;
+$comment = $User->Name if lc $User->Name ne lc $address;
+my $obj = Mail::Address->new( $phrase, $address, $comment );
+$obj->comment('') if $comment && lc $obj->user eq lc $comment;
+if ( $phrase and my ($l, $r) = ($phrase =~ /^(\w+) (\w+)$/) ) {
+    $obj->phrase('') if $obj->user =~ /^\Q$l\E.\Q$r\E$/
+                        || $obj->user =~ /^\Q$r\E.\Q$l\E$/; 
+}
+</%INIT>
 <%ARGS>
 $User => undef
-</%ARGS>
\ No newline at end of file
+</%ARGS>


More information about the Rt-commit mailing list