Diff for /loncom/interface/portfolio.pm between versions 1.40 and 1.44

version 1.40, 2004/09/09 17:53:59 version 1.44, 2004/09/10 20:31:35
Line 211  sub delete_dir_confirmed { Line 211  sub delete_dir_confirmed {
  $r->print('<font color="red"> An error occured (dir) ('.$result.   $r->print('<font color="red"> An error occured (dir) ('.$result.
   ') while trying to delete '.$directory_name.'</font><br />');    ') while trying to delete '.$directory_name.'</font><br />');
     } else {      } else {
           # now remove from recent
   #        $r->print('<br /> removing '.$directory_name.'<br /');
           &Apache::lonhtmlcommon::remove_recent('portfolio',[$directory_name.'/']);
         my @dirs = split m!/!, $directory_name;          my @dirs = split m!/!, $directory_name;
                   
 #        $directory_name =~ m/^(\/*\/)(\/*.)$/;  #        $directory_name =~ m/^(\/*\/)(\/*.)$/;
Line 347  sub handler { Line 350  sub handler {
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['selectfile','currentpath',                                              ['selectfile','currentpath',
      'currentfile']);       'currentfile']);
  # make sure there is a portfolio directory off /userfiles  
  # Fixme -- Do this in a better way -- offload it to the LOND routine  
  my @dir_list=&Apache::lonnet::dirlist('/',  
     $ENV{'user.domain'},  
     $ENV{'user.name'},$portfolio_root);  
  if ($dir_list[0] eq 'no_such_dir'){  
      &Apache::lonnet::mkdiruserfile($ENV{'user.name'},  
      $ENV{'user.domain'},'portfolio');  
  }  
  if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){   if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){
        $r->print('<font color="red"> No file was selected to upload.'.         $r->print('<font color="red"> No file was selected to upload.'.
                'To upload a file, click <strong>Browse...</strong>'.                 'To upload a file, click <strong>Browse...</strong>'.
Line 382  sub handler { Line 376  sub handler {
  if ($ENV{'form.currentpath'}) {   if ($ENV{'form.currentpath'}) {
     $current_path = $ENV{'form.currentpath'};      $current_path = $ENV{'form.currentpath'};
  }   }
  @dir_list=&Apache::lonnet::dirlist($current_path,   my @dir_list=&Apache::lonnet::dirlist($current_path,
     $ENV{'user.domain'},      $ENV{'user.domain'},
     $ENV{'user.name'},$portfolio_root);      $ENV{'user.name'},$portfolio_root);
           if (@dir_list[0] eq 'no_such_dir'){
  # need to know if directory is empty so it can be removed if desired          # two main reasons for this: 1) never been here, so directory structure not created
  my $is_empty=(@dir_list == 2);          #                            2) back-button navigation after deleting a directory
  &display_directory($r,$current_path,$is_empty,\@dir_list);          if ($current_path eq '/'){
  $r->print("</body>\n</html>\n");          &Apache::lonnet::mkdiruserfile($ENV{'user.name'},
  return OK;          $ENV{'user.domain'},'portfolio');
           } else { # some directory that snuck in
               # get rid of the directory from the recent pulldown, just in case
               &Apache::lonhtmlcommon::remove_recent('portfolio',[$current_path]);
               $current_path = '/'; # force it back to the root        
           }
           # now grab the directory list again, for the first time
           @dir_list=&Apache::lonnet::dirlist($current_path,
       $ENV{'user.domain'},
       $ENV{'user.name'},$portfolio_root);
           
           }
       # need to know if directory is empty so it can be removed if desired
       my $is_empty=(@dir_list == 2);
       &display_directory($r,$current_path,$is_empty,\@dir_list);
       $r->print("</body>\n</html>\n");
       return OK;
     }      }
 }  }
 1;  1;

Removed from v.1.40  
changed lines
  Added in v.1.44


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