Diff for /loncom/imspackages/imsimportdocs.pm between versions 1.24 and 1.25

version 1.24, 2009/11/06 17:16:53 version 1.25, 2009/11/20 11:16:59
Line 165  sub handler { Line 165  sub handler {
     my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});      my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
     unless ($allowed) {      unless ($allowed) {
         $r->print(&Apache::loncommon::start_page('Import IMS package',undef,          $r->print(&Apache::loncommon::start_page('Import IMS package',undef,
  {'only_body' => 1,}));                                                     {'only_body' => 1,}));  
         $r->print('<h3>'.&mt('Modification of Course Contents Disallowed').'</h3>'.&mt('Your current role does not grant you the right to modify course content in this course.').          $r->print(
   &Apache::loncommon::end_page());              '<p class="LC_error">'
              .&mt('Modification of Course Contents Disallowed')
              .'</p><p>'
              .&mt('Your current role does not grant you the right to modify course content in this course.')
              .'</p>'
              .&Apache::loncommon::end_page()
           );
         return OK;          return OK;
     }      }
   
Line 183  sub handler { Line 189  sub handler {
     }      }
   
     $javascript =       $javascript = 
  "<script type=\"text/javascript\">\n".          "<script type=\"text/javascript\">\n".
  "//<!--\n$javascript\n// --></script>\n";          "//<!--\n$javascript\n// --></script>\n";
     my $start_page = &Apache::loncommon::start_page('Import IMS package',      my $headline = 'Import IMS package';
     $javascript,      my $start_page = &Apache::loncommon::start_page($headline,
     {'only_body' => 1,});                                                      $javascript,
                                                       {'only_body' => 1,})
                       .'<h1>'.&mt($headline).'</h1>';
 # print screen  # print screen
     $r->print($start_page);      $r->print($start_page);
   
Line 278  sub display_two { Line 286  sub display_two {
                 users => 0,                  users => 0,
                 );                  );
   
     if ($unzip_result eq 'ok') {      if ($unzip_result ne 'ok') {
         $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'choose',\%includedres,\%includeditems);          $r->print(
         if ($manifest_result eq 'ok') {              '<p class="LC_warning">'
             foreach my $res (sort keys %resources) {             .&mt('Processing of your IMS package failed because the file you'
                 if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4') {                 .' uploaded could not be unzipped.')
                     foreach my $area (keys %{$cmsmap{$cms}}) {             .'</p>'
                         if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {          );
                             $count{$area} ++;          return();
                         }      }
                     }  
                 } elsif ($cms eq 'angel5') {      # Get manifest file from package
                     foreach my $area (keys %{$cmsmap{$cms}}) {      $manifest_result = &Apache::imsprocessor::process_manifest(
                         if ($area eq 'doc') {                             $cms,$tempdir,\%resources,\%items,\%hrefs,
                             if (grep/^$resources{$res}{type}$/,@{$cmsmap{$cms}{doc}}) {                             \%resinfo,'choose',\%includedres,\%includeditems);
                                 $count{$area} ++;      if ($manifest_result ne 'ok') {
                             }          $r->print(
                         } elsif ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {             '<p class="LC_warning">'
                             $count{$area} ++;            .&mt('Unpacking of your IMS package failed because an IMS manifest file was not located in the package.')
                         }            .'</p>'
           );
           return();
       }
   
       # Count areas depending on cms version
       foreach my $res (sort keys %resources) {
           if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4') {
               foreach my $area (keys %{$cmsmap{$cms}}) {
                   if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {
                       $count{$area} ++;
                   }
               }
           } elsif ($cms eq 'angel5') {
               foreach my $area (keys %{$cmsmap{$cms}}) {
                   if ($area eq 'doc') {
                       if (grep/^$resources{$res}{type}$/,@{$cmsmap{$cms}{doc}}) {
                           $count{$area} ++;
                     }                      }
                   } elsif ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {
                       $count{$area} ++;
                 }                  }
             }              }
           } else { # Unknown cms format
               $r->print(
                   '<span class="LC_warning">'
                  .&mt('Unsupported IMS format: [_1]',$cms)
                  .'</span><br />'
               );
               # return();
           }
       }
   
             $r->print(<<ENDBLOCK);              $r->print(<<ENDBLOCK);
 <form name="pickoptions" method="post">  <form name="pickoptions" method="post">
   <table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'>    <table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'>
Line 437  ENDBLOCK Line 474  ENDBLOCK
    </tr>     </tr>
   </table>    </table>
 ENDDOCUMENT  ENDDOCUMENT
         } else {  
             $r->print(  
                '<p class="LC_warning">'  
                .&mt('Unpacking of your IMS package failed because an IMS manifest file was not located in the package.')  
                .'</p>'  
             );  
         }  
     } else {  
         $r->print(  
             '<p class="LC_warning">'  
            .&mt('Processing of your IMS package failed because the file you'  
                .' uploaded could not be unzipped.')  
            .'</p>'  
         );  
     }  
 }  }
   
   

Removed from v.1.24  
changed lines
  Added in v.1.25


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