# The LearningOnline Network with CAPA # definition of tags that give a structure to a document # 2/19 Guy package Apache::structuretags; use strict; use Apache::lonnet; sub BEGIN { &Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext')); # &Apache::lonxml::register_insert('problem','',('part','postanswerdate','preduedate')) } sub start_web { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $bodytext=&Apache::lonxml::get_all_text("/web",$$parser[$#$parser]); if ($target eq 'web') { return $bodytext; } return ''; } sub end_web { } sub start_tex { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $bodytext=&Apache::lonxml::get_all_text("/tex",$$parser[$#$parser]); if ($target eq 'tex') { return $bodytext } return ''; } sub end_tex { } sub start_problem { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; #intialize globals $Apache::inputtags::part='0'; @Apache::inputtags::responselist = (); #adeed vars to the scripting enviroment my $expression='$external::part='.$Apache::inputtags::part.';'; &Apache::run::run($expression,$safeeval); my $status; my $datemsg; #should get back a or the neccesary stuff to start XML/MathML my $result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack,$parser,$safeeval); my $head_tag_start='
'.&Apache::lonxml::registerurl(); my $body_tag_start=''; if ($target eq 'web' || $target eq 'grade') { ($status,$datemsg) = &Apache::lonhomework::check_date('0'); push (@Apache::inputtags::status,$status); my $expression='$external::datestatus="'.$status.'";'; $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";'; &Apache::run::run($expression,$safeeval); if ( $status eq 'CLOSED' ) { my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]); if ( $target eq "web" ) { $result.= $head_tag_start.''; return $result . $body_tag_start . "