--- loncom/imspackages/imsprocessor.pm 2005/02/14 22:46:12 1.14
+++ loncom/imspackages/imsprocessor.pm 2005/02/21 23:47:46 1.15
@@ -51,6 +51,11 @@ sub ims_config {
survey => 'FORM',
);
@{$$cmsmap{angel}{doc}} = ('FILE','PAGE');
+ %{$$cmsmap{webct4}} = (
+ quiz => 'webctquiz',
+ survey => 'webctsurvey',
+ doc => 'webcontent'
+ );
%{$areaname} = (
announce => 'Announcements',
board => 'Discussion Boards',
@@ -146,6 +151,7 @@ sub process_manifest {
bb6 => 'organization',
bb5 => 'tableofcontents',
angel => 'organization',
+ webct4 => 'organization',
);
my %contents = ();
my @state = ();
@@ -198,7 +204,7 @@ sub process_manifest {
if ($$includeditems{$itm} || $phase ne 'build') {
%{$$items{$itm}} = ();
$$items{$itm}{contentscount} = 0;
- if ($cms eq 'bb5' || $cms eq 'bb6') {
+ if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webct4') {
$$items{$itm}{resnum} = $attr->{identifierref};
if ($cms eq 'bb5') {
$$items{$itm}{title} = $attr->{title};
@@ -255,7 +261,7 @@ sub process_manifest {
} elsif ("@state" eq "manifest resources resource" ) {
$identifier = $attr->{identifier};
if ($$includedres{$identifier} || $phase ne 'build') {
- if ($cms eq 'bb5' || $cms eq 'bb6') {
+ if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webct4') {
$$resources{$identifier}{file} = $attr->{file};
$$resources{$identifier}{type} = $attr->{type};
} elsif ($cms eq 'angel') {
@@ -268,7 +274,7 @@ sub process_manifest {
}
} elsif ("@state" eq "manifest resources resource file") {
if ($$includedres{$identifier} || $phase ne 'build') {
- if ($cms eq 'bb5' || $cms eq 'bb6') {
+ if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webct4') {
push @{$$hrefs{$identifier}},$attr->{href};
} elsif ($cms eq 'angel') {
if ($attr->{href} =~ m/^_assoc\\$identifier\\(.+)$/) {
@@ -283,11 +289,18 @@ sub process_manifest {
text_h =>
[sub {
my ($text) = @_;
+ if ("@state" eq "manifest metadata lom general title langstring") {
+ $$items{'Top'}{title} = $text;
+ }
if ($state[0] eq "manifest" && $state[1] eq "organizations" && $state[2] eq $toc{$cms} && $state[-1] eq "title") {
if ($$includeditems{$itm} || $phase ne 'build') {
if ($cms eq 'angel' || $cms eq 'bb6') {
$$items{$itm}{title} = $text;
}
+ if ($cms eq 'webct4') {
+ $$items{$itm}{title} = $text;
+ $$items{$itm}{title} =~ s/(<[^>]*>)//g;
+ }
}
}
}, "dtext"],
@@ -353,6 +366,9 @@ sub copy_resources {
%{$$url{$key}} = ();
foreach my $file (@{$$hrefs{$key}}) {
my $source = $tempdir.'/'.$key.'/'.$file;
+ if ($cms eq 'webct4') {
+ $source = $tempdir.'/'.$file;
+ }
my $filename = '';
my $fpath = $timenow.'/resfiles/'.$key.'/';
if ($cms eq 'angel') {
@@ -361,8 +377,19 @@ sub copy_resources {
}
}
$file =~ s-\\-/-g;
- $file = $fpath.$file;
- my $fileresult = &Apache::lonnet::process_coursefile('copy',$crs,$cdom,$chome,$file,$source);
+ my $copyfile = $file;
+ if ($cms eq 'webct4') {
+ if ($file =~ m-/([^/]+)$-) {
+ $copyfile = $1;
+ }
+ }
+ unless (($cms eq 'webct4') && ($copyfile eq 'questionDB.xml' || $copyfile =~ m/^quiz_QIZ_\d+\.xml$/)) {
+ $copyfile = $fpath.$copyfile;
+ my $fileresult;
+ if (-e $source) {
+ $fileresult = &Apache::lonnet::process_coursefile('copy',$crs,$cdom,$chome,$copyfile,$source);
+ }
+ }
}
}
}
@@ -374,11 +401,10 @@ sub copy_resources {
if (grep/^$key$/,@{$targets}) {
foreach my $file (@{$$hrefs{$key}}) {
$file =~ s-\\-/-g;
- if ( ($cms eq 'angel' && $file ne 'pg'.$key.'.htm') || ($cms eq 'bb5') || ($cms eq 'bb6') ) {
+ if ( ($cms eq 'angel' && $file ne 'pg'.$key.'.htm') || ($cms eq 'bb5') || ($cms eq 'bb6')) {
if (!-e "$destdir/resfiles/$key") {
mkdir("$destdir/resfiles/$key",0770);
}
-
my $filepath = $file;
my $front = '';
while ($filepath =~ m-(\w+)/(.+)-) {
@@ -395,6 +421,16 @@ sub copy_resources {
} elsif ($cms eq 'bb5' || $cms eq 'bb6') {
rename("$tempdir/$key/$file","$destdir/resfiles/$key/$file");
}
+ } elsif ($cms eq 'webct4') {
+ if (!-e "$destdir/resfiles/$key") {
+ mkdir("$destdir/resfiles/$key",0770);
+ }
+ if ($file =~ m-/([^/]+)$-) {
+ my $copyfile = $1;
+ unless ($copyfile eq 'questionDB.xml' || $copyfile =~ m/^quiz_QIZ_\d+\.xml$/) {
+ rename("$tempdir/$file","$destdir/resfiles/$key/$1");
+ }
+ }
}
}
}
@@ -403,9 +439,10 @@ sub copy_resources {
}
sub process_resinfo {
- my ($cms,$context,$docroot,$destdir,$items,$resources,$targets,$boards,$announcements,$quizzes,$surveys,$pools,$groups,$messages,$timestamp,$boardnum,$resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,$total,$dirname,$seqstem,$resrcfiles,$packages,$hrefs,$pagesfiles,$sequencesfiles) = @_;
+ my ($cms,$context,$docroot,$destdir,$items,$resources,$targets,$boards,$announcements,$quizzes,$surveys,$pools,$groups,$messages,$timestamp,$boardnum,$resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,$total,$dirname,$seqstem,$resrcfiles,$packages,$hrefs,$pagesfiles,$sequencesfiles,$randompicks) = @_;
my $board_id = time;
my $board_count = 0;
+ my $dbparse = 0;
my $announce_handling = 'include';
my $longcrs = '';
if ($crs =~ m/^(\d)(\d)(\d)/) {
@@ -471,15 +508,15 @@ sub process_resinfo {
}
} elsif ($$resources{$key}{type} eq "assessment/x-bb-pool") {
%{$$resinfo{$key}} = ();
- &process_assessment($context,$key,$docroot,'pool',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles);
+ &process_assessment($cms,$context,$key,$docroot,'pool',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse);
push @{$pools}, $key;
} elsif ($$resources{$key}{type} eq "assessment/x-bb-quiz") {
%{$$resinfo{$key}} = ();
- &process_assessment($context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles);
+ &process_assessment($cms,$context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse);
push @{$quizzes}, $key;
} elsif ($$resources{$key}{type} eq "assessment/x-bb-survey") {
%{$$resinfo{$key}} = ();
- &process_assessment($context,$key,$docroot,'survey',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles);
+ &process_assessment($cms,$context,$key,$docroot,'survey',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse);
push @{$surveys}, $key;
} elsif ($$resources{$key}{type} eq "assessment/x-bb-group") {
%{$$resinfo{$key}} = ();
@@ -514,6 +551,19 @@ sub process_resinfo {
if (@{$pools}) {
$$items{'Top'}{'contentscount'} ++;
}
+ } elsif ($cms eq 'webct4') {
+ foreach my $key (sort keys %{$resources}) {
+ if (grep/^$key$/,@{$targets}) {
+ if ($$resources{$key}{type} eq "webcontent") {
+ %{$$resinfo{$key}} = ();
+# &webct4_content($key,$docroot,$destdir,\%{$$resinfo{$key}},$udom,$uname,$$resources{$key}{type},$$items{$$resources{$key}{revitm}}{title},$resrcfiles);
+ } elsif ($$resources{$key}{type} eq "webctquiz") {
+# &webct4_assessment($key,$docroot,$destdir,\%{$$resinfo{$key}},$udom,$uname,$$resources{$key}{type},$$items{$$resources{$key}{revitm}}{title},$resrcfiles);
+ &process_assessment($cms,$context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse);
+
+ }
+ }
+ }
}
$$total{'board'} = $board_count;
@@ -523,7 +573,7 @@ sub process_resinfo {
}
sub build_structure {
- my ($cms,$context,$destdir,$items,$resinfo,$resources,$targets,$hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,$timestamp,$total,$boards,$announcements,$quizzes,$surveys,$pools,$boardnum,$pagesfiles,$seqfiles,$topurls,$topnames,$packages,$includeditems) = @_;
+ my ($cms,$context,$destdir,$items,$resinfo,$resources,$targets,$hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,$timestamp,$total,$boards,$announcements,$quizzes,$surveys,$pools,$boardnum,$pagesfiles,$seqfiles,$topurls,$topnames,$packages,$includeditems,$randompicks) = @_;
my %flag = ();
my %count = ();
my %pagecontents = ();
@@ -582,11 +632,13 @@ sub build_structure {
my $curr_id = 1;
my $resnum = $$items{$key}{resnum};
my $type = $$resources{$resnum}{type};
- if (($cms eq 'angel' && $type eq "FOLDER") || (($cms eq 'bb5' || $cms eq 'bb6') && $$resinfo{$resnum}{'isfolder'} eq "true") && (($type eq "resource/x-bb-document") || ($type eq "resource/x-bb-staffinfo") || ($type eq "resource/x-bb-externallink")) ) {
+ my $contentscount = $$items{$key}{'contentscount'};
+ if (($cms eq 'angel' && $type eq "FOLDER") || (($cms eq 'bb5' || $cms eq 'bb6') && $$resinfo{$resnum}{'isfolder'} eq "true") && (($type eq "resource/x-bb-document") || ($type eq "resource/x-bb-staffinfo") || ($type eq "resource/x-bb-externallink")) || ($cms eq 'webct4' && $contentscount > 0)) {
+ print STDERR "$key is identified as a folder has $contentscount\n";
unless (($cms eq 'bb5') && $key eq 'Top') {
$seqtext{$key} = "|;
+ if (!-e "$destdir/problems") {
+ mkdir("$destdir/problems",0755);
+ }
+ if (!-e "$destdir/problems/$seqname") {
+ mkdir("$destdir/problems/$seqname",0755);
+ }
+ my $newdir = "$destdir/problems/$seqname";
+ my $dbcontainerdir;
+ &build_problem_container($seqname,$newdir,$destdir,'database',$seqname,$total,$sequencesfiles,$pagesfiles,$randompickflag,$context,\@{$catinfo{$category}{contents}},$udom,$uname,$dirname,\$dbcontainerdir,\$newdir,$cid,$cdom,$cnum);
+ }
+ close($fh);
+ &write_webct4_questions(\@alldbquestids,$context,$settings,$dirname,\%alldbanswers,\%alldbchoices,$total,$cid,$cdom,$cnum);
+ $$dbparse = 1;
+ }
+ &parse_webct4_quizprops($res,$docroot,$container,\%qzparams);
+ foreach (sort keys %qzparams) {
+ if (exists($qzparams{$res}{numpick})) {
+ if ($qzparams{$res}{numpick} < @allids) {
+ $$randompicks{$res} = $qzparams{$res}{numpick};
+ $randompickflag = 1;
+ }
+ }
+ }
+ &parse_webct4_assessment($res,$docroot,$container,\@allids);
+ }
my $dirtitle = $$settings{'title'};
$dirtitle =~ s/\W//g;
$dirtitle .= '_'.$res;
@@ -1710,60 +2257,65 @@ sub process_assessment {
mkdir("$destdir/problems/$dirtitle",0755);
}
my $newdir = "$destdir/problems/$dirtitle";
+
+ &build_problem_container($dirtitle,$newdir,$destdir,$container,$res,$total,$sequencesfiles,$pagesfiles,$randompickflag,$context,\@allids,$udom,$uname,$dirname,\$containerdir,\$newdir,$cid,$cdom,$cnum);
+ if ($cms eq 'bb5') {
+ &write_bb5_questions(\@allids,$containerdir,$context,$settings,$dirname,$res,\%allanswers,\%allchoices,$total,$newdir,$cid,$cdom,$cnum);
+ } elsif ($cms eq 'bb6') {
+ &write_bb6_questions(\@allids,$containerdir,$context,$settings,$dirname,$res,\%allanswers,\%allchoices,$total,$newdir,$cid,$cdom,$cnum);
+ }
+}
+
+sub build_problem_container {
+ my ($dirtitle,$newdir,$destdir,$container,$res,$total,$sequencesfiles,$pagesfiles,$randompickflag,$context,$allids,$udom,$uname,$dirname,$containerdir,$newdir,$cid,$cdom,$cnum) = @_;
my $seqdir = "$destdir/sequences";
my $pagedir = "$destdir/pages";
my $curr_id = 0;
my $next_id = 1;
my $fh;
- my $containerdir;
- if ($container eq 'pool') {
- $containerdir = $seqdir.'/'.$res.'.sequence';
+ if ($container eq 'pool' || $randompickflag || $container eq 'database') {
+ $$containerdir = $seqdir.'/'.$res.'.sequence';
if (!-e "$seqdir") {
mkdir("$seqdir",0770);
}
- open($fh,">$containerdir");
+ open($fh,">$$containerdir");
$$total{seq} ++;
push @{$sequencesfiles},$res.'.sequence';
} else {
- $containerdir = $pagedir.'/'.$res.'.page';
+ $$containerdir = $pagedir.'/'.$res.'.page';
if (!-e "$destdir/pages") {
mkdir("$destdir/pages",0770);
}
- open($fh,">$containerdir");
+ open($fh,">$$containerdir");
$$total{page} ++;
push @{$pagesfiles},$res.'.page';
}
print $fh qq||;
close($fh);
+}
+
+sub write_bb5_questions {
+ my ($allids,$containerdir,$context,$settings,$dirname,$res,$allanswers,$allchoices,$total,$newdir,$cid,$cdom,$cnum) = @_;
my $qnum = 0;
- foreach my $id (@allids) {
+ foreach my $id (@{$allids}) {
$qnum ++;
my $output;
my $permcontainer = $containerdir;
@@ -1785,7 +2341,7 @@ sub process_assessment {
$resourcedata{$symb.'text'.$iter} = "";
$resourcedata{$symb.'value'.$iter} = "unused";
$resourcedata{$symb.'position'.$iter} = "random";
- }
+ }
$resourcedata{$symb.'randomize'} = 'yes';
$resourcedata{$symb.'maxfoils'} = 10;
if ($context eq 'CSTR') {
@@ -1800,7 +2356,7 @@ sub process_assessment {
- $$settings{$id}{feedbackcorr}
+ $$settings{$id}{feedbackcorr}
|;
} else {
@@ -1832,7 +2388,7 @@ sub process_assessment {
$resourcedata{$symb.'questiontext'} .= $image.$imglink.$url;
}
if ($$settings{$id}{class} eq 'QUESTION_MULTIPLECHOICE') {
- my $numfoils = @{$allanswers{$id}};
+ my $numfoils = @{$$allanswers{$id}};
if ($context eq 'CSTR') {
$output .= qq|
@@ -1843,30 +2399,30 @@ sub process_assessment {
$resourcedata{$symb.'questiontype'} = 'radio';
$resourcedata{$symb.'maxfoils'} = $numfoils;
}
- for (my $k=0; $k<@{$allanswers{$id}}; $k++) {
+ for (my $k=0; $k<@{$$allanswers{$id}}; $k++) {
my $iter = $k+1;
$output .= "
|;
+ if ( defined($$settings{$id}{$$allanswers{$id}[$k]}{image}) ) {
+ if ( $$settings{$id}{$$allanswers{$id}[$k]}{style} eq 'embed' ) {
+ $ans_image .= qq|
|;
} else {
- $ans_link .= qq|
Link to file
|;
+ $ans_link .= qq|
Link to file
|;
}
}
$output .= $ans_image.$ans_link.''."\n";
@@ -1880,7 +2436,7 @@ sub process_assessment {
|;
}
} elsif ($$settings{$id}{class} eq 'QUESTION_TRUEFALSE') {
- my $numfoils = @{$allanswers{$id}};
+ my $numfoils = @{$$allanswers{$id}};
if ($context eq 'CSTR') {
$output .= qq|
@@ -1891,18 +2447,18 @@ sub process_assessment {
$resourcedata{$symb.'hiddenparts'} = '!radio';
$resourcedata{$symb.'questiontype'} = 'radio';
}
- for (my $k=0; $k<@{$allanswers{$id}}; $k++) {
+ for (my $k=0; $k<@{$$allanswers{$id}}; $k++) {
my $iter = $k+1;
$output .= " \n";
- $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text};
+ $output .= "\>".$$settings{$id}{$$allanswers{$id}[$k]}{text}."\n";
+ $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$$allanswers{$id}[$k]}{text};
}
if ($context eq 'CSTR') {
chomp($output);
@@ -1912,7 +2468,7 @@ sub process_assessment {
|;
}
} elsif ($$settings{$id}{class} eq 'QUESTION_MULTIPLEANSWER') {
- my $numfoils = @{$allanswers{$id}};
+ my $numfoils = @{$$allanswers{$id}};
if ($context eq 'CSTR') {
$output .= qq|
@@ -1926,18 +2482,18 @@ sub process_assessment {
$resourcedata{$symb.'questiontype'} = 'option';
$resourcedata{$symb.'maxfoils'} = $numfoils;
}
- for (my $k=0; $k<@{$allanswers{$id}}; $k++) {
+ for (my $k=0; $k<@{$$allanswers{$id}}; $k++) {
my $iter = $k+1;
$output .= " \n";
- $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text};
+ $output .= "\>".$$settings{$id}{$$allanswers{$id}[$k]}{text}."\n";
+ $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$$allanswers{$id}[$k]}{text};
}
if ($context eq 'CSTR') {
chomp($output);
@@ -1947,7 +2503,7 @@ sub process_assessment {
|;
}
} elsif ($$settings{$id}{class} eq 'QUESTION_ORDER') {
- my $numfoils = @{$allanswers{$id}};
+ my $numfoils = @{$$allanswers{$id}};
my @allorder = ();
if ($context eq 'CSTR') {
$output .= qq|
@@ -1961,14 +2517,14 @@ sub process_assessment {
$resourcedata{$symb.'questiontype'} = 'option';
$resourcedata{$symb.'maxfoils'} = $numfoils;
}
- for (my $k=0; $k<@{$allanswers{$id}}; $k++) {
+ for (my $k=0; $k<@{$$allanswers{$id}}; $k++) {
if ($context eq 'CSTR') {
- $output .= " ".$$settings{$id}{$allanswers{$id}[$k]}{text}."\n";
+ $output .= " ".$$settings{$id}{$$allanswers{$id}[$k]}{text}."\n";
} else {
my $iter = $k+1;
- $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text};
- if (!grep/^$$settings{$id}{$allanswers{$id}[$k]}{order}$/,@allorder) {
- push @allorder, $$settings{$id}{$allanswers{$id}[$k]}{order};
+ $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$$allanswers{$id}[$k]}{text};
+ if (!grep/^$$settings{$id}{$$allanswers{$id}[$k]}{order}$/,@allorder) {
+ push @allorder, $$settings{$id}{$$allanswers{$id}[$k]}{order};
}
}
}
@@ -1987,8 +2543,8 @@ sub process_assessment {
if ($context eq 'DOCS') {
$numerical = 0;
} else {
- for (my $k=0; $k<@{$allanswers{$id}}; $k++) {
- if ($$settings{$id}{$allanswers{$id}[$k]}{text} =~ m/([^\d\.]|\.\.)/) {
+ for (my $k=0; $k<@{$$allanswers{$id}}; $k++) {
+ if ($$settings{$id}{$$allanswers{$id}[$k]}{text} =~ m/([^\d\.]|\.\.)/) {
$numerical = 0;
}
}
@@ -1996,18 +2552,18 @@ sub process_assessment {
if ($numerical) {
my $numans;
my $tol;
- if (@{$allanswers{$id}} == 1) {
+ if (@{$$allanswers{$id}} == 1) {
$tol = 5;
- $numans = $$settings{$id}{$allanswers{$id}[0]}{text};
+ $numans = $$settings{$id}{$$allanswers{$id}[0]}{text};
} else {
- my $min = $$settings{$id}{$allanswers{$id}[0]}{text};
- my $max = $$settings{$id}{$allanswers{$id}[0]}{text};
- for (my $k=1; $k<@{$allanswers{$id}}; $k++) {
- if ($$settings{$id}{$allanswers{$id}[$k]}{text} <= $min) {
- $min = $$settings{$id}{$allanswers{$id}[$k]}{text};
+ my $min = $$settings{$id}{$$allanswers{$id}[0]}{text};
+ my $max = $$settings{$id}{$$allanswers{$id}[0]}{text};
+ for (my $k=1; $k<@{$$allanswers{$id}}; $k++) {
+ if ($$settings{$id}{$$allanswers{$id}[$k]}{text} <= $min) {
+ $min = $$settings{$id}{$$allanswers{$id}[$k]}{text};
}
- if ($$settings{$id}{$allanswers{$id}[$k]}{text} >= $max) {
- $max = $$settings{$id}{$allanswers{$id}[$k]}{text};
+ if ($$settings{$id}{$$allanswers{$id}[$k]}{text} >= $max) {
+ $max = $$settings{$id}{$$allanswers{$id}[$k]}{text};
}
}
$numans = ($max + $min)/2;
@@ -2027,23 +2583,23 @@ sub process_assessment {
if ($context eq 'DOCS') {
$resourcedata{$symb.'hiddenparts'} = '!string';
$resourcedata{$symb.'questiontype'} = 'string';
- $resourcedata{$symb.'maxfoils'} = @{$allanswers{$id}};
+ $resourcedata{$symb.'maxfoils'} = @{$$allanswers{$id}};
$resourcedata{$symb.'hiddenparts'} = '!string';
$resourcedata{$symb.'stringtype'} = 'ci';
- $resourcedata{$symb.'stringanswer'} = $$settings{$id}{$allanswers{$id}[0]}{text};
+ $resourcedata{$symb.'stringanswer'} = $$settings{$id}{$$allanswers{$id}[0]}{text};
} else {
- if (@{$allanswers{$id}} == 1) {
+ if (@{$$allanswers{$id}} == 1) {
$output .= qq|
-
+
|;
} else {
my @answertext = ();
- for (my $k=0; $k<@{$allanswers{$id}}; $k++) {
- $$settings{$id}{$allanswers{$id}[$k]}{text} =~ s/\|/\|/g;
- push @answertext, $$settings{$id}{$allanswers{$id}[$k]}{text};
+ for (my $k=0; $k<@{$$allanswers{$id}}; $k++) {
+ $$settings{$id}{$$allanswers{$id}[$k]}{text} =~ s/\|/\|/g;
+ push @answertext, $$settings{$id}{$$allanswers{$id}[$k]}{text};
}
my $regexpans = join('|',@answertext);
$regexpans = '/^('.$regexpans.')\b/';
@@ -2070,19 +2626,19 @@ sub process_assessment {
$resourcedata{$symb.'delopt'} = '';
$resourcedata{$symb.'hiddenparts'} = '!option';
$resourcedata{$symb.'questiontype'} = 'option';
- $resourcedata{$symb.'maxfoils'} = @{$allanswers{$id}};
+ $resourcedata{$symb.'maxfoils'} = @{$$allanswers{$id}};
}
- for (my $k=0; $k<@{$allchoices{$id}}; $k++) {
+ for (my $k=0; $k<@{$$allchoices{$id}}; $k++) {
if ($context eq 'CSTR') {
$output .= qq|
--
-$$settings{$id}{$allchoices{$id}[$k]}{text}
+
-
+$$settings{$id}{$$allchoices{$id}[$k]}{text}
|;
} else {
- if (!grep/^$$settings{$id}{$allchoices{$id}[$k]}{text}$/,@allmatchers) {
- push @allmatchers, $$settings{$id}{$allchoices{$id}[$k]}{text};
- $matchtext{$allchoices{$id}[$k]} = $$settings{$id}{$allchoices{$id}[$k]}{text};
+ if (!grep/^$$settings{$id}{$$allchoices{$id}[$k]}{text}$/,@allmatchers) {
+ push @allmatchers, $$settings{$id}{$$allchoices{$id}[$k]}{text};
+ $matchtext{$$allchoices{$id}[$k]} = $$settings{$id}{$$allchoices{$id}[$k]}{text};
}
}
}
@@ -2091,17 +2647,17 @@ sub process_assessment {
|;
}
- for (my $k=0; $k<@{$allanswers{$id}}; $k++) {
+ for (my $k=0; $k<@{$$allanswers{$id}}; $k++) {
if ($context eq 'CSTR') {
$output .= qq|
-
- $$settings{$id}{$allanswers{$id}[$k]}{text}
+
+ $$settings{$id}{$$allanswers{$id}[$k]}{text}
|;
} else {
my $iter = $k+1;
- $resourcedata{$symb.'value'.$iter} = $matchtext{$$settings{$id}{$allanswers{$id}[$k]}{choice_id}};
- $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text};
+ $resourcedata{$symb.'value'.$iter} = $matchtext{$$settings{$id}{$$allanswers{$id}[$k]}{choice_id}};
+ $resourcedata{$symb.'text'.$iter} = $$settings{$id}{$$allanswers{$id}[$k]}{text};
}
}
if ($context eq 'CSTR') {
@@ -2128,6 +2684,14 @@ sub process_assessment {
}
}
+sub write_webct4_questions {
+ my ($alldbquestids,$context,$settings,$dirname,$alldbanswers,$alldbchoices,$total,$cid,$cdom,$cnum) = @_;
+}
+
+sub write_bb6_questions {
+ my ($allids,$containerdir,$context,$settings,$dirname,$res,$allanswers,$allchoices) = @_;
+}
+
# ---------------------------------------------------------------- Process Blackboard Announcements
sub process_announce {
my ($res,$docroot,$destdir,$settings,$globalresref,$seqstem,$resrcfiles) = @_;
@@ -2222,8 +2786,7 @@ sub process_content {
my $xmlfile = $docroot.'/'.$res.".dat";
my $destresdir = $destdir;
if ($context eq 'CSTR') {
-# $destresdir =~ s|/home/$user/public_html/|/res/$dom/$user/|;
- $destresdir =~ s|/home/$user/public_html/|/priv/$user/|;
+ $destresdir =~ s|/home/$user/public_html/|/res/$dom/$user/|;
} elsif ($context eq 'DOCS') {
$destresdir =~ s|^/home/httpd/html/userfiles|/uploaded|;
}
@@ -2643,5 +3206,39 @@ sub angel_content {
close(FILE);
}
+# ---------------------------------------------------------------- WebCT content
+sub webct4_content {
+ my ($res,$docroot,$destdir,$settings,$dom,$user,$type,$title,$resrcfiles) = @_;
+ if (!open(FILE,">$destdir/resfiles/$res.html")) {
+ &Apache::lonnet::logthis("IMS import error: Cannot open file - $destdir/resfiles/$res.html - $!");
+ } else {
+ push(@{$resrcfiles}, "$res.html");
+ my $linktag = '';
+ if (defined($$settings{url})) {
+ $linktag = qq|$title|;
+ } else {
+ $linktag .= qq|>$$settings{url}|;
+ }
+ }
+ print FILE qq|
+
+$title
+
+
+$linktag
+
+|;
+ close(FILE);
+ }
+}
+
+# ---------------------------------------------------------------- WebCT assessments
+sub webct4_assessment {
+ my ($res,$docroot,$destdir,$settings,$dom,$user,$type,$title,$resrcfiles) = @_;
+ print STDERR "webct assessment detected - $res, $docroot, $destdir, $type,$title\n";
+}
+
1;
__END__