--- loncom/homework/lonhomework.pm 2002/01/30 17:39:13 1.70
+++ loncom/homework/lonhomework.pm 2002/03/29 18:32:46 1.74
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.70 2002/01/30 17:39:13 albertel Exp $
+# $Id: lonhomework.pm,v 1.74 2002/03/29 18:32:46 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 {
@@ -60,6 +61,9 @@ sub get_target {
return ('web');
}
} elsif ($ENV{'request.state'} eq "construct") {
+ if ( defined($ENV{'form.grade_target'}) ) {
+ return ($ENV{'form.grade_target'});
+ }
if ( defined($ENV{'form.preview'})) {
if ( defined($ENV{'form.submitted'})) {
return ('grade', 'web');
@@ -128,6 +132,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 +194,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 '';
@@ -255,6 +273,16 @@ sub handle_save_or_undo {
return $error;
}
+sub analyze {
+ my ($request,$file) = @_;
+ &Apache::lonxml::debug("Analyze");
+ my $result=&Apache::lonnet::ssi($request->uri,('grade_target' => 'analyze'));
+ &Apache::lonxml::debug(":$result:");
+ (my $garbage,$result)=split(/_HASH_REF__/,$result,2);
+ &showhash(&Apache::lonnet::str2hash($result));
+ return $result;
+}
+
sub editxmlmode {
my ($request,$file) = @_;
my $result;
@@ -281,7 +309,7 @@ sub editxmlmode {