--- loncom/interface/lonblockingstatus.pm 2009/07/26 20:39:46 1.3 +++ loncom/interface/lonblockingstatus.pm 2009/07/27 11:30:05 1.4 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # displays the blocking status table # -# $Id: lonblockingstatus.pm,v 1.3 2009/07/26 20:39:46 kalberla Exp $ +# $Id: lonblockingstatus.pm,v 1.4 2009/07/27 11:30:05 kalberla Exp $ # # Copyright Michigan State University Board of Trustees # @@ -59,13 +59,69 @@ sub handler { 'Communication Blocking Status Information', undef, {'only_body' => 1, })); Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['activity']); - my ($blocked, $blocktext) = &Apache::loncommon::blocking_status_print($env{'form.activity'}); + my ($blocked, $blocktext) = print_blocking_table($env{'form.activity'}); $r->print($blocktext); $r->print(Apache::loncommon::end_page()); return OK; } - +sub print_blocking_table{ + my ($activity,$uname,$udom) = @_; + my %setters; + my ($blocked,$output,$ownitem,$is_course); + my ($startblock,$endblock)=&Apache::loncommon::blockcheck(\%setters,$activity,$uname,$udom); + if ($startblock && $endblock) { + $blocked = 1; + my $category; + if ($activity eq 'boards') { + $category = 'Discussion posts in this course'; + } elsif ($activity eq 'chat') { + $category = 'Chat'; + } elsif ($activity eq 'msgdisplay') { + $category = 'This message'; + } elsif ($activity eq 'blogs') { + $category = 'Blogs'; + } elsif ($activity eq 'port') { + if (defined($uname) && defined($udom)) { + if ($uname eq $env{'user.name'} && + $udom eq $env{'user.domain'}) { + $ownitem = 1; + } + } + $is_course = &Apache::lonnet::is_course($udom,$uname); + if ($ownitem) { + $category = 'Your portfolio files'; + } elsif ($is_course) { + my $coursedesc; + foreach my $course (keys(%setters)) { + my %courseinfo = + &Apache::lonnet::coursedescription($course); + $coursedesc = $courseinfo{'description'}; + } + $category = "Group portfolio in the course '$coursedesc'"; + } else { + $category = 'Portfolio files belonging to '; + if ($env{'user.name'} eq 'public' && + $env{'user.domain'} eq 'public') { + $category .= &plainname($uname,$udom); + } else { + $category .= &aboutmewrapper(&plainname($uname,$udom),$uname,$udom); + } + } + } elsif ($activity eq 'groups') { + $category = 'Groups in this course'; + } else { + $category = 'Communication'; + } + my $showstart = &Apache::lonlocal::locallocaltime($startblock); + my $showend = &Apache::lonlocal::locallocaltime($endblock); + $output = '
'.&mt('[_1] will be inaccessible between [_2] and [_3] because communication is being blocked.',$category,$showstart,$showend).'
'; + if (!($activity eq 'port' && !($ownitem) && !($is_course))) { + $output .= &Apache::loncommon::build_block_table($startblock,$endblock,\%setters); + } + } + return ($blocked,$output); +} 1; __END__