Diff for /loncom/interface/portfolio.pm between versions 1.60 and 1.63

version 1.60, 2004/12/04 02:15:42 version 1.63, 2004/12/06 18:13:10
Line 112  sub display_directory { Line 112  sub display_directory {
     #$strip holds directory/file name      #$strip holds directory/file name
     #$dom       #$dom 
     my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);       my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
     if ($Apache::lonhomework::results{"resource.$ENV{'user.domain'}.$ENV{'user.name'}.$filename"}eq'true'){  
        &Apache::lonnet::logthis("found submitted file");  
        &Apache::lonnet::logthis("resource.$ENV{'user.domain'}.$ENV{'user.name'}.$filename");  
     } else {  
        &Apache::lonnet::logthis("$filename not found submitted file");  
        &Apache::lonnet::logthis("resource.$ENV{'user.domain'}.$ENV{'user.name'}.$filename");  
     }  
     if (($filename ne '.') && ($filename ne '..')) {      if (($filename ne '.') && ($filename ne '..')) {
             if ($dirptr&$testdir) {              if ($dirptr&$testdir) {
                 $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');                  $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
Line 159  sub display_file_select { Line 152  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') . "/";
     my $display_out;      my $display_out;
     my %checked_files = &Apache::lonnet::files_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});      my $checked_files = &Apache::lonnet::files_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});
       foreach my $key (keys %$checked_files) {
           &Apache::lonnet::logthis("a key is $key $$checked_files{$key} is the value");
       }
     if ($is_empty && ($current_path ne '/')) {      if ($is_empty && ($current_path ne '/')) {
         $display_out = '<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" />'.
Line 185  sub display_file_select { Line 181  sub display_file_select {
     #$strip holds directory/file name      #$strip holds directory/file name
     #$dom       #$dom 
     my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);       my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
       $filename =~ s/\s+$//;
     if (($filename ne '.') && ($filename ne '..')) {      if (($filename ne '.') && ($filename ne '..')) {
             if ($dirptr&$testdir) {              if ($dirptr&$testdir) {
                 $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');                  $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
Line 193  sub display_file_select { Line 190  sub display_file_select {
                 $r->print('</tr>');                   $r->print('</tr>'); 
             } else {              } else {
                 $r->print('<tr bgcolor="#CCCCFF">');                  $r->print('<tr bgcolor="#CCCCFF">');
                 $r->print('<td>                  $r->print('<td><input type="checkbox" name="selectedfile" value="'.$filename.'"'); 
                         <input type="checkbox" name="selectedfile" value="'.$filename.'" >                  if ($$checked_files{$filename} eq 'selected') {
                     </td>');                      $r->print("CHECKED");
                       &Apache::lonnet::logthis("checked");
                   } else {
                       &Apache::lonnet::logthis("not checked $$checked_files{$filename} $filename");
                   }
                   $r->print('></td>');
                 $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');                  $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');
                 $r->print('<td><a href="'.$href_location.$filename.'">'.                  $r->print('<td><a href="'.$href_location.$filename.'">'.
     $filename.'</a></td>');       $filename.'</a></td>'); 
Line 359  sub select_files { Line 361  sub select_files {
         # eventually, have to handle removing those not checked, but . . .           # eventually, have to handle removing those not checked, but . . . 
         my @items=&Apache::loncommon::get_env_multiple('form.selectedfile');          my @items=&Apache::loncommon::get_env_multiple('form.selectedfile');
         &Apache::lonnet::save_selected_files($ENV{'user.name'}, $ENV{'form.currentpath'}, @items);          &Apache::lonnet::save_selected_files($ENV{'user.name'}, $ENV{'form.currentpath'}, @items);
       } else {
           if ($ENV{'form.currentpath'} eq '/') {
               #empty the file for a fresh start
               # &Apache::lonnet::clear_selected_files($ENV{'user.name'});
           }
     }      }
     my $java_script =(<<ENDSMP);      my @files = &Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});
       my $java_files = join ",", @files;
       if ($java_files) {
           $java_files.=',';
       }
       my $javascript =(<<ENDSMP);
         <script language='javascript'>          <script language='javascript'>
         function finishSelect() {          function finishSelect() {
             fileList = "";  ENDSMP
       $javascript .= 'fileList = "'.$java_files.'";';
       $javascript .= (<<ENDSMP);
             for (i=0;i<document.forms.checkselect.length;i++) {               for (i=0;i<document.forms.checkselect.length;i++) { 
                 if (document.forms.checkselect[i].checked){                  if (document.forms.checkselect[i].checked){
                     fileList = fileList + document.forms.checkselect.currentpath.value + document.forms.checkselect[i].value + "," ;                      fileList = fileList + document.forms.checkselect.currentpath.value + document.forms.checkselect[i].value + "," ;
Line 371  sub select_files { Line 385  sub select_files {
             }              }
             opener.document.forms.lonhomework.              opener.document.forms.lonhomework.
 ENDSMP  ENDSMP
     $java_script .= $ENV{'form.fieldname'};      $javascript .= $ENV{'form.fieldname'};
     $java_script .= (<<ENDSMP);      $javascript .= (<<ENDSMP);
         .value=fileList;          .value=fileList;
             self.close();              self.close();
         }          }
         </script>          </script>
 ENDSMP  ENDSMP
     $r->print($java_script);      $r->print($javascript);
     $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 />");
     $r->print("<strong>Files selected:</strong><br />");      $r->print("<strong>Files selected from other directories:</strong><br />");
     foreach (&Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'})) {      foreach (&Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'})) {
         $r->print($_."<br />");          $r->print($_."<br />");
     }      }

Removed from v.1.60  
changed lines
  Added in v.1.63


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