--- loncom/interface/loncommon.pm 2006/04/22 01:06:48 1.347 +++ loncom/interface/loncommon.pm 2006/04/22 16:26:31 1.348 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.347 2006/04/22 01:06:48 albertel Exp $ +# $Id: loncommon.pm,v 1.348 2006/04/22 16:26:31 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2605,11 +2605,13 @@ sub maketime { ######################################### sub findallcourses { - my %courses=(); + my %courses; my $now=time; - foreach (keys %env) { - if ($_=~/^user\.role\.\w+\.\/(\w+)\/(\w+)/) { - my ($starttime,$endtime)=$env{$_}; + foreach my $key (keys(%env)) { + if ( $key=~m{^user\.role\.(\w+)\./(\w+)/(\w+)} ) { + my ($role,$domain,$id) = ($1,$2,$3); + next if ($role eq 'ca' || $role eq 'aa'); + my ($starttime,$endtime)=$env{$key}; my $active=1; if ($starttime) { if ($now<$starttime) { $active=0; } @@ -2617,10 +2619,10 @@ sub findallcourses { if ($endtime) { if ($now>$endtime) { $active=0; } } - if ($active) { $courses{$1.'_'.$2}=1; } + if ($active) { $courses{$domain.'_'.$id}=1; } } } - return keys %courses; + return keys(%courses); } ###############################################