--- loncom/homework/lonhomework.pm 2002/03/29 18:32:46 1.74
+++ loncom/homework/lonhomework.pm 2002/05/24 18:55:23 1.79
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.74 2002/03/29 18:32:46 albertel Exp $
+# $Id: lonhomework.pm,v 1.79 2002/05/24 18:55:23 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -192,21 +192,29 @@ sub check_access {
sub showhash {
my (%hash) = @_;
+ &showhashsubset(\%hash,'');
+ return '';
+}
+
+sub showhashsubset {
+ my ($hash,$keyre) = @_;
my $resultkey;
- foreach $resultkey (sort keys %hash) {
- if (ref($hash{$resultkey})) {
- if ($hash{$resultkey} =~ /ARRAY/ ) {
- my $string="$resultkey ---- (";
- foreach my $elm (@{ $hash{$resultkey} }) {
- $string.="$elm,";
+ foreach $resultkey (sort keys %$hash) {
+ 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)");
+ } else {
+ &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");
}
- chop($string);
- &Apache::lonxml::debug("$string)");
} else {
- &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}");
+ &Apache::lonxml::debug("$resultkey ---- $$hash{$resultkey}");
}
- } else {
- &Apache::lonxml::debug("$resultkey ---- $hash{$resultkey}");
}
}
&Apache::lonxml::debug("\n
restored values^\n");
@@ -334,7 +342,8 @@ sub renderpage {
&Apache::edit::initialize_edit;
if ($target eq 'analyze') { %Apache::lonhomework::anaylze=(); }
if ($target eq 'web') {
- if (&Apache::lonnet::symbread() eq '') {
+ my ($symb)=&Apache::lonxml::whichuser();
+ if ($symb eq '') {
if ($ENV{'request.state'} eq "construct") {
} else {
$request->print("Browsing or ambiguous reference, submissions ignored
");
@@ -343,6 +352,7 @@ sub renderpage {
#if ($Apache::lonhomework::viewgrades eq 'F') {&createmenu('grade',$request); }
}
#if ($target eq 'grade') { &showhash(%Apache::lonhomework::history); }
+ #if ($target eq 'web') { &showhash(%ENV); }
my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm');
if ($default == -1) {
@@ -350,7 +360,7 @@ sub renderpage {
$default='';
}
&Apache::lonxml::debug("Should be parsing now");
- $result = &Apache::lonxml::xmlparse($target, $problem,
+ $result = &Apache::lonxml::xmlparse($request, $target, $problem,
$default.&setup_vars($target),%mystyle);
#$request->print("Result follows:");
@@ -359,6 +369,7 @@ sub renderpage {
} else {
if ($target eq 'analyze') {
$result=&Apache::lonnet::hashref2str(\%Apache::lonhomework::analyze);
+ undef(%Apache::lonhomework::analyze);
}
#my $td=&tv_interval($t0);
#if ( $Apache::lonxml::debug) {
@@ -470,7 +481,7 @@ sub handler {
# some times multiple problemmodes are submitted, need to select
# the last one
if ( defined($ENV{'form.problemmode'}) &&
- defined(@{ $ENV{'form.problemmode'} })) {
+ ref($ENV{'form.problemmode'}) ) {
my $mode=$ENV{'form.problemmode'}->[-1];
undef $ENV{'form.problemmode'};
$ENV{'form.problemmode'}=$mode;