version 1.16, 2016/01/27 00:24:09
|
version 1.32, 2024/12/31 19:28:29
|
Line 105 block (including deletion), or when a ne
|
Line 105 block (including deletion), or when a ne
|
|
|
=over |
=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() |
=item &get_timed_items() |
|
|
Provides perl data structure with information about timed interval |
Provides perl data structure with information about timed interval |
Line 222 Side Effects: &update_released_required(
|
Line 235 Side Effects: &update_released_required(
|
Generates web form elements used to display, cancel, or modify |
Generates web form elements used to display, cancel, or modify |
existing blocking events. |
existing blocking events. |
|
|
Inputs: 7 |
Inputs: 8 |
- $r - Apache request object |
- $r - Apache request object |
|
|
- $records - Reference to hash of current blocks |
- $records - Reference to hash of current blocks |
Line 238 Inputs: 7
|
Line 251 Inputs: 7
|
|
|
- $blockcount - number of existing blocking events in course |
- $blockcount - number of existing blocking events in course |
|
|
|
- $readonly - if true, modification not allowed. |
|
|
|
|
Output: None |
Output: None |
|
|
Side Effects: prints web form elements (in a table) for current blocks. |
Side Effects: prints web form elements (in a table) for current blocks. |
Line 302 Creates web form elements used to select
|
Line 318 Creates web form elements used to select
|
items in the course for use in an exam block of type: "Triggered by |
items in the course for use in an exam block of type: "Triggered by |
Activating Timer". |
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 |
- $intervals - Reference to hash of parameters for timed intervals |
|
|
- $parmcount - numeric ID of current block |
- $parmcount - numeric ID of current block |
|
|
- $navmap - navmaps object |
- $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 |
- $currkey - current interval (where this is a block already using |
an interval-based trigger). |
an interval-based trigger). |
|
|
Line 323 Inputs: 7 (three required, last four opt
|
Line 342 Inputs: 7 (three required, last four opt
|
Outputs: 1 - $intervalform - web form elements used to select a time interval |
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() |
=item &trigger_details_toggle() |
|
|
Creates link used to expand item showing information about timer for current |
Creates link used to expand item showing information about timer for current |
Line 332 Inputs: 1 - $parmcount - numericID of ex
|
Line 379 Inputs: 1 - $parmcount - numericID of ex
|
|
|
Outputs: 1 - returns HTML for link to display contents of information item |
Outputs: 1 - returns HTML for link to display contents of information item |
|
|
|
|
=item &show_timer_path() |
=item &show_timer_path() |
|
|
Display hierarchy of names of folders/sub-folders containing the current |
Display hierarchy of names of folders/sub-folders containing the current |
Line 376 Output: 1 - Javascript (with <script></s
|
Line 424 Output: 1 - Javascript (with <script></s
|
|
|
=item * for action to take -- add or modify block |
=item * for action to take -- add or modify block |
|
|
=item * for display of detailed information about intervals |
|
|
|
=back |
=back |
|
|
|
|
=back |
=item &details_javascript() |
|
|
|
Create Javascript to toggle visibility of unordered list item |
|
containing details about item with timed interval parameter. |
|
|
|
Inputs: none |
|
|
|
Output: 1 Javascript (with <script></script> tags) for functions used to: |
|
toggle visibility of unordered list for display of detailed |
|
information about intervals. |
|
|
|
=back |
|
|
=cut |
=cut |
|
|
Line 422 sub handler {
|
Line 479 sub handler {
|
|
|
# ----------------------------------------------------------- Permissions check |
# ----------------------------------------------------------- Permissions check |
|
|
unless ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) || |
my ($readonly,$allowed) = &get_permission(); |
(&Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
unless ($allowed) { |
'/'.$env{'request.course.sec'}))) { |
|
$env{'user.error.msg'}= |
$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; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
|
Line 471 sub handler {
|
Line 527 sub handler {
|
$r->print(&Apache::loncourserespicker::create_picker($navmap, |
$r->print(&Apache::loncourserespicker::create_picker($navmap, |
'examblock','resourceblocks',$crstype, |
'examblock','resourceblocks',$crstype, |
\%blockedmaps,\%blockedresources, |
\%blockedmaps,\%blockedresources, |
$env{'form.block'})); |
$env{'form.block'},'','',undef,undef,undef, |
|
$readonly)); |
} else { |
} else { |
$r->print($errormsg); |
$r->print($errormsg); |
} |
} |
Line 480 sub handler {
|
Line 537 sub handler {
|
|
|
# -------------------------- Store changes and retrieve latest block information |
# -------------------------- Store changes and retrieve latest block information |
my $storeresult; |
my $storeresult; |
if ($env{'form.action'} eq 'store') { |
unless ($readonly) { |
(my $numchanges,$storeresult) = &blockstore($r,$crstype,$blockcount,\%records); |
if ($env{'form.action'} eq 'store') { |
if ($numchanges > 0) { |
(my $numchanges,$storeresult) = &blockstore($r,$crstype,$blockcount,\%records); |
$blockcount = &get_blockdates(\%records); |
if ($numchanges > 0) { |
|
$blockcount = &get_blockdates(\%records); |
|
} |
} |
} |
} |
} |
|
|
Line 503 sub handler {
|
Line 562 sub handler {
|
({href=>'/adm/setblock', |
({href=>'/adm/setblock', |
text=>'Blocking communication/content access'}); |
text=>'Blocking communication/content access'}); |
|
|
my $js = &blockingmenu_javascript($blockcount); |
my $js = &blockingmenu_javascript($blockcount). |
|
&details_javascript(); |
|
|
$r->print( |
$r->print( |
&Apache::loncommon::start_page('Blocking communication/content access',$js). |
&Apache::loncommon::start_page('Blocking communication/content access',$js). |
Line 519 sub handler {
|
Line 579 sub handler {
|
my %lt=&Apache::lonlocal::texthash ( |
my %lt=&Apache::lonlocal::texthash ( |
'cbds' => 'Blocking communication and/or content access during exams', |
'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:", |
'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.", |
'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.", |
'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:", |
'actt' => "Action to take:", |
Line 558 sub handler {
|
Line 619 sub handler {
|
'<ul>'."\n". |
'<ul>'."\n". |
'<li>'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'</li>'."\n". |
'<li>'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'</li>'."\n". |
'<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n". |
'<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n". |
'<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n". |
'<li>'.&mt('accessing content in LON-CAPA portfolios, blogs, or user information pages').'</li>'."\n". |
'<li>'.&mt("generating printouts of $lctype content").'</li>'. |
'<li>'.&mt("generating printouts of $lctype content").'</li>'. |
|
'<li>'.&mt("displaying the LON-CAPA gradebook in the $lctype").'</li>'. |
|
'<li>'.&mt("searching $lctype content by keyword").'</li>'. |
|
'<li>'.&mt("displaying $lctype content indexed by keyword").'</li>'. |
'<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'. |
'<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'. |
'<li>'.&mt("changing user's own password").'</li>'. |
'<li>'.&mt("changing user's own password").'</li>'. |
'</ul>'. |
'</ul>'. |
|
$lt{'flow'}. |
|
'<ul>'."\n". |
|
'<li>'.&mt("re-initialization of cached course structure, when a change has been made to $lctype content by a Coordinator").'</li>'. |
|
'<li>'.&mt('display of Critical Messages when navigation arrows used to move to the adjacent resource').'</li>'. |
|
'</ul>'. |
'<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>' |
'<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>' |
); |
); |
} |
} |
|
|
# ------------------------ Choose between modifying existing block or adding new |
# ------------------------ Choose between modifying existing block or adding new |
$r->print('<form name="blockform" method="post" action="/adm/setblock?action=store">'); |
$r->print('<form name="blockform" method="post" action="/adm/setblock?action=store">'); |
if ($blockcount > 0) { |
|
$r->print(<<"END"); |
unless ($readonly) { |
|
if ($blockcount > 0) { |
|
$r->print(<<"END"); |
<div class="LC_left_float"> |
<div class="LC_left_float"> |
<fieldset><legend>$lt{'actt'}</legend> |
<fieldset><legend>$lt{'actt'}</legend> |
<span class="LC_nobreak"> |
<span class="LC_nobreak"> |
Line 587 onclick="toggleAddModify();" />$lt{'addn
|
Line 658 onclick="toggleAddModify();" />$lt{'addn
|
<br clear="all" /> |
<br clear="all" /> |
<div id="showadd" style="display:none"> |
<div id="showadd" style="display:none"> |
END |
END |
} else { |
} else { |
$r->print($lt{'ncbc'}.'<br /><br />'. |
$r->print($lt{'ncbc'}.'<br /><br />'. |
'<h4>'.$lt{'addn'}.'</h4>'. |
'<h4>'.$lt{'addn'}.'</h4>'. |
'<input type="hidden" name="blockaction" value="add" />'); |
'<input type="hidden" name="blockaction" value="add" />'); |
|
} |
} |
} |
my ($navmap,$errormsg) = |
my ($navmap,$errormsg) = |
&Apache::loncourserespicker::get_navmap_object($crstype,'examblock'); |
&Apache::loncourserespicker::get_navmap_object($crstype,'examblock'); |
|
|
# --------------------------------------------- Interface for adding a new block |
# --------------------------------------------- Interface for adding a new block |
&display_addblocker_table($r,$blockcount,\%ltext,\%intervals, |
unless ($readonly) { |
$navmap,$errormsg); |
&display_addblocker_table($r,$blockcount,\%ltext,\%intervals, |
|
$navmap,$errormsg); |
# ------------------------------------------------- Interface for existig blocks |
if ($blockcount > 0) { |
if ($blockcount > 0) { |
$r->print('</div>'); |
$r->print('</div>'); |
} |
|
} |
|
# ------------------------------------------------ Interface for existing blocks |
|
if (!$blockcount) { |
|
if ($readonly) { |
|
$r->print($lt{'ncbc'}.'<br />'); |
|
} |
|
} else { |
&display_blocker_status($r,\%records,\%ltext,\%intervals, |
&display_blocker_status($r,\%records,\%ltext,\%intervals, |
$navmap,$errormsg,$blockcount); |
$navmap,$errormsg,$blockcount,$readonly); |
} |
} |
$r->print(<<"END"); |
unless ($readonly) { |
|
$r->print(<<"END"); |
<br /> |
<br /> |
<input type ="submit" value="$lt{'stor'}" /> |
<input type ="submit" value="$lt{'stor'}" /> |
</form> |
|
END |
END |
$r->print(&Apache::loncommon::end_page()); |
} |
|
$r->print('</form>'. |
|
&Apache::loncommon::end_page()); |
return OK; |
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 { |
sub get_timed_items { |
my ($cdom,$cnum) = @_; |
my ($cdom,$cnum) = @_; |
my ($cid,%intervals); |
my ($cid,%intervals); |
Line 630 sub get_timed_items {
|
Line 729 sub get_timed_items {
|
my $resourcedata=&Apache::lonparmset::readdata($cnum,$cdom); |
my $resourcedata=&Apache::lonparmset::readdata($cnum,$cdom); |
if (ref($resourcedata) eq 'HASH') { |
if (ref($resourcedata) eq 'HASH') { |
foreach my $key (keys(%{$resourcedata})) { |
foreach my $key (keys(%{$resourcedata})) { |
if ($key =~ /^\Q$cid\E(.+)\.0\.interval$/) { |
if ($key =~ /^\Q$cid\E(.*)\.0\.interval$/) { |
my $middle = $1; |
my $middle = $1; |
if ($middle eq '') { |
if ($middle eq '') { |
$intervals{'course'}{'all'} = $resourcedata->{$key}; |
$intervals{'course'}{'all'} = $resourcedata->{$key}; |
Line 788 sub blockstore {
|
Line 887 sub blockstore {
|
&escape($env{'form.title_'.$key})).'<br />'; |
&escape($env{'form.title_'.$key})).'<br />'; |
} |
} |
} |
} |
|
if ($blocktypes->{'alert'} eq 'on') { |
|
($status,$needsrelease) = &check_release_required('alert',$chomemajor,$chomeminor); |
|
if ($status eq 'fail') { |
|
$blocktypes->{'alert'} = 'off'; |
|
$output .= '<p class="LC_warning">'. |
|
&mt('Message Alert blocking not allowed for [_1]', |
|
&escape($env{'form.title_'.$key})).'<br />'; |
|
} |
|
} |
|
if ($blocktypes->{'reinit'} eq 'on') { |
|
($status,$needsrelease) = &check_release_required('reinit',$chomemajor,$chomeminor); |
|
if ($status eq 'fail') { |
|
$blocktypes->{'reinit'} = 'off'; |
|
$output .= '<p class="LC_warning">'. |
|
&mt('Course Re-initialization blocking not allowed for [_1]', |
|
&escape($env{'form.title_'.$key})).'<br />'; |
|
} |
|
} |
} |
} |
if ($blockdocs) { |
if ($blockdocs) { |
($status,$needsrelease) = &check_release_required('docs',$chomemajor,$chomeminor); |
($status,$needsrelease) = &check_release_required('docs',$chomemajor,$chomeminor); |
Line 874 sub update_releasereq {
|
Line 991 sub update_releasereq {
|
} |
} |
$modified_courses = []; |
$modified_courses = []; |
} |
} |
undef($registered_cleanup); |
return OK; |
return; |
|
} |
} |
|
|
sub get_dates_from_form { |
sub get_dates_from_form { |
Line 951 sub get_block_choices {
|
Line 1067 sub get_block_choices {
|
|
|
sub check_release_required { |
sub check_release_required { |
my ($value,$chomemajor,$chomeminor) = @_; |
my ($value,$chomemajor,$chomeminor) = @_; |
my $needsrelease = $Apache::lonnet::needsrelease{'course:commblock:'.$value.':'}; |
my $needsrelease = $Apache::lonnet::needsrelease{'course:commblock:'.$value}; |
if ($needsrelease) { |
if ($needsrelease) { |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
if (($chomemajor < $needsmajor) || |
if (($chomemajor < $needsmajor) || |
Line 975 sub check_release_required {
|
Line 1091 sub check_release_required {
|
} |
} |
|
|
sub display_blocker_status { |
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 $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'); |
&Apache::loncourserespicker::enumerate_course_contents($navmap,\%map_url,\%resource_symb,\%titles,'examblock'); |
%{$lookups{'maps'}} = reverse(%map_url); |
%{$lookups{'maps'}} = reverse(%map_url); |
%{$lookups{'resources'}} = reverse(%resource_symb); |
%{$lookups{'resources'}} = reverse(%resource_symb); |
Line 987 sub display_blocker_status {
|
Line 1103 sub display_blocker_status {
|
'noch' => 'No change', |
'noch' => 'No change', |
); |
); |
$r->print('<div id="showmodify" style="display:block">'. |
$r->print('<div id="showmodify" style="display:block">'. |
&Apache::loncommon::start_data_table()); |
&Apache::loncommon::start_data_table().'<tr>'); |
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} else { |
|
$r->print('<th></th>'); |
|
} |
$r->print(<<"END"); |
$r->print(<<"END"); |
<tr> |
|
<th></th> |
|
<th>$ltext->{'type'}</th> |
<th>$ltext->{'type'}</th> |
<th>$ltext->{'even'}</th> |
<th>$ltext->{'even'}</th> |
<th>$ltext->{'blck'}</th> |
<th>$ltext->{'blck'}</th> |
Line 1009 END
|
Line 1128 END
|
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::plainname($setuname,$setudom), |
&Apache::loncommon::plainname($setuname,$setudom), |
$setuname,$setudom); |
$setuname,$setudom); |
|
my $state = ''; |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(<<"ACT"); |
if ($readonly) { |
|
$state = 'disabled'; |
|
} else { |
|
$r->print(<<"ACT"); |
|
|
<td valign="middle"><span class="LC_nobreak"><label> |
<td valign="middle"><span class="LC_nobreak"><label> |
<input type="radio" name="action_$parmcount" value="modify" />$lt{'modi'} |
<input type="radio" name="action_$parmcount" value="modify" />$lt{'modi'} |
Line 1024 END
|
Line 1147 END
|
</label></span> |
</label></span> |
</td> |
</td> |
ACT |
ACT |
|
} |
my ($start,$end,$startform,$endform); |
my ($start,$end,$startform,$endform); |
if ($record =~ /^(\d+)____(\d+)$/) { |
if ($record =~ /^(\d+)____(\d+)$/) { |
($start,$end) = split(/____/,$record); |
($start,$end) = split(/____/,$record); |
$startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'. |
$startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'. |
$parmcount,$start,$onchange); |
$parmcount,$start,$onchange, |
|
undef,$state); |
$endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'. |
$endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'. |
$parmcount,$end,$onchange); |
$parmcount,$end,$onchange, |
|
undef,$state); |
$r->print('<td><fieldset><legend>'.$ltext->{'defs'}.'</legend>'. |
$r->print('<td><fieldset><legend>'.$ltext->{'defs'}.'</legend>'. |
$ltext->{'star'}.': '.$startform.'<br />'. |
$ltext->{'star'}.': '.$startform.'<br />'. |
$ltext->{'endd'}.': '.$endform.'</fieldset></td>'); |
$ltext->{'endd'}.': '.$endform.'</fieldset></td>'); |
} elsif ($record =~ /^firstaccess____(.+)$/) { |
} elsif ($record =~ /^firstaccess____(.+)$/) { |
my $item = $1; |
my $item = $1; |
my ($itemname,$iteminfo,$skipdetails); |
|
my $type = 'map'; |
my $type = 'map'; |
my $url; |
my $url; |
if ($item eq 'course') { |
if ($item eq 'course') { |
Line 1048 ACT
|
Line 1173 ACT
|
$url = $item; |
$url = $item; |
} |
} |
$r->print('<td><fieldset><legend>'.$ltext->{'trig'}.'</legend>'); |
$r->print('<td><fieldset><legend>'.$ltext->{'trig'}.'</legend>'); |
if ($type eq 'course') { |
my ($itemname,$iteminfo) = &interval_details($item,$type,$url,$navmap,$intervals,$parmcount); |
$itemname = &mt('Timer for all items in course.'); |
$r->print(&create_interval_form($intervals,$parmcount,$navmap,'blocking',$item,$jschg, |
} else { |
$itemname,$iteminfo,$disabled).'</fieldset></td>'); |
if (&Apache::lonnet::is_on_map($url)) { |
|
if ($type eq 'map') { |
|
if (ref($navmap)) { |
|
my $title; |
|
my $resobj = $navmap->getResourceByUrl($item); |
|
if (ref($resobj)) { |
|
$title = $resobj->compTitle(); |
|
} else { |
|
$title = &Apache::lonnet::gettitle($item); |
|
} |
|
$itemname = &mt('Timer for all items in folder: [_1]', |
|
'<span style="font-style:italic">'. |
|
$title.'</span>'); |
|
} |
|
} else { |
|
if (ref($navmap)) { |
|
my $title; |
|
my $resobj = $navmap->getBySymb($item); |
|
if (ref($resobj)) { |
|
$title = $resobj->compTitle(); |
|
} else { |
|
$title = &Apache::lonnet::gettitle($item); |
|
} |
|
$itemname = &mt('Timer for resource: [_1]', |
|
'<span style="font-style:italic">'. |
|
$title.'</span>'); |
|
} |
|
} |
|
if (ref($navmap)) { |
|
my $path = &show_timer_path($type,$item); |
|
if ($path) { |
|
$iteminfo = ' <span style="font-size:90%;">'. |
|
&mt('(in: [_1])',$path). |
|
'</span>'; |
|
} |
|
} |
|
} else { |
|
$skipdetails = 1; |
|
$itemname = '<span style="LC_warning">'. |
|
&mt('Timer folder/resource not in course'). |
|
'</span>'; |
|
} |
|
} |
|
if ((!$skipdetails) && (ref($intervals) eq 'HASH')) { |
|
if (ref($intervals->{$type}) eq 'HASH') { |
|
$iteminfo .= &trigger_details_toggle($parmcount). |
|
'<ul id="trigdetails_'.$parmcount.'" style="display:none">'; |
|
if ($type eq 'course') { |
|
foreach my $scope (keys(%{$intervals->{$type}})) { |
|
if ($scope eq 'all') { |
|
$iteminfo .= '<li>'.&mt('All users -- time limit: [_1]', |
|
&convlim($intervals->{$type}->{$scope})).'</li>'; |
|
} elsif ($scope eq 'secgrp') { |
|
if (ref($intervals->{$type}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Sections/groups').'<ul>'; |
|
foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$item, |
|
&convlim($intervals->{$type}->{$scope}->{$item})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} elsif ($scope eq 'users') { |
|
if (ref($intervals->{$type}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Users').'<ul>'; |
|
foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]', |
|
&convlim($item,$intervals->{$type}->{$scope}->{$item})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} |
|
} |
|
} elsif (($type eq 'map') || ($type eq 'resource')) { |
|
if (ref($intervals->{$type}->{$item}) eq 'HASH') { |
|
foreach my $scope (keys(%{$intervals->{$type}->{$item}})) { |
|
if ($scope eq 'all') { |
|
$iteminfo .= '<li>'.&mt('All users -- time limit: [_1]', |
|
&convlim($intervals->{$type}->{$item}->{$scope})). |
|
'</li>'; |
|
} elsif ($scope eq 'secgrp') { |
|
if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Sections/groups').'<ul>'; |
|
foreach my $sec (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$sec, |
|
&convlim($intervals->{$type}->{$item}->{$scope}->{$sec})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} elsif ($scope eq 'users') { |
|
if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Users').'<ul>'; |
|
foreach my $user (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$user, |
|
&convlim($intervals->{$type}->{$item}->{$scope}->{$user})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
$iteminfo .= '</ul>'; |
|
} |
|
} |
|
$r->print(&create_interval_form($intervals,$parmcount,$navmap,$item,$jschg, |
|
$itemname,$iteminfo).'</fieldset></td>'); |
|
} |
} |
$r->print(<<"END"); |
$r->print(<<"END"); |
<td> |
<td> |
<input type="text" name="title_$parmcount" size="15" value="$title" onfocus="$jschg" /> |
<input type="text" name="title_$parmcount" size="15" value="$title" onfocus="$jschg" $disabled /> |
<input type="hidden" name="key_$parmcount" value="$blockid" /> |
<input type="hidden" name="key_$parmcount" value="$blockid" /> |
<br /> |
<br /> |
<br /> |
<br /> |
$ltext->{'setb'}: $settername |
$ltext->{'setb'}: $settername |
</td> |
</td> |
END |
END |
$r->print('<td>'.&blocker_checkboxes($parmcount,$blocks,$jschg,\%lookups).'</td>'. |
$r->print('<td>'.&blocker_checkboxes($parmcount,$blocks,$jschg,\%lookups,$disabled).'</td>'. |
&Apache::loncommon::end_data_table_row()); |
&Apache::loncommon::end_data_table_row()); |
$parmcount++; |
$parmcount++; |
} |
} |
Line 1223 sub display_addblocker_table {
|
Line 1238 sub display_addblocker_table {
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'exam' => 'e.g., Exam 1', |
'exam' => 'e.g., Exam 1', |
); |
); |
my $intervalform = &create_interval_form($intervals,$parmcount,$navmap); |
my $intervalform = &create_interval_form($intervals,$parmcount,$navmap,'blocking'); |
if ($intervalform ne '') { |
if ($intervalform ne '') { |
$intervalform = '<fieldset>'. |
$intervalform = '<fieldset>'. |
'<legend>'.$ltext->{'chtr'}.'</legend>'. |
'<legend>'.$ltext->{'chtr'}.'</legend>'. |
Line 1261 END
|
Line 1276 END
|
} |
} |
|
|
sub blocker_checkboxes { |
sub blocker_checkboxes { |
my ($parmcount,$blocks,$jschg,$lookups) = @_; |
my ($parmcount,$blocks,$jschg,$lookups,$disabled) = @_; |
my ($typeorder,$types) = &blocktype_text(); |
my ($typeorder,$types) = &blocktype_text(); |
my $numinrow = 2; |
my $numinrow = 2; |
my %currdocs; |
my %currdocs; |
Line 1328 sub blocker_checkboxes {
|
Line 1343 sub blocker_checkboxes {
|
} |
} |
$output .= '<span class="LC_nobreak"><label>'."\n". |
$output .= '<span class="LC_nobreak"><label>'."\n". |
'<input type="checkbox" id="'.$item.'" name="'.$item.'"'. |
'<input type="checkbox" id="'.$item.'" name="'.$item.'"'. |
$blockstatus.$clickaction.' value="1" />'. |
$blockstatus.$clickaction.' value="1"'.$disabled.' />'. |
$types->{$block}.'</label></span>'."\n"; |
$types->{$block}.'</label></span>'."\n"; |
if ($block eq 'docs') { |
if ($block eq 'docs') { |
if ($blockstatus ne '') { |
if ($blockstatus ne '') { |
Line 1347 sub blocker_checkboxes {
|
Line 1362 sub blocker_checkboxes {
|
} |
} |
|
|
sub create_interval_form { |
sub create_interval_form { |
my ($intervals,$parmcount,$navmap,$currkey,$jschg,$itemname,$iteminfo) = @_; |
my ($intervals,$parmcount,$navmap,$context,$currkey,$jschg,$itemname,$iteminfo,$disabled) = @_; |
return unless ((ref($intervals) eq 'HASH') && (ref($navmap))); |
return unless ((ref($intervals) eq 'HASH') && (ref($navmap))); |
my $intervalform; |
my $intervalform; |
|
my $counter = 0; |
if (keys(%{$intervals}) > 0) { |
if (keys(%{$intervals}) > 0) { |
foreach my $type (sort(keys(%{$intervals}))) { |
foreach my $type (sort(keys(%{$intervals}))) { |
if ($type eq 'course') { |
if ($type eq 'course') { |
Line 1360 sub create_interval_form {
|
Line 1376 sub create_interval_form {
|
$clickaction = ' onclick="'.$jschg.'"'; |
$clickaction = ' onclick="'.$jschg.'"'; |
} |
} |
$intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount. |
$intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount. |
'" value="course"'.$checked.$clickaction.' />'; |
'" value="course"'.$checked.$clickaction.$disabled.' />'; |
if ($currkey eq 'course') { |
if ($currkey eq 'course') { |
$intervalform .= $itemname; |
$intervalform .= $itemname; |
} else { |
} else { |
Line 1369 sub create_interval_form {
|
Line 1385 sub create_interval_form {
|
$intervalform .= '</label>'; |
$intervalform .= '</label>'; |
if ($currkey eq 'course') { |
if ($currkey eq 'course') { |
$intervalform .= $iteminfo; |
$intervalform .= $iteminfo; |
|
} elsif ($context eq 'accesstimes') { |
|
(undef,$iteminfo) = &interval_details('course',$type,'',$navmap,$intervals,$counter); |
|
if ($iteminfo) { |
|
$intervalform .= ' '.$iteminfo; |
|
} |
} |
} |
$intervalform .= '<br />'; |
$intervalform .= '<br />'; |
|
$counter ++; |
} elsif ($type eq 'map') { |
} elsif ($type eq 'map') { |
if (ref($intervals->{$type}) eq 'HASH') { |
if (ref($intervals->{$type}) eq 'HASH') { |
if (ref($navmap)) { |
if (ref($navmap)) { |
Line 1385 sub create_interval_form {
|
Line 1407 sub create_interval_form {
|
} |
} |
$intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount. |
$intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount. |
'" value="'.&HTML::Entities::encode($map,'"<>&').'"'. |
'" value="'.&HTML::Entities::encode($map,'"<>&').'"'. |
$checked.$clickaction.' />'; |
$checked.$clickaction.$disabled.' />'; |
if ($currkey eq $map) { |
if ($currkey eq $map) { |
$intervalform .= $itemname.'</label>'.$iteminfo; |
$intervalform .= $itemname.'</label>'.$iteminfo; |
} else { |
} else { |
Line 1405 sub create_interval_form {
|
Line 1427 sub create_interval_form {
|
$intervalform .= &mt('Timer for all items in folder: [_1]', |
$intervalform .= &mt('Timer for all items in folder: [_1]', |
'<i>'.$title.'</i>'). |
'<i>'.$title.'</i>'). |
'</label>'.$path; |
'</label>'.$path; |
|
if ($context eq 'accesstimes') { |
|
(undef,$iteminfo) = &interval_details($map,$type,$map,$navmap,$intervals,$counter); |
|
if ($iteminfo) { |
|
$intervalform .= ' '.$iteminfo; |
|
} |
|
} |
} |
} |
$intervalform .= '<br />'; |
$intervalform .= '<br />'; |
|
$counter ++; |
} |
} |
} |
} |
} |
} |
Line 1426 sub create_interval_form {
|
Line 1455 sub create_interval_form {
|
} |
} |
$intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount. |
$intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount. |
'" value="'.&HTML::Entities::encode($resource,'"<>&').'"'. |
'" value="'.&HTML::Entities::encode($resource,'"<>&').'"'. |
$checked.$clickaction.' />'; |
$checked.$clickaction.$disabled.' />'; |
if ($currkey eq $resource) { |
if ($currkey eq $resource) { |
$intervalform .= $itemname.'</label>'.$iteminfo; |
$intervalform .= $itemname.'</label>'.$iteminfo; |
} else { |
} else { |
my ($title,$path,$hierarchy); |
my ($title,$path,$hierarchy); |
if (ref($resobj)) { |
if (ref($resobj)) { |
$title = $resobj->compTitle(); |
$title = $resobj->compTitle(); |
} else { |
} |
|
if ($title eq '') { |
$title = &Apache::lonnet::gettitle($resource); |
$title = &Apache::lonnet::gettitle($resource); |
} |
} |
$hierarchy = &show_timer_path($type,$resource,$navmap); |
$hierarchy = &show_timer_path($type,$resource,$navmap); |
Line 1445 sub create_interval_form {
|
Line 1475 sub create_interval_form {
|
$intervalform .= &mt('Timer for resource: [_1]','<i>'.$title.'</i>'). |
$intervalform .= &mt('Timer for resource: [_1]','<i>'.$title.'</i>'). |
'</label>'. |
'</label>'. |
$path; |
$path; |
|
if ($context eq 'accesstimes') { |
|
if (ref($resobj)) { |
|
my $url = $resobj->src(); |
|
if ($url eq '') { |
|
(my $map, my $resid, $url) = &Apache::lonnet::decode_symb($resource); |
|
} |
|
($itemname,$iteminfo) = &interval_details($resource,$type,$url,$navmap,$intervals,$counter); |
|
$intervalform .= ' '.$iteminfo; |
|
} |
|
} |
} |
} |
$intervalform .= '<br />'; |
$intervalform .= '<br />'; |
|
$counter ++; |
} |
} |
} |
} |
} |
} |
Line 1456 sub create_interval_form {
|
Line 1497 sub create_interval_form {
|
if ($currkey ne '') { |
if ($currkey ne '') { |
$intervalform = '<input type="radio" name="firstaccess_'.$parmcount. |
$intervalform = '<input type="radio" name="firstaccess_'.$parmcount. |
'" checked="checked" value="'. |
'" checked="checked" value="'. |
&HTML::Entities::encode($currkey,'"<>&').' />'. |
&HTML::Entities::encode($currkey,'"<>&').'"'.$disabled.' />'. |
$itemname.'<br />'; |
$itemname.'<br />'; |
} else { |
} else { |
$intervalform = &mt('No timed items defined.').' '. |
$intervalform = &mt('No timed items defined.').' '. |
Line 1474 sub trigger_details_toggle {
|
Line 1515 sub trigger_details_toggle {
|
'style="text-decoration: none;"><b>'.&mt('(More ...)').'</b></a></span>'; |
'style="text-decoration: none;"><b>'.&mt('(More ...)').'</b></a></span>'; |
} |
} |
|
|
|
sub interval_details { |
|
my ($item,$type,$url,$navmap,$intervals,$parmcount) = @_; |
|
my ($itemname,$iteminfo,$skipdetails); |
|
if ($type eq 'course') { |
|
$itemname = &mt('Timer for all items in course.'); |
|
} else { |
|
if (&Apache::lonnet::is_on_map($url)) { |
|
if ($type eq 'map') { |
|
if (ref($navmap)) { |
|
my $title; |
|
my $resobj = $navmap->getResourceByUrl($item); |
|
if (ref($resobj)) { |
|
$title = $resobj->compTitle(); |
|
} else { |
|
$title = &Apache::lonnet::gettitle($item); |
|
} |
|
$itemname = &mt('Timer for all items in folder: [_1]', |
|
'<span style="font-style:italic">'. |
|
$title.'</span>'); |
|
} |
|
} else { |
|
if (ref($navmap)) { |
|
my $title; |
|
my $resobj = $navmap->getBySymb($item); |
|
if (ref($resobj)) { |
|
$title = $resobj->compTitle(); |
|
} else { |
|
$title = &Apache::lonnet::gettitle($item); |
|
} |
|
$itemname = &mt('Timer for resource: [_1]', |
|
'<span style="font-style:italic">'. |
|
$title.'</span>'); |
|
} |
|
} |
|
if (ref($navmap)) { |
|
my $path = &show_timer_path($type,$item); |
|
if ($path) { |
|
$iteminfo = ' <span style="font-size:90%;">'. |
|
&mt('(in: [_1])',$path). |
|
'</span>'; |
|
} |
|
} |
|
} else { |
|
$skipdetails = 1; |
|
$itemname = '<span style="LC_warning">'. |
|
&mt('Timer folder/resource not in course'). |
|
'</span>'; |
|
} |
|
} |
|
if ((!$skipdetails) && (ref($intervals) eq 'HASH') && (ref($intervals->{$type}) eq 'HASH')) { |
|
$iteminfo = &trigger_details_toggle($parmcount). |
|
'<ul id="trigdetails_'.$parmcount.'" style="display:none">'; |
|
if ($type eq 'course') { |
|
foreach my $scope (keys(%{$intervals->{$type}})) { |
|
if ($scope eq 'all') { |
|
$iteminfo .= '<li>'.&mt('All users -- time limit: [_1]', |
|
&convlim($intervals->{$type}->{$scope})).'</li>'; |
|
} elsif ($scope eq 'secgrp') { |
|
if (ref($intervals->{$type}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Sections/groups').'<ul>'; |
|
foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$item, |
|
&convlim($intervals->{$type}->{$scope}->{$item})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} elsif ($scope eq 'users') { |
|
if (ref($intervals->{$type}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Users').'<ul>'; |
|
foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]', |
|
&convlim($item,$intervals->{$type}->{$scope}->{$item})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} |
|
} |
|
} elsif (($type eq 'map') || ($type eq 'resource')) { |
|
if (ref($intervals->{$type}->{$item}) eq 'HASH') { |
|
foreach my $scope (keys(%{$intervals->{$type}->{$item}})) { |
|
if ($scope eq 'all') { |
|
$iteminfo .= '<li>'.&mt('All users -- time limit: [_1]', |
|
&convlim($intervals->{$type}->{$item}->{$scope})). |
|
'</li>'; |
|
} elsif ($scope eq 'secgrp') { |
|
if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Sections/groups').'<ul>'; |
|
foreach my $sec (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$sec, |
|
&convlim($intervals->{$type}->{$item}->{$scope}->{$sec})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} elsif ($scope eq 'users') { |
|
if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') { |
|
$iteminfo .= '<li>'.&mt('Users').'<ul>'; |
|
foreach my $user (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) { |
|
$iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$user, |
|
&convlim($intervals->{$type}->{$item}->{$scope}->{$user})). |
|
'</li>'; |
|
} |
|
$iteminfo .= '</ul></li>'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
$iteminfo .= '</ul>'; |
|
} |
|
return ($itemname,$iteminfo); |
|
} |
|
|
sub show_timer_path { |
sub show_timer_path { |
my ($type,$item,$navmap) = @_; |
my ($type,$item,$navmap) = @_; |
return unless(ref($navmap)); |
return unless(ref($navmap)); |
Line 1500 sub blocktype_text {
|
Line 1656 sub blocktype_text {
|
'port' => 'Portfolio', |
'port' => 'Portfolio', |
'groups' => 'Groups', |
'groups' => 'Groups', |
'blogs' => 'Blogs', |
'blogs' => 'Blogs', |
|
'about' => 'User Information', |
'docs' => 'Content', |
'docs' => 'Content', |
'printout' => 'Printouts', |
'printout' => 'Printouts', |
'passwd' => 'Password', |
'passwd' => 'Change Password', |
|
'grades' => 'Gradebook', |
|
'search' => 'Content Search', |
|
'index' => 'Content Index', |
|
'alert' => 'Critical Alert', |
|
'reinit' => 'Course Re-init', |
); |
); |
my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','passwd']; |
my $typeorder = ['com','chat','boards','port','groups','blogs','about','printout','docs','grades','search','index','alert','reinit','passwd']; |
return ($typeorder,\%types); |
return ($typeorder,\%types); |
} |
} |
|
|
sub blockingmenu_javascript { |
sub blockingmenu_javascript { |
my ($blockcount) = @_; |
my ($blockcount) = @_; |
my %lt = &Apache::lonlocal::texthash ( |
|
more => 'More ...', |
|
less => 'Less ...', |
|
); |
|
return <<ENDSCRIPT; |
return <<ENDSCRIPT; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1569 function toggleAddModify() {
|
Line 1727 function toggleAddModify() {
|
return; |
return; |
} |
} |
|
|
|
// ]]> |
|
</script> |
|
ENDSCRIPT |
|
|
|
} |
|
|
|
sub details_javascript { |
|
my %lt = &Apache::lonlocal::texthash ( |
|
more => 'More ...', |
|
less => 'Less ...', |
|
); |
|
return <<ENDSCRIPT; |
|
|
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
function showTriggerDetails(item) { |
function showTriggerDetails(item) { |
document.getElementById('trigdetails_'+item).style.display='block'; |
document.getElementById('trigdetails_'+item).style.display='block'; |
document.getElementById('trigdetails_'+item).style.textAlign='left'; |
document.getElementById('trigdetails_'+item).style.textAlign='left'; |