Diff for /loncom/interface/lonfeedback.pm between versions 1.146 and 1.147

version 1.146, 2004/12/23 13:28:50 version 1.147, 2004/12/23 14:00:58
Line 68  sub discussion_visible { Line 68  sub discussion_visible {
 }  }
   
 sub list_discussion {  sub list_discussion {
     my ($mode,$status,$ressymb)=@_;      my ($mode,$status,$ressymb,$imsextras)=@_;
     my $outputtarget=$ENV{'form.grade_target'};      my $outputtarget=$ENV{'form.grade_target'};
     if (defined($ENV{'form.export'})) {      if (defined($ENV{'form.export'})) {
  if($ENV{'form.export'}) {   if($ENV{'form.export'}) {
             $outputtarget = 'export';              $outputtarget = 'export';
         }          }
     }      }
       if (defined($imsextras)) {
           if ($$imsextras{'caller'} eq 'imsexport') {
               $outputtarget = 'export';
           }
       }
     if (not &discussion_visible($status)) { return ''; }      if (not &discussion_visible($status)) { return ''; }
     my @bgcols = ("#cccccc","#eeeeee");      my @bgcols = ("#cccccc","#eeeeee");
     my $discussiononly=0;      my $discussiononly=0;
Line 325  sub list_discussion { Line 330  sub list_discussion {
         } elsif ($outputtarget eq 'export') {          } elsif ($outputtarget eq 'export') {
 # Create temporary directory if this is an export  # Create temporary directory if this is an export
             my $now = time;              my $now = time;
             $tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports';              if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) {
             if (!-e $tempexport) {                  $tempexport = $$imsextras{'tempexport'};
                 mkdir($tempexport,0700);                  if (!-e $tempexport) {
             }                      mkdir($tempexport,0700);
             $tempexport .= '/'.$now;                  }
             if (!-e $tempexport) {                  $tempexport .= '/'.$$imsextras{'count'};
                 mkdir($tempexport,0700);                  if (!-e $tempexport) {
                       mkdir($tempexport,0700);
                   }
               } else {
                   $tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports';
                   if (!-e $tempexport) {
                       mkdir($tempexport,0700);
                   }
                   $tempexport .= '/'.$now;
                   if (!-e $tempexport) {
                       mkdir($tempexport,0700);
                   }
                   $tempexport .= '/'.$ENV{'user.domain'}.'_'.$ENV{'user.name'};
             }              }
             $tempexport .= '/'.$ENV{'user.domain'}.'_'.$ENV{'user.name'};  
             if (!-e $tempexport) {              if (!-e $tempexport) {
                 mkdir($tempexport,0700);                  mkdir($tempexport,0700);
             }              }
Line 634  END Line 650  END
 </manifest>  </manifest>
                 |;                  |;
                 close($manifestfile);                  close($manifestfile);
                   if ((defined($imsextras)) && ($$imsextras{'caller'} eq 'imsexport')) {
                       $discussion = $copyresult;
                   } else {
   
 #Create zip file in prtspool  #Create zip file in prtspool
   
                 my $imszipfile = '/prtspool/'.                      my $imszipfile = '/prtspool/'.
                 $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.                      $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                      time.'_'.rand(1000000000).'.zip';                           time.'_'.rand(1000000000).'.zip';
     # zip can cause an sh launch which can pass along all of %ENV      # zip can cause an sh launch which can pass along all of %ENV
     # which can be too large for /bin/sh to handle      # which can be too large for /bin/sh to handle
                 my %oldENV=%ENV;                      my %oldENV=%ENV;
                 undef(%ENV);                      undef(%ENV);
                 my $cwd = &getcwd();                       my $cwd = &getcwd(); 
                 my $imszip = '/home/httpd/'.$imszipfile;                      my $imszip = '/home/httpd/'.$imszipfile;
                 chdir $tempexport;                      chdir $tempexport;
                 open(OUTPUT, "zip -r $imszip *  2> /dev/null |");                      open(OUTPUT, "zip -r $imszip *  2> /dev/null |");
                 close(OUTPUT);                      close(OUTPUT);
                 chdir $cwd;                      chdir $cwd;
                 %ENV=%oldENV;                      %ENV=%oldENV;
                 undef(%oldENV);                      undef(%oldENV);
                 $discussion .= 'Download the zip file from <a href="'.$imszipfile.'">Discussion Posting Archive</a><br />';                      $discussion .= 'Download the zip file from <a href="'.$imszipfile.'">Discussion Posting Archive</a><br />';
                 if ($copyresult) {                      if ($copyresult) {
                     $discussion .= 'The following errors occurred during export - <br />'.$copyresult;                          $discussion .= 'The following errors occurred during export - <br />'.$copyresult;
                       }
                 }                  }
             } else {              } else {
                 $discussion .= '<br />Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file.<br />';                  $discussion .= '<br />Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file.<br />';

Removed from v.1.146  
changed lines
  Added in v.1.147


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