Diff for /loncom/interface/loncommon.pm between versions 1.1052 and 1.1053

version 1.1052, 2012/01/09 19:56:28 version 1.1053, 2012/01/16 18:00:24
Line 9708  sub check_for_traversal { Line 9708  sub check_for_traversal {
     return $cleanpath;      return $cleanpath;
 }  }
   
   sub is_archive_file {
       my ($mimetype) = @_;
       if (($mimetype eq 'application/octet-stream') ||
           ($mimetype eq 'application/x-stuffit') ||
           ($mimetype =~ m{^application/(x\-)?(compressed|tar|zip|tgz|gz|gtar|gzip|gunzip|bz|bz2|bzip2)})) {
           return 1;
       }
       return;
   }
   
   sub decompress_form {
       my ($mimetype,$archiveurl,$action,$noextract,$hiddenelements) = @_;
       my %lt = &Apache::lonlocal::texthash (
           this => 'This file is an archive file.',
           youm => 'You may wish to extract its contents.',
           camt => 'Extraction of contents is recommended for Camtasia zip files.',
           perm => 'Permanently remove archive file after extraction of contents?',
           extr => 'Extract contents',
           yes  => 'Yes',
           no   => 'No',
       );
       my $output = '<p>'.$lt{'this'}.' '.$lt{'youm'}.'<br />';
       if ($mimetype =~ m{^application/(x\-)?(compressed|zip)}) {
           $output .= $lt{'camt'};
       }
       $output .= '</p>';
       $output .= <<"START";
   <div id="uploadfileresult">
     <form name="uploaded_decompress" action="$action" method="post">
     <input type="hidden" name="archiveurl" value="$archiveurl" />
   START
       if (ref($hiddenelements) eq 'HASH') {
           foreach my $hidden (sort(keys(%{$hiddenelements}))) {
               $output .= '<input type="hidden" name="'.$hidden.'" value="'.$hiddenelements->{$hidden}.'" />'."\n";
           }
       }
       $output .= <<"END";
   <input type="hidden" name="folderpath" value="$env{'form.folderpath'}" />
   <input type="hidden" name="pagepath" value="$env{'form.pagepath'}" />
   <input type="hidden" name="cmd" value="$nextphase" />
   <input type="hidden" name="newidx" value="$newidx" />
   <input type="hidden" name="position" value="$position" />
   <input type="hidden" name="phase" value="$nextphase" />
   <span class="LC_nobreak">$lt{'perm'}&nbsp;
   <label><input type="radio" name="archivedelete" value="0" checked="checked" />$lt{'no'}</label>&nbsp;&nbsp;
   <label><input type="radio" name="archivedelete" value="1" />$lt{'yes'}</label></span><br />
   <input type="submit" name="decompress" value="$lt{'extr'}" />
   </form>
   $noextract
   </div>
   END
       return $output;
   }
   
   sub decompress_uploaded_file {
       my ($file,$dir) = @_;
       &Apache::lonnet::appenv({'cgi.file' => $file});
       &Apache::lonnet::appenv({'cgi.dir' => $dir});
       my $result = &Apache::lonnet::ssi_body('/cgi-bin/decompress.pl');
       my ($handle) = ($env{'user.environment'} =~m{/([^/]+)\.id$});
       my $lonidsdir = $Apache::lonnet::perlvar{'lonIDsDir'};
       &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle,1);
       my $decompressed = $env{'cgi.decompressed'};
       &Apache::lonnet::delenv('cgi.file');
       &Apache::lonnet::delenv('cgi.dir');
       &Apache::lonnet::delenv('cgi.decompressed');
       return ($decompressed,$result);
   }
   
 =pod  =pod
   
 =item * &get_turnedin_filepath()  =item * &get_turnedin_filepath()

Removed from v.1.1052  
changed lines
  Added in v.1.1053


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