Diff for /loncom/interface/portfolio.pm between versions 1.232 and 1.233

version 1.232, 2011/05/27 18:55:54 version 1.233, 2011/10/17 12:41:30
Line 379  sub display_directory { Line 379  sub display_directory {
     my $href_edit_location="/editupload/$udom/$uname/$port_path".$current_path;      my $href_edit_location="/editupload/$udom/$uname/$port_path".$current_path;
     my @dir_lines;      my @dir_lines;
     my %versioned;      my %versioned;
     foreach my $dir_line (sort       if (ref($dir_list) eq 'ARRAY') { 
       {           foreach my $dir_line (sort 
   my ($afile)=split('&',$a,2);            { 
   my ($bfile)=split('&',$b,2);        my ($afile)=split('&',$a,2);
   return (lc($afile) cmp lc($bfile));        my ($bfile)=split('&',$b,2);
       } (@$dir_list)) {        return (lc($afile) cmp lc($bfile));
     my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_line,16);             } (@{$dir_list})) {
     $filename =~ s/\s+$//;         my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_line,16); 
     my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);         $filename =~ s/\s+$//;
     if ($version) {         my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
     my $fullpath = &prepend_group($current_path.$fname.'.'.$extension);         if ($version) {
        push(@{ $versioned{$fullpath} },          my $fullpath = &prepend_group($current_path.$fname.'.'.$extension);
  [$filename,$dom,$testdir,$size,$mtime,$obs,]);             push(@{ $versioned{$fullpath} },
     } else {       [$filename,$dom,$testdir,$size,$mtime,$obs,]);
        push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]);         } else {
     }             push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]);
          }
           }
     }      }
     my $zerobyte;      my $zerobyte;
     foreach my $dir_line (@dir_lines) {      foreach my $dir_line (@dir_lines) {
Line 2249  sub createdir { Line 2251  sub createdir {
     return;      return;
     }      }
     my $portfolio_root = &get_portfolio_root();       my $portfolio_root = &get_portfolio_root(); 
     my @dir_list=&get_dir_list($portfolio_root,undef,$group);      my ($dirlistref,$listerror) = &get_dir_list($portfolio_root,undef,$group);
     my $found_file = 0;      my $found_file = 0;
     foreach my $line (@dir_list) {      if (ref($dirlistref) eq 'ARRAY') {
         my ($filename)=split(/\&/,$line,2);          foreach my $line (@{$dirlistref}) {
         if ($filename eq $newdir){              my ($filename)=split(/\&/,$line,2);
             $found_file = 1;              if ($filename eq $newdir){
                   $found_file = 1;
               }
         }          }
     }      }
     if ($found_file){      if ($found_file){
Line 2703  sub handler { Line 2707  sub handler {
             &Apache::lonhtmlcommon::clear_breadcrumbs();              &Apache::lonhtmlcommon::clear_breadcrumbs();
             $r->print(&coursegrp_portfolio_header($udom,$uname,$grp_desc));              $r->print(&coursegrp_portfolio_header($udom,$uname,$grp_desc));
         }          }
         my @dir_list=&get_dir_list($portfolio_root,$current_path,$group);          my ($dirlistref,$listerror) =
  if ($dir_list[0] eq 'no_such_dir'){              &get_dir_list($portfolio_root,$current_path,$group);
    if ($listerror eq 'no_such_dir'){
     # two main reasons for this:      # two main reasons for this:
             #    1) never been here, so directory structure not created              #    1) never been here, so directory structure not created
     #    2) back-button navigation after deleting a directory      #    2) back-button navigation after deleting a directory
Line 2719  sub handler { Line 2724  sub handler {
  $current_path = '/'; # force it back to the root           $current_path = '/'; # force it back to the root        
     }      }
     # now grab the directory list again, for the first time      # now grab the directory list again, for the first time
             @dir_list=&get_dir_list($portfolio_root,$current_path,$group);              ($dirlistref,$listerror) =
                   &get_dir_list($portfolio_root,$current_path,$group);
         }          }
  # need to know if directory is empty so it can be removed if desired   # need to know if directory is empty so it can be removed if desired
  my $is_empty=(@dir_list == 2);          my $is_empty;
  &display_common($r,$url,$current_path,$is_empty,\@dir_list,          if ($listerror eq 'empty') {
               $is_empty = 1;
           } elsif (ref($dirlistref) eq 'ARRAY') {
               if ((scalar(@{$dirlistref}) == 2) && ($dirlistref->[0] =~ /^\.+\&/)
                   && ($dirlistref->[1] =~ /^\.+\&/))  {
                   $is_empty = 1;
               }
           }
    &display_common($r,$url,$current_path,$is_empty,$dirlistref,
  $can_upload,$group);   $can_upload,$group);
         &display_directory($r,$url,$current_path,$is_empty,\@dir_list,$group,          &display_directory($r,$url,$current_path,$is_empty,$dirlistref,$group,
                            $can_upload,$can_modify,$can_delete,$can_setacl);                             $can_upload,$can_modify,$can_delete,$can_setacl);
     }      }
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());

Removed from v.1.232  
changed lines
  Added in v.1.233


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