Revision 414

Date:
2014/02/11 22:48:17
Author:
ahitrov
Revision Log:
User name operations
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/users/lib/users/Keeper.pm

     
    267 267 }
    268 268 }
    269 269
    270 sub _create_name {
    271 my $self = shift;
    272 my ( $last_name, $first_name, $middle_name ) = @_;
    273 my $name = $last_name.($first_name ? ', '.$first_name : '').($middle_name ? ' '.$middle_name : '');
    274 return $name;
    275 }
    276
    270 277 1;
  • utf8/plugins/users/lib/users/UserProfile.pm

     
    122 122 my $name = $self->name;
    123 123 if ( $name =~ /^(.*?),[\ \t]+(.*)$/ ) {
    124 124 $name = $2;
    125 } else {
    126 my @parts = split /\s+/, $name;
    127 if ( @parts > 1 ) {
    128 pop @parts;
    129 }
    130 $name = join ' ', @parts;
    125 131 }
    126 132 return $name;
    127 133 }
     
    132 138 my $name = $self->name;
    133 139 if ( $name =~ /^(.*?),[\ \t]+(.*)$/ ) {
    134 140 $name = $1;
    141 } else {
    142 my @parts = split /\s+/, $name;
    143 if ( @parts > 1 ) {
    144 $name = pop @parts;
    145 }
    135 146 }
    136 147 return $name;
    137 148 }
    138 149
    150 sub name_first
    151 {
    152 my $self = shift;
    153 my @name = split /\s+/, $self->name_part;
    154
    155 return $name[0];
    156 }
    157
    158 sub name_middle
    159 {
    160 my $self = shift;
    161 my @name = split /\s+/, $self->name_part;
    162 shift @name if @name;
    163 my $name = @name ? join (' ', @name) : '';
    164
    165 return $name;
    166 }
    167
    139 168 sub class_name
    140 169 {
    141 170 return 'Профиль пользователя';