Diff for /loncom/interface/portfolio.pm between versions 1.49 and 1.50

version 1.49, 2004/10/18 20:37:30 version 1.50, 2004/10/19 19:13:04
Line 44  sub display_common { Line 44  sub display_common {
     $r->print('<table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">');      $r->print('<table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">');
     $r->print('<td bgcolor="#ccddaa" align="center">');      $r->print('<td bgcolor="#ccddaa" align="center">');
     my $displayOut = '<form method="post" enctype="multipart/form-data">';      my $displayOut = '<form method="post" enctype="multipart/form-data">';
     $displayOut = $displayOut.'<input name="uploaddoc" type="file" />'.      $displayOut .= '<input name="uploaddoc" type="file" />'.
         '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.          '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
           '<input type="hidden" name="action" value="'.$ENV{"form.action"}.'" />'.
           '<input type="hidden" name="fieldname" value="'.$ENV{"form.fieldname"}.'" />'.
         '<input type="submit" name="storeupl" value="Upload" />'.          '<input type="submit" name="storeupl" value="Upload" />'.
         '</form>';          '</form>';
     $r->print($displayOut);      $r->print($displayOut);
Line 53  sub display_common { Line 55  sub display_common {
     $displayOut = '<form method="post">';      $displayOut = '<form method="post">';
     $displayOut .= '<input name="newdir" type="input" />'.      $displayOut .= '<input name="newdir" type="input" />'.
         '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.          '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
           '<input type="hidden" name="action" value="'.$ENV{"form.action"}.'" />'.
           '<input type="hidden" name="fieldname" value="'.$ENV{"form.fieldname"}.'" />'.
         '<input type="submit" name="createdir" value="'.&mt("Create Directory").'" />'.          '<input type="submit" name="createdir" value="'.&mt("Create Directory").'" />'.
         '</form>';          '</form>';
     $r->print($displayOut);      $r->print($displayOut);
Line 226  sub display_file { Line 230  sub display_file {
   
 sub done {  sub done {
     return ('<h3><a href="/adm/portfolio?currentpath='.      return ('<h3><a href="/adm/portfolio?currentpath='.
     $ENV{'form.currentpath'}.'">'.&mt('Done').'</a></h3>');      $ENV{'form.currentpath'}.
       '&fieldname='.$ENV{'form.fieldname'}.
       '">'.&mt('Done').'</a></h3>');
 }  }
   
 sub delete {  sub delete {
Line 336  ENDSMP Line 342  ENDSMP
     $r->print($java_script);      $r->print($java_script);
     $r->print("<h1>Select portfolio files</h1>      $r->print("<h1>Select portfolio files</h1>
                 Check as many as you wish in response to the essay problem.<br />");                  Check as many as you wish in response to the essay problem.<br />");
     my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},  
  $ENV{'user.name'}).  
  '/userfiles/portfolio';  
     my $current_path='/';  
     if ($ENV{'form.currentpath'}) {  
  $current_path = $ENV{'form.currentpath'};  
     }  
     my @dir_list=&Apache::lonnet::dirlist($current_path,  
     $ENV{'user.domain'},  
     $ENV{'user.name'},$portfolio_root);  
     if ($dir_list[0] eq 'no_such_dir'){  
  # two main reasons for this:  
         #    1) never been here, so directory structure not created,  
  #    2) back-button navigation after deleting a directory  
         if ($current_path eq '/'){  
         &Apache::lonnet::mkdiruserfile($ENV{'user.name'},  
        $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_common($r,$current_path,$is_empty,\@dir_list);  
     &display_file_select($r,$current_path,$is_empty,\@dir_list);  
     $r->print("</body>\n</html>\n");  
     return OK;  
 }  }
 sub upload {  sub upload {
     my ($r)=@_;      my ($r)=@_;
Line 473  sub handler { Line 444  sub handler {
  }   }
     if ($ENV{'form.uploaddoc.filename'}) {      if ($ENV{'form.uploaddoc.filename'}) {
  &upload($r);   &upload($r);
     } elsif ($ENV{'form.action'} eq 'selectfile') {  
         &select_files($r);  
     } elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) {      } elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) {
  &delete_confirmed($r);   &delete_confirmed($r);
     } elsif ($ENV{'form.action'} eq 'delete') {      } elsif ($ENV{'form.action'} eq 'delete') {
Line 519  sub handler { Line 488  sub handler {
  # 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=(@dir_list == 2);
  &display_common($r,$current_path,$is_empty,\@dir_list);   &display_common($r,$current_path,$is_empty,\@dir_list);
  &display_directory($r,$current_path,$is_empty,\@dir_list);   if ($ENV{"form.mode"}='selectfile'){
       &select_files($r);
               &display_file_select($r,$current_path,$is_empty,\@dir_list);
    } else {
       &display_directory($r,$current_path,$is_empty,\@dir_list);
    }
  $r->print("</body>\n</html>\n");   $r->print("</body>\n</html>\n");
  return OK;   return OK;
     }      }

Removed from v.1.49  
changed lines
  Added in v.1.50


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