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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 20 Jun 2006 01:56:18 -0000


banghart		Mon Jun 19 21:56:18 2006 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	Saving work in progress. Get version info available in directory
  	display loop.
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.104 loncom/interface/portfolio.pm:1.105
--- loncom/interface/portfolio.pm:1.104	Fri Jun 16 18:37:10 2006
+++ loncom/interface/portfolio.pm	Mon Jun 19 21:56:17 2006
@@ -166,6 +166,8 @@
     }
     my $href_location="/uploaded/$udom/$uname/$port_path".$current_path;
     my $href_edit_location="/editupload/$udom/$uname/$port_path".$current_path;
+    my @dir_lines;
+    my %versioned;
     foreach my $line (sort 
 		      { 
 			  my ($afile)=split('&',$a,2);
@@ -176,6 +178,15 @@
     	#$dom 
     	my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
     	$filename =~ s/\s+$//;
+    	my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
+    	if ($version) {
+    	    $versioned{$fname} .= $version.",";
+    	}
+        push @dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs];
+    }
+    foreach my $line(@dir_lines) {
+        my ($filename,$dom,$testdir,$size,$mtime,$obs) = @$line;
+        my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
     	if (($filename ne '.') && ($filename ne '..') && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/)) {
             if ($dirptr&$testdir) {
                 if ($select_mode eq 'true'){
@@ -188,7 +199,13 @@
                 $r->print('</tr>'); 
             } else {
                 $r->print('<tr bgcolor="#CCCCFF">');
-                my $fullpath = $current_path.$filename;
+                my $version_flag;
+                if (exists($versioned{$fname})) {
+                   $version_flag = "*";
+                } else {
+                    $version_flag = "";
+                }
+               my $fullpath = $current_path.$filename;
                 $fullpath = &prepend_group($fullpath,$group);
                 if ($select_mode eq 'true'){
                     $r->print('<td><input type="checkbox" name="checkfile" value="'.$filename.'"');