[LON-CAPA-cvs] cvs: loncom /interface portfolio.pm

banghart lon-capa-cvs@mail.lon-capa.org
Sat, 04 Dec 2004 18:37:36 -0000


banghart		Sat Dec  4 13:37:36 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	Another step toward submission from multiple directories.
  	At least now it LOOKS good to the user! Now to actually
  	submit the selected files.
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.60 loncom/interface/portfolio.pm:1.61
--- loncom/interface/portfolio.pm:1.60	Fri Dec  3 21:15:42 2004
+++ loncom/interface/portfolio.pm	Sat Dec  4 13:37:36 2004
@@ -112,13 +112,6 @@
     	#$strip holds directory/file name
     	#$dom 
     	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 ($dirptr&$testdir) {
                 $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
@@ -159,7 +152,10 @@
     my ($r,$current_path,$is_empty,$dir_list)=@_;
     my $iconpath= $r->dir_config('lonIconsURL') . "/";
     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 '/')) {
         $display_out = '<form method="post" action="/adm/portfolio">'.
         '<input type="hidden" name="action" value="deletedir" />'.
@@ -185,6 +181,7 @@
     	#$strip holds directory/file name
     	#$dom 
     	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 ($dirptr&$testdir) {
                 $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
@@ -193,9 +190,14 @@
                 $r->print('</tr>'); 
             } else {
                 $r->print('<tr bgcolor="#CCCCFF">');
-                $r->print('<td>
-                        <input type="checkbox" name="selectedfile" value="'.$filename.'" >
-                    </td>');
+                $r->print('<td><input type="checkbox" name="selectedfile" value="'.$filename.'"'); 
+                if ($$checked_files{$filename} eq 'selected') {
+                    $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><a href="'.$href_location.$filename.'">'.
 			    $filename.'</a></td>'); 
@@ -381,7 +383,7 @@
     $r->print($java_script);
     $r->print("<h1>Select portfolio files</h1>
                 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'})) {
         $r->print($_."<br />");
     }