--- loncom/homework/lonhomework.pm 2005/01/11 19:38:53 1.192
+++ loncom/homework/lonhomework.pm 2005/01/28 21:08:45 1.195
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.192 2005/01/11 19:38:53 albertel Exp $
+# $Id: lonhomework.pm,v 1.195 2005/01/28 21:08:45 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -377,10 +377,11 @@ sub showarray {
my ($array)=@_;
my $string="(";
foreach my $elm (@{ $array }) {
- if (ref($elm)) {
- if ($elm =~ /ARRAY/ ) {
- $string.=&showarray($elm);
- }
+ if (ref($elm) eq 'ARRAY') {
+ $string.=&showarray($elm);
+ } elsif (ref($elm) eq 'HASH') {
+ $string.= "HASH --- \n
";
+ $string.= &showhashsubset($elm,'.');
} else {
$string.="$elm,"
}
@@ -394,20 +395,15 @@ sub showhashsubset {
my ($hash,$keyre) = @_;
my $resultkey;
foreach $resultkey (sort keys %$hash) {
- if ($resultkey =~ /$keyre/) {
- if (ref($$hash{$resultkey})) {
- if ($$hash{$resultkey} =~ /ARRAY/ ) {
- &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}");
- }
- } else {
- &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");
- }
+ if ($resultkey !~ /$keyre/) { next; }
+ if (ref($$hash{$resultkey}) eq 'ARRAY' ) {
+ &Apache::lonxml::debug("$resultkey ---- ".
+ &showarray($$hash{$resultkey}));
+ } elsif (ref($$hash{$resultkey}) eq 'HASH' ) {
+ &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");
+ &showhashsubset($$hash{$resultkey},'.');
+ } else {
+ &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");
}
}
&Apache::lonxml::debug("\n
restored values^\n");
@@ -443,6 +439,8 @@ sub setupheader {
if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) {
&Apache::loncommon::no_cache($request);
}
+ $request->set_last_modified(&Apache::lonnet::metadata($request->uri,
+ 'lastrevisiondate'));
$request->send_http_header;
return OK if $request->header_only;
return ''
@@ -818,18 +816,14 @@ sub handler {
$Apache::lonxml::debug=$ENV{'user.debug'};
$ENV{'request.uri'}=$request->uri;
&setuppermissions();
- &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:");
# some times multiple problemmodes are submitted, need to select
# the last one
- &Apache::lonxml::debug("Problem Mode ".$ENV{'form.problemmode'});
- if ( defined($ENV{'form.problemmode'}) &&
- ref($ENV{'form.problemmode'}) ) {
- &Apache::lonxml::debug("Problem Mode ".join(",",@$ENV{'form.problemmode'}));
+ if ( defined($ENV{'form.problemmode'}) && ref($ENV{'form.problemmode'}) ) {
my $mode=$ENV{'form.problemmode'}->[-1];
undef $ENV{'form.problemmode'};
$ENV{'form.problemmode'}=$mode;
}
- &Apache::lonxml::debug("Problem Mode ".$ENV{'form.problemmode'});
+
my $file=&Apache::lonnet::filelocation("",$request->uri);
#check if we know where we are
@@ -846,7 +840,8 @@ sub handler {
}
}
if (&setupheader($request)) { return OK; }
-
+ &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:");
+ &Apache::lonxml::debug("Problem Mode ".$ENV{'form.problemmode'});
my ($symb) = &Apache::lonxml::whichuser();
&Apache::lonxml::debug('symb is '.$symb);
if ($ENV{'request.state'} eq "construct" || $symb eq '') {