--- loncom/interface/lonaboutme.pm 2021/01/02 21:07:36 1.160
+++ loncom/interface/lonaboutme.pm 2023/12/28 15:57:27 1.168
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Personal Information Page
#
-# $Id: lonaboutme.pm,v 1.160 2021/01/02 21:07:36 raeburn Exp $
+# $Id: lonaboutme.pm,v 1.168 2023/12/28 15:57:27 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -84,6 +84,7 @@ use Apache::lonlocal;
use Apache::lonmsgdisplay();
use Apache::lontemplate;
use Apache::longroup;
+use Apache::lonhtmlcommon();
use HTML::Entities();
use Image::Magick;
@@ -108,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);
}
@@ -141,7 +147,7 @@ sub handler {
# ------------------------------------------------------------ Get Query String
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['forceedit','forcestudent','todocs',
- 'register','popup','folderpath','title']);
+ 'register','popup','folderpath','title','only_body']);
# ----------------------------------------------- Available Portfolio file display
if (($target ne 'tex') && ($action eq 'portfolio')) {
&display_portfolio_header($r,$is_course);
@@ -153,7 +159,7 @@ sub handler {
'');
} else {
my ($blocked,$blocktext) =
- &Apache::loncommon::blocking_status('port',$cnum,$cdom);
+ &Apache::loncommon::blocking_status('port',$clientip,$cnum,$cdom);
if (!$blocked) {
&display_portfolio_files($r,$is_course);
} else {
@@ -220,17 +226,22 @@ sub handler {
if ($env{'form.popup'}) { # Don't show breadcrumbs in popup window
$args->{'no_nav_bar'} = 1;
} elsif (!$env{'form.register'}) { #Don't show breadcrumbs twice, when this page is part of course content and you call it
- if (($env{'request.course.id'}) &&
- ($env{'form.folderpath'} =~ /^supplemental/)) {
+ if (($env{'form.only_body'}) && ($env{'request.course.id'})) {
+ $args->{'only_body'} = 1;
+ } elsif (($env{'request.course.id'}) &&
+ ($env{'form.folderpath'} =~ /^supplemental/)) {
+ &Apache::loncommon::validate_folderpath(1,'',$coursenum,$coursedomain);
my $crstype = &Apache::loncommon::course_type();
my $title = $env{'form.title'};
if ($title eq '') {
$title = &mt('Personal Information Page');
}
+ $title = &HTML::Entities::encode($title,'\'"<>&');
my $brcrum =
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
if (ref($brcrum) eq 'ARRAY') {
$args->{'bread_crumbs'} = $brcrum;
+ $args->{'bread_crumbs_nomenu'} = 1;
}
} else {
$args->{'bread_crumbs'} = [{href=>"/adm/$cdom/$cnum/aboutme",
@@ -241,7 +252,7 @@ sub handler {
$r->print($start_page);
}
my ($blocked,$blocktext) =
- &Apache::loncommon::blocking_status('about',$cnum,$cdom);
+ &Apache::loncommon::blocking_status('about',$clientip,$cnum,$cdom);
if ($blocked) {
if ($target eq 'tex') {
$r->print('\noindent{\large\textbf{'.&mt('No user personal information page available').'}}\\\\\\\\');
@@ -396,6 +407,9 @@ sub handler {
if ($target ne 'tex') {$r->print('
');} else {$r->print('\\\\');}
} else {
$r->print('
'.&mt('No personal information provided').'.
'); + if ($target ne 'tex') { + &print_portfiles_link($r,$is_course); + } } if ($env{'request.course.id'} @@ -625,6 +639,10 @@ sub portfolio_files { withoutpass => 0, both => 0, }; + unless (($is_course) || + (&Apache::lonnet::usertools_access($cnum,$cdom,'portaccess',undef,'tools'))) { + return $filecounts; + } my $current_permissions = &Apache::lonnet::get_portfile_permissions($cdom,$cnum); my %access_controls = @@ -683,10 +701,11 @@ sub build_hierarchy { my ($r,$cdom,$cnum,$portaccess,$is_course,$filecounts,$mode,$access_info, $allfileshash,$group) = @_; my $clientip = &Apache::lonnet::get_requestor_ip($r); + my $usercanshare = &Apache::lonnet::usertools_access($cnum,$cdom,'portaccess',undef,'tools'); foreach my $filename (sort(keys(%{$access_info}))) { my $access_status = &Apache::lonnet::get_portfolio_access($cdom,$cnum,$filename,$group,$clientip, - $access_info->{$filename}); + $access_info->{$filename},\$usercanshare); if ($portaccess eq 'both') { if (($access_status ne 'ok') && ($access_status !~ /^[^:]+:guest_/)) { @@ -804,10 +823,8 @@ sub parse_directory { sub aboutme_access { my ($uname,$udom) = @_; my $privcheck = $env{'request.course.id'}; - my $sec; if ($env{'request.course.sec'} ne '') { - $sec = $env{'request.course.sec'}; - $privcheck .= '/'.$sec; + $privcheck .= '/'.$env{'request.course.sec'}; } my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};