--- loncom/homework/structuretags.pm 2005/11/21 21:51:29 1.324 +++ loncom/homework/structuretags.pm 2005/12/22 22:06:54 1.328 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.324 2005/11/21 21:51:29 albertel Exp $ +# $Id: structuretags.pm,v 1.328 2005/12/22 22:06:54 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,8 +42,8 @@ BEGIN { } sub start_web { - my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - my $bodytext=&Apache::lonxml::get_all_text("/web",$parser); + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + my $bodytext=&Apache::lonxml::get_all_text("/web",$parser,$style); if ($target eq 'web') { return $bodytext; } @@ -55,9 +55,9 @@ sub end_web { } sub start_tex { - my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result=''; - my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser); + my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser,$style); if ($target eq 'tex') { return $bodytext.' '; } @@ -113,6 +113,9 @@ sub page_start { &Apache::lonhtmlcommon::htmlareaheaders(). &Apache::lonhtmlcommon::spellheader(). &Apache::lonxml::fontsettings(); + if ($target eq 'edit') { + $head_tag_start.=&Apache::edit::js_change_detection(); + } } my $body_tag_start; if (!defined($found{'body'}) && $env{'request.state'} eq 'construct') { @@ -150,7 +153,11 @@ sub page_start { $form_tag_start='
'; + $form_tag_start.=$uri.'" '; + if ($target eq 'edit') { + $form_tag_start.=&Apache::edit::form_change_detection(); + } + $form_tag_start.='>'; } return ($result,$head_tag_start,$body_tag_start,$form_tag_start); } @@ -225,7 +232,7 @@ sub problem_edit_header { &Apache::structuretags::remember_problem_state().' - +
'. @@ -514,7 +521,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) { @@ -527,7 +534,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 ''; } @@ -630,7 +637,8 @@ sub start_problem { ( $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; @@ -645,6 +653,8 @@ 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') { @@ -656,7 +666,8 @@ sub start_problem { } } } elsif ($status eq 'NEEDS_CHECKIN') { - 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.''; $result .= $body_tag_start; @@ -931,12 +942,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= '
'; @@ -1082,7 +1093,7 @@ 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' || @@ -1094,7 +1105,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-"); @@ -1150,11 +1161,11 @@ 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') { - my $body= &Apache::lonxml::get_all_text("/randomlist",$parser); + my $body= &Apache::lonxml::get_all_text("/randomlist",$parser,$style); my $b_parser= HTML::LCParser->new(\$body); $b_parser->xml_mode(1); $b_parser->marked_sections(1); @@ -1243,7 +1254,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. @@ -1272,7 +1283,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); @@ -1288,7 +1299,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' ) { @@ -1390,14 +1402,14 @@ sub end_part { } sub start_preduedate { - 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') { &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 ''; @@ -1408,14 +1420,14 @@ sub end_preduedate { } sub start_postanswerdate { - my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; if ($target eq 'web' || $target eq 'grade') { 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 ''; } @@ -1425,7 +1437,7 @@ 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') { my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; @@ -1433,7 +1445,7 @@ sub start_notsolved { 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 ''; @@ -1444,13 +1456,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 ''; @@ -1461,7 +1473,7 @@ 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') { @@ -1473,10 +1485,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); @@ -1510,12 +1522,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)."
END '.$name.'
".&mt('Text Block')." ".&mt('Delete:'). &Apache::edit::deletelist($target,$token) @@ -1554,8 +1566,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");