--- loncom/homework/structuretags.pm 2003/11/05 21:43:11 1.224 +++ loncom/homework/structuretags.pm 2004/01/30 16:22:52 1.227.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.224 2003/11/05 21:43:11 www Exp $ +# $Id: structuretags.pm,v 1.227.2.1 2004/01/30 16:22:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -429,26 +429,19 @@ sub start_problem { } } elsif ($target eq 'web') { my $name= &get_resource_name($parstack,$safeeval); - if ($status eq 'CAN_ANSWER') { - # create a page header and exit - $result.="$head_tag_start$name + $result.="$head_tag_start$name $body_tag_start \n $form_tag_start". - ''; - if ($ENV{'request.state'} eq "construct") { - $result.= &problem_web_to_edit_header($ENV{'form.rndseed'}); - } - # if we are viewing someone else preserve that info - if (defined $ENV{'form.grade_symb'}) { - foreach my $field ('symb','courseid','domain','username') { - $result .= ''."\n"; - } + ''; + # create a page header and exit + if ($ENV{'request.state'} eq "construct") { + $result.= &problem_web_to_edit_header($ENV{'form.rndseed'}); + } + # if we are viewing someone else preserve that info + if (defined $ENV{'form.grade_symb'}) { + foreach my $field ('symb','courseid','domain','username') { + $result .= ''."\n"; } - } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' - || $status eq 'CLOSED' || $status eq 'UNAVALAILABLE' || - $status eq 'INVALID_ACCESS') { - $result.=$head_tag_start. - "$name\n$body_tag_start\n"; } } elsif ($target eq 'tex') { my $startminipage = ''; @@ -461,7 +454,7 @@ sub start_problem { my @packages = split /,/,$packages; my $allow_print_points = 0; foreach my $partial_key (@packages) { - if ($partial_key=~m/part_0/) { + if ($partial_key=~m/^part_0$/) { $allow_print_points=1; } } @@ -503,6 +496,8 @@ sub start_problem { } elsif ($target eq 'edit') { $result.=$head_tag_start."".$body_tag_start.$form_tag_start. &problem_edit_header(); + $Apache::lonxml::warnings_error_header= + &mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")."
"; my $temp=&Apache::edit::insertlist($target,$token); $result.=$temp; } elsif ($target eq 'modified') { @@ -537,17 +532,9 @@ sub end_problem { (($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || ($target eq 'answer') || ($target eq 'tex') ) { - if ($status eq 'CAN_ANSWER') { - if ($target ne 'tex' && - $ENV{'form.answer_output_mode'} ne 'tex') { - $result.="\n"; - } - } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || - $status eq 'UNCHECKEDOUT' || $status eq 'INVALID_ACCESS') { - if ($target ne 'tex' && - $ENV{'form.answer_output_mode'} ne 'tex') { - $result.="\n"; - } + if ($target ne 'tex' && + $ENV{'form.answer_output_mode'} ne 'tex') { + $result.="\n"; } if ($target eq 'web') { $result.=&Apache::lonxml::xmlend(); @@ -982,11 +969,11 @@ sub start_part { $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; } my $weight = &Apache::lonnet::EXT("resource.$id.weight"); - my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys'); + my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'packages'); my @allkeys = split /,/,$allkeys; my $allow_print_points = 0; foreach my $partial_key (@allkeys) { - if ($partial_key=~m/\_(\d*)\_weight/) { + if ($partial_key=~m/^part_(.*)$/) { if ($1 ne '0') {$allow_print_points=1;} } } @@ -1003,10 +990,9 @@ sub start_part { &Apache::edit::end_row().&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack, - $safeeval,'id'). - &Apache::edit::get_new_args($token,$parstack, - $safeeval,'display'); + $safeeval,'id','display'); if ($constructtag) { + #limiting ids to only letters numbers, and space $token->[2]->{'id'}=~s/[^A-Za-z0-9 ]//gs; $result = &Apache::edit::rebuild_tag($token); $result.=&Apache::edit::handle_insert();