Diff for /loncom/interface/portfolio.pm between versions 1.47 and 1.48

version 1.47, 2004/10/11 22:52:20 version 1.48, 2004/10/12 00:44:05
Line 38  sub make_anchor { Line 38  sub make_anchor {
     return $anchor;      return $anchor;
 }  }
 my $dirptr=16384;  my $dirptr=16384;
 sub display_directory {  sub display_common {
     my ($r,$current_path,$is_empty,$dir_list)=@_;      my ($r,$current_path,$is_empty,$dir_list)=@_;
     my $iconpath= $r->dir_config('lonIconsURL') . "/";      my $iconpath= $r->dir_config('lonIconsURL') . "/";
     $r->print('<table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">');      $r->print('<table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">');
Line 73  sub display_directory { Line 73  sub display_directory {
       &Apache::lonhtmlcommon::select_recent('portfolio','currentpath',        &Apache::lonhtmlcommon::select_recent('portfolio','currentpath',
     'this.form.submit();'));      'this.form.submit();'));
     $r->print("</form>");      $r->print("</form>");
   }
   sub display_directory {
       my ($r,$current_path,$is_empty,$dir_list)=@_;
       my $iconpath= $r->dir_config('lonIconsURL') . "/";
       my $display_out;
     if ($is_empty && ($current_path ne '/')) {      if ($is_empty && ($current_path ne '/')) {
         $displayOut = '<form method="post" action="/adm/portfolio">'.          $display_out = '<form method="post" action="/adm/portfolio">'.
         '<input type="hidden" name="action" value="deletedir" />'.          '<input type="hidden" name="action" value="deletedir" />'.
         '<input type="submit" name="deletedir" value="'.&mt("Delete Directory").'" />'.          '<input type="submit" name="deletedir" value="'.&mt("Delete Directory").'" />'.
         '<input type="hidden" name="selectfile" value="" />'.          '<input type="hidden" name="selectfile" value="" />'.
         '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.          '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
         '</form>';          '</form>';
                   
         $r->print($displayOut);          $r->print($display_out);
  return;   return;
     }      }
     $r->print('<table border="0" cellspacing="2" cellpadding="2">'.      $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
Line 135  sub display_directory { Line 140  sub display_directory {
 sub display_file_select {  sub display_file_select {
     my ($r,$current_path,$is_empty,$dir_list)=@_;      my ($r,$current_path,$is_empty,$dir_list)=@_;
     my $iconpath= $r->dir_config('lonIconsURL') . "/";      my $iconpath= $r->dir_config('lonIconsURL') . "/";
     $r->print('<table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">');      my $display_out;
     $r->print('<td bgcolor="#ccddaa" align="center">');  
     my $displayOut = '<form method="post" enctype="multipart/form-data">';  
     $displayOut = $displayOut.'<input name="uploaddoc" type="file" />'.  
         '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.  
         '<input type="submit" name="storeupl" value="Upload" />'.  
         '</form>';  
     $r->print($displayOut);  
     $r->print('</td></tr><tr><td bgcolor="#ccddaa" align="center">');  
     $displayOut = '<form method="post">';  
     $displayOut .= '<input name="newdir" type="input" />'.  
         '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.  
         '<input type="submit" name="createdir" value="'.&mt("Create Directory").'" />'.  
         '</form>';  
     $r->print($displayOut);  
     $r->print('</td></tr></table>');  
     my @tree = split (/\//,$current_path);  
     $r->print('<font size="+2">'.&make_anchor('portfolio','/').'/');  
     if (@tree > 1){  
         my $newCurrentPath = '';  
         for (my $i = 1; $i< @tree; $i++){  
             $newCurrentPath .= $tree[$i].'/';  
             $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath).'/');  
         }  
     }  
     $r->print('</font>');  
     &Apache::lonhtmlcommon::store_recent('portfolio',$current_path,$current_path);  
     #Fixme -- remove from recent those paths that are deleted  
     $r->print('<br /><form method=post action="/adm/portfolio">'.  
       &Apache::lonhtmlcommon::select_recent('portfolio','currentpath',  
     'this.form.submit();'));  
     $r->print("</form>");  
     if ($is_empty && ($current_path ne '/')) {      if ($is_empty && ($current_path ne '/')) {
         $displayOut = '<form method="post" action="/adm/portfolio">'.          $display_out = '<form method="post" action="/adm/portfolio">'.
         '<input type="hidden" name="action" value="deletedir" />'.          '<input type="hidden" name="action" value="deletedir" />'.
         '<input type="submit" name="deletedir" value="'.&mt("Delete Directory").'" />'.          '<input type="submit" name="deletedir" value="'.&mt("Delete Directory").'" />'.
         '<input type="hidden" name="selectfile" value="" />'.          '<input type="hidden" name="selectfile" value="" />'.
         '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.          '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
   
         '</form>';          '</form>';
                   
         $r->print($displayOut);          $r->print($display_out);
  return;   return;
     }      }
     $r->print('<table border="0" cellspacing="2" cellpadding="2">'.      $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
             '<tr><th>Select</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');              '<tr><th>Select</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');
     my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path";      my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path";
     $r->print('<form method="post" action="/adm/portfolio">');      $r->print('<form method="post" name="checkselect" action="/adm/portfolio">');
     foreach my $line (sort       foreach my $line (sort 
       {         { 
   my ($afile)=split('&',$a,2);    my ($afile)=split('&',$a,2);
Line 211  sub display_file_select { Line 186  sub display_file_select {
             }              }
         }          }
     }      }
     $r->print('<input type="submit" name="doit" value="Go" />      $r->print('</table>
                               <input type="button" name="doit" onClick= "finishSelect();" value="Select checked files, and close window" />
                 <input type="hidden" name="currentpath" value="'.$current_path.'" />');              <input type="hidden" name="currentpath" value="'.$current_path.'" />
       </form>');
 #   <tr bgcolor="#FFAA99"> pink bg   
 #   <tr bgcolor="#CCCCFF"> blue bg              
 #   $r->print(&display_directory($current_path, $currentFile, @dir_list));  
 #    $r->print('</td>><td>');  
 #   $r->print(&display_actions($current_path, $currentFile, $isEmpty));  
     $r->print('</table></form>');  
 }  }
   
 sub open_form {  sub open_form {
Line 346  sub rename_confirmed { Line 315  sub rename_confirmed {
 }  }
 sub select_files {  sub select_files {
     my ($r)=@_;      my ($r)=@_;
       my $java_script =(<<ENDSMP);
           <script language='javascript'>
           function finishSelect() {
               opener.document.forms.lonhomework.selectedfiles.value='files were selected';
               
               self.close();
           }
           </script>
   ENDSMP
       $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'},      my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
Line 379  sub select_files { Line 358  sub select_files {
     }      }
     # 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_file_select($r,$current_path,$is_empty,\@dir_list);      &display_file_select($r,$current_path,$is_empty,\@dir_list);
     $r->print("</body>\n</html>\n");      $r->print("</body>\n</html>\n");
     return OK;      return OK;
Line 529  sub handler { Line 509  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_directory($r,$current_path,$is_empty,\@dir_list);   &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.47  
changed lines
  Added in v.1.48


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