[LON-CAPA-cvs] cvs: loncom /interface lonuserutils.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 17 Jan 2008 00:14:50 -0000
raeburn Wed Jan 16 19:14:50 2008 EDT
Modified files:
/loncom/interface lonuserutils.pm
Log:
Bug 5545. User can choose to display a user's 'about me" page in a new window.
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.47 loncom/interface/lonuserutils.pm:1.48
--- loncom/interface/lonuserutils.pm:1.47 Sun Jan 6 22:00:00 2008
+++ loncom/interface/lonuserutils.pm Wed Jan 16 19:14:49 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.47 2008/01/07 03:00:00 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.48 2008/01/17 00:14:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2000,9 +2000,14 @@
document.studentform.action.value = 'singleuser';
document.studentform.submit();
}
- else {
+ if (target == 'aboutme') {
document.location.href = '/adm/'+domain+'/'+username+'/aboutme';
}
+ if (target == 'aboutmewin') {
+ var url = '/adm/'+domain+'/'+username+'/aboutme';
+ var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
+ aboutmewin = window.open(url,'',options,1);
+ }
}
</script>
$date_sec_selector
@@ -2036,6 +2041,7 @@
'ac' => "Action to take for selected users",
'link' => "Behavior of username links",
'aboutme' => "Display a user's personal page",
+ 'aboutmewin' => "Display a user's personal page in a new window",
'modify' => "Modify a user's information",
);
if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
@@ -2092,25 +2098,23 @@
<input type="hidden" name="srchdomain" value="" />
END
$output = '<p>';
- my @linkdests = ('aboutme');
+ my @linkdests = ('aboutme','aboutmewin');
if ($permission->{'cusr'}) {
- push (@linkdests,'modify');
- $output .= '<span class="LC_nobreak">'.$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 .= '<label><input type="radio" name="usernamelink" value="'.$item.'"'.$checkedstr.'> '.$lt{$item}.'</label> ';
+ unshift (@linkdests,'modify');
+ }
+ $output .= '<span class="LC_nobreak">'.$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 .= '</span><br />';
- } else {
- $output .= &mt("Click on a username to view the user's personal page.").'<br />';
+ $output .= '<label><input type="radio" name="usernamelink" value="'.$item.'"'.$checkedstr.'> '.$lt{$item}.'</label> ';
}
+ $output .= '</span><br />';
if ($actionselect) {
$output .= <<"END";
$lt{'ac'}: $actionselect <input type="button" value="$lt{'go'}" onclick="javascript:opendatebrowser(this.form,'studentform','go')" /></p>
@@ -2463,8 +2467,7 @@
}
foreach my $item (@cols) {
if ($item eq 'username') {
- $r->print('<td>'.&print_username_link($mode,$permission,
- \%in).'</td>');
+ $r->print('<td>'.&print_username_link($mode,\%in).'</td>');
} elsif (($item eq 'start' || $item eq 'end') && ($actionselect)) {
$r->print('<td>'.$in{$item}.'<input type="hidden" name="'.$checkval.'_'.$item.'" value="'.$sdata->[$index{$item}].'" /></td>'."\n");
} else {
@@ -2548,14 +2551,10 @@
}
sub print_username_link {
- my ($mode,$permission,$in) = @_;
+ my ($mode,$in) = @_;
my $output;
if ($mode eq 'autoenroll') {
$output = $in->{'username'};
- } elsif (!$permission->{'cusr'}) {
- $output = &Apache::loncommon::aboutmewrapper($in->{'username'},
- $in->{'username'},
- $in->{'domain'});
} else {
$output = '<a href="javascript:username_display_launch('.
"'$in->{'username'}','$in->{'domain'}'".')" />'.