[LON-CAPA-cvs] cvs: loncom /misc refresh_courseids_db.pl releaseslist.xml

raeburn raeburn at source.lon-capa.org
Sat Mar 31 18:10:16 EDT 2012


raeburn		Sat Mar 31 22:10:16 2012 EDT

  Modified files:              
    /loncom/misc	releaseslist.xml refresh_courseids_db.pl 
  Log:
  - Bug 6518.
    - Exam blocks can now block access to specified folders and/or resources
      for the duration of an exam (2.11) as well as collaborative tools (pre-2.11).
    - The start time for blocking can be based on activation of the timer for a
      specific timed quiz item (map or resource specific) -- 2.11 required.
  
  
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.6 loncom/misc/releaseslist.xml:1.7
--- loncom/misc/releaseslist.xml:1.6	Tue Mar 13 05:38:08 2012
+++ loncom/misc/releaseslist.xml	Sat Mar 31 22:10:16 2012
@@ -1,4 +1,6 @@
 <course name="crstype" value="Community">2.9</course>
+<course name="commblock" value="timer">2.11</course>
+<course name="commblock" value="docs">2.11</course>
 <parameter name="type" value="anonsurvey">2.10</parameter>
 <parameter name="type" value="anonsurveycred">2.10</parameter>
 <parameter name="type" value="surveycred">2.10</parameter>
Index: loncom/misc/refresh_courseids_db.pl
diff -u loncom/misc/refresh_courseids_db.pl:1.10 loncom/misc/refresh_courseids_db.pl:1.11
--- loncom/misc/refresh_courseids_db.pl:1.10	Fri Dec 24 07:58:09 2010
+++ loncom/misc/refresh_courseids_db.pl	Sat Mar 31 22:10:16 2012
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # The LearningOnline Network
 #
-# $Id: refresh_courseids_db.pl,v 1.10 2010/12/24 07:58:09 raeburn Exp $
+# $Id: refresh_courseids_db.pl,v 1.11 2012/03/31 22:10:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -227,6 +227,10 @@
                     ($reqdmajor,$reqdminor) = &coursetype_constraints($cnum,$cdom,$crstype,
                                                                       $reqdmajor,
                                                                       $reqdminor);
+                    # check communication blocks 
+                    ($reqdmajor,$reqdminor) = &commblock_constraints($cnum,$cdom,
+                                                                     $reqdmajor,
+                                                                     $reqdminor);
                     # check course contents
                     ($reqdmajor,$reqdminor) = &coursecontent_constraints($cnum,$cdom,
                                                                          $reqdmajor,
@@ -377,6 +381,36 @@
     return ($reqdmajor,$reqdminor);
 }
 
+sub commblock_constraints {
+    my ($cnum,$cdom,$reqdmajor,$reqdminor) = @_;
+    my %comm_blocks =  &Apache::lonnet::dump('commblock',$cdom,$cnum);
+    my $now = time;
+    if (keys(%comm_blocks) > 0) {
+        foreach my $block (keys(%comm_blocks)) {
+            if ($block =~ /^firstaccess____(.+)$/) {
+                my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course.commblock.timer'});
+                ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
+                last;
+            } elsif ($block =~ /^(\d+)____(\d+)$) {
+                my ($start,$end) = ($1,$2);
+                next if ($end < $now); 
+            }
+            if (ref($comm_blocks{$block}) eq 'HASH') {
+                if (ref($comm_blocks{$block}{'blocks'}) eq 'HASH') {
+                    if (ref($comm_blocks{$block}{'blocks'}{'docs'}) eq 'HASH') {
+                        if (keys(%{$comm_blocks{$block}{'blocks'}{'docs'}} > 0) {
+                            my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course.commblock.docs'});
+                            ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
+                            last;
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return;
+}
+
 sub coursecontent_constraints {
     my ($cnum,$cdom,$reqdmajor,$reqdminor) = @_;
     my $navmap = Apache::lonnavmaps::navmap->new();




More information about the LON-CAPA-cvs mailing list