--- loncom/interface/lonaboutme.pm 2006/08/02 20:23:33 1.46 +++ loncom/interface/lonaboutme.pm 2006/09/21 15:50:10 1.56 @@ -1,7 +1,7 @@ # The LearningOnline Network # "About Me" Personal Information # -# $Id: lonaboutme.pm,v 1.46 2006/08/02 20:23:33 albertel Exp $ +# $Id: lonaboutme.pm,v 1.56 2006/09/21 15:50:10 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,6 +37,7 @@ use Apache::lonfeedback; use Apache::lonrss(); use Apache::lonlocal; use Apache::lonmsgdisplay(); +use HTML::Entities(); sub handler { my $r = shift; @@ -48,13 +49,17 @@ sub handler { if ($target eq 'tex') { $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); } - my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri); + my (undef,undef,$cdom,$cnum,undef,$action)=split(/\//,$r->uri); + my $is_course; # Is this even a user? if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') { &Apache::loncommon::simple_error_page($r,'No info', 'No user information available'); return OK; + } else { + $is_course = &check_for_course($cdom,$cnum); } + # --------------------------------------------------------- The syllabus fields my %syllabusfields=&Apache::lonlocal::texthash( 'aaa_contactinfo' => 'Contact Information', @@ -62,22 +67,35 @@ sub handler { 'ccc_webreferences' => 'Web References'); # ------------------------------------------------------------ Get Query String - &Apache::loncommon::get_unprocessed_cgi - ($ENV{'QUERY_STRING'},['forceedit','forcestudent','register','action']); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['forceedit','forcestudent', + 'register']); # ----------------------------------------------- Available Portfolio file display - if (($target ne 'tex') && ($env{'form.action'} eq 'portfolio')) { - my %lt = &Apache::lonlocal::texthash ( - withoutpass => 'passphrase not required', - withpass => 'passphrase protected', - both => 'all access types ', - ); - &display_portfolio_header($r); - &display_portfolio_files($r,\%lt); + if (($target ne 'tex') && ($action eq 'portfolio')) { + &display_portfolio_header($r,$is_course); + &display_portfolio_files($r,$is_course); $r->print(&Apache::loncommon::end_page()); return OK; } + if ($is_course) { + if ($target ne 'tex') { + my $start_page = + &Apache::loncommon::start_page( + "Course Information", + undef, + {'function' => $env{'forcestudent'}, + 'domain' => $cdom, + 'force_register' => $env{'forceregister'},}); + $r->print($start_page); + $r->print('

'.&mt('Group files').'

'); + &print_portfiles_link($r,$is_course); + $r->print(&Apache::loncommon::end_page()); + } + return OK; + } + # --------------------------------------------------------------- Force Student my $forcestudent=''; if ($env{'form.forcestudent'}) { $forcestudent='student'; }; @@ -93,7 +111,7 @@ sub handler { my $start_page = &Apache::loncommon::start_page("Personal Information",undef, {'function' => $forcestudent, - 'domain' => $cdom, + 'domain' => $cdom, 'force_register' => $forceregister,}); $r->print($start_page); @@ -210,7 +228,7 @@ sub handler { } if ($allowed) { $r->print('
'); } @@ -225,7 +243,7 @@ sub handler { } if ($target ne 'tex') { - &print_portfiles_link($r); + &print_portfiles_link($r,$is_course); } if ($env{'request.course.id'}) { @@ -264,29 +282,49 @@ sub handler { } sub aboutme_info { - my ($r) = @_; + my ($r,$is_course) = @_; my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri); - my $name = &Apache::loncommon::plainname($cnum,$cdom); + my $name; + if (!$is_course) { + $name = &Apache::loncommon::plainname($cnum,$cdom); + } return ($cdom,$cnum,$name); } sub print_portfiles_link { - my ($r) = @_; - my ($cdom,$cnum,$name) = &aboutme_info($r); - my $filecounts = &portfolio_files($r,'showlink'); - my $query_string = &build_query_string({'action' => 'portfolio',}); + my ($r,$is_course) = @_; + my ($cdom,$cnum,$name) = &aboutme_info($r,$is_course); + my $filecounts = &portfolio_files($r,'showlink',undef,$is_course); + my $query_string = &build_query_string(); my $output; + my %lt = &Apache::lonlocal::texthash( + vpfi => 'Viewable portfolio files', + vgpf => 'Viewable group portfolio files', + difl => 'Display file listing', + ); if ($filecounts->{'both'} > 0) { - $output = &mt('

Viewable portfolio files

'); - $output .= ''.&mt('Display file listing'). + $output = '

'.($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'

'; + $output .= '
'.$lt{'difl'}. '

'; - $output .= &mt('A total of [quant,_1,portfolio file] owned by [_2] are available.',$filecounts->{'both'},$name).'