--- loncom/interface/lonaboutme.pm 2009/06/11 16:48:33 1.138 +++ loncom/interface/lonaboutme.pm 2023/09/27 14:52:26 1.166 @@ -1,7 +1,7 @@ # The LearningOnline Network # Personal Information Page # -# $Id: lonaboutme.pm,v 1.138 2009/06/11 16:48:33 bisitz Exp $ +# $Id: lonaboutme.pm,v 1.166 2023/09/27 14:52:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,8 +50,6 @@ described at http://www.lon-capa.org. =item handler() -=item in_course() - =item aboutme_info() =item print_portfiles_link() @@ -80,11 +78,13 @@ use Apache::Constants qw(:common); use Apache::loncommon; use Apache::lonnet; use Apache::lontexconvert; -use Apache::lonfeedback; +use Apache::lonhtmlgateway; use Apache::lonrss(); use Apache::lonlocal; use Apache::lonmsgdisplay(); use Apache::lontemplate; +use Apache::longroup; +use Apache::lonhtmlcommon(); use HTML::Entities(); use Image::Magick; @@ -109,10 +109,15 @@ sub handler { $is_course = &Apache::lonnet::is_course($cdom,$cnum); } + my $clientip = &Apache::lonnet::get_requestor_ip($r); my $candisplay = 1; if (!$is_course) { if ($action ne 'portfolio') { - $candisplay = &Apache::lonnet::usertools_access($cnum,$cdom,'aboutme'); + if (($env{'user.name'} eq $cnum) && ($env{'user.domain'} eq $cdom)) { + $candisplay = &Apache::lonnet::usertools_access($cnum,$cdom,'aboutme'); + } else { + $candisplay = &Apache::loncommon::aboutme_on($cnum,$cdom); + } if ((!$candisplay) && ($env{'request.course.id'})) { $candisplay = &aboutme_access($cnum,$cdom); } @@ -121,7 +126,7 @@ sub handler { $r->print('\noindent{\large\textbf{'.&mt('No user personal information page available').'}}\\\\\\\\'); } else { $r->print(&Apache::loncommon::start_page("Personal Information Page")); - $r->print('
'.&mt('No user personal information page available') .'
'. &mt('This is a result of one of the following:').''); + $r->print('
'); } if($allowed) { - $r->print(''.&mt('Close window').''); + $r->print('
'); } $r->print(&Apache::loncommon::end_page()); } else { @@ -444,33 +441,6 @@ sub handler { return OK; } -sub in_course { - my ($udom,$uname,$cdom,$cnum,$type) = @_; - $type ||= 'any'; - if (!defined($cdom) || !defined($cnum)) { - my $cid = $env{'request.course.id'}; - $cdom = $env{'course.'.$cid.'.domain'}; - $cnum = $env{'course.'.$cid.'.num'}; - } - my %roles = &Apache::lonnet::dump('roles',$udom,$uname); - my @course_roles = grep(m{^/\Q$cdom\E/\Q$cnum\E[/_]}, keys(%roles)); - return 0 if (!@course_roles); - return 1 if ($type eq 'any'); - my $now = time(); - foreach my $role (@course_roles) { - my (undef,$role_end,$role_start)=split(/\_/,$roles{$role}); - my $status = 'active'; - if ($role_start > 0 && $now < $role_start) { - $status = 'future'; - } - if ($role_end > 0 && $now > $role_end) { - $status = 'previous'; - } - return 1 if ($status eq $type); - } - return 0; -} - sub aboutme_info { my ($r,$is_course) = @_; my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri); @@ -522,6 +492,8 @@ sub print_portfiles_link { } $output .= ''; $output .= '