--- loncom/interface/lonblockingstatus.pm 2009/07/07 19:50:47 1.1
+++ 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.1 2009/07/07 19:50:47 droeschl Exp $
+# $Id: lonblockingstatus.pm,v 1.4 2009/07/27 11:30:05 kalberla Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,6 +31,21 @@ 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;
@@ -43,14 +58,70 @@ sub handler {
Apache::loncommon::start_page(
'Communication Blocking Status Information',
undef, {'only_body' => 1, }));
-
- my $table = 'Status table goes here';
- $r->print($table);
+ 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__