+
END
}
@@ -1772,6 +1798,9 @@ END
'clicker' => "clicker id",
'photo' => "photo",
'extent' => "extent",
+ 'link' => "Behavior of username links",
+ 'aboutme' => "Display a user's personal page",
+ 'modify' => "Modify a user's information",
);
if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
$lt{'extent'} = &mt('Course(s): description, section(s), status');
@@ -1813,13 +1842,33 @@ END
my $output;
if ($mode eq 'html' || $mode eq 'view') {
$r->print(<
-
+
+
+
+
+
END
- if ($linkto eq 'aboutme') {
- $output = &mt("Select a user name to view the user's personal page.");
- } elsif ($linkto eq 'modify') {
- $output = &mt("Select a user name to modify the user's information");
+ if ($mode ne 'autoenroll') {
+ $output = '';
+ my @linkdests = ('aboutme');
+ if ($permission->{'cusr'}) {
+ push (@linkdests,'modify');
+ $output .= ''.$lt{'link'}.': ';
+ my $usernamelink = $env{'form.usernamelink'};
+ if ($usernamelink eq '') {
+ $usernamelink = 'aboutme';
+ }
+ foreach my $item (@linkdests) {
+ my $checkedstr = '';
+ if ($item eq $usernamelink) {
+ $checkedstr = ' checked="checked" ';
+ }
+ $output .= ' ';
+ }
+ $output .= '
';
+ } else {
+ $output .= &mt("Click on a username to view the user's personal page.").'
';
+ }
}
$output .= "\n
\n".
&Apache::loncommon::start_data_table().
@@ -2000,22 +2049,12 @@ END
if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') {
$r->print(&Apache::loncommon::start_data_table_row());
$r->print("
$rowcount | \n");
- if ($linkto eq 'aboutme') {
- $in{'username'} =
- &Apache::loncommon::aboutmewrapper($in{'username'},
- $in{'username'},
- $in{'domain'});
- } elsif ($linkto eq 'modify') {
- $in{'username'} = ''.
- $in{'username'}."\n";
- }
foreach my $item (@cols) {
- $r->print(''.$in{$item}.' | '."\n");
+ if ($item eq 'username') {
+ $r->print(''.&print_username_link($permission,\%in).' | ');
+ } else {
+ $r->print(''.$in{$item}.' | '."\n");
+ }
}
if ($context eq 'course') {
if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {
@@ -2096,6 +2135,21 @@ END
}
}
+sub print_username_link {
+ my ($permission,$in) = @_;
+ my $output;
+ if (!$permission->{'cusr'}) {
+ $output = &Apache::loncommon::aboutmewrapper($in->{'username'},
+ $in->{'username'},
+ $in->{'domain'});
+ } else {
+ $output = '{'username'}','$in->{'domain'}'".')" />'.
+ $in->{'username'}.'';
+ }
+ return $output;
+}
+
sub role_type_names {
my %lt = &Apache::lonlocal::texthash (
'domain' => 'Domain Roles',