[Rt-commit] r13265 - in rt/branches/3.8-TESTING: . etc share/html/Elements share/html/Ticket/Elements

kyoki at bestpractical.com kyoki at bestpractical.com
Thu Jun 12 22:34:49 EDT 2008


Author: kyoki
Date: Thu Jun 12 22:34:48 2008
New Revision: 13265

Added:
   rt/branches/3.8-TESTING/share/html/Elements/ShowUserConcise
   rt/branches/3.8-TESTING/share/html/Elements/ShowUserVerbose
Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/etc/RT_Config.pm.in
   rt/branches/3.8-TESTING/lib/RT/Config.pm
   rt/branches/3.8-TESTING/share/html/Elements/ShowUser
   rt/branches/3.8-TESTING/share/html/Ticket/Elements/AddWatchers

Log:
 r22876 at nyx:  kyoki | 2008-06-12 22:32:55 -0400
 RT-Ticket: 9624
 RT-Status: Resolved
 RT-Update: Correspond
 Username displays are now customizable to either concise or verbose, default being concise


Modified: rt/branches/3.8-TESTING/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.8-TESTING/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.8-TESTING/etc/RT_Config.pm.in	Thu Jun 12 22:34:48 2008
@@ -700,6 +700,18 @@
 
 Set($WebDefaultStylesheet, 'web2');
 
+=item C<$UsernameFormat>
+
+This determines how user info is displayed. Concise will show one of 
+either NickName, RealName, Name or EmailAddress, depending on what exists 
+and whether the user is privileged or not. Verbose will show RealName and
+EmailAddress.
+
+=cut
+
+  Set($UsernameFormat, 'concise');
+
+
 =item C<$WebPath>
 
 If you're putting the web ui somewhere other than at the root of

Modified: rt/branches/3.8-TESTING/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Config.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Config.pm	Thu Jun 12 22:34:48 2008
@@ -182,6 +182,19 @@
             },
         },
     },
+    UsernameFormat => {
+        Section         => 'General',
+        Overridable     => 1,
+	Widget          =>'/Widgets/Form/Select',
+	WidgetArguments => {
+	   Description  => 'Username format',
+	   Values       => [qw(concise verbose)],
+           ValueLabel   => {
+                concise     => 'Short usernames',
+                verbose     => 'Name and email address',
+                },
+	},
+    },
     DefaultQueue => {
         Section         => 'General',
         Overridable     => 1,

Modified: rt/branches/3.8-TESTING/share/html/Elements/ShowUser
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/ShowUser	(original)
+++ rt/branches/3.8-TESTING/share/html/Elements/ShowUser	Thu Jun 12 22:34:48 2008
@@ -46,26 +46,13 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 %# Released under the terms of version 2 of the GNU Public License
-<% $Address->format %>\
 <%INIT>
-my ($phrase, $address, $comment);
-
-if ($User) {
-$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;
- $Address = Mail::Address->new( $phrase, $address, $comment );
-} 
-
-
-$Address->comment('') if $comment && lc $Address->user eq lc $comment;
-if ( $phrase and my ($l, $r) = ($phrase =~ /^(\w+) (\w+)$/) ) {
-    $Address->phrase('') if $Address->user =~ /^\Q$l\E.\Q$r\E$/
-                        || $Address->user =~ /^\Q$r\E.\Q$l\E$/; 
-}
+warn caller;
+if ($style eq 'concise'){$m->comp('/Elements/ShowUserConcise', User => $User);}
+else {$m->comp('/Elements/ShowUserVerbose', User => $User);}
 </%INIT>
 <%ARGS>
 $User => undef
 $Address => undef
+$style => RT->Config->Get('UsernameFormat', $session{'CurrentUser'})
 </%ARGS>

Added: rt/branches/3.8-TESTING/share/html/Elements/ShowUserConcise
==============================================================================
--- (empty file)
+++ rt/branches/3.8-TESTING/share/html/Elements/ShowUserConcise	Thu Jun 12 22:34:48 2008
@@ -0,0 +1,71 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%# 
+%# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC
+%#                                          <jesse at bestpractical.com>
+%# 
+%# (Except where explicitly superseded by other copyright notices)
+%# 
+%# 
+%# LICENSE:
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%# 
+%# 
+%# CONTRIBUTION SUBMISSION POLICY:
+%# 
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%# 
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%# 
+%# END BPS TAGGED BLOCK }}}
+%# Released under the terms of version 2 of the GNU Public License
+<%INIT>
+if ($User) {
+    my $printable;
+    if ( $User->Privileged ) {
+             $printable = $User->NickName
+          || $User->RealName
+          || $User->Name
+          || $User->EmailAddress;
+    }
+    else {
+             $printable = $User->EmailAddress
+          || $User->Name
+          || $User->RealName
+          || $User->NickName;
+    }
+    $m->out( $printable);
+}
+
+</%INIT>
+<%ARGS>
+$User => undef
+$Address => undef
+</%ARGS>

Added: rt/branches/3.8-TESTING/share/html/Elements/ShowUserVerbose
==============================================================================
--- (empty file)
+++ rt/branches/3.8-TESTING/share/html/Elements/ShowUserVerbose	Thu Jun 12 22:34:48 2008
@@ -0,0 +1,71 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%# 
+%# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC
+%#                                          <jesse at bestpractical.com>
+%# 
+%# (Except where explicitly superseded by other copyright notices)
+%# 
+%# 
+%# LICENSE:
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%# 
+%# 
+%# CONTRIBUTION SUBMISSION POLICY:
+%# 
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%# 
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%# 
+%# END BPS TAGGED BLOCK }}}
+%# Released under the terms of version 2 of the GNU Public License
+<% $Address->format %>\
+<%INIT>
+my ($phrase, $address, $comment);
+
+if ($User) {
+$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;
+ $Address = Mail::Address->new( $phrase, $address, $comment );
+} 
+
+
+$Address->comment('') if $comment && lc $Address->user eq lc $comment;
+if ( $phrase and my ($l, $r) = ($phrase =~ /^(\w+) (\w+)$/) ) {
+    $Address->phrase('') if $Address->user =~ /^\Q$l\E.\Q$r\E$/
+                        || $Address->user =~ /^\Q$r\E.\Q$l\E$/; 
+}
+</%INIT>
+<%ARGS>
+$User => undef
+$Address => undef
+</%ARGS>

Modified: rt/branches/3.8-TESTING/share/html/Ticket/Elements/AddWatchers
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Ticket/Elements/AddWatchers	(original)
+++ rt/branches/3.8-TESTING/share/html/Ticket/Elements/AddWatchers	Thu Jun 12 22:34:48 2008
@@ -58,7 +58,7 @@
 <&|/l&>Username</&>
 </td></tr>
 % while (my $u = $Users->Next ) {
-<tr><td><&/Elements/SelectWatcherType, Name => "Ticket-AddWatcher-Principal-". $u->PrincipalId &></td><td><& '/Elements/ShowUser', User => $u &></td></tr>
+<tr><td><&/Elements/SelectWatcherType, Name => "Ticket-AddWatcher-Principal-". $u->PrincipalId &></td><td><& '/Elements/ShowUser', User => $u, style=>'verbose' &></td></tr>
 % }
 % }
 


More information about the Rt-commit mailing list