--- loncom/interface/loncourserespicker.pm 2015/06/09 21:22:56 1.13 +++ loncom/interface/loncourserespicker.pm 2016/10/16 21:49:51 1.14 @@ -1,6 +1,6 @@ # The LearningOnline Network # -# $Id: loncourserespicker.pm,v 1.13 2015/06/09 21:22:56 damieng Exp $ +# $Id: loncourserespicker.pm,v 1.14 2016/10/16 21:49:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -75,7 +75,7 @@ select items. Checking a folder causes within the folder. Unchecking a resource causing unchecking of folders containing the item back up to the top level. -Inputs: 9. +Inputs: 11. - $navmap -- Reference to LON-CAPA navmap object (encapsulates information about resources in the course). @@ -106,6 +106,10 @@ Inputs: 9. - $uploadedfiles -- Reference to hash: keys are paths to files in /home/httpd/lonUsers/$cdom/$1/$2/$3/$cnum/userfiles. + + - $readonly -- if true, no "check all" or "uncheck all" buttons will + be displayed, and checkboxes will be disabled, if this + is for an exam block. Output: $output is the HTML mark-up for display/selection of content @@ -206,7 +210,8 @@ use Apache::lonlocal; use LONCAPA qw(:DEFAULT :match); sub create_picker { - my ($navmap,$context,$formname,$crstype,$blockedmaps,$blockedresources,$block,$preamble,$numhome,$uploadedfiles) = @_; + my ($navmap,$context,$formname,$crstype,$blockedmaps,$blockedresources,$block,$preamble, + $numhome,$uploadedfiles,$readonly) = @_; return unless (ref($navmap)); my ($it,$output,$numdisc,%maps,%resources,%discussiontime,%currmaps,%currresources,%files); $it = $navmap->getIterator(undef,undef,undef,1,undef,undef); @@ -236,12 +241,15 @@ sub create_picker { my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $crsprefix = &propath($cdom,$cnum).'/userfiles/'; - my ($info,$display,$onsubmit,$togglebuttons); + my ($info,$display,$onsubmit,$togglebuttons,$disabled); if ($context eq 'examblock') { my $maps_elem = 'docs_maps_'.$block; my $res_elem = 'docs_resources_'.$block; $onsubmit = ' onsubmit="return writeToOpener('."'$maps_elem','$res_elem'".');"'; $info = &mt('Items in '.lc($crstype).' for which access will be blocked.'); + if ($readonly) { + $disabled = ' disabled="disabled"'; + } } if ($context eq 'dumpdocs') { $info = ''. @@ -253,10 +261,14 @@ sub create_picker { $info = &mt('Choose which items you wish to export from your '.$crstype.'.'); $startcount = 5; } - $togglebuttons = ''. - '  '; + if ($disabled) { + $togglebuttons = '
'; + } else { + $togglebuttons = ''. + '  '; + } $display = '
'."\n"; if ($context eq 'imsexport') { $display .= $info. @@ -353,7 +365,7 @@ sub create_picker { $display .= 'checked="checked"'; } } - $display .= ' />'."\n"; + $display .= $disabled.' />'."\n"; if ($context eq 'dumpdocs') { $display .= ''; } @@ -450,10 +462,12 @@ sub create_picker { &mt('Export').'" />

'; $numcount = $count + $boards + $startcount; } elsif ($context eq 'examblock') { - $display .= - '

'. - '

'; + unless ($readonly) { + $display .= + '

'. + '

'; + } $numcount = $count + $startcount; } elsif ($context eq 'dumpdocs') { $display .= ''.