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

raeburn lon-capa-cvs@mail.lon-capa.org
Sun, 24 Jul 2005 19:31:03 -0000


raeburn		Sun Jul 24 15:31:03 2005 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Make &process_file_upload() more self-contained.
  Fixes so that files can once again be uploaded to the top level of Supplemental Docs.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.193 loncom/interface/londocs.pm:1.194
--- loncom/interface/londocs.pm:1.193	Wed Jun 29 14:36:41 2005
+++ loncom/interface/londocs.pm	Sun Jul 24 15:31:00 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.193 2005/06/29 18:36:41 albertel Exp $
+# $Id: londocs.pm,v 1.194 2005/07/24 19:31:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1175,7 +1175,7 @@
 }
 
 sub process_file_upload {
-    my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase) = @_;
+    my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
 # upload a file, if present
     my $parseaction;
    if ($env{'form.parserflag'}) {
@@ -1183,10 +1183,10 @@
     }
     my $phase_status;
     my $folder=$env{'form.folder'};
-    if ($folder eq '' || $folder eq 'supplemental') {
+    if ($folder eq '') {
         $folder='default';
     }
-    if ( ($folder=~/^$1/) || ($1 eq 'default') ) {
+    if ( ($folder=~/^$uploadcmd/) || ($uploadcmd eq 'default') ) {
         my $errtext='';
         my $fatal=0;
         my $container='sequence';
@@ -1203,10 +1203,13 @@
             return 'failed';
         }
         my $destination = 'docs/';
-        if ($folder eq 'default') {
+        if ($folder =~ /^supplemental/) {
+            $destination = 'supplemental/';
+        }
+        if (($folder eq 'default') || ($folder eq 'supplemental')) {
             $destination .= 'default/';
-        } elsif ($folder =~ /^default_(\d+)$/) {
-            $destination .=  $1.'/';
+        } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
+            $destination .=  $2.'/';
         }
 # this is for a course, not a user, so set coursedoc flag
 # probably the only place in the system where this should be "1"
@@ -2256,7 +2259,7 @@
 # Process file upload - phase one - upload and parse primary file.  
           $upload_result = &process_file_upload(\$upload_output,$coursenum,
 						$coursedom,\%allfiles,
-						\%codebase);
+						\%codebase,$1);
           if ($upload_result eq 'phasetwo') {
               $r->print($upload_output);
           }