Diff for /loncom/imspackages/imsimport.pm between versions 1.45 and 1.47

version 1.45, 2013/09/30 17:42:12 version 1.47, 2015/06/09 21:22:51
Line 57  sub jscript_one { Line 57  sub jscript_one {
     my $end_page =       my $end_page = 
  &Apache::loncommon::end_page({'js_ready' => 1,});   &Apache::loncommon::end_page({'js_ready' => 1,});
   
     my %lt = &Apache::lonlocal::texthash(       my %js_lt = &Apache::lonlocal::texthash( 
                ddir => 'You must choose a destination directory for the import',                 ddir => 'You must choose a destination directory for the import',
                cmss => 'You must choose the Course Management System from which the IMS package was exported',                 cmss => 'You must choose the Course Management System from which the IMS package was exported',
                );
       my %html_lt = &Apache::lonlocal::texthash( 
                loca => 'Location:',                 loca => 'Location:',
                newd => 'New Directory',                 newd => 'New Directory',
                nndi => 'Enter the name of the new directory where you will store the contents of your IMS package.',                 nndi => 'Enter the name of the new directory where you will store the contents of your IMS package.',
                go => 'Go',                  go => 'Go', 
              );               );
       &js_escape(\%js_lt);
       &html_escape(\%html_lt);
     return <<"END_OF_ONE";      return <<"END_OF_ONE";
 function verify() {  function verify() {
  if ((document.forms.$formname.newdir.value == '')  || (!document.forms.$formname.newdir.value)) {   if ((document.forms.$formname.newdir.value == '')  || (!document.forms.$formname.newdir.value)) {
    alert('$lt{'ddir'}')     alert('$js_lt{'ddir'}')
    return false     return false
  }   }
  if (document.forms.$formname.source.selectedIndex == 0) {   if (document.forms.$formname.source.selectedIndex == 0) {
    alert('$lt{'cmss'}');     alert('$js_lt{'cmss'}');
    return false     return false
  }   }
  return true   return true
Line 92  function createWin() { Line 96  function createWin() {
   newWindow.document.write("\\n<img border='0' src='/adm/lonInterFace/author.jpg' alt='[Author Header]' />\\n")    newWindow.document.write("\\n<img border='0' src='/adm/lonInterFace/author.jpg' alt='[Author Header]' />\\n")
   newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' width='600'>\\n")    newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' width='600'>\\n")
   newWindow.document.write("<tr><td width='2'>&nbsp;</td><td width='3'>&nbsp;</td>\\n")    newWindow.document.write("<tr><td width='2'>&nbsp;</td><td width='3'>&nbsp;</td>\\n")
   newWindow.document.write("<td><h3>$lt{'loca'} <tt>$fullpath</tt></h3><h3>$lt{'newd'}</h3></td></tr>\\n")    newWindow.document.write("<td><h3>$html_lt{'loca'} <tt>$fullpath</tt></h3><h3>$html_lt{'newd'}</h3></td></tr>\\n")
   newWindow.document.write("<tr><td width='2'>&nbsp;</td><td width='3'>&nbsp;</td>\\n")    newWindow.document.write("<tr><td width='2'>&nbsp;</td><td width='3'>&nbsp;</td>\\n")
   newWindow.document.write("<td><form name='fileaction' action='/adm/cfile' method='post'>\\n")    newWindow.document.write("<td><form name='fileaction' action='/adm/cfile' method='post'>\\n")
   newWindow.document.write("$lt{'nndi'}<br /><br />")    newWindow.document.write("$html_lt{'nndi'}<br /><br />")
   newWindow.document.write("<input type='hidden' name='filename' value='$fullpath' />")    newWindow.document.write("<input type='hidden' name='filename' value='$fullpath' />")
   newWindow.document.write("<input type='hidden' name='action' value='newdir' />")    newWindow.document.write("<input type='hidden' name='action' value='newdir' />")
   newWindow.document.write("<input type='hidden' name='callingmode' value='imsimport' />")    newWindow.document.write("<input type='hidden' name='callingmode' value='imsimport' />")
   newWindow.document.write("$fullpath<input type='text' name='newfilename' value='' />")    newWindow.document.write("$fullpath<input type='text' name='newfilename' value='' />")
   newWindow.document.write("<input type='button' value='$lt{'go'}' onclick='document.fileaction.submit();' />")    newWindow.document.write("<input type='button' value='$html_lt{'go'}' onclick='document.fileaction.submit();' />")
   newWindow.document.write("</td></tr>\\n")    newWindow.document.write("</td></tr>\\n")
   newWindow.document.write("</table>")    newWindow.document.write("</table>")
   newWindow.document.write('$end_page')    newWindow.document.write('$end_page')
Line 133  sub jscript_two { Line 137  sub jscript_two {
     $course_list = '"'.join('","',@crslist).'"';      $course_list = '"'.join('","',@crslist).'"';
     $$numcrs = @crslist;      $$numcrs = @crslist;
   
     my %lt = &Apache::lonlocal::texthash(      my %js_lt = &Apache::lonlocal::texthash(
                   sel    => 'Please select',                    sel    => 'Please select',
                   impto  => 'Import topics only',                    impto  => 'Import topics only',
                   imptpa => 'Import topics + posts (with author)',                    imptpa => 'Import topics + posts (with author)',
Line 147  sub jscript_two { Line 151  sub jscript_two {
                   errte  => 'You must select a target course when importing enrollment information.',                    errte  => 'You must select a target course when importing enrollment information.',
                   errcc  => 'You must check at least one Content Type.',                    errcc  => 'You must check at least one Content Type.',
        );         );
       &js_escape(\%js_lt);
     return <<"END_OF_TWO";      return <<"END_OF_TWO";
   
 function checkCourse() {  function checkCourse() {
Line 195  function setCourse(step2Form,call) { Line 200  function setCourse(step2Form,call) {
     step2Form.targetcourse.length = 0      step2Form.targetcourse.length = 0
     if (call == 'add') {      if (call == 'add') {
         step2Form.targetcourse.length = 0          step2Form.targetcourse.length = 0
         step2Form.targetcourse.options[0] = new Option("$lt{'sel'}","0",true,true)          step2Form.targetcourse.options[0] = new Option("$js_lt{'sel'}","0",true,true)
         for (var i=0; i<courseID_array.length; i++) {          for (var i=0; i<courseID_array.length; i++) {
             step2Form.targetcourse.options[i+1] = new Option(courseTitle_array[i],courseID_array[i],false,false)              step2Form.targetcourse.options[i+1] = new Option(courseTitle_array[i],courseID_array[i],false,false)
         }          }
Line 215  function setOptions(caller,itemnum) { Line 220  function setOptions(caller,itemnum) {
   opForm.elements[menu].length = 0    opForm.elements[menu].length = 0
   if (opForm.elements[itemnum*2].checked == true) {    if (opForm.elements[itemnum*2].checked == true) {
     if (caller == "board") {      if (caller == "board") {
       opForm.elements[menu].options[0] = new Option("$lt{'sel'}","-1",true,true)        opForm.elements[menu].options[0] = new Option("$js_lt{'sel'}","-1",true,true)
       opForm.elements[menu].options[1] = new Option("$lt{'impto'}","topics",true,true)        opForm.elements[menu].options[1] = new Option("$js_lt{'impto'}","topics",true,true)
       opForm.elements[menu].options[2] = new Option("$lt{'imptpa'}","allpost",true,true)        opForm.elements[menu].options[2] = new Option("$js_lt{'imptpa'}","allpost",true,true)
       opForm.elements[menu].options[3] = new Option("$lt{'imptpn'}","allanon",true,true)        opForm.elements[menu].options[3] = new Option("$js_lt{'imptpn'}","allanon",true,true)
     }      }
     else {       else { 
       if (caller == "users") {        if (caller == "users") {
         opForm.elements[menu].length = 0          opForm.elements[menu].length = 0
         opForm.elements[menu].options[0] = new Option("$lt{'sel'}","-1",true,true)          opForm.elements[menu].options[0] = new Option("$js_lt{'sel'}","-1",true,true)
         opForm.elements[menu].options[1] = new Option("$lt{'enrst'}","students",true,true)          opForm.elements[menu].options[1] = new Option("$js_lt{'enrst'}","students",true,true)
         opForm.elements[menu].options[2] = new Option("$lt{'enrall'}","all",true,true)          opForm.elements[menu].options[2] = new Option("$js_lt{'enrall'}","all",true,true)
       }        }
     }      }
   }    }
   else {    else {
     opForm.elements[menu].options[0] = new Option("$lt{'notreq'}","0",true,true)      opForm.elements[menu].options[0] = new Option("$js_lt{'notreq'}","0",true,true)
   }    }
   opForm.elements[menu].selectedIndex = 0    opForm.elements[menu].selectedIndex = 0
   if (numCrs > 0) {    if (numCrs > 0) {
Line 248  function verify(caller) { Line 253  function verify(caller) {
       totcheck ++        totcheck ++
       if (opForm.elements[2*i].name == "board") {         if (opForm.elements[2*i].name == "board") { 
         if (opForm.elements[2*i+1].selectedIndex == 0) {               if (opForm.elements[2*i+1].selectedIndex == 0) {     
           alert("$lt{'errao'}")            alert("$js_lt{'errao'}")
           return false            return false
         }          }
         if (numCrs == 0) {          if (numCrs == 0) {
Line 257  function verify(caller) { Line 262  function verify(caller) {
         }          }
         else {          else {
           if (opForm.targetcourse.selectedIndex == 0) {            if (opForm.targetcourse.selectedIndex == 0) {
             alert("$lt{'errtd'}")              alert("$js_lt{'errtd'}")
             return false              return false
           }            }
         }          }
       }        }
       if (opForm.elements[2*i].name == "users") {        if (opForm.elements[2*i].name == "users") {
         if (opForm.elements[2*i+1].selectedIndex == 0) {               if (opForm.elements[2*i+1].selectedIndex == 0) {     
           alert("$lt{'errap'}")            alert("$js_lt{'errap'}")
           return false            return false
         }          }
         if (numCrs == 0) {          if (numCrs == 0) {
Line 273  function verify(caller) { Line 278  function verify(caller) {
         }          }
         else {          else {
           if (opForm.targetcourse.selectedIndex == 0) {            if (opForm.targetcourse.selectedIndex == 0) {
             alert("$lt{'errte'}")              alert("$js_lt{'errte'}")
             return false              return false
           }            }
         }          }
Line 281  function verify(caller) { Line 286  function verify(caller) {
     }      }
   }    }
   if (totcheck == 0) {    if (totcheck == 0) {
     alert("$lt{'errcc'}");      alert("$js_lt{'errcc'}");
     return false      return false
   }    }
   return true    return true
Line 378  sub display_two { Line 383  sub display_two {
                             $tempdir,\%resources,\%items,\%hrefs,\%resinfo,                              $tempdir,\%resources,\%items,\%hrefs,\%resinfo,
                             'choose',\%includedres,\%includeditems);                              'choose',\%includedres,\%includeditems);
         if ($manifest_result eq 'ok') {          if ($manifest_result eq 'ok') {
             foreach my $res (sort keys %resources) {              foreach my $res (sort(keys(%resources))) {
                 if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4'                   if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4' 
                     || $cms eq 'webctvista4') {                      || $cms eq 'webctvista4') {
                     foreach my $area (keys %{$$cmsmap{$cms}}) {                      foreach my $area (keys(%{$$cmsmap{$cms}})) {
                         if ($resources{$res}{type} eq $$cmsmap{$cms}{$area}) {                          if ($resources{$res}{type} eq $$cmsmap{$cms}{$area}) {
                             $count{$area} ++;                              $count{$area} ++;
                         }                          }
                     }                      }
                 } elsif ($cms eq 'angel5') {                  } elsif ($cms eq 'angel5') {
                     foreach my $area (keys %{$$cmsmap{$cms}}) {                      foreach my $area (keys(%{$$cmsmap{$cms}})) {
                         if ($area eq 'doc') {                          if ($area eq 'doc') {
                             if (grep/^$resources{$res}{type}$/,@{$$cmsmap{$cms}{doc}}) {                              if (grep/^$resources{$res}{type}$/,@{$$cmsmap{$cms}{doc}}) {
                                 $count{$area} ++;                                  $count{$area} ++;
Line 564  sub display_three { Line 569  sub display_three {
   
     if ($manifest_result eq 'ok') {      if ($manifest_result eq 'ok') {
         my %possibledep;          my %possibledep;
         foreach my $res (sort keys %resources) {          foreach my $res (sort(keys(%resources))) {
             if ($importareas{$resources{$res}{type}}) {              if ($importareas{$resources{$res}{type}}) {
                 $includedres{$res} = 1;                  $includedres{$res} = 1;
                 if ($resources{$res}{type} eq 'webct.manifest' ||                   if ($resources{$res}{type} eq 'webct.manifest' || 
Line 581  sub display_three { Line 586  sub display_three {
                 $includedres{$res} = 1;                  $includedres{$res} = 1;
             }              }
         }          }
         foreach my $itm (sort keys %items) {          foreach my $itm (sort(keys(%items))) {
             &Apache::imsprocessor::get_imports(\%includeditems,\%items,\%resources,\%importareas,$itm);              &Apache::imsprocessor::get_imports(\%includeditems,\%items,\%resources,\%importareas,$itm);
         }          }
     }      }
   
     foreach my $itm (sort keys %includeditems) {      foreach my $itm (sort(keys(%includeditems))) {
         &Apache::imsprocessor::get_parents(\%includeditems,\%items,$itm);          &Apache::imsprocessor::get_parents(\%includeditems,\%items,$itm);
     }      }
   
Line 686  sub get_ccroles { Line 691  sub get_ccroles {
             push @{$courses{$currcode}}, $cdom.'/'.$crs;              push @{$courses{$currcode}}, $cdom.'/'.$crs;
         }          }
     }      }
     foreach my $code (sort @codes) {      foreach my $code (sort(@codes)) {
         foreach my $crsdom (@{$courses{$code}}) {          foreach my $crsdom (@{$courses{$code}}) {
             my ($cdom,$crs) = split/\//,$crsdom;              my ($cdom,$crs) = split/\//,$crsdom;
             my $showcode = '';              my $showcode = '';

Removed from v.1.45  
changed lines
  Added in v.1.47


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