--- loncom/homework/structuretags.pm 2003/10/24 21:04:21 1.218 +++ loncom/homework/structuretags.pm 2003/11/04 14:46:28 1.222 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.218 2003/10/24 21:04:21 albertel Exp $ +# $Id: structuretags.pm,v 1.222 2003/11/04 14:46:28 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -171,8 +171,10 @@ sub setup_rndseed { if (defined($rndseed) && $rndseed ne int($rndseed)) { $rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed)); } - &Apache::lonxml::debug("Setting rndseed to $rndseed"); - &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval); + if ($safeeval) { + &Apache::lonxml::debug("Setting rndseed to $rndseed"); + &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval); + } } return $rndseed; } @@ -457,10 +459,10 @@ sub start_problem { my $weight = &Apache::lonnet::EXT("resource.$id.weight"); my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys'); my @allkeys = split /,/,$allkeys; - my $allow_print_points = 0; + my $allow_print_points = 1; foreach my $partial_key (@allkeys) { - if ($partial_key=~m/weight/) { - $allow_print_points++; + if ($partial_key=~m/\_(\d*)\_weight/) { + if ($1 ne '0') {$allow_print_points=0;} } } my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); @@ -978,7 +980,15 @@ sub start_part { $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; } my $weight = &Apache::lonnet::EXT("resource.$id.weight"); - if ($Apache::lonhomework::type eq 'exam') { $result .= '\fbox{\textit{'.$weight.' pt}}';} + my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys'); + my @allkeys = split /,/,$allkeys; + my $allow_print_points = 0; + foreach my $partial_key (@allkeys) { + if ($partial_key=~m/\_(\d*)\_weight/) { + if ($1 ne '0') {$allow_print_points=1;} + } + } + if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} } } } @@ -1115,8 +1125,7 @@ sub end_startouttext { &Apache::edit::editfield($token->[1],$text,"",80,4); } if ($target eq 'modified') { - $text=&Apache::lonxml::get_all_text("endouttext",$parser); - $result=''.&Apache::edit::modifiedfield(); + $result=''.&Apache::edit::modifiedfield("endouttext",$parser); } if ($target eq 'tex') { $result .= '\noindent '; @@ -1160,7 +1169,7 @@ sub start_simpleeditbutton { my $result=''; if (($target eq 'web') && (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { - my $url=$ENV{'REQUEST_URI'}; + my $url=$ENV{'request.noversionuri'}; $url=~s/\?.*$//; $result='
'. ''.&mt('Simple Problem Editor').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').