--- loncom/homework/structuretags.pm 2006/04/20 19:07:09 1.352 +++ loncom/homework/structuretags.pm 2006/05/30 12:45:37 1.356 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.352 2006/04/20 19:07:09 albertel Exp $ +# $Id: structuretags.pm,v 1.356 2006/05/30 12:45:37 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,6 +38,9 @@ use Apache::lonlocal; use Apache::lonxml; use Apache::lonenc(); use Time::HiRes qw( gettimeofday tv_interval ); +use lib '/home/httpd/lib/perl/'; +use LONCAPA; + BEGIN { &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag')); } @@ -160,6 +163,14 @@ sub page_start { $form_tag_start.=&Apache::edit::form_change_detection(); } $form_tag_start.='>'; + + my $symb=&Apache::lonnet::symbread(); + if ($symb =~ /\S/) { + $symb= + &HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb)); + $form_tag_start.= + ''; + } } return ($page_start,$form_tag_start); } @@ -331,9 +342,16 @@ Feedback Mode: } sub initialize_storage { - %Apache::lonhomework::results=(); - %Apache::lonhomework::history=(); + undef(%Apache::lonhomework::results); + undef(%Apache::lonhomework::history); my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); + + # anonymous users (CODEd exams) have no data + if ($name eq 'anonymous' + && !defined($domain)) { + return; + } + if ($env{'request.state'} eq 'construct' || $symb eq '' || $Apache::lonhomework::type eq 'practice') { @@ -353,6 +371,7 @@ sub initialize_storage { %Apache::lonhomework::history= &Apache::lonnet::restore($symb,$courseid,$domain,$name); } + #ignore error conditions my ($temp)=keys %Apache::lonhomework::history ; if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); } @@ -598,7 +617,8 @@ sub start_problem { my $name= &get_resource_name($parstack,$safeeval); my ($result,$form_tag_start); - if ($target eq 'web' || $target eq 'webgrade' || $target eq 'tex') { + if ($target eq 'web' || $target eq 'webgrade' || $target eq 'tex' + || $target eq 'edit') { ($result,$form_tag_start) = &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval, $name); @@ -1363,7 +1383,7 @@ sub start_part { } if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} } elsif ($target eq 'web') { - $result.=''; + $result.=''; } } } @@ -1616,7 +1636,7 @@ sub start_simpleeditbutton { $url=~s/\?.*$//; my ($symb) = &Apache::lonxml::whichuser(); $result='
'. - ''.&mt('Edit').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). + ''.&mt('Edit').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). &Apache::loncommon::help_open_topic('Caching').'

'; } return $result;