# The LearningOnline Network with CAPA # displays the blocking status table # # $Id: lonblockingstatus.pm,v 1.4 2009/07/27 11:30:05 kalberla Exp $ # # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). # # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # LON-CAPA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with LON-CAPA; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # /home/httpd/html/adm/gpl.txt # # http://www.lon-capa.org/ # # package Apache::lonblockingstatus; use strict; use Apache::Constants qw(:common); use Apache::loncommon(); use Apache::lonnet; use GDBM_File; use POSIX qw(strftime mktime); use Apache::lonmenu(); use Apache::lonenc(); use Apache::lonlocal; use Apache::lonnet(); use HTML::Entities; use Apache::lonhtmlcommon(); use Apache::loncoursedata(); use Apache::lontexconvert(); use Apache::lonclonecourse(); use LONCAPA qw(:DEFAULT :match); use DateTime::TimeZone; use DateTime::Locale::Catalog; sub handler { my $r = shift; Apache::loncommon::no_cache($r); Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; $r->print( Apache::loncommon::start_page( 'Communication Blocking Status Information', undef, {'only_body' => 1, })); Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['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__