--- loncom/imspackages/imsprocessor.pm 2005/04/07 06:56:22 1.19
+++ loncom/imspackages/imsprocessor.pm 2005/07/12 16:05:59 1.22
@@ -24,6 +24,9 @@
package Apache::imsprocessor;
use Apache::lonnet;
+use Apache::loncleanup;
+use LWP::UserAgent;
+use HTTP::Request::Common;
use LONCAPA::Configuration;
use strict;
@@ -1724,7 +1727,7 @@ sub parse_bb5_assessment {
$id = $attr->{id};
} elsif ( ($state[0] eq $toptag{$container}) && ($state[1] =~ m/^QUESTION_(\w+)$/) && ($state[2] eq "BODY") && ($state[3] eq "FLAGS") ) {
if ($state[4] eq "ISHTML") {
- $$settings{$id}{html} = $attr->{value};
+ $$settings{$id}{ishtml} = $attr->{value};
} elsif ($state[4] eq "ISNEWLINELITERAL") {
$$settings{$id}{newline} = $attr->{value};
}
@@ -2342,7 +2345,7 @@ sub process_assessment {
if (!-e "$destdir/problems/$seqname") {
mkdir("$destdir/problems/$seqname",0755);
}
- my $newdir = "$destdir/problems/$seqname";
+ $newdir = "$destdir/problems/$seqname";
my $dbcontainerdir;
&build_problem_container($cms,$seqname,$destdir,'database',$seqname,$total,$sequencesfiles,$pagesfiles,$randompickflag,$context,\@{$$catinfo{$category}{contents}},$udom,$uname,$dirname,\$dbcontainerdir,$cid,$cdom,$cnum,$catinfo,$qzdbsettings);
}
@@ -2370,14 +2373,18 @@ sub process_assessment {
if (!-e "$destdir/problems/$dirtitle") {
mkdir("$destdir/problems/$dirtitle",0755);
}
- my $newdir = "$destdir/problems/$dirtitle";
+ $newdir = "$destdir/problems/$dirtitle";
}
- &build_problem_container($cms,$dirtitle,$destdir,$container,$res,$total,$sequencesfiles,$pagesfiles,$randompickflag,$context,\@allids,$udom,$uname,$dirname,\$containerdir,$cid,$cdom,$cnum,$catinfo,$qzdbsettings);
+ if ($cms eq 'webct4') {
+ &build_problem_container($cms,$dirtitle,$destdir,$container,$res,$total,$sequencesfiles,$pagesfiles,$randompickflag,$context,\@allids,$udom,$uname,$dirname,\$containerdir,$cid,$cdom,$cnum,$catinfo,$qzdbsettings);
+ } else {
+ &build_problem_container($cms,$dirtitle,$destdir,$container,$res,$total,$sequencesfiles,$pagesfiles,$randompickflag,$context,\@allids,$udom,$uname,$dirname,\$containerdir,$cid,$cdom,$cnum,$catinfo,$settings);
+ }
if ($cms eq 'bb5') {
- &write_bb5_questions(\@allids,$containerdir,$context,$settings,$dirname,$res,\%allanswers,\%allchoices,$total,$newdir,$cid,$cdom,$cnum);
+ &write_bb5_questions(\@allids,$containerdir,$context,$settings,$dirname,$destdir,$res,\%allanswers,\%allchoices,$total,$newdir,$cid,$cdom,$cnum,$docroot);
} elsif ($cms eq 'bb6') {
- &write_bb6_questions(\@allids,$containerdir,$context,$settings,$dirname,$res,\%allanswers,\%allchoices,$total,$newdir,$cid,$cdom,$cnum);
+ &write_bb6_questions(\@allids,$containerdir,$context,$settings,$dirname,$destdir,$res,\%allanswers,\%allchoices,$total,$newdir,$cid,$cdom,$cnum);
}
}
@@ -2411,7 +2418,11 @@ sub build_problem_container {
my $probsrc = "/res/lib/templates/simpleproblem.problem";
if ($context eq 'CSTR') {
foreach my $id (@{$allids}) {
- $probtitle{$id} = $$settings{$id}{title};
+ if ($cms eq 'webct4') {
+ $probtitle{$id} = $$settings{$id}{title};
+ } else {
+ $probtitle{$id} = $$settings{title};
+ }
$probtitle{$id} =~ s/\s/_/g;
$probtitle{$id} =~ s/\W//g;
$probtitle{$id} .= '_'.$id;
@@ -2423,7 +2434,7 @@ sub build_problem_container {
$probdir =~ s/\W//g;
$probsrc = "$dirname/problems/$probdir/$probtitle{$$allids[0]}.problem";
} else {
- $probsrc="$dirname/problems/$dirtitle/$$allids[0].problem";
+ $probsrc="$dirname/problems/$dirtitle/$probtitle{$$allids[0]}.problem";
}
}
print $fh qq|
#
#g;
$qnum ++;
my $output;
my $permcontainer = $containerdir;
@@ -2811,7 +2832,11 @@ sub write_bb5_questions {
if ($context eq 'CSTR') {
$output .= qq|
|;
- open(PROB,">$newdir/problems/$id.problem");
+ my $title = $$settings{title};
+ $title =~ s/\s/_/g;
+ $title =~ s/\W//g;
+ $title .= '_'.$id;
+ open(PROB,">:utf8", "$newdir/$title.problem");
print PROB $output;
close PROB;
} else {
@@ -2840,14 +2865,14 @@ sub write_webct4_questions {
}
if ($$settings{$id}{texttype} eq 'text/html') {
$$settings{$id}{text} = &HTML::Entities::decode($$settings{$id}{text});
- $$settings{$id}{text} = &Apache::lonxml::htmlclean($$settings{$id}{text});
- $$settings{$id}{text} =~ s#(]+)(/?>)#$1../../resfiles/$2 />#gi;
+ $$settings{$id}{text} =~ s#<([bh])r>#<$1r />#g;
# $$settings{$id}{text} =~ s#
#
#g; # $$settings{$id}{text} =~ s#
##; # $$settings{$id}{text} =~ s###g; $$settings{$id}{text} =~ s##
#g;
- $$settings{$id}{text} =~ s#<\\p>##g;
+ $$settings{$id}{text} =~ s#