[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm lonhomework.pm structuretags.pm /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 05 Dec 2002 22:59:37 -0000
albertel Thu Dec 5 17:59:37 2002 EDT
Modified files:
/loncom/homework inputtags.pm lonhomework.pm structuretags.pm
/loncom/lonnet/perl lonnet.pm
Log:
- Fixes BUG#794
- Created new status UNAVAILABLE
- EXT now passes con_lost and no_such_host messages back when fetching parameters
- Updated start_problem, start_part, and gradestatus to understand new UNAVAILABLE status
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.76 loncom/homework/inputtags.pm:1.77
--- loncom/homework/inputtags.pm:1.76 Tue Dec 3 05:17:05 2002
+++ loncom/homework/inputtags.pm Thu Dec 5 17:59:37 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.76 2002/12/03 10:17:05 sakharuk Exp $
+# $Id: inputtags.pm,v 1.77 2002/12/05 22:59:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -427,7 +427,7 @@
my $status = $Apache::inputtags::status['-1'];
&Apache::lonxml::debug("gradestatus has :$status:");
- if ( $status ne 'CLOSED' ) {
+ if ( $status ne 'CLOSED' && $status ne 'UNAVAILABLE') {
my $award = $Apache::lonhomework::history{"resource.$id.award"};
my $solved = $Apache::lonhomework::history{"resource.$id.solved"};
my $previous = $Apache::lonhomework::history{"resource.$id.previous"};
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.102 loncom/homework/lonhomework.pm:1.103
--- loncom/homework/lonhomework.pm:1.102 Wed Nov 13 18:05:46 2002
+++ loncom/homework/lonhomework.pm Thu Dec 5 17:59:37 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.102 2002/11/13 23:05:46 albertel Exp $
+# $Id: lonhomework.pm,v 1.103 2002/12/05 22:59:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -144,7 +144,7 @@
sub check_access {
my ($id) = @_;
my $date ='';
- my $status = '';
+ my $status;
my $datemsg = '';
my $lastdate = '';
my $temp;
@@ -156,6 +156,12 @@
$lastdate = $date;
$date = &Apache::lonnet::EXT("resource.$id.$temp");
my $thistype = &Apache::lonnet::EXT("resource.$id.$temp.type");
+ if ($thistype =~ /^(con_lost|no_such_host)/ ||
+ $date =~ /^(con_lost|no_such_host)/) {
+ $status='UNAVAILABLE';
+ $date="may open later.";
+ return($status,$date);
+ }
if ($thistype eq 'date_interval') {
if ($temp eq 'opendate') {
$date=&Apache::lonnet::EXT("resource.$id.duedate")-$date;
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.141 loncom/homework/structuretags.pm:1.142
--- loncom/homework/structuretags.pm:1.141 Thu Dec 5 09:37:17 2002
+++ loncom/homework/structuretags.pm Thu Dec 5 17:59:37 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.141 2002/12/05 14:37:17 matthew Exp $
+# $Id: structuretags.pm,v 1.142 2002/12/05 22:59:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -305,12 +305,17 @@
&Apache::lonxml::debug("Got $status");
if (( $status eq 'CLOSED' ) ||
( $status eq 'UNCHECKEDOUT') ||
- ( $status eq 'BANNED')) {
+ ( $status eq 'BANNED') ||
+ ( $status eq 'UNAVAILABLE')) {
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
if ( $target eq "web" ) {
$result.= $head_tag_start.'</head>';
- my $msg=$body_tag_start.
- '<h1>Not open to be viewed</h1>';
+ my $msg=$body_tag_start;
+ if ($status eq 'UNAVAILABLE') {
+ $result.='<h1>Unable to determine if this resource is open due to network problems. Please try again later.</h1>';
+ } else {
+ $result.='<h1>Not open to be viewed</h1>';
+ }
if ($status eq 'CLOSED') {
$msg.='The problem '.$accessmsg;
} elsif ($status eq 'UNCHECKEDOUT') {
@@ -318,8 +323,13 @@
}
$result.=$msg.'<br />';
} elsif ($target eq 'tex') {
- $result.="\\begin{document}\\noindent \\vskip 1 mm \\begin{minipage}{\\textwidth}\\vskip 0 mm Problem is not open to be viewed. It $accessmsg \\vskip 0 mm ";
- }
+ $result.="\\begin{document}\\noindent \\vskip 1 mm \\begin{minipage}{\\textwidth}\\vskip 0 mm ";
+ if ($status eq 'UNAVAILABLE') {
+ $result.='Unable to determine if this resource is open due to network problems. Please try again later.\vskip 0 mm ';
+ } else {
+ $result.="Problem is not open to be viewed. It $accessmsg \\vskip 0 mm ";
+ }
+ }
} elsif ($target eq 'web') {
my $name= &get_resource_name($parstack,$safeeval);
if ($status eq 'CAN_ANSWER') {
@@ -338,7 +348,7 @@
}
}
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER'
- || $status eq 'CLOSED') {
+ || $status eq 'CLOSED' || $status eq 'UNAVALAILABLE') {
$result.=$head_tag_start.
"<title>$name</title></head>\n$body_tag_start\n";
}
@@ -448,7 +458,7 @@
} elsif ($target eq 'edit') {
&Apache::lonxml::debug("in end_problem with $target, edit");
$result = &problem_edit_footer();
- }
+ }
return $result;
}
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.305 loncom/lonnet/perl/lonnet.pm:1.306
--- loncom/lonnet/perl/lonnet.pm:1.305 Thu Dec 5 14:53:19 2002
+++ loncom/lonnet/perl/lonnet.pm Thu Dec 5 17:59:37 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.305 2002/12/05 19:53:19 www Exp $
+# $Id: lonnet.pm,v 1.306 2002/12/05 22:59:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2720,6 +2720,8 @@
if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
$courseresdatacache{$hashid.'.time'}=time;
$courseresdatacache{$hashid}=\%dumpreply;
+ } elsif ($tmp =~ /^(con_lost|no_such_host)/) {
+ return $tmp;
}
}
foreach my $item (@which) {
@@ -2849,8 +2851,9 @@
my %resourcedata=&get('resourcedata',
[$courselevelr,$courselevelm,$courselevel],
$udom,$uname);
- if (($resourcedata{$courselevelr}!~/^error\:/) &&
- ($resourcedata{$courselevelr}!~/^con_lost/)) {
+ my ($tmp)=keys(%resourcedata);
+ &Apache::lonnet::logthis("Returned $tmp: ".join(':',keys(%resourcedata)));
+ if (($tmp!~/^error\:/) && ($tmp!~/^con_lost/)) {
if ($resourcedata{$courselevelr}) {
return $resourcedata{$courselevelr}; }
@@ -2859,11 +2862,13 @@
if ($resourcedata{$courselevel}) {
return $resourcedata{$courselevel}; }
} else {
- if ($resourcedata{$courselevelr}!~/No such file/) {
+ if ($tmp!~/No such file/) {
&logthis("<font color=blue>WARNING:".
" Trying to get resource data for ".
$uname." at ".$udom.": ".
- $resourcedata{$courselevelr}."</font>");
+ $tmp."</font>");
+ } elsif ($tmp =~ /^(con_lost|no_such_host)/) {
+ return $tmp;
}
}