version 1.70.2.2, 2008/12/17 23:05:11
|
version 1.75, 2008/12/02 09:41:07
|
Line 26
|
Line 26
|
# http://www.lon-capa.org/ |
# 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; |
package Apache::lonaboutme; |
|
|
use strict; |
use strict; |
Line 37 use Apache::lonfeedback;
|
Line 84 use Apache::lonfeedback;
|
use Apache::lonrss(); |
use Apache::lonrss(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonmsgdisplay(); |
use Apache::lonmsgdisplay(); |
|
use Apache::lontemplate; |
use HTML::Entities(); |
use HTML::Entities(); |
|
|
sub handler { |
sub handler { |
Line 60 sub handler {
|
Line 108 sub handler {
|
$is_course = &Apache::lonnet::is_course($cdom,$cnum); |
$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('<h2>'.&mt('No user home page available') .'</h2>'. |
|
&mt('This is a result of one of the following:').'<ul>'. |
|
'<li>'.&mt('The administrator of this domain has disabled home page functionality for this specific user.').'</li>'. |
|
'<li>'.&mt('The domain has been configured to disable, by default, home page functionality for all users in the domain.').'</li>'. |
|
'</ul>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
return OK; |
|
} |
|
} |
|
} |
|
|
|
# --------------------------------------------------------- The syllabus fields |
# --------------------------------------------------------- The syllabus fields |
my %syllabusfields=&Apache::lonlocal::texthash( |
my %syllabusfields=&Apache::lonlocal::texthash( |
'aaa_contactinfo' => 'Contact Information', |
'aaa_contactinfo' => 'Contact Information', |
Line 98 sub handler {
|
Line 122 sub handler {
|
# ----------------------------------------------- Available Portfolio file display |
# ----------------------------------------------- Available Portfolio file display |
if (($target ne 'tex') && ($action eq 'portfolio')) { |
if (($target ne 'tex') && ($action eq 'portfolio')) { |
&display_portfolio_header($r,$is_course); |
&display_portfolio_header($r,$is_course); |
if ((!$is_course) && (!&Apache::lonnet::usertools_access($cnum,$cdom,'portfolio'))) { |
my ($blocked,$blocktext) = |
$r->print('<h2>'.&mt('No user portfolio available') .'</h2>'. |
&Apache::loncommon::blocking_status('port',$cnum,$cdom); |
&mt('This is a result of one of the following:').'<ul>'. |
if (!$blocked) { |
'<li>'.&mt('The administrator of this domain has disabled portfolio functionality for this specific user.').'</li>'. |
&display_portfolio_files($r,$is_course); |
'<li>'.&mt('The domain has been configured to disable, by default, portfolio functionality for all users in the domain.').'</li>'. |
|
'</ul>'); |
|
} else { |
} else { |
my ($blocked,$blocktext) = |
$r->print($blocktext); |
&Apache::loncommon::blocking_status('port',$cnum,$cdom); |
|
if (!$blocked) { |
|
&display_portfolio_files($r,$is_course); |
|
} else { |
|
$r->print($blocktext); |
|
} |
|
$r->print(&Apache::loncommon::end_page()); |
|
return OK; |
|
} |
} |
|
$r->print(&Apache::loncommon::end_page()); |
|
return OK; |
} |
} |
|
|
if ($is_course) { |
if ($is_course) { |
Line 166 sub handler {
|
Line 182 sub handler {
|
'"</h2>'); |
'"</h2>'); |
} |
} |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
$r->print('<h3>'.&Apache::lonnet::domain($cdom,'description').'</h3>'. |
$r->print('<h3>'.&Apache::lonnet::domain($cdom,'description').'</h3>');#OLD SendMessage POS |
'<p>'.&Apache::loncommon::messagewrapper(&mt('Send me a message'),$cnum,$cdom).'</p>'.&Apache::lonrss::advertisefeeds($cnum,$cdom)); |
|
} else { |
} else { |
$r->print('\textbf{'.&Apache::lonnet::domain($cdom,'description').'}\\\\'); |
$r->print('\textbf{'.&Apache::lonnet::domain($cdom,'description').'}\\\\'); |
} |
} |
Line 223 sub handler {
|
Line 238 sub handler {
|
&Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum); |
&Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum); |
} |
} |
|
|
|
my $lastmod; |
|
my $image; |
# ---------------------------------------------------------------- Get syllabus |
# ---------------------------------------------------------------- Get syllabus |
if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) { |
if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) { |
my $lastmod=$syllabus{'uploaded.lastmodified'}; |
$lastmod=$syllabus{'uploaded.lastmodified'}; |
$lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never')); |
$lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never')); |
$r->print(&mt('Last updated').': '.$lastmod); |
# $r->print(&mt('Last updated').': '.$lastmod); #Old Last Modifi Pos |
if ($syllabus{'uploaded.photourl'}) { |
if ($syllabus{'uploaded.photourl'}) { |
&Apache::lonnet::allowuploaded('/adm/aboutme', |
&Apache::lonnet::allowuploaded('/adm/aboutme', |
$syllabus{'uploaded.photourl'}); |
$syllabus{'uploaded.photourl'}); |
my $image= |
$image= |
qq{<img src="$syllabus{'uploaded.photourl'}" align="right" />}; |
qq{<img name="userPhoto" src="$syllabus{'uploaded.photourl'}" style="vertical-align:text-top;float:right;" />}; |
|
|
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$image=&Apache::lonxml::xmlparse($r,'tex',$image); |
$image=&Apache::lonxml::xmlparse($r,'tex',$image); |
} |
} |
$r->print($image); |
# $r->print($image); #Print old Image |
} |
} |
if ($allowed) { |
if ($allowed) { |
$r->print( |
$r->print( |
Line 251 sub handler {
|
Line 269 sub handler {
|
'</form><form method="post">'); |
'</form><form method="post">'); |
|
|
} |
} |
foreach my $field (sort(keys(%syllabusfields))) { |
&Apache::lontemplate::print_content_template($r,$allowed,$target,\%syllabusfields,\%syllabus); |
if (($syllabus{$field}) || ($allowed)) { |
if($target ne 'tex') |
my $message=$syllabus{$field}; |
{ |
&Apache::lonfeedback::newline_to_br(\$message); |
|
$message |
&print_portfiles_link($r,$is_course); |
=~s/(http\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g; |
|
if ($allowed) { |
$r->print('</div>'); |
$message=&Apache::lonspeller::markeduptext($message); |
$r->print('<div style="margin:0 0 0 75">'); |
} |
$r->print($image); |
$message=&Apache::lontexconvert::msgtexconverted($message); |
|
if ($target ne 'tex') { |
$r->print('Kontakt'); |
$r->print('<h3>'.$syllabusfields{$field}.'</h3><blockquote>'. |
$r->print(&Apache::loncommon::messagewrapper(&mt('Send me a message'),$cnum,$cdom).'</p>'.&Apache::lonrss::advertisefeeds($cnum,$cdom)); |
$message.'</blockquote>'); |
|
} else { |
|
$r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'. |
|
&Apache::lonxml::xmlparse($r,'tex',$message).'\\\\'); |
|
} |
|
if ($allowed) { |
|
$r->print('<br /><textarea cols="80" rows="6" name="'.$field.'">'. |
|
&HTML::Entities::encode($syllabus{$field},'"&<>'). |
|
'</textarea><input type="submit" name="storesyl" value="'. |
|
&mt('Save').'" />'); |
|
} |
|
} |
|
} |
} |
|
|
if ($allowed) { |
if ($allowed) { |
if ($env{'form.popup'}) { |
if ($env{'form.popup'}) { |
$r->print('<input type="hidden" name="popup" value="'. |
$r->print('<input type="hidden" name="popup" value="'. |
Line 289 sub handler {
|
Line 298 sub handler {
|
} |
} |
|
|
if ($target ne 'tex') { |
if ($target ne 'tex') { |
&print_portfiles_link($r,$is_course); |
# &print_portfiles_link($r,$is_course); #old Print files |
|
|
} |
} |
|
|
if ($env{'request.course.id'} |
if ($env{'request.course.id'} |
Line 323 sub handler {
|
Line 333 sub handler {
|
if ($env{'form.popup'}) { |
if ($env{'form.popup'}) { |
$r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a>'); |
$r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a>'); |
} |
} |
|
$r->print('<br />'.&mt('Last updated').': '.$lastmod); |
|
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} else { |
} else { |
$r->print('\end{document}'); |
$r->print('\end{document}'); |
} |
} |
|
|
|
|
|
|
return OK; |
return OK; |
} |
} |
|
|
Line 380 sub print_portfiles_link {
|
Line 395 sub print_portfiles_link {
|
difl => 'Display file listing', |
difl => 'Display file listing', |
); |
); |
if ($filecounts->{'both'} > 0) { |
if ($filecounts->{'both'} > 0) { |
$output = '<h3>'.($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'</h3>'; |
$output = '<fieldset><legend><b>'; |
|
$output .= ($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'</b></legend><br />'; |
|
|
|
#$output = '<h3>'.($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'</h3>'; |
$output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme/portfolio'. |
$output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme/portfolio'. |
$query_string.'">'.$lt{'difl'}. |
$query_string.'">'.$lt{'difl'}. |
'</a><br /><br />'; |
'</a><br /><br />'; |
Line 404 sub print_portfiles_link {
|
Line 422 sub print_portfiles_link {
|
$output .= '<li>'.&mt('[quant,_1,file requires,files require] a passphrase for access.',$filecounts->{'withpass'}).'</li>'; |
$output .= '<li>'.&mt('[quant,_1,file requires,files require] a passphrase for access.',$filecounts->{'withpass'}).'</li>'; |
} |
} |
$output .= '</ul>'; |
$output .= '</ul>'; |
|
$output .='</fieldset>'; |
} |
} |
$r->print($output); |
$r->print($output); |
return; |
return; |
Line 707 sub parse_directory {
|
Line 726 sub parse_directory {
|
return $output; |
return $output; |
} |
} |
|
|
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; |
|
} |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
if (($cdom eq '') || ($cnum eq '')) { |
|
my %coursehash = &coursedescription($env{'request.course.id'}); |
|
$cdom = $coursehash{'domain'}; |
|
$cnum = $coursehash{'cnum'}; |
|
} |
|
if ((&Apache::lonnet::allowed('srm',$privcheck)) || |
|
(&Apache::lonnet::allowed('dff',$privcheck))) { |
|
if (&in_course($uname,$udom,$cnum,$cdom)) { |
|
return 1; |
|
} |
|
} |
|
return; |
|
} |
|
|
|
1; |
1; |
__END__ |
__END__ |