--- loncom/interface/lonblockingmenu.pm 2016/03/04 21:43:15 1.18
+++ loncom/interface/lonblockingmenu.pm 2024/12/31 19:28:29 1.32
@@ -2,7 +2,7 @@
# Routines for configuring blocking of access to collaborative functions,
# and specific resources during an exam
#
-# $Id: lonblockingmenu.pm,v 1.18 2016/03/04 21:43:15 raeburn Exp $
+# $Id: lonblockingmenu.pm,v 1.32 2024/12/31 19:28:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -105,6 +105,19 @@ block (including deletion), or when a ne
=over
+=item &get_permission()
+
+Returns information about permission user has to set/modify exam
+blocking events.
+
+Inputs: None
+
+Outputs: 2
+ $readonly - true if modification of blocking events is prohibited.
+
+ $allowed - true if blocking events information can be shown.
+
+
=item &get_timed_items()
Provides perl data structure with information about timed interval
@@ -222,7 +235,7 @@ Side Effects: &update_released_required(
Generates web form elements used to display, cancel, or modify
existing blocking events.
-Inputs: 7
+Inputs: 8
- $r - Apache request object
- $records - Reference to hash of current blocks
@@ -238,6 +251,9 @@ Inputs: 7
- $blockcount - number of existing blocking events in course
+ - $readonly - if true, modification not allowed.
+
+
Output: None
Side Effects: prints web form elements (in a table) for current blocks.
@@ -302,13 +318,16 @@ Creates web form elements used to select
items in the course for use in an exam block of type: "Triggered by
Activating Timer".
-Inputs: 7 (three required, last four optional)
+Inputs: 8 (four required, last four optional)
- $intervals - Reference to hash of parameters for timed intervals
- $parmcount - numeric ID of current block
- $navmap - navmaps object
+ - $context - this will be "accesstimes" if called by lonaccesstimes.pm,
+ or "blocking" if called internally by lonblockingmenu.pm
+
- $currkey - current interval (where this is a block already using
an interval-based trigger).
@@ -323,6 +342,34 @@ Inputs: 7 (three required, last four opt
Outputs: 1 - $intervalform - web form elements used to select a time interval
+=item &interval_details()
+
+Creates name/scope of current interval and expandable/collapsible
+showing which interval parameters apply to the current folder/resource
+
+Inputs: 6
+
+ - $item - course, map url, or resource symb
+
+ - $type - course, map, or resource
+
+ - $url - url of item (null if item is course).
+
+ - $navmap - navmaps object
+
+ - $intervals - Reference to hash of parameters for timed intervals
+
+ - $parmcount - unique ID for current element.
+
+
+Outputs: 2
+
+ - $itemname - name/scope of interval (timer) parameter
+
+ - $iteminfo - Expandable/collapsible block showing which interval
+ (timer) parameters affect the current folder or resource.
+
+
=item &trigger_details_toggle()
Creates link used to expand item showing information about timer for current
@@ -332,6 +379,7 @@ Inputs: 1 - $parmcount - numericID of ex
Outputs: 1 - returns HTML for link to display contents of information item
+
=item &show_timer_path()
Display hierarchy of names of folders/sub-folders containing the current
@@ -376,12 +424,21 @@ Output: 1 - Javascript (with tags) for functions used to:
+ toggle visibility of unordered list for display of detailed
+ information about intervals.
+
+=back
=cut
@@ -422,11 +479,10 @@ sub handler {
# ----------------------------------------------------------- Permissions check
- unless ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) ||
- (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.
- '/'.$env{'request.course.sec'}))) {
+ my ($readonly,$allowed) = &get_permission();
+ unless ($allowed) {
$env{'user.error.msg'}=
- "/adm/setblock:dcm:0:0:Cannot set blocking of communications in a course";
+ "/adm/setblock:dcm:0:0:Cannot view/set blocking of communications in a course";
return HTTP_NOT_ACCEPTABLE;
}
@@ -471,7 +527,8 @@ sub handler {
$r->print(&Apache::loncourserespicker::create_picker($navmap,
'examblock','resourceblocks',$crstype,
\%blockedmaps,\%blockedresources,
- $env{'form.block'}));
+ $env{'form.block'},'','',undef,undef,undef,
+ $readonly));
} else {
$r->print($errormsg);
}
@@ -480,10 +537,12 @@ sub handler {
# -------------------------- Store changes and retrieve latest block information
my $storeresult;
- if ($env{'form.action'} eq 'store') {
- (my $numchanges,$storeresult) = &blockstore($r,$crstype,$blockcount,\%records);
- if ($numchanges > 0) {
- $blockcount = &get_blockdates(\%records);
+ unless ($readonly) {
+ if ($env{'form.action'} eq 'store') {
+ (my $numchanges,$storeresult) = &blockstore($r,$crstype,$blockcount,\%records);
+ if ($numchanges > 0) {
+ $blockcount = &get_blockdates(\%records);
+ }
}
}
@@ -503,7 +562,8 @@ sub handler {
({href=>'/adm/setblock',
text=>'Blocking communication/content access'});
- my $js = &blockingmenu_javascript($blockcount);
+ my $js = &blockingmenu_javascript($blockcount).
+ &details_javascript();
$r->print(
&Apache::loncommon::start_page('Blocking communication/content access',$js).
@@ -519,6 +579,7 @@ sub handler {
my %lt=&Apache::lonlocal::texthash (
'cbds' => 'Blocking communication and/or content access during exams',
'prev' => "For the duration of an exam, or a timed quiz, students in this course can be prevented from:",
+ 'flow' => "For the duration of an exam, or a timed quiz, event-driven interruptions to a student's workflow can be suppressed:",
'blca' => "Blocks can potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA $lctype.",
'pobl' => "Portfolio blocking can impact a student's ability to complete assignments in courses besides your own. Please use this feature wisely.",
'actt' => "Action to take:",
@@ -558,19 +619,29 @@ sub handler {
'
'."\n".
'
'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'
'."\n".
'
'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'
'."\n".
- '
'.&mt('accessing content in LON-CAPA portfolios or blogs').'
'."\n".
+ '
'.&mt('accessing content in LON-CAPA portfolios, blogs, or user information pages').'
'."\n".
'
'.&mt("generating printouts of $lctype content").'
'.
+ '
'.&mt("displaying the LON-CAPA gradebook in the $lctype").'
'.
+ '
'.&mt("searching $lctype content by keyword").'
'.
+ '
'.&mt("displaying $lctype content indexed by keyword").'
'.
'
'.&mt("accessing $lctype content in specified folders or resources").'
'.
'
'.&mt("changing user's own password").'
'.
'
'.
+ $lt{'flow'}.
+ '
'."\n".
+ '
'.&mt("re-initialization of cached course structure, when a change has been made to $lctype content by a Coordinator").'
'.
+ '
'.&mt('display of Critical Messages when navigation arrows used to move to the adjacent resource').'
'.
+ '
'.
'
'.$lt{'blca'}.' '.$lt{'pobl'}.'
'
);
}
# ------------------------ Choose between modifying existing block or adding new
$r->print('
END
- $r->print(&Apache::loncommon::end_page());
+ }
+ $r->print(''.
+ &Apache::loncommon::end_page());
return OK;
}
+sub get_permission {
+ my %permission;
+ my $allowed = 0;
+ my $readonly = 0;
+ return ($readonly,$allowed) unless ($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'}))) {
+ $allowed = 1;
+ } elsif ((&Apache::lonnet::allowed('vcb',$env{'request.course.id'})) ||
+ (&Apache::lonnet::allowed('vcb',$env{'request.course.id'}.'/'.
+ $env{'request.course.sec'}))) {
+ $readonly = 1;
+ $allowed = 1;
+ }
+ return ($readonly,$allowed);
+}
+
sub get_timed_items {
my ($cdom,$cnum) = @_;
my ($cid,%intervals);
@@ -630,7 +729,7 @@ sub get_timed_items {
my $resourcedata=&Apache::lonparmset::readdata($cnum,$cdom);
if (ref($resourcedata) eq 'HASH') {
foreach my $key (keys(%{$resourcedata})) {
- if ($key =~ /^\Q$cid\E(.+)\.0\.interval$/) {
+ if ($key =~ /^\Q$cid\E(.*)\.0\.interval$/) {
my $middle = $1;
if ($middle eq '') {
$intervals{'course'}{'all'} = $resourcedata->{$key};
@@ -788,6 +887,24 @@ sub blockstore {
&escape($env{'form.title_'.$key})).' ';
}
}
+ if ($blocktypes->{'alert'} eq 'on') {
+ ($status,$needsrelease) = &check_release_required('alert',$chomemajor,$chomeminor);
+ if ($status eq 'fail') {
+ $blocktypes->{'alert'} = 'off';
+ $output .= '
'.
+ &mt('Message Alert blocking not allowed for [_1]',
+ &escape($env{'form.title_'.$key})).' ';
+ }
+ }
+ if ($blocktypes->{'reinit'} eq 'on') {
+ ($status,$needsrelease) = &check_release_required('reinit',$chomemajor,$chomeminor);
+ if ($status eq 'fail') {
+ $blocktypes->{'reinit'} = 'off';
+ $output .= '
'.
+ &mt('Course Re-initialization blocking not allowed for [_1]',
+ &escape($env{'form.title_'.$key})).' ';
+ }
+ }
}
if ($blockdocs) {
($status,$needsrelease) = &check_release_required('docs',$chomemajor,$chomeminor);
@@ -874,8 +991,7 @@ sub update_releasereq {
}
$modified_courses = [];
}
- undef($registered_cleanup);
- return;
+ return OK;
}
sub get_dates_from_form {
@@ -975,9 +1091,9 @@ sub check_release_required {
}
sub display_blocker_status {
- my ($r,$records,$ltext,$intervals,$navmap,$errormsg,$blockcount) = @_;
+ my ($r,$records,$ltext,$intervals,$navmap,$errormsg,$blockcount,$readonly) = @_;
my $parmcount = 0;
- my (%map_url,%resource_symb,%titles,%lookups);
+ my (%map_url,%resource_symb,%titles,%lookups,$disabled);
&Apache::loncourserespicker::enumerate_course_contents($navmap,\%map_url,\%resource_symb,\%titles,'examblock');
%{$lookups{'maps'}} = reverse(%map_url);
%{$lookups{'resources'}} = reverse(%resource_symb);
@@ -987,10 +1103,13 @@ sub display_blocker_status {
'noch' => 'No change',
);
$r->print('