--- loncom/interface/lonaboutme.pm 2007/05/23 21:44:11 1.63 +++ loncom/interface/lonaboutme.pm 2009/02/13 18:56:13 1.94 @@ -1,7 +1,7 @@ # The LearningOnline Network # "About Me" Personal Information # -# $Id: lonaboutme.pm,v 1.63 2007/05/23 21:44:11 albertel Exp $ +# $Id: lonaboutme.pm,v 1.94 2009/02/13 18:56:13 neumanie Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,6 +26,53 @@ # 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 in_course() + +=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; @@ -37,7 +84,9 @@ use Apache::lonfeedback; use Apache::lonrss(); use Apache::lonlocal; use Apache::lonmsgdisplay(); +use Apache::lontemplate; use HTML::Entities(); +use Image::Magick; sub handler { my $r = shift; @@ -60,6 +109,30 @@ sub handler { $is_course = &Apache::lonnet::is_course($cdom,$cnum); } + my $candisplay = 1; + if (!$is_course) { + if ($action ne 'portfolio') { + $candisplay = &Apache::lonnet::usertools_access($cnum,$cdom,'aboutme'); + if ((!$candisplay) && ($env{'request.course.id'})) { + $candisplay = &aboutme_access($cnum,$cdom); + } + if (!$candisplay) { + if ($target eq 'tex') { + $r->print('\noindent{\large\textbf{'.&mt('No user home page available').'}}\\\\\\\\'); + } else { + $r->print(&Apache::loncommon::start_page("Personal Information")); + $r->print('
'.&Apache::loncommon::messagewrapper('Send me a message',$cnum,$cdom).'
'.&Apache::lonrss::advertisefeeds($cnum,$cdom)); + $r->print(''.&mt('Privacy Note').': '. &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.'). - '
'. - &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'Show Public View'. - &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'
'); + ''.&mt('Show Public View').''. + &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'
'. + &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).''); } elsif ($privleged && $target ne 'tex') { - my $query_string = &build_query_string({'forceedit' => '1',}); - $r->print(''); + $query_string = &build_query_string({'forceedit' => '1','popup' => $env{'form.popup'}}); + $r->print(''); } if (($env{'form.uploaddoc.filename'}) && ($env{'form.storeupl'}) && ($allowed)) { @@ -164,7 +251,7 @@ sub handler { &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'}); } $syllabus{'uploaded.photourl'}= - &Apache::lonnet::userfileupload('uploaddoc',undef,'aboutme'); + &Apache::lonnet::userphotoupload('uploaddoc','aboutme'); } $syllabus{'uploaded.lastmodified'}=time; &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum); @@ -188,69 +275,86 @@ sub handler { &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum); } +my $lastmod; +my $image; # ---------------------------------------------------------------- Get syllabus if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) { - my $lastmod=$syllabus{'uploaded.lastmodified'}; + $lastmod=$syllabus{'uploaded.lastmodified'}; $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never')); - $r->print(&mt('Last updated').': '.$lastmod); + $r->print('
+');
}
- foreach my $field (sort(keys(%syllabusfields))) {
- if (($syllabus{$field}) || ($allowed)) {
- my $message=$syllabus{$field};
- &Apache::lonfeedback::newline_to_br(\$message);
- $message
- =~s/(http\:\/\/[^\s]+)/\\$1\<\/tt\>\<\/a\>/g;
- if ($allowed) {
- $message=&Apache::lonspeller::markeduptext($message);
- }
- $message=&Apache::lontexconvert::msgtexconverted($message);
- if ($target ne 'tex') {
- $r->print(' '.&mt('No personal information provided').'. '.&mt('Close window').'');
+ }
$r->print(&Apache::loncommon::end_page());
} else {
$r->print('\end{document}');
}
+
+
+
return OK;
}
@@ -327,7 +437,8 @@ sub aboutme_info {
sub print_portfiles_link {
my ($r,$is_course) = @_;
my ($cdom,$cnum,$name) = &aboutme_info($r,$is_course);
- my $filecounts = &portfolio_files($r,'showlink',undef,$is_course);
+ my $filecounts = &portfolio_files($r,'showlink',undef,$is_course,
+ $cdom,$cnum,$name);
my $query_string = &build_query_string();
my $output;
my %lt = &Apache::lonlocal::texthash(
@@ -336,7 +447,10 @@ sub print_portfiles_link {
difl => 'Display file listing',
);
if ($filecounts->{'both'} > 0) {
- $output = ''.$syllabusfields{$field}.'
'.
- $message.'
');
- } else {
- $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.
- &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');
- }
- if ($allowed) {
- $r->print('
');
- }
- }
- }
+
+ if($allowed) {
+ $r->print('');
}
if ($target ne 'tex') {$r->print('
');} else {$r->print('\\\\');}
} else {
+ &Apache::lontemplate::send_message($r,$cnum,$cdom);
$r->print(''.($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'
';
+ $output = '';
+ $output .= ($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'
';
+
+ #$output = ''.($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'
';
$output .= ''.$lt{'difl'}.
'
';
@@ -360,6 +474,8 @@ sub print_portfiles_link {
$output .= '
';
$r->print($output);
- my $filecounts = &portfolio_files($r,'listfiles',\%lt,$is_course);
+ my $filecounts = &portfolio_files($r,'listfiles',\%lt,$is_course,
+ $cdom,$cnum,$name);
if (!($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public')) {
my $query_string = &build_query_string();
$r->print('
';
@@ -652,7 +769,7 @@ sub parse_directory {
' '.$showname.'';
$output.='