Diff for /loncom/imspackages/imsprocessor.pm between versions 1.57 and 1.58

version 1.57, 2018/05/02 17:08:40 version 1.58, 2018/05/02 19:34:58
Line 994  sub build_structure { Line 994  sub build_structure {
                 $seqtext{$key} .= "</map>\n";                  $seqtext{$key} .= "</map>\n";
                 if ($cms eq 'webctce4' && $key ne 'Top') {                  if ($cms eq 'webctce4' && $key ne 'Top') {
                     push @{$seqfiles}, "$seqtitle.sequence";                      push @{$seqfiles}, "$seqtitle.sequence";
                     open(LOCFILE,">$destdir/sequences/$seqtitle.sequence");                      open(LOCFILE,'>',"$destdir/sequences/$seqtitle.sequence");
                 } else {                  } else {
                     push @{$seqfiles}, "$key.sequence";                      push @{$seqfiles}, "$key.sequence";
                     open(LOCFILE,">$destdir/sequences/$key.sequence");                      open(LOCFILE,'>',"$destdir/sequences/$key.sequence");
                 }                  }
                 print LOCFILE $seqtext{$key};                  print LOCFILE $seqtext{$key};
                 close(LOCFILE);                  close(LOCFILE);
Line 1027  sub build_structure { Line 1027  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);              &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'} .= "</map>\n";          $seqtext{'Top'} .= "</map>\n";
         open(TOPFILE,">$destdir/sequences/Top.sequence");          open(TOPFILE,'>',"$destdir/sequences/Top.sequence");
         print TOPFILE $seqtext{'Top'};          print TOPFILE $seqtext{'Top'};
         close(TOPFILE);          close(TOPFILE);
         push @{$seqfiles}, 'Top.sequence';          push @{$seqfiles}, 'Top.sequence';
Line 1049  sub build_structure { Line 1049  sub build_structure {
             if (grep/^$res$/,@{$packages}) {              if (grep/^$res$/,@{$packages}) {
                 $resource =  $filestem.'/resfiles/'.$res.'./index.html'; # should be entry_point                  $resource =  $filestem.'/resfiles/'.$res.'./index.html'; # should be entry_point
             }              }
             open(PAGEFILE,">$filename");              open(PAGEFILE,'>',$filename);
             print PAGEFILE qq|<map>              print PAGEFILE qq|<map>
 <resource src="$resource" id="1" type="start" title="$$items{$pagecontents{$key}[$i][0]}{title}"></resource>  <resource src="$resource" id="1" type="start" title="$$items{$pagecontents{$key}[$i][0]}{title}"></resource>
 <link to="2" index="1" from="1">\n|;  <link to="2" index="1" from="1">\n|;
Line 1238  sub process_specials { Line 1238  sub process_specials {
   
     if ($type eq "announcements") {      if ($type eq "announcements") {
         push @{$pagesfiles}, "$seqnames{$type}.page";          push @{$pagesfiles}, "$seqnames{$type}.page";
         open(ITEM,">$destdir/pages/$seqnames{$type}.page");          open(ITEM,'>',"$destdir/pages/$seqnames{$type}.page");
     } else {      } else {
         push @{$seqfiles}, "$seqnames{$type}.sequence";          push @{$seqfiles}, "$seqnames{$type}.sequence";
         open(ITEM,">$destdir/sequences/$seqnames{$type}.sequence");          open(ITEM,'>',"$destdir/sequences/$seqnames{$type}.sequence");
     }      }
   
     if ($type eq 'boards') {      if ($type eq 'boards') {
Line 1584  sub process_staff { Line 1584  sub process_staff {
   </tr>    </tr>
 </table>  </table>
     |;      |;
     open(FILE,">$destdir/resfiles/$res.html");      open(FILE,'>',"$destdir/resfiles/$res.html");
     push @{$resrcfiles}, "$res.html";      push @{$resrcfiles}, "$res.html";
     print FILE qq|<html>      print FILE qq|<html>
 <head>  <head>
Line 1663  sub process_link { Line 1663  sub process_link {
         $linktag .= qq|>$$settings{title}</a>|;          $linktag .= qq|>$$settings{title}</a>|;
     }      }
   
     open(FILE,">$destdir/resfiles/$res.html");      open(FILE,'>',"$destdir/resfiles/$res.html");
     push @{$resrcfiles}, "$res.html";      push @{$resrcfiles}, "$res.html";
     print FILE qq|<html>      print FILE qq|<html>
 <head>  <head>
Line 3399  sub build_category_sequences { Line 3399  sub build_category_sequences {
     my $curr_id = 0;      my $curr_id = 0;
     my $next_id = 1;      my $next_id = 1;
     my $fh;      my $fh;
     open($fh,">$destdir/sequences/question_database.sequence");      open($fh,'>',"$destdir/sequences/question_database.sequence");
     push @{$sequencesfiles},'question_database.sequence';      push @{$sequencesfiles},'question_database.sequence';
     foreach my $category (sort(keys(%{$catinfo}))) {      foreach my $category (sort(keys(%{$catinfo}))) {
         my $seqname;          my $seqname;
Line 3465  sub build_problem_container { Line 3465  sub build_problem_container {
         if (!-e "$seqdir") {          if (!-e "$seqdir") {
             mkdir("$seqdir",0770);              mkdir("$seqdir",0770);
         }          }
         open($fh,">$$containerdir");          open($fh,'>',$$containerdir);
         $$total{seq} ++;          $$total{seq} ++;
         push @{$sequencesfiles},$mapname.'.sequence';          push @{$sequencesfiles},$mapname.'.sequence';
     } else {      } else {
Line 3473  sub build_problem_container { Line 3473  sub build_problem_container {
         if (!-e "$pagedir") {          if (!-e "$pagedir") {
             mkdir("$pagedir",0770);              mkdir("$pagedir",0770);
         }          }
         open($fh,">$$containerdir");          open($fh,'>',$$containerdir);
         $$total{page} ++;          $$total{page} ++;
         push @{$pagesfiles},$mapname.'.page';          push @{$pagesfiles},$mapname.'.page';
     }      }
Line 3931  sub write_bb5_questions { Line 3931  sub write_bb5_questions {
             $title =~ s/\s/_/g;              $title =~ s/\s/_/g;
             $title =~ s/\W//g;              $title =~ s/\W//g;
             $title .= '_'.$id;              $title .= '_'.$id;
             open(PROB,">$newdir/$title.problem");              open(PROB,'>',"$newdir/$title.problem");
             print PROB $output;              print PROB $output;
             close PROB;              close PROB;
         } else {          } else {
Line 4549  $$settings{$id}{$list}{jumbledtext}[$k] Line 4549  $$settings{$id}{$list}{jumbledtext}[$k]
             $title =~ s/\s/_/g;              $title =~ s/\s/_/g;
             $title =~ s/:/_/g;              $title =~ 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;              print PROB $output;
             close PROB;              close PROB;
         } else {          } else {
Line 4948  sub write_bb6_questions { Line 4948  sub write_bb6_questions {
             $title =~ s/\s/_/g;              $title =~ s/\s/_/g;
             $title =~ s/\W//g;              $title =~ s/\W//g;
             $title .= '_'.$id;              $title .= '_'.$id;
             open(PROB,">$newdir/$title.problem");              open(PROB,'>',"$newdir/$title.problem");
             print PROB $output;              print PROB $output;
             close PROB;              close PROB;
         } else {          } else {
Line 4974  sub retrieve_image { Line 4974  sub retrieve_image {
         if (!-e "$docroot/$res/webimages") {          if (!-e "$docroot/$res/webimages") {
             mkdir("$docroot/$res/webimages",0755);              mkdir("$docroot/$res/webimages",0755);
         }          }
         open(my $fh,">$docroot/$res/webimages/$filename");          open(my $fh,'>',"$docroot/$res/webimages/$filename");
         print $fh $contents;          print $fh $contents;
         close($fh);          close($fh);
         if ($context eq 'DOCS') {          if ($context eq 'DOCS') {
Line 5067  sub process_announce { Line 5067  sub process_announce {
         }          }
     }      }
   
     open(FILE,">$destdir/resfiles/$res.html");      open(FILE,'>',"$destdir/resfiles/$res.html");
     push @{$resrcfiles}, "$res.html";      push @{$resrcfiles}, "$res.html";
     print FILE qq|<html>      print FILE qq|<html>
 <head>  <head>
Line 5273  sub process_content { Line 5273  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 - $!");          &Apache::lonnet::logthis("IMS import error: Cannot open file - $destdir/resfiles/$res.html - $!");
     } else {      } else {
         push @{$resrcfiles}, "$res.html";          push @{$resrcfiles}, "$res.html";
Line 5466  sub angel_content { Line 5466  sub angel_content {
     $p->parse_file($xmlfile);      $p->parse_file($xmlfile);
     $p->eof;      $p->eof;
     if ($type eq "PAGE") {      if ($type eq "PAGE") {
         open(FILE,"<$xmlfile");          open(FILE,'<',$xmlfile);
         @buffer = <FILE>;          @buffer = <FILE>;
         close(FILE);          close(FILE);
         chomp(@buffer);          chomp(@buffer);
Line 5483  sub angel_content { Line 5483  sub angel_content {
             }              }
         }          }
     }      }
     open(FILE,">$destdir/resfiles/$res.html");      open(FILE,'>',"$destdir/resfiles/$res.html");
     push @{$resrcfiles}, "$res.html";      push @{$resrcfiles}, "$res.html";
     print FILE qq|<html>      print FILE qq|<html>
 <head>  <head>
Line 5519  sub angel_content { Line 5519  sub angel_content {
 sub webct4_content {  sub webct4_content {
     my ($res,$docroot,$destdir,$settings,$dom,$user,$type,$title,$resrcfiles) = @_;      my ($res,$docroot,$destdir,$settings,$dom,$user,$type,$title,$resrcfiles) = @_;
     if (defined($$settings{url})) {      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 - $!");              &Apache::lonnet::logthis("IMS import error: Cannot open file - $destdir/resfiles/$res.html - $!");
         } else {          } else {
             push(@{$resrcfiles}, "$res.html");              push(@{$resrcfiles}, "$res.html");

Removed from v.1.57  
changed lines
  Added in v.1.58


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>