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

banghart lon-capa-cvs@mail.lon-capa.org
Sat, 04 Dec 2004 02:15:42 -0000


banghart		Fri Dec  3 21:15:42 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	Saving work in progress. managing selecting files from 
  	multiple directories.
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.59 loncom/interface/portfolio.pm:1.60
--- loncom/interface/portfolio.pm:1.59	Thu Nov 25 19:17:37 2004
+++ loncom/interface/portfolio.pm	Fri Dec  3 21:15:42 2004
@@ -159,6 +159,7 @@
     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'});
     if ($is_empty && ($current_path ne '/')) {
         $display_out = '<form method="post" action="/adm/portfolio">'.
         '<input type="hidden" name="action" value="deletedir" />'.
@@ -205,6 +206,10 @@
         }
     }
     $r->print('</table>
+            <input type="hidden" name="continue" value="true">
+            <input type="hidden" name="fieldname" value="'.$ENV{'form.fieldname'}.'">
+            <input type="hidden" name="mode" value="selectfile">
+            <input type="submit" name="submit" value="Select checked files, and continue selecting." /><br />
             <input type="button" name="doit" onClick= "finishSelect();" value="Select checked files, and close window" />
             <input type="hidden" name="currentpath" value="'.$current_path.'" />
     </form>');
@@ -349,6 +354,12 @@
 }
 sub select_files {
     my ($r)=@_;
+    if ($ENV{'form.continue'} eq 'true') {
+        # here we update the selections for the currentpath
+        # 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);
+    }
     my $java_script =(<<ENDSMP);
         <script language='javascript'>
         function finishSelect() {
@@ -370,6 +381,10 @@
     $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 />");
+    foreach (&Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'})) {
+        $r->print($_."<br />");
+    }
 }
 sub upload {
     my ($r)=@_;