--- loncom/interface/lonaboutme.pm 2009/05/19 10:03:37 1.134
+++ 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.134 2009/05/19 10:03:37 amueller Exp $
+# $Id: lonaboutme.pm,v 1.168 2023/12/28 15:57:27 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') .'
'.
+ $r->print('
'.&mt('No user personal information page available') .'
'.
&mt('This is a result of one of the following:').'
'.
'
'.&mt('The administrator of this domain has disabled personal information page functionality for this specific user.').'
'.
'
'.&mt('The domain has been configured to disable, by default, personal information page functionality for all users in the domain.').'
'.
@@ -141,9 +146,8 @@ sub handler {
# ------------------------------------------------------------ Get Query String
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['forceedit','forcestudent',
- 'register','popup']);
-
+ ['forceedit','forcestudent','todocs',
+ 'register','popup','folderpath','title','only_body']);
# ----------------------------------------------- Available Portfolio file display
if (($target ne 'tex') && ($action eq 'portfolio')) {
&display_portfolio_header($r,$is_course);
@@ -155,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 {
@@ -168,16 +172,22 @@ sub handler {
if ($is_course) {
if ($target ne 'tex') {
- my $brcrum = [{href=>"/adm/navmaps",text=>"Navigate Course Contents"},
- {href=>"/adm/aboutme",text=>"Course Information"}];
- my $start_page =
- &Apache::loncommon::start_page(
- "Course Information",
- undef,
- {'function' => $env{'forcestudent'},
- 'domain' => $cdom,
- 'force_register' => $env{'forceregister'},
- 'bread_crumbs' => $brcrum});
+ my $args = {'function' => undef,
+ 'domain' => $cdom};
+ if ($env{'form.register'}) {
+ $args->{'force_register'} = $env{'form.register'};
+ } else {
+ my %coursedescription =
+ &Apache::lonnet::coursedescription($cdom.'_'.$cnum);
+ my $cdescr = $coursedescription{'description'};
+ my $brcrum = [{href=>"/adm/$cdom/$cnum/aboutme",
+ text=>&mt('Course Information - [_1]',$cdescr),
+ no_mt=>1}
+ ];
+ $args->{'bread_crumbs'} = $brcrum;
+ }
+ my $start_page = &Apache::loncommon::start_page(
+ "Course Information",undef,$args);
$r->print($start_page);
$r->print('
'.&mt('Group Portfolio').'
');
&print_portfiles_link($r,$is_course);
@@ -186,39 +196,76 @@ sub handler {
return OK;
}
-# --------------------------------------------------------------- Force Student
- my $forcestudent='';
- if ($env{'form.forcestudent'}) { $forcestudent='student'; };
-
- my $forceregister = '';
- if ($forcestudent eq '') {
- $forceregister = $env{'form.register'};
- }
-
#------------Get rights
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
- my %syllabus=&Apache::lonnet::dump('aboutme',$cdom,$cnum);
- my $allowed=0;
- my $privleged=$allowed=(($env{'user.name'} eq $cnum) &&
- ($env{'user.domain'} eq $cdom));
- if ($forcestudent or $target eq 'tex') { $allowed=0; }
+ my %syllabus=&Apache::lonnet::dump('aboutme',$cdom,$cnum);
+ my ($allowed,$coursedomain,$coursenum);
+ if ($env{'request.course.id'}) {
+ $coursedomain = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ $coursenum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ }
+ my ($cfile) =
+ &Apache::lonnet::can_edit_resource($env{'request.noversionuri'},
+ $coursenum,$coursedomain,
+ $env{'request.noversionuri'},
+ $env{'request.symb'});
+ if ($cfile ne '') {
+ $allowed = 1;
+ }
+ if (!$env{'form.forceedit'} or $target eq 'tex') { $allowed=0; }
# --------------------------------------- There is such a user, get environment
if ($target ne 'tex') {
my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
- my $args = {'function' => $forcestudent,
+ my $args = {'function' => undef,
'domain' => $cdom,
- 'force_register' => $forceregister};
- if ($env{'form.popup'}) {
+ 'force_register' => $env{'form.register'},
+ };
+ if ($env{'form.popup'}) { # Don't show breadcrumbs in popup window
$args->{'no_nav_bar'} = 1;
- } else { # Don't show breadcrumbs in popup window
- $args->{'bread_crumbs'} = [{href=>"/adm/$cdom/$cnum/aboutme",text=>"Personal Information Page"}];
+ } elsif (!$env{'form.register'}) { #Don't show breadcrumbs twice, when this page is part of course content and you call it
+ 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",
+ text=>"Personal Information Page"}];
+ }
}
my $start_page = &Apache::loncommon::start_page('Personal Information Page',$rss_link,$args);
$r->print($start_page);
+ }
+ my ($blocked,$blocktext) =
+ &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').'}}\\\\\\\\');
+ } else {
+ $r->print($blocktext);
+ }
+ $r->print(&Apache::loncommon::end_page());
+ return OK;
+ }
+
+#----------------Print Privacy note (edit mode) or last modified date.
+ if ($target ne 'tex') {
#Print Privacy Note
if ($allowed) {
$r->print('
'
@@ -226,66 +273,36 @@ sub handler {
.&mt('The information you submit can be viewed by anybody who is logged into LON-CAPA. Do not provide information that you are not ready to share publicly.')
.'
'
);
- }
-
-#Print last modified
-
- my $lastmod;
- if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
- $lastmod=$syllabus{'uploaded.lastmodified'};
+ } elsif ($syllabus{'uploaded.lastmodified'}) {
+ #Print last modified
+ my $lastmod=$syllabus{'uploaded.lastmodified'};
$lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));
$r->print('
');
}
}
-#Print Help Text
- if ($target ne 'tex') {
- if($allowed){
- $r->print(&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')));
- }
- }
-#----------------Print Functions
- if ($target ne 'tex') {
- $r->print(&Apache::lontemplate::start_functionslist());
+#------Print Headtitle
+ if ($target ne 'tex') {
+ $r->print('
'.
+ '
'.&Apache::loncommon::plainname($cnum,$cdom).'
');
if ($allowed) {
- my $query_string = &build_query_string({'forcestudent' => '1','popup' => $env{'form.popup'}});
- $r->print(&Apache::lontemplate::item_functionslist(
- ''.&mt('Show Public View').''
- .&Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView')));
- } elsif ($privleged) {
- my $query_string = &build_query_string({'forceedit' => '1','popup' => $env{'form.popup'}});
- $r->print(&Apache::lontemplate::item_functionslist(
- ''. &mt('Edit').''));
- }
- $r->print(&Apache::lontemplate::item_functionslist(
- &Apache::lontemplate::send_message($r,$cnum,$cdom)));
-
- if ($env{'request.course.id'} && &Apache::lonnet::allowed('srm',$env{'request.course.id'}) && &in_course($cdom,$cnum)) {
- if (&Apache::lonnet::allowed('vsa', $env{'request.course.id'}) || &Apache::lonnet::allowed('vsa', $env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
- $r->print(&Apache::lontemplate::item_functionslist(
- &Apache::loncommon::track_student_link('View recent activity by this student',$cnum,$cdom)));
+ $r->print('