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

banghart lon-capa-cvs@mail.lon-capa.org
Sat, 04 Dec 2004 19:08:43 -0000


banghart		Sat Dec  4 14:08:43 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	Actually works once. Need to work out logic for clearing the
  	file storing selected files, so files are "preselected" on
  	subsequent visits.
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.61 loncom/interface/portfolio.pm:1.62
--- loncom/interface/portfolio.pm:1.61	Sat Dec  4 13:37:36 2004
+++ loncom/interface/portfolio.pm	Sat Dec  4 14:08:42 2004
@@ -361,11 +361,23 @@
         # eventually, have to handle removing those not checked, but . . . 
         my @items=&Apache::loncommon::get_env_multiple('form.selectedfile');
         &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 @files = &Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});
+    my $java_files = join ",", @files;
+    if ($java_files) {
+        $java_files.=',';
     }
     my $java_script =(<<ENDSMP);
         <script language='javascript'>
         function finishSelect() {
-            fileList = "";
+ENDSMP
+    $java_script .= 'fileList = "'.$java_files.'";';
+    $java_script .= (<<ENDSMP);
             for (i=0;i<document.forms.checkselect.length;i++) { 
                 if (document.forms.checkselect[i].checked){
                     fileList = fileList + document.forms.checkselect.currentpath.value + document.forms.checkselect[i].value + "," ;