--- loncom/interface/portfolio.pm 2010/10/29 23:22:43 1.229
+++ loncom/interface/portfolio.pm 2011/10/17 12:41:30 1.233
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.229 2010/10/29 23:22:43 raeburn Exp $
+# $Id: portfolio.pm,v 1.233 2011/10/17 12:41:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -379,22 +379,24 @@ sub display_directory {
my $href_edit_location="/editupload/$udom/$uname/$port_path".$current_path;
my @dir_lines;
my %versioned;
- foreach my $dir_line (sort
- {
- my ($afile)=split('&',$a,2);
- my ($bfile)=split('&',$b,2);
- return (lc($afile) cmp lc($bfile));
- } (@$dir_list)) {
- my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_line,16);
- $filename =~ s/\s+$//;
- my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
- if ($version) {
- my $fullpath = &prepend_group($current_path.$fname.'.'.$extension);
- push(@{ $versioned{$fullpath} },
- [$filename,$dom,$testdir,$size,$mtime,$obs,]);
- } else {
- push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]);
- }
+ if (ref($dir_list) eq 'ARRAY') {
+ foreach my $dir_line (sort
+ {
+ my ($afile)=split('&',$a,2);
+ my ($bfile)=split('&',$b,2);
+ return (lc($afile) cmp lc($bfile));
+ } (@{$dir_list})) {
+ my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_line,16);
+ $filename =~ s/\s+$//;
+ my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
+ if ($version) {
+ my $fullpath = &prepend_group($current_path.$fname.'.'.$extension);
+ push(@{ $versioned{$fullpath} },
+ [$filename,$dom,$testdir,$size,$mtime,$obs,]);
+ } else {
+ push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]);
+ }
+ }
}
my $zerobyte;
foreach my $dir_line (@dir_lines) {
@@ -1964,7 +1966,7 @@ sub upload {
return;
}
- my (%allfiles,%codebase,$mode);
+ my (%allfiles,%codebase,$mode,$mimetype);
if ($env{'form.'.$formname.'.filename'} =~ m/(\.htm|\.html|\.shtml)$/i) {
if ($env{'form.parserflag'}) {
$mode = 'parse';
@@ -1974,10 +1976,12 @@ sub upload {
if ($state eq 'existingfile') {
$context = $state;
}
+ my $subdir = $port_path.$env{'form.currentpath'};
+ $subdir =~ s{(/)$}{};
my ($result,$timestamp) =
- &Apache::lonnet::userfileupload($formname,$context,
- $port_path.$env{'form.currentpath'},
- $mode,\%allfiles,\%codebase);
+ &Apache::lonnet::userfileupload($formname,$context,$subdir,
+ $mode,\%allfiles,\%codebase,undef,undef,
+ undef,undef,undef,undef,\$mimetype);
if ($state eq 'existingfile') {
my $group_elem;
my $rootdir = $r->dir_config('lonDaemons').'/tmp/overwrites';
@@ -1998,44 +2002,56 @@ sub upload {
conf => 'Are you sure you want to overwrite an existing file?',
cont => 'Continue',
);
+ my $parserflag;
+ my $hidden = &hidden_elems();
+ if ($mode eq 'parse') {
+ $parserflag = '';
+ }
$r->print(<<"END");
$msg
-