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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 24 Aug 2004 06:51:11 -0000


albertel		Tue Aug 24 02:51:11 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  - things are now sorted
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.25 loncom/interface/portfolio.pm:1.26
--- loncom/interface/portfolio.pm:1.25	Tue Aug 24 02:43:21 2004
+++ loncom/interface/portfolio.pm	Tue Aug 24 02:51:11 2004
@@ -197,7 +197,12 @@
     $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
             '<tr><th>Actions</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');
     my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio/$current_path/";
-    foreach my $line (@$dir_list) {
+    foreach my $line (sort 
+		      { 
+			  my ($afile)=split('&',$a,2);
+			  my ($bfile)=split('&',$b,2);
+			  return (lc($afile) cmp lc($bfile));
+		      } (@$dir_list)) {
     	#$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); 
@@ -319,8 +324,8 @@
 
 sub createdir {
     my ($r)=@_;
-    #FIXME 1) bad dirnames
-    #      2) file exists in place of dir
+    #FIXME 1) bad dirnames ( '/' etc)
+    #      2) file exists in place of dir (errormessage needs improvement)
     my $result=&Apache::lonnet::mkdiruserfile($ENV{'user.name'},
 	     $ENV{'user.domain'},'portfolio'.$ENV{'form.currentpath'}.$ENV{'form.newdir'});
     if ($result ne 'ok') {