--- loncom/homework/structuretags.pm 2006/04/20 02:05:30 1.349 +++ loncom/homework/structuretags.pm 2006/05/23 19:05:42 1.355 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.349 2006/04/20 02:05:30 albertel Exp $ +# $Id: structuretags.pm,v 1.355 2006/05/23 19:05:42 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -79,7 +79,6 @@ sub page_start { } } - if ($target eq 'tex') { return &Apache::londefdef::start_html($target,$token,$tagstack, @@ -161,8 +160,15 @@ 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); } @@ -333,9 +339,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') { @@ -355,6 +368,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=(); } @@ -442,13 +456,14 @@ sub checkout_msg { 'warning'=>'Checking out resources is subject to course policies, and may exclude future credit even if done erroneously.', 'checkout'=>'Check out Exam for Viewing', 'checkout?'=>'Check out Exam?'); + my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'}); return (<$lt{'resource'}

$lt{'id_expln'}

$lt{'warning'}

-
+
@@ -460,9 +475,10 @@ sub firstaccess_msg { my ($map)=&Apache::lonnet::decode_symb($symb); my $foldertitle=&Apache::lonnet::gettitle($map); &Apache::lonxml::debug("map is $map title is $foldertitle"); + my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'}); return (<The resources in "$foldertitle" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources "$foldertitle". -
+
@@ -597,9 +613,14 @@ sub start_problem { my $accessmsg; my $name= &get_resource_name($parstack,$safeeval); - my ($result,$form_tag_start)= - &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval, - $name); + my ($result,$form_tag_start); + 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); + } + if ($target eq 'tex' and $env{'request.symb'} =~ m/\.page_/) {$result='';} if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval); }