[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncommon.pm

raeburn raeburn at source.lon-capa.org
Fri May 16 14:36:06 EDT 2014


raeburn		Fri May 16 18:36:06 2014 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncommon.pm 
  Log:
  - For 2.11
    - Backport 1.1189.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.72 loncom/interface/loncommon.pm:1.1075.2.73
--- loncom/interface/loncommon.pm:1.1075.2.72	Thu May 15 20:37:22 2014
+++ loncom/interface/loncommon.pm	Fri May 16 18:36:05 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1075.2.72 2014/05/15 20:37:22 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.73 2014/05/16 18:36:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4236,23 +4236,20 @@
 ###############################################
 
 sub blockcheck {
-    my ($setters,$activity,$uname,$udom,$url) = @_;
+    my ($setters,$activity,$uname,$udom,$url,$is_course) = @_;
 
-    if (!defined($udom)) {
+    if (defined($udom) && defined($uname)) {
+        # If uname and udom are for a course, check for blocks in the course.
+        if (($is_course) || (&Apache::lonnet::is_course($udom,$uname))) {
+            my ($startblock,$endblock,$triggerblock) =
+                &get_blocks($setters,$activity,$udom,$uname,$url);
+            return ($startblock,$endblock,$triggerblock);
+        }
+    } else {
         $udom = $env{'user.domain'};
-    }
-    if (!defined($uname)) {
         $uname = $env{'user.name'};
     }
 
-    # If uname and udom are for a course, check for blocks in the course.
-
-    if (&Apache::lonnet::is_course($udom,$uname)) {
-        my ($startblock,$endblock,$triggerblock) = 
-            &get_blocks($setters,$activity,$udom,$uname,$url);
-        return ($startblock,$endblock,$triggerblock);
-    }
-
     my $startblock = 0;
     my $endblock = 0;
     my $triggerblock = '';
@@ -4262,7 +4259,8 @@
     # boards, chat or groups, check for blocking in current course only.
 
     if (($activity eq 'boards' || $activity eq 'chat' ||
-         $activity eq 'groups') && ($env{'request.course.id'})) {
+         $activity eq 'groups' || $activity eq 'printout') &&
+        ($env{'request.course.id'})) {
         foreach my $key (keys(%live_courses)) {
             if ($key ne $env{'request.course.id'}) {
                 delete($live_courses{$key});
@@ -4526,12 +4524,12 @@
 }
 
 sub blocking_status {
-    my ($activity,$uname,$udom,$url) = @_;
+    my ($activity,$uname,$udom,$url,$is_course) = @_;
     my %setters;
 
 # check for active blocking
     my ($startblock,$endblock,$triggerblock) = 
-        &blockcheck(\%setters,$activity,$uname,$udom,$url);
+        &blockcheck(\%setters,$activity,$uname,$udom,$url,$is_course);
     my $blocked = 0;
     if ($startblock && $endblock) {
         $blocked = 1;
@@ -7425,7 +7423,7 @@
         }
         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
-        my $blocked = &blocking_status('printout',$cnum,$cdom);
+        my $blocked = &blocking_status('printout',$cnum,$cdom,undef,1);
         if ($blocked) {
             my $checkrole = "cm./$cdom/$cnum";
             if ($env{'request.course.sec'} ne '') {




More information about the LON-CAPA-cvs mailing list