--- loncom/interface/lonaboutme.pm 2010/03/29 12:21:38 1.146 +++ loncom/interface/lonaboutme.pm 2012/11/08 18:37:44 1.150 @@ -1,7 +1,7 @@ # The LearningOnline Network # Personal Information Page # -# $Id: lonaboutme.pm,v 1.146 2010/03/29 12:21:38 raeburn Exp $ +# $Id: lonaboutme.pm,v 1.150 2012/11/08 18:37:44 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() @@ -121,7 +119,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:').''.&mt('No personal information provided').'.
'); + $r->print(''.&mt('No personal information provided').'.
'); } if ($env{'request.course.id'} && &Apache::lonnet::allowed('srm',$env{'request.course.id'}) - && &in_course($cdom,$cnum)) { + && &Apache::lonnet::in_course($cdom,$cnum)) { if ($target ne 'tex') { $r->print(''); &Apache::lontemplate::print_start_template($r,&mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course'),'LC_Box'); @@ -444,33 +404,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); @@ -779,9 +712,12 @@ sub parse_directory { my $portfolio_root = &Apache::portfolio::get_portfolio_root($cdom,$cnum, $group); my $getpropath = 1; - my %dirlist = map { - ((split('&',$_,2))[0],1) - } &Apache::lonnet::dirlist($portfolio_root.$path,$cdom,$cnum,$getpropath); + my ($listref,$listerror) = + &Apache::lonnet::dirlist($portfolio_root.$path,$cdom,$cnum,$getpropath); + my %dirlist; + if (ref($listref) eq 'ARRAY') { + %dirlist = map { ((split('&',$_,2))[0],1) } @{$listref}; + } foreach my $item (sort(keys(%{$currhash}))) { $output .= &Apache::loncommon::start_data_table_row(); $output .= '