Diff for /loncom/interface/multidownload.pl between versions 1.37 and 1.38

version 1.37, 2008/02/05 06:51:55 version 1.38, 2008/12/30 23:18:24
Line 72  sub get_part_resp_path { Line 72  sub get_part_resp_path {
   
   
 $|=1;  $|=1;
   &Apache::lonlocal::get_language_handle();
   &Apache::loncommon::content_type(undef,'text/html');
 if (! &LONCAPA::loncgi::check_cookie_and_load_env()) {  if (! &LONCAPA::loncgi::check_cookie_and_load_env()) {
     print <<END;      print(&LONCAPA::loncgi::missing_cookie_msg());
 Content-type: text/html  
   
 <html>  
 <head><title>Bad Cookie</title></head>  
 <body>  
 Your cookie information is incorrect.  
 </body>  
 </html>  
 END  
     return;      return;
 }  }
   
 &Apache::lonlocal::get_language_handle();  
 &Apache::loncommon::content_type(undef,'text/html');  
 my $identifier = $ENV{'QUERY_STRING'};  my $identifier = $ENV{'QUERY_STRING'};
 my $unique_path = $identifier.time();  my $unique_path = $identifier.time();
 print(&Apache::loncommon::start_page('Multiple Downloads'));  print(&Apache::loncommon::start_page('Multiple Downloads'));
Line 132  if (&Apache::lonnet::allowed('vgr',$scop Line 123  if (&Apache::lonnet::allowed('vgr',$scop
         my %files_saved;          my %files_saved;
         my ($stuname,$studom,$fullname) = split(/:/,$stu);          my ($stuname,$studom,$fullname) = split(/:/,$stu);
         my %record = &Apache::lonnet::restore($symb,$courseid,$studom,$stuname);          my %record = &Apache::lonnet::restore($symb,$courseid,$studom,$stuname);
         my $file_url = '/uploaded/'.$studom.'/'.$stuname.'/portfolio';          my $port_url = '/uploaded/'.$studom.'/'.$stuname.'/portfolio';
         print MANIFEST ($fullname."\n");          print MANIFEST ($fullname."\n");
                     
         my $submission_count = 0;          my $submission_count = 0;
Line 141  if (&Apache::lonnet::allowed('vgr',$scop Line 132  if (&Apache::lonnet::allowed('vgr',$scop
             foreach my $respid (@ids) {              foreach my $respid (@ids) {
                 my $part_resp_path = &get_part_resp_path($flat_part,$flat_resp, $partid, $respid);                  my $part_resp_path = &get_part_resp_path($flat_part,$flat_resp, $partid, $respid);
                 &mkpath($doc_zip_root."/zipdir/$unique_user/$unique_path/$stuname/$part_resp_path",0,0700);                  &mkpath($doc_zip_root."/zipdir/$unique_user/$unique_path/$stuname/$part_resp_path",0,0700);
                 foreach my $file (split(',',$record{"resource.$partid.$respid.portfiles"})) {                  foreach my $origin ('portfiles','uploadedurl') {
                     $file = $file_url.$file;                      my @files;
                     my ($file_name_only) = ($file =~ /^.*\/(.+$)/);                      if ($record{"resource.$partid.$respid.$origin"} ne '') {
                     print MANIFEST ("\t$file_name_only (".&mt("Part [_1]",$partid).                          if ($origin eq 'portfiles') {
                                     ") (".&mt("Response [_1]",$respid).")"."\n");                              @files = (split(',',$record{"resource.$partid.$respid.$origin"}));
                     $submission_count ++;                          } else {
                     &Apache::lonnet::repcopy($file);                              @files = ($record{"resource.$partid.$respid.$origin"});
                     my $source = &Apache::lonnet::filelocation("",$file);                          }
                     my $destination = "$doc_zip_root/zipdir/$unique_user/$unique_path/$stuname$part_resp_path/$file_name_only";  
                     if (exists($files_saved{$destination})) {  
                         # file has already been saved once  
                         my ($file_name,$file_ext) = ($destination =~ /(^.*)(\..+$)/);  
                         $destination = $file_name.$files_saved{$destination}.$file_ext;  
                         $files_saved{$destination}++;  
                     }                      }
                     $files_saved{$destination}++;                      foreach my $file (@files) {
                     if (!&copy($source,$destination)) {                          if ($origin eq 'portfiles') { 
                         if (!$file_problem) {                              $file = $port_url.$file;
                             print(&mt("Unable to create: ")."<br />");                          }
                             $file_problem = 1;                          my ($file_name_only) = ($file =~ m{.*/([^/]+)$});
                           print MANIFEST ("\t$file_name_only (".&mt("Part [_1]",$partid).
                                           ") (".&mt("Response [_1]",$respid).")"."\n");
                           $submission_count ++;
                           &Apache::lonnet::repcopy($file);
                           my $source = &Apache::lonnet::filelocation("",$file);
                           my $destination = "$doc_zip_root/zipdir/$unique_user/$unique_path/$stuname$part_resp_path/$file_name_only";
                           if (exists($files_saved{$destination})) {
                               # file has already been saved once
                               my ($file_name,$file_ext) = 
                                   ($destination =~ /(^.*)(\..+$)/);
                               $destination = $file_name.$files_saved{$destination}.$file_ext;
                               $files_saved{$destination}++;
                           }
                           $files_saved{$destination}++;
                           if (!&copy($source,$destination)) {
                               if (!$file_problem) {
                                   print('<br /><span class="LC_error">'.&mt("Unable to create: ")."</span><br />");
                                   $file_problem = 1;
                               }
                               print('<span class="LC_filename">'."$stuname/part$partid/resp$respid/$file_name_only".'</span><br />');
                         }                          }
                         print("$stuname/part$partid/resp$respid/$file_name_only <br />");  
                     }                      }
                 }                  }
             }              }

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


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