|;
- 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);
+ &parse_webct4_questionDB($docroot,$$resources{$res}{file},$catinfo,$qzdbsettings,\%alldbanswers,\%alldbchoices,\@alldbquestids);
+ &build_category_sequences($destdir,$catinfo,$sequencesfiles,$pagesfiles,$destresdir,$newdir,$cms,$total,$randompickflag,$context,$udom,$uname,$dirname,$cid,$cdom,$cnum,$qzdbsettings);
+ &write_webct4_questions($cms,\@alldbquestids,$context,$qzdbsettings,$dirname,\%alldbanswers,\%alldbchoices,$total,$cid,$cdom,$cnum,$destdir,$catinfo);
$$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,$$resources{$res}{file},$container,\@allids);
+ &parse_webct4_quizprops($res,$docroot,$$hrefs{$$items{$$resources{$res}{revitm}}{properties}}[0],$container,\%qzparams);
+ if (exists($qzparams{$res}{numpick})) {
+ if ($qzparams{$res}{numpick} < @allids) {
+ $$randompicks{$$resources{$res}{revitm}} = $qzparams{$res}{numpick};
+ $randompickflag = 1;
}
}
- &parse_webct4_assessment($res,$docroot,$container,\@allids);
- }
- my $dirtitle = $$settings{'title'};
- $dirtitle =~ s/\W//g;
- $dirtitle .= '_'.$res;
- if (!-e "$destdir/problems") {
- mkdir("$destdir/problems",0755);
- }
- if (!-e "$destdir/problems/$dirtitle") {
- mkdir("$destdir/problems/$dirtitle",0755);
+ } elsif ($cms eq 'webctvista4') {
+ unless($$dbparse) {
+ foreach my $res (sort(keys(%{$allquestions}))) {
+ my $parent = $$allquestions{$res};
+ &parse_webctvista4_question($res,$docroot,$resources,$hrefs,$qzdbsettings,\@allquestids,\%allanswers,\%allchoices,$parent,$catinfo);
+ }
+ &build_category_sequences($destdir,$catinfo,$sequencesfiles,$pagesfiles,$destresdir,$newdir,$cms,$total,$randompickflag,$context,$udom,$uname,$dirname,$cid,$cdom,$cnum,$qzdbsettings);
+ $$dbparse = 1;
+ }
+ &parse_webctvista4_assessment($res,$docroot,$$resources{$res}{file},\@allids,\%qzparams);
+ if ($qzparams{$res}{numpick} < @allids) {
+ $$randompicks{$$resources{$res}{revitm}} = $qzparams{$res}{numpick};
+ $randompickflag = 1;
+ }
+ }
+ my $dirtitle;
+ unless ($cms eq 'webctce4' || $cms eq 'webctvista4') {
+ $dirtitle = $$settings{'title'};
+ $dirtitle =~ s/\s+/_/g;
+ $dirtitle =~ s/:/_/g;
+ $dirtitle .= '_'.$res;
+ if (!-e "$destdir/problems") {
+ mkdir("$destdir/problems",0755);
+ }
+ if (!-e "$destdir/problems/$dirtitle") {
+ mkdir("$destdir/problems/$dirtitle",0755);
+ }
+ $newdir = "$destdir/problems/$dirtitle";
+ }
+
+ if ($cms eq 'webctce4') {
+ if (@allids > 0 && $allids[0] ne '') {
+ &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,$qzdbsettings,\%qzparams);
}
- 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);
+ &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,$total,$newdir,$cid,$cdom,$cnum,$docroot);
+ } elsif ($cms eq 'webctvista4') {
+ &write_webct4_questions($cms,\@allquestids,$context,$qzdbsettings,$dirname,\%allanswers,\%allchoices,$total,$cid,$cdom,$cnum,$destdir,$catinfo,$dirtitle);
+ }
+}
+
+sub build_category_sequences {
+ my ($destdir,$catinfo,$sequencesfiles,$pagesfiles,$destresdir,$newdir,$cms,$total,$randompickflag,$context,$udom,$uname,$dirname,$cid,$cdom,$cnum,$qzdbsettings) = @_;
+ if (!-e "$destdir/sequences") {
+ mkdir("$destdir/sequences",0755);
+ }
+ my $numcats = scalar(keys(%{$catinfo}));
+ my $curr_id = 0;
+ my $next_id = 1;
+ my $fh;
+ open($fh,'>',"$destdir/sequences/question_database.sequence");
+ push @{$sequencesfiles},'question_database.sequence';
+ foreach my $category (sort(keys(%{$catinfo}))) {
+ my $seqname;
+ if ($cms eq 'webctce4') {
+ $seqname = $$catinfo{$category}{title}.'_'.$category;
+ } else {
+ $seqname = $$catinfo{$category}{title};
+ }
+ $seqname =~ s/\s+/_/g;
+ $seqname =~ s/:/_/g;
+ push(@{$sequencesfiles},$seqname.'.sequence');
+ my $catsrc = "$destresdir/sequences/$seqname.sequence";
+ if ($curr_id == 0) {
+ print $fh qq|