version 1.118, 2003/04/03 20:05:21
|
version 1.126, 2003/05/13 01:56:32
|
Line 50 use Apache::essayresponse();
|
Line 50 use Apache::essayresponse();
|
use Apache::externalresponse(); |
use Apache::externalresponse(); |
use Apache::rankresponse(); |
use Apache::rankresponse(); |
use Apache::matchresponse(); |
use Apache::matchresponse(); |
|
#use Apache::chemresponse(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use HTML::Entities(); |
use HTML::Entities(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
Line 60 BEGIN {
|
Line 61 BEGIN {
|
} |
} |
|
|
sub get_target { |
sub get_target { |
if ( $ENV{'request.state'} eq "published") { |
if (($ENV{'request.state'} eq "published") || |
|
($ENV{'request.state'} eq "uploaded")) { |
if ( defined($ENV{'form.grade_target'} ) |
if ( defined($ENV{'form.grade_target'} ) |
&& ($ENV{'form.grade_target'} eq 'tex')) { |
&& ($ENV{'form.grade_target'} eq 'tex')) { |
return ($ENV{'form.grade_target'}); |
return ($ENV{'form.grade_target'}); |
} elsif ( defined($ENV{'form.grade_target'} ) |
} elsif ( defined($ENV{'form.grade_target'} ) |
&& ($Apache::lonhomework::viewgrades == 'F' )) { |
&& ($Apache::lonhomework::viewgrades eq 'F' )) { |
return ($ENV{'form.grade_target'}); |
return ($ENV{'form.grade_target'}); |
} |
} |
|
|
Line 207 sub check_access {
|
Line 209 sub check_access {
|
$datemsg = "was due on $lastdate, and answers will be available on $date"; |
$datemsg = "was due on $lastdate, and answers will be available on $date"; |
} |
} |
if ($status eq 'CAN_ANSWER') { |
if ($status eq 'CAN_ANSWER') { |
#check #tries |
#check #tries, and if correct. |
my $tries = $Apache::lonhomework::history{"resource.$id.tries"}; |
my $tries = $Apache::lonhomework::history{"resource.$id.tries"}; |
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
if ( $tries eq '' ) { $tries = '0'; } |
if ( $tries eq '' ) { $tries = '0'; } |
if ( $maxtries eq '' ) { $maxtries = '2'; } |
if ( $maxtries eq '' ) { $maxtries = '2'; } |
if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } |
if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } |
|
if($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/ |
|
&& lc($Apache::lonhomework::problemstatus) ne 'no') { |
|
$status = 'CANNOT_ANSWER'; |
|
} |
} |
} |
|
|
if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && |
if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && |
Line 285 sub setuppermissions {
|
Line 291 sub setuppermissions {
|
} |
} |
|
|
sub setupheader { |
sub setupheader { |
my $request=$_[0]; |
my $request=$_[0]; |
if ($ENV{'browser.mathml'}) { |
if ($ENV{'browser.mathml'}) { |
$request->content_type('text/xml'); |
$request->content_type('text/xml'); |
} else { |
} else { |
$request->content_type('text/html'); |
$request->content_type('text/html'); |
} |
} |
if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) { |
$request->content_encoding('UTF-8'); |
&Apache::loncommon::no_cache($request); |
if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) { |
} |
&Apache::loncommon::no_cache($request); |
$request->send_http_header; |
} |
return OK if $request->header_only; |
$request->send_http_header; |
return '' |
return OK if $request->header_only; |
|
return '' |
} |
} |
|
|
sub handle_save_or_undo { |
sub handle_save_or_undo { |
Line 600 sub handler {
|
Line 607 sub handler {
|
#my $t0 = [&gettimeofday()]; |
#my $t0 = [&gettimeofday()]; |
my $request=$_[0]; |
my $request=$_[0]; |
|
|
# if ( $ENV{'user.name'} eq 'albertel' ) {$Apache::lonxml::debug=1;} |
|
$Apache::lonxml::debug=$ENV{'user.debug'}; |
$Apache::lonxml::debug=$ENV{'user.debug'}; |
|
|
if (&setupheader($request)) { return OK; } |
if (&setupheader($request)) { return OK; } |