--- loncom/interface/lonaboutme.pm 2003/02/10 20:03:13 1.12
+++ loncom/interface/lonaboutme.pm 2023/12/28 03:33:15 1.167
@@ -1,7 +1,7 @@
# The LearningOnline Network
-# "About Me" Personal Information
+# Personal Information Page
#
-# $Id: lonaboutme.pm,v 1.12 2003/02/10 20:03:13 www Exp $
+# $Id: lonaboutme.pm,v 1.167 2023/12/28 03:33:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,6 +26,51 @@
# http://www.lon-capa.org/
#
+=pod
+
+=head1 NAME
+
+pache::lonaboutme
+
+=head1 SYNOPSIS
+
+(empty)
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+=head1 OVERVIEW
+
+(empty)
+
+
+=head1 SUBROUTINES
+
+=over
+
+=item handler()
+
+=item aboutme_info()
+
+=item print_portfiles_link()
+
+=item build_query_string()
+
+=item display_portfolio_header()
+
+=item display_portfolio_files()
+
+=item portfolio_files()
+
+=item build_hierarchy()
+
+=item parse_directory()
+
+=back
+
+=cut
+
+
package Apache::lonaboutme;
use strict;
@@ -33,138 +78,764 @@ 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;
sub handler {
my $r = shift;
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK if $r->header_only;
-
+ my $target=$env{'form.grade_target'};
# ------------------------------------------------------------ Print the screen
- $r->print(< '.&mt('No user personal information page available') .' '.&Apache::loncommon::messagewrapper('Send me a message',$cnum,$cdom).
- ' Privacy Note: 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 publically.'.
+ '
');
+ $r->print(&Apache::loncommon::end_page());
+ }
+ return OK;
+ }
+ }
+ }
+
# --------------------------------------------------------- The syllabus fields
- my %syllabusfields=(
+ my %syllabusfields=&Apache::lonlocal::texthash(
'aaa_contactinfo' => 'Contact Information',
- 'bbb_aboutme' => 'About Me',
+ 'bbb_aboutme' => 'Personal Information',
'ccc_webreferences' => 'Web References');
-# --------------------------------------------------------------- Force Student
- &Apache::loncommon::get_unprocessed_cgi
- ($ENV{'QUERY_STRING'},['forcestudent']);
- my $forcestudent='';
- if ($ENV{'form.forcestudent'}) { $forcestudent='student'; };
-
-# --------------------------------------- There is such a user, get environment
+# ------------------------------------------------------------ Get Query String
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['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);
+ if ((!$is_course) && (!&Apache::lonnet::usertools_access($cnum,$cdom,'portfolio'))) {
+ $r->print(''.&mt('No user portfolio available') .'
'.
+ &mt('This is a result of one of the following:').''.
+ '
');
+ } else {
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('port',$clientip,$cnum,$cdom);
+ if (!$blocked) {
+ &display_portfolio_files($r,$is_course);
+ } else {
+ $r->print($blocktext);
+ }
+ }
+ $r->print(&Apache::loncommon::end_page());
+ return OK;
+ }
+
+ if ($is_course) {
+ if ($target ne 'tex') {
+ 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);
+ $r->print(&Apache::loncommon::end_page());
+ }
+ return OK;
+ }
+
+#------------Get rights
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
- $r->print(&Apache::loncommon::bodytag
- ("Personal Information",$forcestudent,'','',$cdom));
- $r->print(''.&Apache::loncommon::plainname($cnum,$cdom).'
');
- if ($courseenv{'nickname'}) {
- $r->print(
- '"'.$courseenv{'nickname'}.
- '"
');
- }
- $r->print(''.$Apache::lonnet::domaindescription{$cdom}.'
'.
- '
Show Public View'. - &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'
'); - } - if (($ENV{'form.uploaddoc.filename'}) && - ($ENV{'form.storeupl'}) && ($allowed)) { - if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/) { - $syllabus{'uploaded.photourl'}= - &Apache::lonnet::userfileupload('uploaddoc'); - } - $syllabus{'uploaded.lastmodified'}=time; - &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum); - } - if (($allowed) && ($ENV{'form.storesyl'})) { - foreach (keys %syllabusfields) { - my $field=$ENV{'form.'.$_}; - $field=~s/\s+$//s; - $field=&Apache::lonfeedback::clear_out_html($field, - $ENV{'user.adv'}); - $syllabus{$_}=$field; - } - $syllabus{'uploaded.lastmodified'}=time; - &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum); +# --------------------------------------- There is such a user, get environment + + if ($target ne 'tex') { + my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom); + my $args = {'function' => undef, + 'domain' => $cdom, + 'force_register' => $env{'form.register'}, + }; + 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{'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('No personal information provided.
'); + $r->print(''.&mt('No personal information provided').'.
'); + if ($target ne 'tex') { + &print_portfiles_link($r,$is_course); + } } - if ($ENV{'request.course.id'}) { - if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { - $r->print('