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

banghart lon-capa-cvs@mail.lon-capa.org
Mon, 06 Sep 2004 23:12:00 -0000


banghart		Mon Sep  6 19:12:00 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  
  	Fix bug for first time user of portfolio. Create portfolio
  	subdirectory off of userfiles.
  
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.35 loncom/interface/portfolio.pm:1.36
--- loncom/interface/portfolio.pm:1.35	Sat Aug 28 11:57:35 2004
+++ loncom/interface/portfolio.pm	Mon Sep  6 19:11:57 2004
@@ -443,7 +443,14 @@
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['selectfile','currentpath',
 					     'currentfile']);
-
+	# make sure there is a portfolio directory off /userfiles
+	my @dir_list=&Apache::lonnet::dirlist('/',
+					    $ENV{'user.domain'},
+					    $ENV{'user.name'},$portfolio_root);
+	if ($dir_list[0] eq 'no_such_dir'){
+	     &Apache::lonnet::mkdiruserfile($ENV{'user.name'},
+	     $ENV{'user.domain'},'portfolio');
+	}
     if ($ENV{'form.uploaddoc.filename'}) {
 	&upload($r);
     } elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) {