[LON-CAPA-cvs] cvs: loncom /interface portfolio.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Tue, 18 Jul 2006 01:25:47 -0000
banghart Mon Jul 17 21:25:47 2006 EDT
Modified files:
/loncom/interface portfolio.pm
Log:
Saving work in progress. Refactoring sub display_directory to
permit display of versioned files.
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.133 loncom/interface/portfolio.pm:1.134
--- loncom/interface/portfolio.pm:1.133 Fri Jul 7 21:51:07 2006
+++ loncom/interface/portfolio.pm Mon Jul 17 21:25:43 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.133 2006/07/08 01:51:07 raeburn Exp $
+# $Id: portfolio.pm,v 1.134 2006/07/18 01:25:43 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -128,6 +128,59 @@
'this.form.submit();'));
$r->print("</form>");
}
+sub display_directory_line {
+ my ($r,$select_mode,$fullpath, $css_class, $line, $access_controls,
+ $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);
+ $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>');
+ $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).' ');
+ $r->print('<a href="'.$url.'?access='.$filename.
+ '&currentpath='.$current_path.$groupecho.
+ '">'.$access_admin_text.'</a></span></td>');
+ }
+ $r->print('</tr>'.$/);
+}
sub display_directory {
my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload,
$can_modify,$can_delete,$can_setacl)=@_;
@@ -214,7 +267,11 @@
$show_versions = 'true';
}
if (exists($versioned{$filename})) {
- $version_flag{$filename} = '<a href="portfolio?showversions='.$filename.'"><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_pointer_closed.gif" /></a>';
+ if ($show_versions) {
+ $version_flag{$filename} = '<a href="portfolio"><img alt="'.&mt('opened folder').'" src="'.$iconpath.'folder_pointer_opened.gif" /></a>';
+ } else {
+ $version_flag{$filename} = '<a href="portfolio?showversions='.$filename.'"><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_pointer_closed.gif" /></a>';
+ }
} else {
$version_flag{$filename} = '';
}
@@ -260,6 +317,8 @@
$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;
@@ -308,6 +367,9 @@
'">'.$access_admin_text.'</a></span></td>');
}
$r->print('</tr>'.$/);
+ if ($show_versions) {
+
+ }
}
}
}