'.
@@ -346,6 +359,8 @@ sub initialize_storage {
sub finalize_storage {
my $result;
if (%Apache::lonhomework::results) {
+ my @remove = grep(/^INTERNAL_/,keys(%Apache::lonhomework::results));
+ delete(@Apache::lonhomework::results{@remove});
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
if ($env{'request.state'} eq 'construct' || $symb eq '') {
$Apache::lonhomework::results{'rndseed'}=$env{'form.rndseed'};
@@ -360,6 +375,8 @@ sub finalize_storage {
&store_aggregates($symb,$courseid);
}
}
+ } else {
+ &Apache::lonxml::debug('Nothing to store');
}
return $result;
}
@@ -510,7 +527,7 @@ sub get_problem_status {
}
sub start_problem {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
# We'll use the redirection to fix up printing of duedates.
if (!$Apache::lonxml::metamode) {
@@ -523,7 +540,7 @@ sub start_problem {
if ( $Apache::inputtags::part ne '' ||
$Apache::lonhomework::parsing_a_problem) {
&Apache::lonxml::error('Only one <problem> allowed in a .problem file');
- #my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
+ #my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,$style);
return '';
}
@@ -545,7 +562,7 @@ sub start_problem {
defined($env{'form.problemtype'})) {
$Apache::lonhomework::type=$env{'form.problemtype'};
}
- &Apache::lonxml::debug("Found this to be of type :$Apache::ltonhomework::type:");
+ &Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:");
}
if ($Apache::lonhomework::type eq '' ) {
my $uri=$env{'request.uri'};
@@ -609,19 +626,25 @@ sub start_problem {
}
$form_tag_start.=' ';
}
- ($status,$accessmsg) = &Apache::lonhomework::check_access('0');
+
+ ($status,$accessmsg,my $slot_name,my $slot) =
+ &Apache::lonhomework::check_slot_access('0','problem');
push (@Apache::inputtags::status,$status);
+
my $expression='$external::datestatus="'.$status.'";';
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
&Apache::run::run($expression,$safeeval);
&Apache::lonxml::debug("Got $status");
+
if (( $status eq 'CLOSED' ) ||
( $status eq 'UNCHECKEDOUT') ||
( $status eq 'NOT_YET_VIEWED') ||
( $status eq 'BANNED') ||
( $status eq 'UNAVAILABLE') ||
+ ( $status eq 'NOT_IN_A_SLOT') ||
( $status eq 'INVALID_ACCESS')) {
- my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
+ my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
+ $style);
if ( $target eq "web" ) {
$result.= $head_tag_start.'';
my $msg=$body_tag_start;
@@ -636,16 +659,32 @@ sub start_problem {
$msg.=&checkout_msg;
} elsif ($status eq 'NOT_YET_VIEWED') {
$msg.=&firstaccess_msg($accessmsg,$symb);
+ } elsif ($status eq 'NOT_IN_A_SLOT') {
+ $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work.");
}
$result.=$msg.' ';
} elsif ($target eq 'tex') {
- $result.='\begin{document}\noindent \vskip 1 mm \begin{minipage}{\textwidth}\vskip 0 mm';
+ my $startminipage = ($env{'form.problem_split'}=~/yes/i)? ''
+ : '\begin{minipage}{\textwidth}';
+ $result.='\begin{document}\noindent \vskip 1 mm '.
+ $startminipage.'\vskip 0 mm';
if ($status eq 'UNAVAILABLE') {
$result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
} else {
$result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
}
}
+ } elsif ($status eq 'NEEDS_CHECKIN') {
+ my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
+ $style);
+ if ($target eq 'web') {
+ $result .= $head_tag_start.'';
+ $result .= $body_tag_start;
+ $result .= &Apache::bridgetask::proctor_validation_screen();
+ } elsif ($target eq 'grade') {
+ &Apache::bridgetask::proctor_check_auth($slot_name,$slot,
+ 'problem');
+ }
} elsif ($target eq 'web') {
my $name= &get_resource_name($parstack,$safeeval);
$result.="$head_tag_start$name
@@ -689,6 +728,7 @@ sub end_problem {
if (!$Apache::lonxml::metamode) {
$result = &Apache::lonxml::endredirection(); #started in &start_problem
+ $Apache::lonxml::post_evaluate=0;
}
if ($target eq 'tex') {
@@ -788,6 +828,8 @@ sub end_problem {
# if part is zero, no s existed, so we need to the grading
if ($status eq 'CAN_ANSWER' ||$Apache::lonhomework::scantronmode) {
&Apache::inputtags::grade;
+ } elsif ($status eq 'NEEDS_CHECKIN') {
+ # no need to grade, and don't want to hide data
} else {
# move any submission data to .hidden
&Apache::inputtags::hidealldata($Apache::inputtags::part);
@@ -910,12 +952,12 @@ sub end_library {
}
sub start_definetag {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
my $name = $token->[2]->{'name'};
- my $skip=&Apache::lonxml::get_all_text("/definetag",$parser);
+ my $skip=&Apache::lonxml::get_all_text("/definetag",$parser,$style);
if ($name=~/^\//) {
$result=
'
END '.$name.' | ';
@@ -938,8 +980,8 @@ sub start_block {
my $result;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
- $target eq 'tex' || $target eq 'analyze') {
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $code = $token->[2]->{'condition'};
if (defined($code)) {
if (!$Apache::lonxml::default_homework_loaded) {
@@ -982,8 +1024,8 @@ sub start_languageblock {
my $result;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
- $target eq 'tex' || $target eq 'analyze') {
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $include = $token->[2]->{'include'};
my $exclude = $token->[2]->{'exclude'};
my %languages=&Apache::loncommon::display_languages();
@@ -1035,8 +1077,8 @@ sub start_instructorcomment {
my $result;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
- $target eq 'tex' || $target eq 'analyze') {
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
$result=($env{'request.role'}=~/^(in|cc|au|ca|li)/);
if ( (! $result) or ($env{'form.instructor_comments'} eq 'hide')) {
my $skip=&Apache::lonxml::get_all_text("/instructorcomment",
@@ -1061,11 +1103,11 @@ sub end_instructorcomment {
}
sub start_while {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
- $target eq 'tex' || $target eq 'analyze') {
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $code = $token->[2]->{'condition'};
push( @Apache::structuretags::whileconds, $code);
@@ -1073,7 +1115,7 @@ sub start_while {
&Apache::lonxml::default_homework_load($safeeval);
}
my $result = &Apache::run::run($code,$safeeval);
- my $bodytext=&Apache::lonxml::get_all_text("/while",$parser);
+ my $bodytext=&Apache::lonxml::get_all_text("/while",$parser,$style);
push( @Apache::structuretags::whilebody, $bodytext);
push( @Apache::structuretags::whileline, $token->[5]);
&Apache::lonxml::debug("s code $code got -$result-");
@@ -1097,8 +1139,8 @@ sub end_while {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my $result;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
- $target eq 'tex' || $target eq 'analyze') {
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $code = pop(@Apache::structuretags::whileconds);
my $bodytext = pop(@Apache::structuretags::whilebody);
my $line = pop(@Apache::structuretags::whileline);
@@ -1129,10 +1171,10 @@ sub end_while {
# ...
#
sub start_randomlist {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
- if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' ||
- $target eq 'tex' || $target eq 'analyze') {
+ if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' ||
+ $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $body= &Apache::lonxml::get_all_text("/randomlist",$parser);
my $b_parser= HTML::LCParser->new(\$body);
$b_parser->xml_mode(1);
@@ -1222,7 +1264,7 @@ sub ordered_show_check {
}
sub start_part {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
if (!$Apache::lonxml::metamode) {
&Apache::lonxml::startredirection(); # we'll use redirection to fix up
# duedates.
@@ -1251,7 +1293,7 @@ sub start_part {
} elsif ($target eq 'web' || $target eq 'grade' ||
$target eq 'answer' || $target eq 'tex') {
if ($hidden || !$in_order_show) {
- my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
+ my $bodytext=&Apache::lonxml::get_all_text("/part",$parser,$style);
} else {
my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);
push (@Apache::inputtags::status,$status);
@@ -1267,7 +1309,8 @@ sub start_part {
( $status eq 'BANNED') ||
( $status eq 'UNAVAILABLE') ||
( $status eq 'INVALID_ACCESS')) {
- my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
+ my $bodytext=&Apache::lonxml::get_all_text("/part",$parser,
+ $style);
if ( $target eq "web" ) {
$result=" ".&mt('Part is not open to be viewed. It')." $accessmsg ";
} elsif ( $target eq 'tex' ) {
@@ -1338,6 +1381,7 @@ sub end_part {
my $result;
if (!$Apache::lonxml::metamode) {
$result = &Apache::lonxml::endredirection(); # started in &start_part
+ $Apache::lonxml::post_evaluate=0;
}
if ($target eq 'grade') {
if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
@@ -1369,14 +1413,15 @@ sub end_part {
}
sub start_preduedate {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'tex' || $target eq 'webgrade') {
&Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']);
if (!$Apache::lonhomework::scantronmode &&
$Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
&Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER'));
- &Apache::lonxml::get_all_text("/preduedate",$parser);
+ &Apache::lonxml::get_all_text("/preduedate",$parser,$style);
}
}
return '';
@@ -1387,14 +1432,14 @@ sub end_preduedate {
}
sub start_postanswerdate {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- if ($target eq 'web' || $target eq 'grade') {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'webgrade') {
if ($Apache::lonhomework::scantronmode ||
$Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
- &Apache::lonxml::get_all_text("/postanswerdate",$parser);
+ &Apache::lonxml::get_all_text("/postanswerdate",$parser,$style);
}
} elsif ($target eq 'tex') {
- &Apache::lonxml::get_all_text("/postanswerdate",$parser);
+ &Apache::lonxml::get_all_text("/postanswerdate",$parser,$style);
}
return '';
}
@@ -1404,15 +1449,15 @@ sub end_postanswerdate {
}
sub start_notsolved {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
- $target eq 'tex') {
+ $target eq 'tex' || $target eq 'webgrade') {
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
&Apache::lonxml::debug("not solved has :$gradestatus:");
if ($gradestatus =~ /^correct/ &&
&Apache::response::show_answer()) {
&Apache::lonxml::debug("skipping");
- &Apache::lonxml::get_all_text("/notsolved",$parser);
+ &Apache::lonxml::get_all_text("/notsolved",$parser,$style);
}
}
return '';
@@ -1423,13 +1468,13 @@ sub end_notsolved {
}
sub start_solved {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
$target eq 'tex') {
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
if ($gradestatus !~ /^correct/ ||
!&Apache::response::show_answer()) {
- &Apache::lonxml::get_all_text("/solved",$parser);
+ &Apache::lonxml::get_all_text("/solved",$parser,$style);
}
}
return '';
@@ -1440,10 +1485,10 @@ sub end_solved {
}
sub start_problemtype {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
- $target eq 'tex' || $target eq 'analyze') {
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $mode=lc(&Apache::lonxml::get_param('mode',$parstack,$safeeval));
if (!defined($mode)) { $mode='show'; }
my $for=&Apache::lonxml::get_param('for',$parstack,$safeeval);
@@ -1452,10 +1497,10 @@ sub start_problemtype {
if ($Apache::lonhomework::type eq lc($type)) { $found=1; }
}
if ($mode eq 'show' && !$found) {
- &Apache::lonxml::get_all_text("/problemtype",$parser);
+ &Apache::lonxml::get_all_text("/problemtype",$parser,$style);
}
if ($mode eq 'hide' && $found) {
- &Apache::lonxml::get_all_text("/problemtype",$parser);
+ &Apache::lonxml::get_all_text("/problemtype",$parser,$style);
}
} elsif ($target eq 'edit') {
$result .=&Apache::edit::tag_start($target,$token);
@@ -1489,12 +1534,12 @@ sub start_startouttext {
}
sub end_startouttext {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
my $text='';
if ($target eq 'edit') {
- $text=&Apache::lonxml::get_all_text("endouttext",$parser);
+ $text=&Apache::lonxml::get_all_text("endouttext",$parser,$style);
$result.=&Apache::edit::start_table($token)."".&mt('Text Block')." |
".&mt('Delete:').
&Apache::edit::deletelist($target,$token)
@@ -1533,8 +1578,8 @@ sub end_endouttext {
}
sub delete_startouttext {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- # my $text=&Apache::lonxml::get_all_text("endouttext",$parser);
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ # my $text=&Apache::lonxml::get_all_text("endouttext",$parser,$style);
my $text=$$parser['-1']->get_text("/endouttext");
my $ntoken=$$parser['-1']->get_token();
&Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext");
@@ -1551,7 +1596,7 @@ sub start_simpleeditbutton {
my $result='';
if (($env{'form.simple_edit_button'} ne 'off') &&
($target eq 'web') &&
- (&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) {
+ (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
my $url=$env{'request.noversionuri'};
$url=~s/\?.*$//;
my ($symb) = &Apache::lonxml::whichuser();
|
|