Diff for /loncom/imspackages/imsimport.pm between versions 1.37 and 1.42

version 1.37, 2012/10/04 14:00:22 version 1.42, 2013/07/15 16:13:16
Line 29  package Apache::imsimport; Line 29  package Apache::imsimport;
   
 use strict;  use strict;
 use Apache::Constants qw(:common :http :methods);  use Apache::Constants qw(:common :http :methods);
 use Apache::loncacc;  
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::imsprocessor;  use Apache::imsprocessor;
Line 101  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 287  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 299  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 397  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 410  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 460  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 537  sub display_three { Line 536  sub display_three {
                  yims => 'Your IMS package has been processed successfully.',                   yims => 'Your IMS package has been processed successfully.',
                  plsv => 'Please view the imported items and use the LON-CAPA editing tools to make changes.',                   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.",                   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.',                   tfin => 'The final step in the IMS import process is to publish the materials you have imported into your Authoring 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',                   disp => 'Display new directory',
                  proc => 'Processing of your IMS package failed, because the IMS content package did not contain an IMS manifest file.'                   proc => 'Processing of your IMS package failed, because the IMS content package did not contain an IMS manifest file.'
              );               );
Line 676  sub handler { Line 675  sub handler {
         return HTTP_NOT_FOUND;          return HTTP_NOT_FOUND;
     }      }
   
     my ($uname,$udom) = &Apache::loncacc::constructaccess($fn);      my ($uname,$udom) = &Apache::lonnet::constructaccess($fn);
     if (($uname eq '') || ($udom eq '')) {      if (($uname eq '') || ($udom eq '')) {
         $r->log_reason($uname.' at '.$udom.          $r->log_reason($uname.' at '.$udom.
                        ' trying to publish file '.$fn.' - not authorized',                         ' trying to publish file '.$fn.' - not authorized',
Line 727  $javascript Line 726  $javascript
 END_JS  END_JS
     }      }
   
     my $title = 'Upload IMS package to Construction Space';      my $title = 'Upload IMS package to Authoring Space';
     $r->print(&Apache::loncommon::start_page($title, $javascript));      $r->print(&Apache::loncommon::start_page($title, $javascript));
   
     if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {      if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
Line 752  END_JS Line 751  END_JS
             &display_three($r,$uname,$udom,\@areas,\%areaname,\%cmsmap,$destdir,$dirpath);              &display_three($r,$uname,$udom,\@areas,\%areaname,\%cmsmap,$destdir,$dirpath);
         }          }
     } else {      } else {
         &Apache::lonupload::phaseone($r,$fn,'imsimport');          &Apache::lonupload::phaseone($r,$fn,'imsimport',$uname,$udom);
     }      }
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
     return OK;      return OK;

Removed from v.1.37  
changed lines
  Added in v.1.42


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