--- loncom/imspackages/imsprocessor.pm 2005/03/23 19:54:27 1.17
+++ loncom/imspackages/imsprocessor.pm 2005/03/23 20:55:33 1.18
@@ -519,15 +519,15 @@ sub process_resinfo {
}
} elsif ($$resources{$key}{type} eq "assessment/x-bb-pool") {
%{$$resinfo{$key}} = ();
- &process_assessment($cms,$context,$key,$docroot,'pool',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings);
+ &process_assessment($cms,$context,$key,$docroot,'pool',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings,$hrefs);
push @{$pools}, $key;
} elsif ($$resources{$key}{type} eq "assessment/x-bb-quiz") {
%{$$resinfo{$key}} = ();
- &process_assessment($cms,$context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings);
+ &process_assessment($cms,$context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings,$hrefs);
push @{$quizzes}, $key;
} elsif ($$resources{$key}{type} eq "assessment/x-bb-survey") {
%{$$resinfo{$key}} = ();
- &process_assessment($cms,$context,$key,$docroot,'survey',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings);
+ &process_assessment($cms,$context,$key,$docroot,'survey',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings,$hrefs);
push @{$surveys}, $key;
} elsif ($$resources{$key}{type} eq "assessment/x-bb-group") {
%{$$resinfo{$key}} = ();
@@ -569,7 +569,7 @@ sub process_resinfo {
%{$$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") {
- &process_assessment($cms,$context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings);
+ &process_assessment($cms,$context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,\$dbparse,$resources,$items,\%catinfo,\%qzdbsettings,$hrefs);
}
}
}
@@ -679,8 +679,12 @@ sub build_structure {
if (grep/^$res$/,@{$packages}) {
$packageflag = 1;
}
- $src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$file,$resinfo,$contitem,$uname,$cdom,$contcount,$packageflag,$contitemcount);
+ $src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$file,$resinfo,$contitem,$uname,$cdom,$contcount,$packageflag,$contitemcount,$$randompicks{$contitem});
unless ($flag{$key}{page} == 1) {
+ if ($$randompicks{$contitem}) {
+ $seqtext{$key} .= qq|
+\n|;
+ }
$seqtext{$key} .= qq|
-
+\n|;
+ if ($$randompicks{$contitem}) {
+ $seqtext{$key} .= qq|
+|;
+ }
+ $seqtext{$key} .= qq|
-
+\n|;
+ if ($$randompicks{$contitem}) {
+ $seqtext{$key} .= qq|
+\n|;
+ }
+ $seqtext{$key} .= qq|
0)) {
$src = $srcstem.'/sequences/'.$contitem.'.sequence';
$$flag{$key}{page} = 0;
$$flag{$key}{seq} = 1;
$$count{$key}{seq} ++;
+ } elsif ($cms eq 'webct4' && $randompick) {
+ $src = $srcstem.'/sequences/'.$res.'.sequence';
+ $$flag{$key}{page} = 0;
+ $$flag{$key}{seq} = 1;
+ $$count{$key}{seq} ++;
} elsif ($cms eq 'angel' && $type eq 'BOARD') {
$src = '/adm/'.$cdom.'/'.$uname.'/'.$$timestamp[$$boardnum{$res}].'/bulletinboard';
$$flag{$key}{page} = 0;
@@ -918,6 +936,8 @@ sub make_structure {
} elsif ($cms eq 'webct4') {
if ($type eq 'webctquiz') {
$src = $srcstem.'/pages/'.$res.'.page';
+ $$count{$key}{page} ++;
+ $$flag{$key}{seq} = 0;
} else {
if (grep/^$file$/,@{$$hrefs{$res}}) {
my $filename;
@@ -1860,15 +1880,6 @@ sub parse_webct4_quizprops {
[sub {
my ($tagname, $attr) = @_;
push @state, $tagname;
- my $depth = 0;
- my @seq = ();
- if ($state[0] eq 'properties' && $state[1] eq 'processing') {
- if ($state[2] eq 'scores' && $state[3] eq 'score') {
- $$qzparams{$res}{weight} = $attr->{linkrefid};
- } elsif ($state[2] eq 'selection' && $state[3] eq 'select') {
- $$qzparams{$res}{numpick} = $attr->{linkrefid};
- }
- }
}, "tagname, attr"],
text_h =>
[sub {
@@ -1877,15 +1888,23 @@ sub parse_webct4_quizprops {
if ($state[2] eq 'time_available') {
$$qzparams{$res}{opendate} = $text;
} elsif ($state[2] eq 'time_due') {
- $$qzparams{$res}{opendate} = $text;
+ $$qzparams{$res}{duedate} = $text;
} elsif ($state[3] eq 'max_attempt') {
$$qzparams{$res}{tries} = $text;
} elsif ($state[3] eq 'post_submission') {
$$qzparams{$res}{posts} = $text;
+ } elsif ($state[3] eq 'method') {
+ $$qzparams{$res}{method} = $text;
+ }
+ } elsif ($state[0] eq 'properties' && $state[1] eq 'processing') {
+ if ($state[2] eq 'scores' && $state[3] eq 'score') {
+ $$qzparams{$res}{weight} = $text;
+ } elsif ($state[2] eq 'selection' && $state[3] eq 'select') {
+ $$qzparams{$res}{numpick} = $text;
}
} elsif ($state[0] eq 'properties' && $state[1] eq 'result') {
if ($state[2] eq 'display_answer') {
- $$qzparams{$res}{answerdate} = $text;
+ $$qzparams{$res}{showanswer} = $text;
}
}
}, "dtext"],
@@ -2257,7 +2276,7 @@ sub parse_webct4_questionDB {
}
sub process_assessment {
- my ($cms,$context,$res,$docroot,$container,$dirname,$destdir,$settings,$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,$dbparse,$resources,$items,$catinfo,$qzdbsettings) = @_;
+ my ($cms,$context,$res,$docroot,$container,$dirname,$destdir,$settings,$total,$udom,$uname,$pagesfiles,$sequencesfiles,$randompicks,$dbparse,$resources,$items,$catinfo,$qzdbsettings,$hrefs) = @_;
my @allids = ();
my %allanswers = ();
my %allchoices = ();
@@ -2338,13 +2357,11 @@ sub process_assessment {
$$dbparse = 1;
}
&parse_webct4_assessment($res,$docroot,$$resources{$res}{file},$container,\@allids);
- &parse_webct4_quizprops($res,$docroot,$$resources{$$items{$$resources{$res}{revitm}}{properties}}{file},$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_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;
}
}
}