--- loncom/interface/lonblockingmenu.pm 2012/03/31 14:15:24 1.4 +++ loncom/interface/lonblockingmenu.pm 2013/01/04 05:45:50 1.9 @@ -2,7 +2,7 @@ # Routines for configuring blocking of access to collaborative functions, # and specific resources during an exam # -# $Id: lonblockingmenu.pm,v 1.4 2012/03/31 14:15:24 raeburn Exp $ +# $Id: lonblockingmenu.pm,v 1.9 2013/01/04 05:45:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -238,23 +238,6 @@ Output: None Side Effects: prints web form elements (in a table) for current blocks. -=item &path_to_trigger() - -Provides hierarchy of names of folders/sub-folders containing the current -item identified as an item with an interval timer set, to be used as a -trigger. - -Inputs: 3 - - $navmap - navmaps object - - - $map - url for map (either the trigger itself, or map containing - the resource, which is the trigger). - - - $type - type of trigger: map or resource. - -Outputs: 1 @pathitems - array of folder/subfolder names. - - =item &convlim() Convert a time interval used for a timed quiz (in seconds) to @@ -506,7 +489,7 @@ sub handler { } &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/setblock', - text=>'Blocking communication/resource access'}); + text=>'Blocking communication/content access'}); my $js = &blockingmenu_javascript($blockcount); @@ -515,7 +498,6 @@ sub handler { &Apache::lonhtmlcommon::breadcrumbs('Blocking communication/content access')); my $usertype; - my $crstype = &Apache::loncommon::course_type(); if ($crstype eq 'Community') { $usertype = 'members'; } else { @@ -565,6 +547,7 @@ sub handler { '
  • '.&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("generating printouts of $lctype content").'
  • '. '
  • '.&mt("accessing $lctype content in specified folders or resources").'
  • '. ''. '

    '.$lt{'blca'}.'
    '.$lt{'pobl'}.'

    ' @@ -754,6 +737,11 @@ sub blockstore { if ($blockdocs) { &check_release_required('docs'); } + if (ref($blocktypes) eq 'HASH') { + if ($blocktypes->{'printout'} eq 'on') { + &check_release_required('printout'); + } + } if (exists($removals{$key})) { $modtotal ++; } else { @@ -1123,49 +1111,8 @@ END return; } -sub path_to_trigger { - my ($navmap,$map,$type) = @_; - my @pathitems; - if (ref($navmap)) { - my $mapres = $navmap->getResourceByUrl($map); - if (ref($mapres)) { - my $pcslist = $mapres->map_hierarchy(); - if ($pcslist ne '') { - my @pcs = split(/,/,$pcslist); - foreach my $pc (@pcs) { - if ($pc == 1) { - push(@pathitems,&mt('Main Course Documents')); - } else { - my $res = $navmap->getByMapPc($pc); - if (ref($res)) { - my $title = $res->compTitle(); - $title =~ s/\W+/_/g; - if ($title ne '') { - push(@pathitems,$title); - } - } - } - } - } - } - if ($type eq 'resource') { - if ($mapres->{ID} eq '0.0') { - push(@pathitems,&mt('Main Course Documents')); - } else { - my $maptitle = $mapres->compTitle(); - $maptitle =~ s/\W+/_/g; - if ($maptitle ne '') { - push(@pathitems,$maptitle); - } - } - } - } - return @pathitems; -} - sub convlim { my ($timelimit) = @_; - my $output; my @order = ('days','hours','minutes','seconds'); my %catlimits = ( days => 86400, @@ -1175,13 +1122,15 @@ sub convlim { my @toshow; foreach my $cat (@order) { if ($cat eq 'seconds') { - last if ($timelimit <= 0); + if ($timelimit > 0) { + push(@toshow,&mt("[_1] $cat",$timelimit)); + } } elsif ($timelimit >= $catlimits{$cat}) { my $val = int($timelimit/$catlimits{$cat}); if ($val > 0) { push(@toshow,&mt("[_1] $cat",$val)); } - $timelimit =- $val*$catlimits{$cat}; + $timelimit -= $val*$catlimits{$cat}; } } my $output = join(', ',@toshow); @@ -1452,10 +1401,12 @@ sub show_timer_path { return unless(ref($navmap)); my @pathitems; if ($type eq 'map') { - @pathitems = &path_to_trigger($navmap,$item,$type); + @pathitems = + &Apache::loncommon::get_folder_hierarchy($navmap,$item); } elsif ($type eq 'resource') { my ($map,$id,$resource) = &Apache::lonnet::decode_symb($item); - @pathitems = &path_to_trigger($navmap,$map,$type); + @pathitems = + &Apache::loncommon::get_folder_hierarchy($navmap,$map,1); } if (@pathitems) { return join(' » ',@pathitems); @@ -1471,9 +1422,10 @@ sub blocktype_text { 'port' => 'Portfolio', 'groups' => 'Groups', 'blogs' => 'Blogs', - 'docs' => 'Content', + 'docs' => 'Content', + 'printout' => 'Printouts', ); - my $typeorder = ['com','chat','boards','port','groups','blogs','docs']; + my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs']; return ($typeorder,\%types); }