Diff for /loncom/imspackages/imsimport.pm between versions 1.40 and 1.43

version 1.40, 2013/07/02 19:04:42 version 1.43, 2013/07/27 22:04:49
Line 100  function createWin() { Line 100  function createWin() {
   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='$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 286  END_OF_TWO Line 286  END_OF_TWO
 # ---------------------------------------------------------------- Display One  # ---------------------------------------------------------------- Display One
 sub display_one {  sub display_one {
     my ($r,$fn,$fullpath,$formname) = @_;      my ($r,$fn,$fullpath,$formname) = @_;
     $r->print('<form name="'.$formname.'" method="post">'.      $r->print('<form name="'.$formname.'" method="post" action="">'.
               &Apache::lonhtmlcommon::topic_bar(1,&mt('Specify the Course Management system used to create the package')).                &Apache::lonhtmlcommon::topic_bar(1,&mt('Specify the Course Management system used to create the package')).
         &mt('Choose the CMS used to create your IMS content package.').'&nbsp;&nbsp;          &mt('Choose the CMS used to create your IMS content package.').'&nbsp;&nbsp;
         <select name="source">          <select name="source">
Line 298  sub display_one { Line 298  sub display_one {
          <option value="webctvista4">WebCT Vista 4</option>           <option value="webctvista4">WebCT Vista 4</option>
         </select><br />'."\n".          </select><br />'."\n".
         &Apache::lonhtmlcommon::topic_bar(2,&mt('Create a directory where you will unpack your IMS package'))."\n".          &Apache::lonhtmlcommon::topic_bar(2,&mt('Create a directory where you will unpack your IMS package'))."\n".
          &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 />           &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 />
           <input type="hidden" name="filename" value="'.$fn.'" />            <input type="hidden" name="filename" value="'.$fn.'" />
           <input type="hidden" name="phase" value="three" />            <input type="hidden" name="phase" value="three" />
           <input type="button" name="nextpage" value="'.&mt('Proceed').'" onClick="javascript:nextPage();" />&nbsp;&nbsp;&nbsp;&nbsp;            <input type="button" name="nextpage" value="'.&mt('Proceed').'" onclick="javascript:nextPage();" />&nbsp;&nbsp;&nbsp;&nbsp;
           <input type="button" name="exitpage" value="'.&mt('Exit now').'" onClick="javascript:location.href='."'$fullpath'".'" />            <input type="button" name="exitpage" value="'.&mt('Exit now').'" onclick="javascript:location.href='."'$fullpath'".'" />
          </form>');           </form>');
 }  }
   
Line 396  sub display_two { Line 396  sub display_two {
                 $conditions = 'none';                  $conditions = 'none';
             }              }
   
             $r->print('<form name="pickoptions" method="post">'.              $r->print('<form name="pickoptions" method="post" action="">'.
                       &Apache::lonhtmlcommon::topic_bar(3,$lt{'cont'}).                        &Apache::lonhtmlcommon::topic_bar(3,$lt{'cont'}).
                       &Apache::loncommon::start_data_table().                        &Apache::loncommon::start_data_table().
                       &Apache::loncommon::start_data_table_header_row().                        &Apache::loncommon::start_data_table_header_row().
Line 409  sub display_two { Line 409  sub display_two {
                     $r->print(&Apache::loncommon::start_data_table_row()."\n".                      $r->print(&Apache::loncommon::start_data_table_row()."\n".
                               '<td><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('onClick="javascript:setOptions('."'$area','$counter'".');" ');                          $r->print('onclick="javascript:setOptions('."'$area','$counter'".');" ');
                     }                      }
                     $r->print('/></td>'.                      $r->print('/></td>'.
                               '<td>&nbsp;&nbsp;'.$$areaname{$area}.'&nbsp;&nbsp; - '.                                '<td>&nbsp;&nbsp;'.$$areaname{$area}.'&nbsp;&nbsp; - '.
Line 459  sub display_two { Line 459  sub display_two {
             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('<input type="button" name="nextpage" value="'.$lt{'impa'}.'" onClick="javascript:nextPage('."'$counter.'".')" />&nbsp;&nbsp;&nbsp;              $r->print('<input type="button" name="nextpage" value="'.$lt{'impa'}.'" onclick="javascript:nextPage('."'$counter.'".')" />&nbsp;&nbsp;&nbsp;
            <input type="button" name="exitpage" value="'.$lt{'exit'}.'" onClick="javascript:location.href='."'$fullpath'".'" /></form>');             <input type="button" name="exitpage" value="'.$lt{'exit'}.'" onclick="javascript:location.href='."'$fullpath'".'" /></form>');
         } else {          } else {
             $r->print($lt{'unpa'});              $r->print($lt{'unpa'});
         }          }
Line 543  sub display_three { Line 543  sub display_three {
     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);
   
     if ($manifest_result eq 'ok') {      if ($manifest_result eq 'ok') {
           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;
Line 552  sub display_three { Line 554  sub display_three {
                      $resources{$res}{type} eq 'webct.question') {                       $resources{$res}{type} eq 'webct.question') {
                     push(@assessmentfiles,$res);                      push(@assessmentfiles,$res);
                 }                     }   
               } elsif ($resources{$res}{usedby}) {
                   $possibledep{$res} = 1;
               }
           }
           foreach my $res (sort(keys(%possibledep))) {
               if ($includedres{$resources{$res}{usedby}}) {
                   $includedres{$res} = 1;
             }              }
         }          }
         foreach my $itm (sort keys %items) {          foreach my $itm (sort keys %items) {
Line 566  sub display_three { Line 575  sub display_three {
     $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,      $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,
                        \%resources,\%items,\%hrefs,\%resinfo,'build',                         \%resources,\%items,\%hrefs,\%resinfo,'build',
                        \%includedres,\%includeditems);                         \%includedres,\%includeditems);
   
     if ($manifest_result eq 'ok') {      if ($manifest_result eq 'ok') {
         &Apache::imsprocessor::target_resources(\%resources,\%importareas,\@targets);          &Apache::imsprocessor::target_resources(\%resources,\%importareas,\@targets);
   
Line 584  sub display_three { Line 594  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,\@assessmentfiles,\%total);          my $copy_result = &Apache::imsprocessor::copy_resources('CSTR',$cms,\%hrefs,\%resources,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\@assessmentfiles,\%total);
         
         &Apache::imsprocessor::build_structure($cms,'CSTR',$destdir,\%items,\%resinfo,\%resources,\@targets,\%hrefs,$udom,$uname,$dirpath,$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,$dirpath,$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames,\@packages,\%includeditems,\%randompicks);
   

Removed from v.1.40  
changed lines
  Added in v.1.43


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