Diff for /loncom/interface/lonblockingmenu.pm between versions 1.8 and 1.11

version 1.8, 2012/04/10 00:28:04 version 1.11, 2014/02/28 19:20:05
Line 87  it is important to use reasonable time w Line 87  it is important to use reasonable time w
 the case of blocks triggered by clicking a button to start a timed quiz,   the case of blocks triggered by clicking a button to start a timed quiz, 
 quiz durations that are of limited duration. This is especially important  quiz durations that are of limited duration. This is especially important
 when blocking prtfolio access, as other courses may require students to use  when blocking prtfolio access, as other courses may require students to use
 the portfolio as a mechanism for submitting assigments.  the portfolio as a mechanism for submitting assignments.
   
 Information about blocks in a course will be cached for 10 minutes, so,  Information about blocks in a course will be cached for 10 minutes, so,
 as with parameters set for resources, it can take up to 10 minutes for  as with parameters set for resources, it can take up to 10 minutes for
Line 135  Outputs: 2 Line 135  Outputs: 2
       $output - Information about changes made.        $output - Information about changes made.
   
   
 =item &enumerate_course_contents()  
   
 Create hashes of maps (for folders/pages) and symbs (for resources) in  
 a course, where keys are numbers (starting with 1) and values are  
 map url, or symb, for an iteration through the course, as seen by  
 a Course Coordinator. Used to generate numerical IDs to facilitate  
 storage of lists of maps or resources to be blocked during an exam.     
   
 Inputs: 3  
       $navmap - navmaps object  
   
       $map_url - reference to hash to contain URLs of maps in course  
   
       $resource_symb - reference to hash to contain symbs for  
                        resources in course  
   
 Outputs: None  
   
 Side Effects: $map_url and $resource_symb hashrefs are populated.  
   
   
 =item &get_dates_from_form()  =item &get_dates_from_form()
   
 Extract start and end dates from web form input for blocks with  Extract start and end dates from web form input for blocks with
Line 388  use Apache::Constants qw(:common :http); Line 367  use Apache::Constants qw(:common :http);
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::lonparmset();  use Apache::lonparmset();
   use Apache::loncourserespicker();
 use HTML::Entities();  use HTML::Entities();
 use Apache::lonlocal;  use Apache::lonlocal;
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
Line 498  sub handler { Line 478  sub handler {
         &Apache::lonhtmlcommon::breadcrumbs('Blocking communication/content access'));          &Apache::lonhtmlcommon::breadcrumbs('Blocking communication/content access'));
   
     my $usertype;      my $usertype;
     my $crstype = &Apache::loncommon::course_type();  
     if ($crstype eq 'Community') {      if ($crstype eq 'Community') {
         $usertype = 'members';          $usertype = 'members';
     } else {      } else {
Line 509  sub handler { Line 488  sub handler {
             '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:",
             '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 assigments 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:",
             'addn' => 'Add new blocking event',              'addn' => 'Add new blocking event',
             'mexb' => 'Modify existing blocking event(s)',               'mexb' => 'Modify existing blocking event(s)', 
Line 665  sub blockstore { Line 644  sub blockstore {
     my $changestotal = 0;      my $changestotal = 0;
     my $addtimer = 0;      my $addtimer = 0;
     my %blocking = ();      my %blocking = ();
     my (%map_url,%resource_symb,$output);      my (%map_url,%resource_symb,%titles,$output);
     $output = '<h3>'.$lt{'head'}.'</h3>';      $output = '<h3>'.$lt{'head'}.'</h3>';
     if ($env{'form.blockaction'} eq 'modify') {      if ($env{'form.blockaction'} eq 'modify') {
         foreach my $envkey (keys(%env)) {          foreach my $envkey (keys(%env)) {
Line 691  sub blockstore { Line 670  sub blockstore {
         $output = $lt{'unna'}.' '.$lt{'ncwm'}.'</br>';          $output = $lt{'unna'}.' '.$lt{'ncwm'}.'</br>';
         return ($changestotal,$output);          return ($changestotal,$output);
     }      }
     &enumerate_course_contents($navmap,\%map_url,\%resource_symb);      &Apache::loncourserespicker::enumerate_course_contents($navmap,\%map_url,\%resource_symb,\%titles,'examblock');
     foreach my $key (keys(%removals)) {      foreach my $key (keys(%removals)) {
         my $hashkey = $env{'form.key_'.$key};          my $hashkey = $env{'form.key_'.$key};
         &Apache::lonnet::del('comm_block',["$hashkey"],          &Apache::lonnet::del('comm_block',["$hashkey"],
Line 801  sub blockstore { Line 780  sub blockstore {
     return ($changestotal,$output);      return ($changestotal,$output);
 }  }
   
 sub enumerate_course_contents {  
     my ($navmap,$map_url,$resource_symb) = @_;  
     if ((ref($navmap)) && (ref($map_url) eq 'HASH') &&   
         (ref($resource_symb) eq 'HASH')) {  
         my $it = $navmap->getIterator(undef,undef,undef,1,undef,undef);  
         my $count = 0;  
         while (my $curRes = $it->next()) {  
             if (ref($curRes)) {  
                 $count ++;  
                 my $symb = $curRes->symb();  
                 my $ressymb = $symb;  
                 if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) {  
                     unless ($ressymb =~ m|adm/wrapper/adm|) {  
                         $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.  
                                    '/bulletinboard';  
                     }  
                 }  
                 if (($curRes->is_sequence()) || ($curRes->is_page())) {  
                     $map_url->{$count} = (&Apache::lonnet::decode_symb($symb))[2];  
                 } else {  
                     $resource_symb->{$count} = $ressymb;  
                 }  
             }  
         }  
     }  
     return;  
 }  
   
 sub get_dates_from_form {  sub get_dates_from_form {
     my $item = shift;      my $item = shift;
     my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate_'.$item);      my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate_'.$item);
Line 917  sub check_release_required { Line 868  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) = @_;
     my $parmcount = 0;      my $parmcount = 0;
     my (%map_url,%resource_symb,%lookups);      my (%map_url,%resource_symb,%titles,%lookups);
     &enumerate_course_contents($navmap,\%map_url,\%resource_symb);      &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);
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
Line 1114  END Line 1065  END
   
 sub convlim {  sub convlim {
     my ($timelimit) = @_;      my ($timelimit) = @_;
     my $output;  
     my @order = ('days','hours','minutes','seconds');      my @order = ('days','hours','minutes','seconds');
     my %catlimits = (       my %catlimits = ( 
                       days    => 86400,                        days    => 86400,
Line 1132  sub convlim { Line 1082  sub convlim {
             if ($val > 0) {              if ($val > 0) {
                 push(@toshow,&mt("[_1] $cat",$val));                  push(@toshow,&mt("[_1] $cat",$val));
             }              }
             $timelimit =- $val*$catlimits{$cat};              $timelimit -= $val*$catlimits{$cat};
         }          }
     }      }
     my $output = join(', ',@toshow);      my $output = join(', ',@toshow);

Removed from v.1.8  
changed lines
  Added in v.1.11


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>