--- loncom/imspackages/imsprocessor.pm 2013/07/27 22:04:49 1.52 +++ loncom/imspackages/imsprocessor.pm 2013/08/02 12:56:26 1.53 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Processor for IMS Packages # -# $Id: imsprocessor.pm,v 1.52 2013/07/27 22:04:49 raeburn Exp $ +# $Id: imsprocessor.pm,v 1.53 2013/08/02 12:56:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -334,7 +334,7 @@ sub parse_manifest { $$resources{$identifier}{file} = $attr->{href}; } else { push(@{$$hrefs{$identifier}},$attr->{href}); - } + } } } elsif ($cms eq 'angel5') { if ($attr->{href} =~ m/^_assoc\\$identifier\\(.+)$/) { @@ -371,7 +371,11 @@ sub parse_manifest { } if ("@state" eq "manifest webct:ContentObject webct:Name") { if ($cms eq 'webctvista4') { - $$resources{$identifier}{title} = (split(/,/,$text))[-1]; + if ($text =~ /,/) { + $$resources{$identifier}{title} = (split(/,/,$text))[-1]; + } else { + $$resources{$identifier}{title} = $text; + } } } }, "dtext"], @@ -563,8 +567,8 @@ sub copy_resources { if (ref($$resources{$$resources{$key}{usedby}}{imagetitle}) eq 'ARRAY') { $imgtitle = $$resources{$$resources{$key}{usedby}}{imagetitle}[$i]; } - if (($img =~ /^\Q$filestem\E/i) && ($imgtitle =~ /\Q$extension\E/i)) { - $copyfile = $img.'_'.$imgtitle; + if ($imgtitle =~ /\Q$extension\E/i) { + $copyfile = $imgtitle; last; } elsif ($img =~ /^\Q$filestem\E/i) { $copyfile = $img.'.'.$extension; @@ -2408,6 +2412,7 @@ sub parse_webctvista4_question { @{$$settings{$id}{numids}} = (); %{$$allanswers{$id}} = (); $$settings{$id}{title} = $attr->{title}; + $$settings{$id}{title} =~ s/\%/pct_/g; } if ("@state" eq "questestinterop item presentation flow material mat_extension webct:calculated webct:var") { $currvar = $attr->{'webct:name'}; @@ -2642,11 +2647,17 @@ sub parse_webctvista4_question { text_h => [sub { my ($text) = @_; + $text =~ s/\s*\&\s*/_and_/g; if ($currtexttype eq '/text/html') { $text =~ s#(<img\ssrc=")([^"]+)">#$1../resfiles/$2#g; } if ("@state" eq "questestinterop item presentation flow material matimage") { - my $imagetitle = (split(/,/,$text))[-1]; + my $imagetitle; + if ($text =~ /,/) { + $imagetitle = (split(/,/,$text))[-1]; + } else { + $imagetitle = $text; + } $$settings{$id}{imagetitle} = $imagetitle; push(@{$$resources{$res}{imagetitle}},$imagetitle); } @@ -3474,7 +3485,9 @@ sub build_problem_container { $probtitle{$id} =~ s/\s+/_/g; $probtitle{$id} =~ s/:/_/g; $probtitle{$id} =~ s/\//_/g; - $probtitle{$id} .= '_'.$id; + if ($cms eq 'webctce4') { + $probtitle{$id} .= '_'.$id; + } } if (($cms eq 'webctce4' && $container ne 'database') || ($cms eq 'webctvista4')) { @@ -3996,7 +4009,7 @@ sub write_webct4_questions { if (($cms eq 'webctvista4') && (defined($$settings{$id}{image}))) { my $imgsrc = '../../resfiles/'.$$settings{$id}{image}; if (defined($$settings{$id}{imagetitle})) { - $imgsrc .= '_'.$$settings{$id}{imagetitle}; + $imgsrc = '../../resfiles/'.$$settings{$id}{imagetitle}; } $questionimage = qq|

|; } @@ -4530,7 +4543,6 @@ $$settings{$id}{$list}{jumbledtext}[$k] $title =~ s/\s/_/g; $title =~ s/:/_/g; $title =~ s/\//_/g; - $title .= '_'.$id; open(PROB,">$destdir/problems/$probdir/$title.problem"); print PROB $output; close PROB;