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

banghart lon-capa-cvs@mail.lon-capa.org
Wed, 28 Jul 2004 22:30:32 -0000


banghart		Wed Jul 28 18:30:32 2004 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  
  	Now has subdirectory navigation that looks and acts like 
  	construction space. 
  	
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.18 loncom/interface/portfolio.pm:1.19
--- loncom/interface/portfolio.pm:1.18	Wed Jul 28 15:00:19 2004
+++ loncom/interface/portfolio.pm	Wed Jul 28 18:30:31 2004
@@ -218,9 +218,10 @@
     # as well as information about the home server directory structure, specifically
     # the path to the users userfiles directory.    
     # 
+    $r->print('/userfiles/portfolio'.$currentPath.'<br>');
     my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
 						     $ENV{'user.name'}).
-						       '/userfiles/portfolio'.$currentPath;
+						       '/userfiles/portfolio';
     @dirList = &Apache::lonnet::dirlist($currentPath,  $ENV{'user.domain'}, $ENV{'user.name'}, $portfolio_root);
     
     if (@dirList == 2) { # need to know if directory is empty so it can be removed if desired
@@ -250,16 +251,37 @@
     # Display begins here
     #
     ##############################
+    my @tree = split (/\//,$currentPath);
+    $r->print('<font size="+2">'.makeAnchor('portfolio','/').'/');
+    if (@tree > 1){
+        my $newCurrentPath = '';
+        for (my $i = 1; $i< @tree; $i++){
+            $newCurrentPath .= $tree[$i].'/';
+            $r->print(makeAnchor($tree[$i],'/'.$newCurrentPath).'/');
+        }
+    }
+    $r->print('</font>');
     $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
             '<tr><th>&nbsp;</th><th>Actions</th><th>Name</th><th>Title</th><th>Status</th><th>Last Modified</th></tr>');
     foreach my $line (@dirList) {
     	#$strip holds directory/file name
     	#$dom 
     	my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
-        if ($dirptr&$testdir){
-            $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td></tr>'); 
-        }else{
-            $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'doc.gif"></td></tr>');
+    	if (($fileName ne '.') && ($fileName ne '..')){
+            if ($dirptr&$testdir){
+                $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
+                $r->print('<td>Go to ...</td>');
+                $r->print('<td>'.makeAnchor($fileName.'/',$currentPath.$fileName.'/').'</td>'); 
+                $r->print('</tr>'); 
+            }else{
+                $r->print('<tr bgcolor="#CCCCFF"><td><img src="'.$iconpath.'unknown.gif"></td>');
+                $r->print('<td>Edit</td>');
+                $r->print('<td>'.$fileName.'</td>'); 
+                $r->print('<td>Title Here</td>');
+                $r->print('<td>Status Here</td>');
+                $r->print('<td>Modified Here</td>');
+                $r->print('</tr>'); 
+            }
         }
     }
 #   <tr bgcolor="#FFAA99"> pink bg