Diff for /loncom/imspackages/imsimport.pm between versions 1.22 and 1.23

version 1.22, 2006/12/05 02:55:54 version 1.23, 2008/08/24 13:48:40
Line 29  use Apache::loncacc; Line 29  use Apache::loncacc;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::imsprocessor;  use Apache::imsprocessor;
   use Apache::lonlocal;
 use HTML::Parser;  use HTML::Parser;
 use HTML::Entities();  use HTML::Entities();
 use Apache::lonlocal;  use Apache::lonlocal;
Line 38  use LONCAPA; Line 39  use LONCAPA;
   
 # ----------------------------------------------------------------  Jscript One  # ----------------------------------------------------------------  Jscript One
 sub jscript_one {  sub jscript_one {
     my ($fullpath,$jsref) = @_;      my ($fullpath,$jsref,$formname) = @_;
   
     my %body_layout = ('rightmargin'  => "0",      my %body_layout = ('rightmargin'  => "0",
        'leftmargin'   => "0",         'leftmargin'   => "0",
Line 53  sub jscript_one { Line 54  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( 
                  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',
                  loca => 'Location:',
                  newd => 'New Directory',
                  nndi => 'Enter the name of the new directory where you will store the contents of your IMS package.',
                  go => 'Go', 
                );
     $$jsref = <<"END_OF_ONE";      $$jsref = <<"END_OF_ONE";
 function verify() {  function verify() {
  if ((document.forms.dataForm.newdir.value == '')  || (!document.forms.dataForm.newdir.value)) {   if ((document.forms.$formname.newdir.value == '')  || (!document.forms.$formname.newdir.value)) {
    alert("You must choose a destination directory for the import")     alert('$lt{'ddir'}')
    return false     return false
  }   }
  if (document.forms.dataForm.source.selectedIndex == 0) {   if (document.forms.$formname.source.selectedIndex == 0) {
    alert("You must choose the Course Management System from which the IMS package was exported");     alert('$lt{'cmss'}');
    return false     return false
  }   }
  return true   return true
Line 68  function verify() { Line 77  function verify() {
   
 function nextPage() {  function nextPage() {
   if (verify()) {    if (verify()) {
     document.forms.dataForm.submit()      document.forms.$formname.submit();
   }    }
 }  }
   
 function createWin() {  function createWin() {
   document.dataForm.newdir.value = "";    document.$formname.newdir.value = "";
   newWindow = window.open("","CreateDir","HEIGHT=400,WIDTH=750,scrollbars=yes")    newWindow = window.open("","CreateDir","HEIGHT=400,WIDTH=750,scrollbars=yes")
   newWindow.document.open()    newWindow.document.open()
   newWindow.document.write('$start_page')    newWindow.document.write('$start_page')
   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' bgcolor='#CCFFDD'>\\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>Location: <tt>$fullpath</tt></h3><h3>New Directory</h3></td></tr>\\n")    newWindow.document.write("<td><h3>$lt{'loca'} <tt>$fullpath</tt></h3><h3>$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("<font face='arial,helvetica,sans-serif'>Enter the name of the new directory where you will store the contents of your IMS package.<br /><br />")    newWindow.document.write("$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='Go' onClick='document.fileaction.submit();' />")    newWindow.document.write("<input type='button' value='$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 278  sub jscript_three { Line 287  sub jscript_three {
   
 # ---------------------------------------------------------------- Display One  # ---------------------------------------------------------------- Display One
 sub display_one {  sub display_one {
     my ($r,$uname,$fn,$fullpath) = @_;      my ($r,$uname,$fn,$fullpath,$formname) = @_;
     $r->print(<<"END_OF_ONE");      $r->print('<form name="'.$formname.'" method="post">'.
 <form name="dataForm" method="post">                &Apache::lonhtmlcommon::topic_bar(1,&mt('Specify the Course Management system used to create the package')).
 <table border='0' bgcolor='#CCFFDD' cellspacing='0' cellpadding ='0' width='100%'>          &mt('Choose the CMS used to create your IMS content package.').'&nbsp;&nbsp;
     <tr>  
      <td colspan='2'>  
       <table border='0' cellspacing='0' cellpadding='0'>  
        <tr>  
         <td colspan='2'  align='left'>&nbsp;  
         </td>  
        </tr>  
        <tr bgcolor='#ccddaa'>  
         <td valign='middle'><img src='/res/adm/pages/bl_step1.gif'>&nbsp;  
         </td>  
         <td width='100%' align='left'>&nbsp;&nbsp;  
          <font face='arial,helvetica,sans-serif'><b>Specify the Course Management system used to create the package.</b>&nbsp;&nbsp;  
          </font>  
        </td>  
       </tr>  
       <tr>  
        <td colspan='2'>&nbsp;</td>  
       </tr>  
       <tr>  
        <td>&nbsp;</td>  
        <td>  
         <font face='Arial,Helvetica,sans-serif'>  
 Please choose the CMS used to create your IMS content package.&nbsp;&nbsp;  
         <select name="source">          <select name="source">
          <option value='-1' selected="true">Please select</option>           <option value="-1" selected="true">Please select</option>
          <option value='bb5'>Blackboard 5</option>           <option value="bb5">Blackboard 5</option>
          <option value='bb6'>Blackboard 6</option>           <option value="bb6">Blackboard 6</option>
          <option value='angel'>ANGEL</option>           <option value="angel">ANGEL</option>
          <option value='webctce4'>WebCT 4 Campus Edition</option>           <option value="webctce4">WebCT 4 Campus Edition</option>
          <option value='webctvista4'>WebCT Vista 4</option>           <option value="webctvista4">WebCT Vista 4</option>
         </select>          </select><br />'."\n".
         </font>          &Apache::lonhtmlcommon::topic_bar(2,&mt('Create a directory where you will unpack your IMS package'))."\n".
        </td>           &mt('Create a destination LON-CAPA directory in which to store the contents of the IMS package file.').'&nbsp;&nbsp;<input type="button" name="createdir" value="Create Directory" onClick="javascript:createWin()" /><input type="hidden" name="newdir" value="" /><br /><br />
       </tr>            <input type="hidden" name="uploaduname" value="'.$uname.'" />
       <tr>            <input type="hidden" name="filename" value="'.$fn.'" />
        <td colspan='2'>&nbsp;</td>  
       </tr>  
       <tr>  
        <td colspan='2'>&nbsp;</td>  
       </tr>  
       <tr bgcolor='#ccddaa'>  
        <td valign='middle'><img src='/res/adm/pages/bl_step2.gif'>  
        </td>  
        <td width='100%' align='left'>&nbsp;&nbsp;  
         <font face='arial,helvetica,sans-serif'><b>Create a directory where you will unpack your IMS package.</b>&nbsp;&nbsp;</font></td>  
       </tr>  
       <tr>  
        <td colspan='2'>&nbsp;</td>  
       </tr>  
        <td>&nbsp;</td>  
        <td>  
         <font face='Arial,Helvetica,sans-serif'>  
 Please choose a destination LON-CAPA directory in which to store the contents of the IMS package file. <input type="button" name="createdir" value="Create Directory" onClick="javascript:createWin()" /><input type="hidden" name="newdir" value="" /></font>  
        </td>  
       </tr>  
       <tr>  
        <td colspan='2'>&nbsp;<br /><br /></td>  
       </tr>  
       <tr>  
        <td>&nbsp;</td>  
        <td><font face='arial,helvetica,sans-serif'>If you have selected the CMS used to create the IMS package, and have created a destination directory, click the 'Proceed' button to continue the IMS package upload process.</font></td>  
       </tr>  
       <tr>  
        <td colspan='2'>  
           <input type="hidden" name="uploaduname" value="$uname" />  
           <input type="hidden" name="filename" value="$fn" />  
           <input type="hidden" name="phase" value="three" />            <input type="hidden" name="phase" value="three" />
        </td>            <input type="button" name="nextpage" value="'.&mt('Proceed').'" onClick="javascript:nextPage();" />&nbsp;&nbsp;&nbsp;&nbsp;
       </tr>            <input type="button" name="exitpage" value="'.&mt('Exit now').'" onClick="javascript:location.href='."'$fullpath'".'" />
       <tr>           </form>');
        <td colspan='2'>&nbsp;</td>  
       </tr>  
       <tr>  
        <td colspan='2'>  
         <table border='0' cellspacing='0' cellpadding='0' width="100%">  
          <tr>  
           <td align='left'>  
            <input type='button' name='exitpage' value='Exit now' onClick="javascript:location.href='$fullpath'" />  
           </td>  
           <td align='right'>  
            <input type="button" name="nextpage" value="Proceed" onClick="javascript:nextPage()" />  
           </td>  
          </tr>  
         </table>  
        </td>  
       </tr>  
      </table>  
     </td>  
    </tr>  
   </table>  
 </form>  
 END_OF_ONE  
 }  }
   
 # ---------------------------------------------------------------- Display Two  # ---------------------------------------------------------------- Display Two
Line 396  sub display_two { Line 329  sub display_two {
     my %hrefs = ();      my %hrefs = ();
     my %resinfo = ();      my %resinfo = ();
     my %count = ();      my %count = ();
     my @bgcolors = ("#eeeeee","#dddddd");  
       my %lt = &Apache::lonlocal::texthash(
                     cont => 'Choose which content types you wish to import',
                     impo => 'Import',
                     type => 'Content type',
                     addo => 'Additional options',
                     chec => 'Check Import first',
                     bbus => 'Choose a course to receive bulletin boards and user enrollment',
                     list => 'A listing of possible course targets will be displayed if import of bulletin boards and/or enrollment is checked above (step 3). If you do not plan to import either of these content types, there is no need to specify a course.',
                     chco => 'Choose course:',
                     nreq => 'Not required',
                     yodo => 'You do not have active course coordinator status in any LON-CAPA courses currently, so bulletin boards and enrollment information included in your IMS package will be discarded, regardless of your import choice for these two items above (step 3).',
                     ifyo => "If you wish to import bulletin boards and/or user information into LON-CAPA please click 'Exit now' to quit the current IMS import process, and contact your domain coordinator and request a course coordinator role in a LON-CAPA course into which you can upload bulletin boards and/or enroll users.",
                     impa => 'Import package',
                     unpa => 'Unpacking of your IMS package failed because an IMS manifest file was not located in the package',
                     proc => 'Processing of your IMS package failed because the file you uploaded could not be unzipped',
                     exit => 'Exit now',
       );
   
     my $counter = 0;      my $counter = 0;
     my $iter = 0;      my $iter = 0;
Line 413  sub display_two { Line 363  sub display_two {
                 users => 0,                  users => 0,
                 );                  );
     my $conditions;      my $conditions;
   
     if ($unzip_result eq 'ok') {      if ($unzip_result eq 'ok') {
         $manifest_result = &Apache::imsprocessor::process_manifest($cms,          $manifest_result = &Apache::imsprocessor::process_manifest($cms,
                             $tempdir,\%resources,\%items,\%hrefs,\%resinfo,                              $tempdir,\%resources,\%items,\%hrefs,\%resinfo,
Line 451  sub display_two { Line 400  sub display_two {
                 $conditions = 'none';                  $conditions = 'none';
             }              }
   
             $r->print(<<ENDBLOCK);              $r->print('<form name="pickoptions" method="post">'.
 <form name="pickoptions" method="post">                        &Apache::lonhtmlcommon::topic_bar(3,$lt{'cont'}).
   <table border='0' cellspacing='0' cellpadding ='0' width='100%'>                        &Apache::loncommon::start_data_table().
    <tr>                        &Apache::loncommon::start_data_table_header_row().
     <td colspan='2'>                        '<th>'.$lt{'impo'}.'</th><th>'.$lt{'cont'}.'</th><th>'.
      <table border='0' cellspacing='0' cellpadding='0'>                        $lt{'addo'}.'</th>'.
       <tr>                        &Apache::loncommon::end_data_table_header_row());
        <td colspan='2'  align='left'>&nbsp;  
        </td>  
       </tr>  
       <tr bgcolor='#ccddaa'>  
        <td valign='middle'><img src='/res/adm/pages/bl_step3.gif'>  
        </td>  
        <td width='100%' align='left'>&nbsp;&nbsp;  
         <font face='arial,helvetica,sans-serif'><b>Choose which content types you wish to import</b></font>  
        </td>  
       </tr>  
       <tr>  
        <td colspan='2'>&nbsp;</td>  
       </tr>  
       <tr>  
        <td>&nbsp;</td>  
        <td>  
         <table border='0' cellspacing='0' cellpadding='1' bgcolor='#000000'>  
          <tr>  
           <td>  
            <table border='0' cellspacing='0' cellpadding='0' bgcolor='#ffffff' width='100%'>  
             <tr>  
              <td>  
               <table border='0' cellspacing='1' cellpadding='1' bgcolor='#ffffff' width='100%'>  
                <tr bgcolor='#ccddaa'>  
                 <td align='center'><font face='arial,helvetica,sans-serif'><b>Import?</b></font></td>             
                 <td align='center'><font face='arial,helvetica,sans-serif'><b>Content type</b></font></td>  
                 <td align='center'><font face='arial,helvetica,sans-serif'><b>Additional options</b></font></td>  
                </tr>  
 ENDBLOCK  
             foreach my $area (@{$areas}) {              foreach my $area (@{$areas}) {
                 if ($count{$area} > 0) {                  if ($count{$area} > 0) {
                     my $count_tag = 'flag_'.$counter;                      my $count_tag = 'flag_'.$counter;
                     $r->print("               <tr bgcolor='@bgcolors[$iter]'>                      $r->print(&Apache::loncommon::start_data_table_row()."\n".
                 <td align='left'><font face='arial,helvetica,sans-serif'><input name='$area' type='checkbox' ");                                '<td><input name="'.$area.'" type="checkbox" ');
                     if ($area eq 'board' || $area eq 'users') {                      if ($area eq 'board' || $area eq 'users') {
                         $r->print(qq|onClick='javascript:setOptions("$area","$counter")'|);                          $r->print('onClick="javascript:setOptions('."'$area','$counter'".');" ');
                     }                      }
                     $r->print("/></font></td>                      $r->print('/></td>'.
                 <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;$$areaname{$area}&nbsp;&nbsp; - $count{$area} item(s)</font></td>");                                '<td>&nbsp;&nbsp;'.$$areaname{$area}.'&nbsp;&nbsp; - '.
                                 &mt('[quant,_1,item]',$count{$area}).'</td>');
                     if ($area eq 'board') {                      if ($area eq 'board') {
                         $r->print("            <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;                          $r->print('<td>&nbsp;&nbsp;
                  <select name='db_handling'>                   <select name="db_handling">
                   <option value='-2'>&lt;-- Check Import first</option>                    <option value="-2">&lt;-- '.$lt{'chec'}.'</option>
                  </select></font>                   </select>
                 </td>");                  </td>');
                     } elsif ($area eq 'users') {                      } elsif ($area eq 'users') {
                         $r->print("            <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;                          $r->print('<td>&nbsp;&nbsp;
                  <select name='user_handling'>                   <select name="user_handling">
                   <option value='-2'>&lt;-- Check Import first</option>                    <option value="-2">&lt;-- '.$lt{'chec'}.'</option>
                  </select>                   </select>
                  </font>                          </td>');
                 </td>");  
                     } else {                      } else {
                         $r->print("            <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;None<input type='hidden' name='$count_tag' /></font></td>");                          $r->print('<td>&nbsp;&nbsp;'.&mt('None')."\n".
                                     '<input type="hidden" name="'.$count_tag.'" /></td>');
                     }                      }
                     $counter ++;                      $counter ++;
                     $iter = $counter%2;                      $r->print(&Apache::loncommon::end_data_table_row());
                 }                  }
             }              }
             $r->print(<<ENDBLOCKTWO);              $r->print(&Apache::loncommon::end_data_table());
                </tr>  
               </table>  
              </td>  
             </tr>  
            </table>  
           </td>  
          </tr>  
         </table>  
        </td>  
       </tr>  
       <tr>  
        <td colspan='2'  align='left'>&nbsp;  
        </td>  
       </tr>  
 ENDBLOCKTWO  
             if ($count{board} + $count{users} > 0) {              if ($count{board} + $count{users} > 0) {
                 $r->print("                  $r->print(&Apache::lonhtmlcommon::topic_bar(4,$lt{'bbus'}));
       <tr bgcolor='#ccddaa'>  
        <td valign='middle'><img src='/res/adm/pages/bl_step4.gif'>  
        </td>  
        <td width='100%' align='left'>&nbsp;&nbsp;  
         <font face='arial,helvetica,sans-serif'><b>Choose a course to receive bulletin boards and user enrollment.</b></font>  
        </td>  
       </tr>  
       <tr>  
        <td colspan='2'>&nbsp;</td>  
       </tr>  
                 ");  
                 if ($$numcrs > 0) {                  if ($$numcrs > 0) {
                     $r->print("      <tr>                      $r->print($lt{'list'}.'<br /><br />'.$lt{'chco'}.'&nbsp;&nbsp;'."\n".
        <td>&nbsp;</td>                                '<select name="targetcourse">
        <td><font face='arial,helvetica,sans-serif'>A listing of possible course targets will be displayed if import of bulletin boards and/or enrollment is checked above (step 3). If you do not plan to import either of these content types, there is no need to specify a course.                                  <option value="-1">'.$lt{'nreq'}.'</option>
 <br /><br />                                 </select>');
 Choose course:&nbsp;&nbsp;  
                  <select name='targetcourse'>  
                   <option value='-1'>Not required</option>  
                  </select></font>  
        </td>  
       </tr>  
 ");  
                 } else {                  } else {
                     $r->print("       <tr>                      $r->print($lt{'yodo'}.' '.$lt{'ifyo'});
 <td>&nbsp;</td>                  }
 <td><font face='arial,helvetica,sans-serif'>You do not have active course coordinator status in any LON-CAPA courses currently, so bulletin boards and enrollment information included in your IMS package will be discarded, regardless of your import choice for these two items above (step 3). If you wish to import bulletin boards and/or user information into LON-CAPA please click 'Exit now' to quit the current IMS import process, and contact your domain coordinator and request a course coordinator role in a LON-CAPA course into which you can upload bulletin boards and/or enroll users.</font>              }
         ");              $r->print('<br /><br />
                 }            <input type="hidden" name="newdir" value="'.$env{'form.newdir'}.'" />
             }            <input type="hidden" name="conditions" value="'.$conditions.'" />
             $r->print(<<ENDBLOCK);            <input type="hidden" name="source" value="'.$cms.'" />
       <tr>            <input type="hidden" name="tempdir" value="'.$tempdir.'" />
        <td colspan='2'>&nbsp;<br /><br /></td>            <input type="hidden" name="uploaduname" value="'.$uname.'">
       </tr>            <input type="hidden" name="filename" value="'.$fname.'">
       <tr>            <input type="hidden" name="phase" value="four" />'."\n");
        <td>&nbsp;</td>  
        <td><font face='arial,helvetica,sans-serif'>Once you have checked the checkboxes for all areas you wish to import from the IMS package, and selected additional options (if available) you should click the 'Import package' button.</font></td>  
       </tr>  
       <tr>  
        <td colspan='2'>&nbsp;  
           <input type="hidden" name="newdir" value="$env{'form.newdir'}" />  
           <input type="hidden" name="conditions" value="$conditions" />  
           <input type="hidden" name="source" value="$cms" />  
           <input type="hidden" name="tempdir" value="$tempdir" />  
           <input type="hidden" name="uploaduname" value="$uname">  
           <input type="hidden" name="filename" value="$fname">  
           <input type="hidden" name="phase" value="four" />  
 ENDBLOCK  
             if ($count{board} == 0) {              if ($count{board} == 0) {
                 $r->print('            <input type="hidden" name="board" value="" />'."\n");                  $r->print('<input type="hidden" name="board" value="" />'."\n");
             }              }
             if ($count{users} == 0) {              if ($count{users} == 0) {
                 $r->print('            <input type="hidden" name="users" value="" />'."\n");                  $r->print('<input type="hidden" name="users" value="" />'."\n");
             }              }
             $r->print(<<ENDDOCUMENT);              $r->print('<input type="button" name="nextpage" value="'.$lt{'impa'}.'" onClick="javascript:nextPage('."'$counter.'".')" />&nbsp;&nbsp;&nbsp;
        </td>             <input type="button" name="exitpage" value="'.$lt{'exit'}.'" onClick="javascript:location.href='."'$fullpath'".'" /></form>');
       </tr>  
       <tr>  
        <td colspan='2'>  
         <table border='0' cellspacing='0' cellpadding='0' width="100%">  
          <tr>  
           <td align='left'>  
            <input type='button' name='exitpage' value='Exit now' onClick="javascript:location.href='$fullpath'" />  
           </td>  
           <td align='right'>  
            <input type="button" name="nextpage" value="Import package" onClick="javascript:nextPage($counter)" />  
           </td>  
          </tr>  
         </table>  
        </td>  
       </tr>  
      </table>  
     </td>  
    </tr>  
   </table>  
 ENDDOCUMENT  
         } else {          } else {
             $r->print("Unpacking of your IMS package failed because an IMS manifest file was not located in the package\n");              $r->print($lt{'unpa'});
         }          }
     } else {      } else {
         $r->print("Processing of your IMS package failed because the file you uploaded could not be unzipped\n");          $r->print($lt{'proc'});
     }      }
 }  }
   
Line 655  sub display_three { Line 510  sub display_three {
                    board => 0,                              board => 0,         
                    quiz => 0,                     quiz => 0,
                    surv => 0,                     surv => 0,
                      file => 0,
     );      );
   
     my @pages = ();      my @pages = ();
Line 681  sub display_three { Line 537  sub display_three {
         }          }
     }      }
   
       my %lt = &Apache::lonlocal::texthash (
                    yims => 'Your IMS package has been processed successfully.',
                    plsv => 'Please view the imported items and use the LON-CAPA editing tools to make changes.',
                    tseq => "The sequences directory contains a file named 'Top.sequence' which includes links to the items found at the top level of your IMS package. From there you can follow links to display all the imported items. Alternatively, you can browse the pages, sequences, problems and resfiles directories directly. Note if you rename a file, you will need to modify any .sequence files or .page files which include a reference to the renamed file.",
                    tfin => 'The final step in the IMS import process is to publish the materials you have imported into your Construction Space so that you can use them in a course. Once your files are published, subsequent re-publication will result in the storage of information about changes between the different versions.',
                    disp => 'Display new directory',
                    proc => 'Processing of your IMS package failed, because the IMS content package did not contain an IMS manifest file.'
                );
     my $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,      my $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,
                           \%resources,\%items,\%hrefs,\%resinfo,'prepare',                            \%resources,\%items,\%hrefs,\%resinfo,'prepare',
                           \%includedres);                            \%includedres);
Line 725  sub display_three { Line 589  sub display_three {
   
         &Apache::imsprocessor::process_resinfo($cms,'CSTR',$tempdir,$destdir,\%items,\%resources,\@targets,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$seqstem,$seqstem,\@resrcfiles,\@packages,\%hrefs,\@pages,\@sequences,\%randompicks);          &Apache::imsprocessor::process_resinfo($cms,'CSTR',$tempdir,$destdir,\%items,\%resources,\@targets,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$seqstem,$seqstem,\@resrcfiles,\@packages,\%hrefs,\@pages,\@sequences,\%randompicks);
   
         my $copy_result = &Apache::imsprocessor::copy_resources('CSTR',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\%importareas,\@assessmentfiles);          my $copy_result = &Apache::imsprocessor::copy_resources('CSTR',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\@assessmentfiles,\%total);
         
         &Apache::imsprocessor::build_structure($cms,'CSTR',$destdir,\%items,\%resinfo,\%resources,\@targets,\%hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames,\@packages,\%includeditems,\%randompicks);          &Apache::imsprocessor::build_structure($cms,'CSTR',$destdir,\%items,\%resinfo,\%resources,\@targets,\%hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames,\@packages,\%includeditems,\%randompicks);
   
         $r->print("<h3>IMS import completed</h3>");          $r->print("<h3>IMS import completed</h3>");
   
         if ($cms eq 'bb5') {          if ($cms eq 'angel') {
             $r->print("<font face='arial,helvetica,sans-serif'>Your IMS package has been processed successfully. A total of $total{seq} sequences, $total{page} pages, $total{board} bulletin boards, $total{quiz} quizzes, $total{surv} surveys and $total{prob} problems have been created.<br /><br />\n");              $r->print($lt{'yims'}.' '.&mt('A total of [quant,_1,sequence], [quant,_2,composite page], and [quant,_3,bulletin board] have been created, and [quant,_4,file] copied.',$total{seq},$total{page},$total{board},$total{file})."\n");
         } elsif ($cms eq 'angel') {          } else {
             $r->print("<font face='arial,helvetica,sans-serif'>Your IMS package has been processed successfully. A total of $total{seq} sequences, $total{page} pages, and $total{board} bulletin boards have been created.<br /><br />\n");              $r->print($lt{'yims'}.' '.&mt('A total of [quant,_1,sequence], [quant,_2,composite page], [quant,_3,bulletin board], [quant,_4,quiz,quizzes], [quant,_5,survey], and [quant,_6,problem] have been created, and [quant,_7,file] copied.',$total{seq},$total{page},$total{board},$total{quiz},$total{surv},$total{prob},$total{file})."\n");
         }          }
        $r->print("Please view the imported items and use the LON-CAPA editing tools to make changes.  The sequences directory contains a file named 'Top.sequence' which includes links to the items found at the top level of your IMS package. From there you can follow links to display all the imported items. Alternatively, you can browse the pages, sequences, problems and resfiles directories directly. Note if you rename a file, you will need to modify any .sequence files or .page files which include a reference to the renamed file.<br /><br />The final step in the IMS import process is to publish the materials you have imported into your Construction Space so that you can use them in a course. Once your file are published, subsequent re-publication will result in the storage of information about changes between the different versions.<br /><br /><a href='/priv/".$uname."/".$newdir."'>Display new directory</a></font>");           $r->print('<br /><br />'.$lt{'plsv'}.' '.$lt{'tseq'}.'<br /><br />'.$lt{'tfin'}.'<br /><br /><a href="/priv/'.$uname.'/'.$newdir.'">'.$lt{'disp'}.'</a>');
         if ($destdir =~ m-^/home/$uname/public_html/-) {           if ($destdir =~ m-^/home/$uname/public_html/-) {
             system (" rm -r -f $destdir/temp");              system (" rm -r -f $destdir/temp");
         }          }
     } elsif ($manifest_result eq 'nomanifest') {      } elsif ($manifest_result eq 'nomanifest') {
         $r->print("<font face='arial,helvetica,sans-serif'>Processing of your IMS package failed, because the IMS content package did not contain an IMS manifest file.</font>");          $r->print($lt{'proc'});
     }      }
 }  }
   
Line 880  sub handler { Line 744  sub handler {
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
   
       my $formname_one = 'info';
     if ($env{'form.phase'} eq 'two') {      if ($env{'form.phase'} eq 'two') {
         &jscript_one($fullpath,\$javascript,$uname,$udom);          &jscript_one($fullpath,\$javascript,$formname_one);
     } elsif ($env{'form.phase'} eq 'three') {      } elsif ($env{'form.phase'} eq 'three') {
         &jscript_two(\$javascript,$user,$dom,\$numcrs);          &jscript_two(\$javascript,$user,$dom,\$numcrs);
     } elsif ($env{'form.phase'} eq 'four') {      } elsif ($env{'form.phase'} eq 'four') {
Line 899  sub handler { Line 764  sub handler {
     if ($env{'form.phase'} eq 'two') {      if ($env{'form.phase'} eq 'two') {
         my $flag = &Apache::lonupload::phasetwo($r,$fn,$uname,$udom,'imsimport');          my $flag = &Apache::lonupload::phasetwo($r,$fn,$uname,$udom,'imsimport');
         if ($flag eq 'ok') {          if ($flag eq 'ok') {
             &display_one($r,$uname,$fn,$fullpath);              &display_one($r,$uname,$fn,$fullpath,$formname_one);
         }          }
     } elsif ( ($env{'form.phase'} eq 'three') || ($env{'form.phase'} eq 'four') ) {      } elsif ( ($env{'form.phase'} eq 'three') || ($env{'form.phase'} eq 'four') ) {
         my $docroot = $env{'form.newdir'};          my $docroot = $env{'form.newdir'};

Removed from v.1.22  
changed lines
  Added in v.1.23


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