--- loncom/imspackages/imsprocessor.pm 2017/11/16 18:09:59 1.54.2.1 +++ loncom/imspackages/imsprocessor.pm 2018/05/02 20:01:51 1.54.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Processor for IMS Packages # -# $Id: imsprocessor.pm,v 1.54.2.1 2017/11/16 18:09:59 raeburn Exp $ +# $Id: imsprocessor.pm,v 1.54.2.2 2018/05/02 20:01:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -140,7 +140,7 @@ sub uploadzip { unless ($fname) { return 'error: no uploaded file'; } # Save the file chomp($env{'form.uploadname'}); - open(my $fh,'>'.$tempdir.'/'.$fname); + open(my $fh,'>',"$tempdir/$fname"); print $fh $env{'form.uploadname'}; close($fh); } elsif ($context eq 'CSTR') { @@ -994,10 +994,10 @@ sub build_structure { $seqtext{$key} .= "\n"; if ($cms eq 'webctce4' && $key ne 'Top') { push @{$seqfiles}, "$seqtitle.sequence"; - open(LOCFILE,">$destdir/sequences/$seqtitle.sequence"); + open(LOCFILE,'>',"$destdir/sequences/$seqtitle.sequence"); } else { push @{$seqfiles}, "$key.sequence"; - open(LOCFILE,">$destdir/sequences/$key.sequence"); + open(LOCFILE,'>',"$destdir/sequences/$key.sequence"); } print LOCFILE $seqtext{$key}; close(LOCFILE); @@ -1027,7 +1027,7 @@ sub build_structure { &process_specials($context,'pools',$pools,\$topnum,$$items{'Top'}{contentscount},$destdir,$udom,$uname,$cdom,$crs,$timenow,$newdir,$timestamp,$resinfo,\$seqtext{'Top'},$pagesfiles,$seqfiles,$topurls,$topnames); } $seqtext{'Top'} .= "\n"; - open(TOPFILE,">$destdir/sequences/Top.sequence"); + open(TOPFILE,'>',"$destdir/sequences/Top.sequence"); print TOPFILE $seqtext{'Top'}; close(TOPFILE); push @{$seqfiles}, 'Top.sequence'; @@ -1049,7 +1049,7 @@ sub build_structure { if (grep/^$res$/,@{$packages}) { $resource = $filestem.'/resfiles/'.$res.'./index.html'; # should be entry_point } - open(PAGEFILE,">$filename"); + open(PAGEFILE,'>',$filename); print PAGEFILE qq| \n|; @@ -1238,10 +1238,10 @@ sub process_specials { if ($type eq "announcements") { push @{$pagesfiles}, "$seqnames{$type}.page"; - open(ITEM,">$destdir/pages/$seqnames{$type}.page"); + open(ITEM,'>',"$destdir/pages/$seqnames{$type}.page"); } else { push @{$seqfiles}, "$seqnames{$type}.sequence"; - open(ITEM,">$destdir/sequences/$seqnames{$type}.sequence"); + open(ITEM,'>',"$destdir/sequences/$seqnames{$type}.sequence"); } if ($type eq 'boards') { @@ -1584,7 +1584,7 @@ sub process_staff { |; - open(FILE,">$destdir/resfiles/$res.html"); + open(FILE,'>',"$destdir/resfiles/$res.html"); push @{$resrcfiles}, "$res.html"; print FILE qq| @@ -1663,7 +1663,7 @@ sub process_link { $linktag .= qq|>$$settings{title}|; } - open(FILE,">$destdir/resfiles/$res.html"); + open(FILE,'>',"$destdir/resfiles/$res.html"); push @{$resrcfiles}, "$res.html"; print FILE qq| @@ -3399,7 +3399,7 @@ sub build_category_sequences { my $curr_id = 0; my $next_id = 1; my $fh; - open($fh,">$destdir/sequences/question_database.sequence"); + open($fh,'>',"$destdir/sequences/question_database.sequence"); push @{$sequencesfiles},'question_database.sequence'; foreach my $category (sort(keys(%{$catinfo}))) { my $seqname; @@ -3465,7 +3465,7 @@ sub build_problem_container { if (!-e "$seqdir") { mkdir("$seqdir",0770); } - open($fh,">$$containerdir"); + open($fh,'>',$$containerdir); $$total{seq} ++; push @{$sequencesfiles},$mapname.'.sequence'; } else { @@ -3473,7 +3473,7 @@ sub build_problem_container { if (!-e "$pagedir") { mkdir("$pagedir",0770); } - open($fh,">$$containerdir"); + open($fh,'>',$$containerdir); $$total{page} ++; push @{$pagesfiles},$mapname.'.page'; } @@ -3931,7 +3931,7 @@ sub write_bb5_questions { $title =~ s/\s/_/g; $title =~ s/\W//g; $title .= '_'.$id; - open(PROB,">$newdir/$title.problem"); + open(PROB,'>',"$newdir/$title.problem"); print PROB $output; close PROB; } else { @@ -4549,7 +4549,7 @@ $$settings{$id}{$list}{jumbledtext}[$k] $title =~ s/\s/_/g; $title =~ s/:/_/g; $title =~ s/\//_/g; - open(PROB,">$destdir/problems/$probdir/$title.problem"); + open(PROB,'>',"$destdir/problems/$probdir/$title.problem"); print PROB $output; close PROB; } else { @@ -4948,7 +4948,7 @@ sub write_bb6_questions { $title =~ s/\s/_/g; $title =~ s/\W//g; $title .= '_'.$id; - open(PROB,">$newdir/$title.problem"); + open(PROB,'>',"$newdir/$title.problem"); print PROB $output; close PROB; } else { @@ -4974,7 +4974,7 @@ sub retrieve_image { if (!-e "$docroot/$res/webimages") { mkdir("$docroot/$res/webimages",0755); } - open(my $fh,">$docroot/$res/webimages/$filename"); + open(my $fh,'>',"$docroot/$res/webimages/$filename"); print $fh $contents; close($fh); if ($context eq 'DOCS') { @@ -5067,7 +5067,7 @@ sub process_announce { } } - open(FILE,">$destdir/resfiles/$res.html"); + open(FILE,'>',"$destdir/resfiles/$res.html"); push @{$resrcfiles}, "$res.html"; print FILE qq| @@ -5273,7 +5273,7 @@ sub process_content { } } - if (!open(FILE,">$destdir/resfiles/$res.html")) { + 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"; @@ -5466,7 +5466,7 @@ sub angel_content { $p->parse_file($xmlfile); $p->eof; if ($type eq "PAGE") { - open(FILE,"<$xmlfile"); + open(FILE,'<',$xmlfile); @buffer = ; close(FILE); chomp(@buffer); @@ -5483,7 +5483,7 @@ sub angel_content { } } } - open(FILE,">$destdir/resfiles/$res.html"); + open(FILE,'>',"$destdir/resfiles/$res.html"); push @{$resrcfiles}, "$res.html"; print FILE qq| @@ -5519,7 +5519,7 @@ sub angel_content { sub webct4_content { my ($res,$docroot,$destdir,$settings,$dom,$user,$type,$title,$resrcfiles) = @_; if (defined($$settings{url})) { - if (!open(FILE,">$destdir/resfiles/$res.html")) { + 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");