--- loncom/homework/lonhomework.pm 2002/02/27 20:23:26 1.71 +++ loncom/homework/lonhomework.pm 2002/03/22 20:11:00 1.73 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.71 2002/02/27 20:23:26 albertel Exp $ +# $Id: lonhomework.pm,v 1.73 2002/03/22 20:11:00 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,17 +31,18 @@ package Apache::lonhomework; use strict; -use Apache::style; -use Apache::lonxml; -use Apache::lonnet; -use Apache::lonplot; -use Apache::inputtags; -use Apache::structuretags; -use Apache::randomlabel; -use Apache::response; -use Apache::hint; -use Apache::outputtags; +use Apache::style(); +use Apache::lonxml(); +use Apache::lonnet(); +use Apache::lonplot(); +use Apache::inputtags(); +use Apache::structuretags(); +use Apache::randomlabel(); +use Apache::response(); +use Apache::hint(); +use Apache::outputtags(); use Apache::Constants qw(:common); +use HTML::Entities(); #use Time::HiRes qw( gettimeofday tv_interval ); BEGIN { @@ -128,6 +129,7 @@ sub check_access { my $type; my $passed; &Apache::lonxml::debug("checking for part :$id:"); + &Apache::lonxml::debug("time:".time); foreach $temp ("opendate","duedate","answerdate") { $lastdate = $date; $date = &Apache::lonnet::EXT("resource.$id.$temp"); @@ -189,7 +191,20 @@ sub showhash { my (%hash) = @_; my $resultkey; foreach $resultkey (sort keys %hash) { - &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}"); + if (ref($hash{$resultkey})) { + if ($hash{$resultkey} =~ /ARRAY/ ) { + my $string="$resultkey ---- ("; + foreach my $elm (@{ $hash{$resultkey} }) { + $string.="$elm,"; + } + chop($string); + &Apache::lonxml::debug("$string)"); + } else { + &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}"); + } + } else { + &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}"); + } } &Apache::lonxml::debug("\n
restored values^
\n"); return ''; @@ -281,7 +296,7 @@ sub editxmlmode {
+ &HTML::Entities::encode($problem).' '; $request->print($result); return ''; @@ -437,11 +452,12 @@ sub handler { &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:"); # some times multiple problemmodes are submitted, need to select # the last one - if ( defined @{ $ENV{'form.problemmode'} } ) { - &Apache::lonxml::debug("Problem Modes ".join(':',@{ $ENV{'form.problemmode'} })); - my @modes=@{ $ENV{'form.problemmode'} }; + if ( defined($ENV{'form.problemmode'}) && + defined(@{ $ENV{'form.problemmode'} })) { + &Apache::lonxml::debug("3Problem Modes ".$ENV{'form.problemmode'}); + my $mode=$ENV{'form.problemmode'}->[-1]; undef $ENV{'form.problemmode'}; - $ENV{'form.problemmode'}=$modes[-1]; + $ENV{'form.problemmode'}=$mode; } &Apache::lonxml::debug("Problem Mode ".$ENV{'form.problemmode'}); my $file=&Apache::lonnet::filelocation("",$request->uri);