--- loncom/homework/lonhomework.pm 2002/12/11 15:33:55 1.105 +++ loncom/homework/lonhomework.pm 2003/01/19 08:11:38 1.106 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.105 2002/12/11 15:33:55 www Exp $ +# $Id: lonhomework.pm,v 1.106 2003/01/19 08:11:38 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -48,6 +48,7 @@ use Apache::optionresponse(); use Apache::imageresponse(); use Apache::essayresponse(); use Apache::externalresponse(); +use Apache::rankresponse(); use Apache::Constants qw(:common); use HTML::Entities(); use Apache::loncommon(); @@ -150,6 +151,14 @@ sub check_access { my $temp; my $type; my $passed; + + if ($ENV{'request.state'} eq "construct") { + &Apache::lonxml::debug("in construction ignoring dates"); + $status='CAN_ANSWER'; + $datemsg='is in under construction'; + return ($status,$datemsg); + } + &Apache::lonxml::debug("checking for part :$id:"); &Apache::lonxml::debug("time:".time); foreach $temp ("opendate","duedate","answerdate") { @@ -216,11 +225,7 @@ sub check_access { $status='CAN_ANSWER'; $datemsg='is closed but you are allowed to view it'; } - if ($ENV{'request.state'} eq "construct") { - &Apache::lonxml::debug("in construction ignoring dates"); - $status='CAN_ANSWER'; - $datemsg='is in under construction'; - } + return ($status,$datemsg); } @@ -230,6 +235,23 @@ sub showhash { return ''; } +sub showarray { + my ($array)=@_; + my $string="("; + foreach my $elm (@{ $array }) { + if (ref($elm)) { + if ($elm =~ /ARRAY/ ) { + $string.=&showarray($elm); + } + } else { + $string.="$elm," + } + } + chop($string); + $string.=")"; + return $string; +} + sub showhashsubset { my ($hash,$keyre) = @_; my $resultkey; @@ -237,14 +259,13 @@ sub showhashsubset { if ($resultkey =~ /$keyre/) { if (ref($$hash{$resultkey})) { if ($$hash{$resultkey} =~ /ARRAY/ ) { - my $string="$resultkey ---- ("; - foreach my $elm (@{ $$hash{$resultkey} }) { - $string.="$elm,"; - } - chop($string); - &Apache::lonxml::debug("$string)"); + &Apache::lonxml::debug("$resultkey ---- ". + &showarray($$hash{$resultkey})); + } elsif ($$hash{$resultkey} =~ /HASH/ ) { + &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}"); + &showhashsubset($$hash{$resultkey},'.'); } else { - &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}"); + &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}"); } } else { &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");