--- loncom/interface/lonaboutme.pm 2006/09/13 21:37:29 1.54 +++ loncom/interface/lonaboutme.pm 2006/12/11 03:46:31 1.60 @@ -1,7 +1,7 @@ # The LearningOnline Network # "About Me" Personal Information # -# $Id: lonaboutme.pm,v 1.54 2006/09/13 21:37:29 albertel Exp $ +# $Id: lonaboutme.pm,v 1.60 2006/12/11 03:46:31 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,12 +50,16 @@ sub handler { $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); } 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 = &Apache::lonnet::is_course($cdom,$cnum); } + # --------------------------------------------------------- The syllabus fields my %syllabusfields=&Apache::lonlocal::texthash( 'aaa_contactinfo' => 'Contact Information', @@ -69,12 +73,35 @@ sub handler { # ----------------------------------------------- Available Portfolio file display if (($target ne 'tex') && ($action eq 'portfolio')) { - &display_portfolio_header($r); - &display_portfolio_files($r); + &display_portfolio_header($r,$is_course); + my ($blocked,$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; } + 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'; }; @@ -150,12 +177,12 @@ sub handler { } } if (($allowed) && ($env{'form.storesyl'})) { - foreach (keys %syllabusfields) { - my $field=$env{'form.'.$_}; + foreach my $syl_field (keys(%syllabusfields)) { + my $field=$env{'form.'.$syl_field}; $field=~s/\s+$//s; $field=&Apache::lonfeedback::clear_out_html($field, $env{'user.adv'}); - $syllabus{$_}=$field; + $syllabus{$syl_field}=$field; } $syllabus{'uploaded.lastmodified'}=time; &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum); @@ -188,9 +215,9 @@ sub handler { '
'); } - foreach (sort keys %syllabusfields) { - if (($syllabus{$_}) || ($allowed)) { - my $message=$syllabus{$_}; + 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; @@ -199,15 +226,15 @@ sub handler { } $message=&Apache::lontexconvert::msgtexconverted($message); if ($target ne 'tex') { - $r->print('

'.$syllabusfields{$_}.'

'. + $r->print('

'.$syllabusfields{$field}.'

'. $message.'
'); } else { - $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'. + $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'. &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\'); } if ($allowed) { - $r->print('
'); } @@ -222,7 +249,7 @@ sub handler { } if ($target ne 'tex') { - &print_portfiles_link($r); + &print_portfiles_link($r,$is_course); } if ($env{'request.course.id'}) { @@ -261,27 +288,43 @@ 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 ($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 = '

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

'; $output .= '
'.&mt('Display file listing'). + $query_string.'">'.$lt{'difl'}. '

'; if ($filecounts->{'both'} == 1) { - $output .= &mt('One portfolio file owned by [_2] is available.',$filecounts->{'both'},$name).'