--- loncom/imspackages/imsexport.pm 2012/05/07 02:12:54 1.10 +++ loncom/imspackages/imsexport.pm 2016/06/20 16:39:26 1.13 @@ -1,6 +1,6 @@ # The LearningOnline Network # -# $Id: imsexport.pm,v 1.10 2012/05/07 02:12:54 raeburn Exp $ +# $Id: imsexport.pm,v 1.13 2016/06/20 16:39:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -395,17 +395,17 @@ sub process_content { } } elsif ($symb =~ m-\.(sequence|page)___\d+___uploaded/$cdom/$cnum/-) { $$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'uploaded'); - } elsif ($symb =~ m-\.(sequence|page)___\d+___([^/]+)/([^/]+)-) { - my $canedit = 0; - if ($2 eq $env{'user.domain'} && $3 eq $env{'user.name'}) { - $canedit= 1; - } -# only include problem code where current user is author + } elsif ($symb =~ m-\.(?:sequence|page)___\d+___($match_domain/$match_name/.+)$-) { + my $url = &Apache::lonnet::clutter($1); + $url =~ s{^/res/}{/priv/}; if (($format eq 'html') || ($format eq 'plaintext')) { my $title = $curRes->title; $$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,$format,$currdirpath,$title,$testbank); } elsif ($format eq 'xml') { - if ($canedit) { +# only include problem code where current user is author or co-author, +# or this is a course "author" resource. + my ($ownername,$ownerdom,$ownerhome) = &Apache::lonnet::constructaccess($url); + if (($ownername ne '') && ($ownerdom ne '') && ($ownerhome ne '')) { $$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'resource'); } else { $$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'noedit'); @@ -673,6 +673,7 @@ sub simpleproblem { %values = &evaloptionhash($options); $output .= qq| + $qtext |; @@ -701,8 +702,9 @@ sub simpleproblem { } else { $output .= qq| + $qtext - + |; for (my $k=0; $k<10; $k++) { my $iter = $k+1; @@ -727,14 +729,14 @@ sub simpleproblem { |; } - } elsif ($qtype eq 'stringanswer') { + } elsif ($qtype eq 'string') { my $stringanswer = $qparms{$prefix.'stringanswer'}; my $stringtype=$qparms{$prefix.'stringtype'}; $output .= qq| - - + $qtext + |; if ($hint) { $output .= ' @@ -748,6 +750,55 @@ sub simpleproblem { |; + } elsif ($qtype eq 'numerical') { + my $sigfigs = $qparms{$prefix.'numericalsigfigs'}; + my $unit = $qparms{$prefix.'numericalunit'}; + my $answer = $qparms{$prefix.'numericalanswer'}; + my $tolerance = $qparms{$prefix.'numericaltolerance'}; + my $format = $qparms{$prefix.'numericalformat'}; + my $scriptblock = $qparms{$prefix.'numericalscript'}; + $output .= qq| + +|; + if ($scriptblock) { + $output .= qq| +|; + } + $output .= qq| +$qtext +|; + } + if ($sigfigs) { + $output .= qq| + |; + } + $output .= qq| + |; + if ($hint) { + $output .= qq| + + + '.$hint.' + + |; + } + $output .= qq| + + +|; } else { $output .= qq| @@ -846,7 +897,7 @@ sub templatedpage { $udom |; } - foreach (sort keys %syllabusfields) { + foreach (sort(keys(%syllabusfields))) { $output .= qq| <$_> $syllabusfields{$_}