--- loncom/homework/lonhomework.pm 2000/11/07 17:21:18 1.15
+++ loncom/homework/lonhomework.pm 2000/11/21 18:39:35 1.16
@@ -10,6 +10,7 @@ use Apache::inputtags;
use Apache::structuretags;
use Apache::response;
+
sub handler {
my $request=shift;
@@ -28,6 +29,17 @@ sub handler {
my %mystyle;
my $result = '';
&Apache::inputtags::initialize_inputtags;
+ %Apache::lonhomework::results=();
+ %Apache::lonhomework::history=&Apache::lonnet::restore;
+ #ignore error conditions
+ my ($temp)=keys %Apache::lonhomework::history ;
+ if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }
+
+ my $resultkey;
+ foreach $resultkey (sort keys %Apache::lonhomework::history) {
+ &Apache::lonxml::debug("$resultkey ---- $Apache::lonhomework::history{$resultkey}");
+ }
+ &Apache::lonxml::debug("\n
restored values^\n");
my $problem=&Apache::lonnet::getfile($file);
if ($problem == -1) {
@@ -45,7 +57,17 @@ sub handler {
#$request->print("Result follows:");
$request->print($result);
#$request->print(":Result ends");
+
+ foreach $resultkey (sort keys %Apache::lonhomework::results) {
+ &Apache::lonxml::debug("$resultkey ---- $Apache::lonhomework::results{$resultkey}");
+ }
+ &Apache::lonxml::debug("\n
storing values^\n");
+
&Apache::lonhomework::send_footer($request);
+ ($temp) = keys %Apache::lonhomework::results;
+ if ( $temp ne '' ) {
+ &Apache::lonxml::debug("Store return message:".&Apache::lonnet::cstore(%Apache::lonhomework::results));
+ }
return 'OK';
}
@@ -53,7 +75,7 @@ sub get_target {
if ( $ENV{'request.state'} eq "published") {
return 'web';
} elsif ($ENV{'request.state'} eq "construct") {
- if ( defined $ENV{'form.'.$ENV{'form.request.prefix'}.'preview'}) {
+ if ( defined $ENV{'form.preview'}) {
return 'web';
} else {
return 'edit';
@@ -70,12 +92,13 @@ sub setup_vars {
sub send_header {
my ($request)= @_;
$request->print(&Apache::lontexconvert::header());
- $request->print('