");
- $r->print(&mt('These').' '.$numblocked.' '.&mt('messages are not viewable because '));
- }
- $r->print(
-&mt('display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams').'.');
- &build_block_table($r,$startblock,$endblock,\%setters);
+ $r->print('
'.&mt('You have [quant,_1,blocked unread message,blocked unread messages].',$numblocked).'
'."\n".
+ &mt('[quant,_1,message is,messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock).' '."\n".
+ &Apache::loncommon::build_block_table($startblock,$endblock,
+ \%setters));
}
}
@@ -740,10 +732,8 @@ sub disfolder {
my ($r,$folder)=@_;
my %blocked = ();
my %setters = ();
- my $startblock;
- my $endblock;
my $numblocked = 0;
- &blockcheck(\%setters,\$startblock,\$endblock);
+ my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com');
$r->print(<
function checkall() {
@@ -886,8 +876,9 @@ ENDDISHEADER
my $beginblock = &Apache::lonlocal::locallocaltime($startblock);
my $finishblock = &Apache::lonlocal::locallocaltime($endblock);
$r->print('
'.
- $numblocked.' '.&mt('message(s) is/are not viewable because display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams.'));
- &build_block_table($r,$startblock,$endblock,\%setters);
+ &mt('[_1,quant,message is, messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock));
+ $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
+ \%setters));
}
}
@@ -1311,8 +1302,8 @@ ENDBFORM
sub examblock {
my ($r,$action) = @_;
unless ($env{'request.course.id'}) { return;}
- if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
- && ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+ if (!&Apache::lonnet::allowed('dcm',$env{'request.course.id'})
+ && ! &Apache::lonnet::allowed('dcm',$env{'request.course.id'}.
'/'.$env{'request.course.sec'})) {
$r->print('Not allowed');
return;
@@ -1331,6 +1322,7 @@ sub examblock {
'dura' => 'Duration',
'setb' => 'Set by',
'even' => 'Event',
+ 'blck' => 'Blocked?',
'actn' => 'Action',
'star' => 'Start',
'endd' => 'End'
@@ -1388,7 +1380,7 @@ sub blockstore {
my %blocking = ();
$r->print('
'.$lt{'head'}.'
');
foreach my $envkey (keys(%env)) {
- if ($envkey =~ m/^form\.modify_(\w+)$/) {
+ if ($envkey =~ m/^form\.modify_(\d+)$/) {
$adds{$1} = $1;
$removals{$1} = $1;
$modtotal ++;
@@ -1401,7 +1393,7 @@ sub blockstore {
} elsif ($envkey =~ m/^form\.add_(\d+)$/) {
$adds{$1} = $1;
$addtotal ++;
- }
+ }
}
foreach my $key (keys(%removals)) {
@@ -1415,7 +1407,12 @@ sub blockstore {
unless ( defined($cancels{$key}) ) {
my ($newstart,$newend) = &get_dates_from_form($key);
my $newkey = $newstart.'____'.$newend;
- $blocking{$newkey} = $env{'user.name'}.':'.$env{'user.domain'}.':'.$env{'form.title_'.$key};
+ my $blocktypes = &get_block_choices($key);
+ $blocking{$newkey} = {
+ setter => $env{'user.name'}.':'.$env{'user.domain'},
+ event => &escape($env{'form.title_'.$key}),
+ blocks => $blocktypes,
+ };
}
}
if ($addtotal + $modtotal > 0) {
@@ -1466,6 +1463,20 @@ sub get_blockdates {
}
}
+sub get_block_choices {
+ my $item = shift;
+ my $blocklist;
+ my ($typeorder,$types) = &blocktype_text();
+ foreach my $type (@{$typeorder}) {
+ if ($env{'form.'.$type.'_'.$item}) {
+ $blocklist->{$type} = 'on';
+ } else {
+ $blocklist->{$type} = 'off';
+ }
+ }
+ return $blocklist;
+}
+
sub display_blocker_status {
my ($r,$records,$ltext) = @_;
my $parmcount = 0;
@@ -1474,13 +1485,15 @@ sub display_blocker_status {
'modi' => 'Modify',
'canc' => 'Cancel',
);
+ my ($typeorder,$types) = &blocktype_text();
$r->print(&Apache::loncommon::start_data_table());
$r->print(<<"END");
-
$$ltext{'dura'}
-
$$ltext{'setb'}
-
$$ltext{'even'}
-
$$ltext{'actn'}?
+
$ltext->{'dura'}
+
$ltext->{'setb'}
+
$ltext->{'even'}
+
$ltext->{'blck'}
+
$ltext->{'actn'}?
END
foreach my $record (sort(keys(%{$records}))) {
@@ -1491,15 +1504,29 @@ END
my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange);
my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange);
- my ($setuname,$setudom,$title) =
- &parse_block_record($$records{$record});
+ my ($setuname,$setudom,$title,$blocks) =
+ &Apache::loncommon::parse_block_record($$records{$record});
$title = &HTML::Entities::encode($title,'"<>&');
- my $settername = &Apache::loncommon::plainname($setuname,$setudom);
+ my $settername =
+ &Apache::loncommon::aboutmewrapper(
+ &Apache::loncommon::plainname($setuname,$setudom),
+ $setuname,$setudom);
$r->print(&Apache::loncommon::start_data_table_row());
$r->print(<<"END");
-