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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 18 Jul 2006 02:20:19 -0000


banghart		Mon Jul 17 22:20:19 2006 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	saving work in progress. I think the refactoring is good, we'll see.
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.134 loncom/interface/portfolio.pm:1.135
--- loncom/interface/portfolio.pm:1.134	Mon Jul 17 21:25:43 2006
+++ loncom/interface/portfolio.pm	Mon Jul 17 22:20:19 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.134 2006/07/18 01:25:43 banghart Exp $
+# $Id: portfolio.pm,v 1.135 2006/07/18 02:20:19 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -129,44 +129,11 @@
     $r->print("</form>");
 }
 sub display_directory_line {
-    my ($r,$select_mode,$fullpath, $css_class, $line, $access_controls, 
+    my ($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class, $line, $access_controls, $curr_access,
             $now, $version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text)=@_;
-    my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
+    # my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
 		$r->print('<tr class="'.$css_class.'">');
 		$r->print($line);
-		my $curr_access;
-		if ($select_mode ne 'true') {
-		    my $pub_access = 0;
-		    my $guest_access = 0;
-		    my $cond_access = 0;
-		    foreach my $key (sort(keys(%{$$access_controls{$fullpath}}))) {
-			my ($num,$scope,$end,$start) = &unpack_acc_key($key);
-			if (($now > $start) && (!$end || $end > $now)) {
-			    if ($scope eq 'public')  {
-				$pub_access = 1;
-			    } elsif ($scope eq 'guest') {
-				$guest_access = 1;
-			    } else {
-				$cond_access = 1;
-			    }
-			}
-		    }
-		    if (!$pub_access && !$guest_access && !$cond_access) {
-			$curr_access = &mt('Private');
-		    } else {
-			my @allaccesses; 
-			if ($pub_access) {
-			    push(@allaccesses,&mt('Public'));
-			}
-			if ($guest_access) {
-			    push(@allaccesses,&mt('Passphrase-protected'));
-			}
-			if ($cond_access) {
-			    push(@allaccesses,&mt('Conditional'));
-			}
-			$curr_access = join('+ ',@allaccesses);
-		    }
-		}
 		$r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
 		$r->print('<td>'.$$version_flag{$filename}.'<a href="'.$href_location.$filename.'">'.
 			  $filename.'</a></td>'); 
@@ -317,10 +284,6 @@
                         $line .= '</td>';
                     }
                 }
-#                &display_directory_line($r,$select_mode,$fullpath, $css_class, $line, \%access_controls, 
-#                        $now, \%version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text);
-		$r->print('<tr class="'.$css_class.'">');
-		$r->print($line);
 		my $curr_access;
 		if ($select_mode ne 'true') {
 		    my $pub_access = 0;
@@ -354,21 +317,27 @@
 			$curr_access = join('+ ',@allaccesses);
 		    }
 		}
-		$r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
-		$r->print('<td>'.$version_flag{$filename}.'<a href="'.$href_location.$filename.'">'.
-			  $filename.'</a></td>'); 
-		$r->print('<td>'.$size.'</td>');
-		$r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
-		if ($select_mode ne 'true') {
-		    $r->print('<td><span style="white-space: nowrap">'.
-			      &mt($curr_access).'&nbsp;&nbsp;&nbsp;');
-		    $r->print('<a href="'.$url.'?access='.$filename.
-			      '&amp;currentpath='.$current_path.$groupecho.
-			      '">'.$access_admin_text.'</a></span></td>');
-		}
-		$r->print('</tr>'.$/);
+                &display_directory_line($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class, $line, \%access_controls, $curr_access,
+                        $now, \%version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text);
+#		$r->print('<tr class="'.$css_class.'">');
+#		$r->print($line);
+#		$r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
+#		$r->print('<td>'.$version_flag{$filename}.'<a href="'.$href_location.$filename.'">'.
+#			  $filename.'</a></td>'); 
+#		$r->print('<td>'.$size.'</td>');
+#		$r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
+#		if ($select_mode ne 'true') {
+#		    $r->print('<td><span style="white-space: nowrap">'.
+#			      &mt($curr_access).'&nbsp;&nbsp;&nbsp;');
+#		    $r->print('<a href="'.$url.'?access='.$filename.
+#			      '&amp;currentpath='.$current_path.$groupecho.
+#			      '">'.$access_admin_text.'</a></span></td>');
+#		}
+#		$r->print('</tr>'.$/);
 		if ($show_versions) {
-		    
+		    &display_directory_line($r,$select_mode,$fullpath, $css_class, $line, \%access_controls, 
+                        $now, \%version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text);
+
 		}
             }
         }