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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 04 Jul 2006 23:52:11 -0000


banghart		Tue Jul  4 19:52:11 2006 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	Work in progress. Starting display of versioned files. Now
  	just indicating which files have versions. No likely to remain 
  	this way at all.
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.128 loncom/interface/portfolio.pm:1.129
--- loncom/interface/portfolio.pm:1.128	Sun Jul  2 23:59:25 2006
+++ loncom/interface/portfolio.pm	Tue Jul  4 19:52:10 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.128 2006/07/03 03:59:25 albertel Exp $
+# $Id: portfolio.pm,v 1.129 2006/07/04 23:52:10 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -196,7 +196,7 @@
     	$filename =~ s/\s+$//;
     	my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename);
     	if ($version) {
-    	    $versioned{$fname} .= $version.",";
+    	    $versioned{$fname.'.'.$extension} .= $version.",";
     	}
         push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]);
     }
@@ -204,6 +204,12 @@
         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+)\.([^\.]*)$/)) {
+    	    my $version_flag;
+    	    if (exists($versioned{$filename})) {
+    	        $version_flag = ' (*) ';
+    	    } else {
+    	        $version_flag = '';
+    	    }
             if ($dirptr&$testdir) {
 		my $colspan='colspan="2"';
                 if ($select_mode eq 'true'){
@@ -211,18 +217,12 @@
                 }
 		$r->print('<tr class="LC_browser_folder"><td '.$colspan.'><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_closed.gif" /></td>');
                 $r->print('<td>Go to ...</td>');
-                $r->print('<td>'.&make_anchor($url,$filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'},$group).'</td>'); 
+                $r->print('<td>'.&make_anchor($url,$filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'},$group).$version_flag.'</td>'); 
                 $r->print('</tr>'); 
             } else {
 		my $css_class = 'LC_browser_file';
 		my $line;
-                my $version_flag;
-                if (exists($versioned{$fname})) {
-                   $version_flag = "*";
-                } else {
-                    $version_flag = "";
-                }
-               my $fullpath = $current_path.$filename;
+                my $fullpath = $current_path.$filename;
                 $fullpath = &prepend_group($fullpath,$group);
                 if ($select_mode eq 'true') {
                     $line='<td><input type="checkbox" name="checkfile" value="'.$filename.'"';
@@ -247,7 +247,7 @@
                             my $cat='<img alt="'.&mt('Catalog Information').
                             '" src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').'" />';
                             $line .= '<a href="'.$url.'?rename='.$filename.'&amp;currentpath='.$current_path.$groupecho.'">Rename</a>';
-                            $line .= '</td><td><a href="'.$href_edit_location.$filename.'.meta">'.$cat.'</a>';
+                            $line .= '</td><td><a href="'.$href_edit_location.$filename.'.meta">'.$cat.'</a>'.$version_flag;
                         }
                         $line .= '</td>';
                     }
@@ -289,7 +289,7 @@
 		}
 		$r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
 		$r->print('<td><a href="'.$href_location.$filename.'">'.
-			  $filename.'</a></td>'); 
+			  $filename.'</a>'.$version_flag.'</td>'); 
 		$r->print('<td>'.$size.'</td>');
 		$r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
 		if ($select_mode ne 'true') {