--- loncom/interface/loncommon.pm 2007/01/15 20:48:34 1.501 +++ loncom/interface/loncommon.pm 2007/01/20 22:04:57 1.502 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.501 2007/01/15 20:48:34 banghart Exp $ +# $Id: loncommon.pm,v 1.502 2007/01/20 22:04:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2903,16 +2903,16 @@ sub blockcheck { $uname = $env{'user.name'}; } - my ($startblock,$endblock); - # If uname and udom are for a course, check for blocks in the course. if (&Apache::lonnet::is_course($udom,$uname)) { my %records = &Apache::lonnet::dump('comm_block',$udom,$uname); - ($startblock,$endblock)=&get_blocks($setters,$activity,$udom,$uname); + my ($startblock,$endblock)=&get_blocks($setters,$activity,$udom,$uname); return ($startblock,$endblock); } + my $startblock = 0; + my $endblock = 0; my %live_courses = &findallcourses(undef,$uname,$udom); # If uname is for a user, and activity is course-specific, i.e., @@ -2973,8 +2973,6 @@ sub blockcheck { if ($sec ne 'none') { $checkrole .= '/'.$sec; } - # Resource belongs to user other than current user. - # Assemble privs for that user, and check for 'evb' priv. if ($otheruser) { # Resource belongs to user other than current user. # Assemble privs for that user, and check for 'evb' priv. @@ -3024,8 +3022,16 @@ sub blockcheck { # Retrieve blocking times and identity of blocker for course # of specified user, unless user has 'evb' privilege. - - ($startblock,$endblock)=&get_blocks($setters,$activity,$cdom,$cnum); + + my ($start,$end)=&get_blocks($setters,$activity,$cdom,$cnum); + if (($start != 0) && + (($startblock == 0) || ($startblock > $start))) { + $startblock = $start; + } + if (($end != 0) && + (($endblock == 0) || ($endblock < $end))) { + $endblock = $end; + } } return ($startblock,$endblock); }