[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
raeburn
raeburn@source.lon-capa.org
Sun, 28 Feb 2010 22:56:23 -0000
raeburn Sun Feb 28 22:56:23 2010 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- Bug 6119.
- Hide submission information if part has type 'anonsurvey' or 'anonsurveycred'.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.944 loncom/interface/loncommon.pm:1.945
--- loncom/interface/loncommon.pm:1.944 Thu Feb 25 15:41:14 2010
+++ loncom/interface/loncommon.pm Sun Feb 28 22:56:23 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.944 2010/02/25 15:41:14 raeburn Exp $
+# $Id: loncommon.pm,v 1.945 2010/02/28 22:56:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3412,12 +3412,22 @@
}
$prevattempts=&start_data_table().&start_data_table_header_row();
$prevattempts.='<th>'.&mt('History').'</th>';
+ my %typeparts;
+ my $showsurv=&Apache::lonnet::allowed('vas',$env{'request.course.id'});
foreach my $key (sort(keys(%lasthash))) {
my ($ign,@parts) = split(/\./,$key);
if ($#parts > 0) {
my $data=$parts[-1];
pop(@parts);
- $prevattempts.='<th>'.&mt('Part ').join('.',@parts).'<br />'.$data.' </th>';
+ if ($data eq 'type') {
+ unless ($showsurv) {
+ my $id = join(',',@parts);
+ $typeparts{$ign.'.'.$id} = $lasthash{$key};
+ }
+ delete($lasthash{$key});
+ } else {
+ $prevattempts.='<th>'.&mt('Part ').join('.',@parts).'<br />'.$data.' </th>';
+ }
} else {
if ($#parts == 0) {
$prevattempts.='<th>'.$parts[0].'</th>';
@@ -3427,23 +3437,98 @@
}
}
$prevattempts.=&end_data_table_header_row();
+ my %lasthidden;
if ($getattempt eq '') {
for ($version=1;$version<=$returnhash{'version'};$version++) {
- $prevattempts.=&start_data_table_row().
- '<td>'.&mt('Transaction [_1]',$version).'</td>';
- foreach my $key (sort(keys(%lasthash))) {
- my $value = &format_previous_attempt_value($key,
- $returnhash{$version.':'.$key});
- $prevattempts.='<td>'.$value.' </td>';
- }
- $prevattempts.=&end_data_table_row();
+ my @hidden;
+ if (%typeparts) {
+ foreach my $id (keys(%typeparts)) {
+ if (($returnhash{$version.':'.$id.'.type'} eq 'anonsurvey') || ($returnhash{$version.':'.$id.'.type'} eq 'anonsurveycred')) {
+ push(@hidden,$id);
+ $lasthidden{$id} = 1;
+ } elsif ($lasthidden{$id}) {
+ if (exists($returnhash{$version.':'.$id.'.award'})) {
+ delete($lasthidden{$id});
+ }
+ }
+ }
+ }
+ $prevattempts.=&start_data_table_row().
+ '<td>'.&mt('Transaction [_1]',$version).'</td>';
+ if (@hidden) {
+ foreach my $key (sort(keys(%lasthash))) {
+ my $hide;
+ foreach my $id (@hidden) {
+ if ($key =~ /^\Q$id\E/) {
+ $hide = 1;
+ last;
+ }
+ }
+ if ($hide) {
+ my ($id,$data) = ($key =~ /^(.+)\.([^.]+)$/);
+ if (($data eq 'award') || ($data eq 'awarddetail')) {
+ my $value = &format_previous_attempt_value($key,
+ $returnhash{$version.':'.$key});
+ $prevattempts.='<td>'.$value.' </td>';
+ } else {
+ $prevattempts.='<td> </td>';
+ }
+ } else {
+ if ($key =~ /\./) {
+ my $value = &format_previous_attempt_value($key,
+ $returnhash{$version.':'.$key});
+ $prevattempts.='<td>'.$value.' </td>';
+ } else {
+ $prevattempts.='<td> </td>';
+ }
+ }
+ }
+ } else {
+ foreach my $key (sort(keys(%lasthash))) {
+ my $value = &format_previous_attempt_value($key,
+ $returnhash{$version.':'.$key});
+ $prevattempts.='<td>'.$value.' </td>';
+ }
+ }
+ $prevattempts.=&end_data_table_row();
}
}
+ my @currhidden = keys(%lasthidden);
$prevattempts.=&start_data_table_row().'<td>'.&mt('Current').'</td>';
foreach my $key (sort(keys(%lasthash))) {
- my $value = &format_previous_attempt_value($key,$lasthash{$key});
- if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)}
- $prevattempts.='<td>'.$value.' </td>';
+ if (%typeparts) {
+ my $hidden;
+ foreach my $id (@currhidden) {
+ if ($key =~ /^\Q$id\E/) {
+ $hidden = 1;
+ last;
+ }
+ }
+ if ($hidden) {
+ my ($id,$data) = ($key =~ /^(.+)\.([^.]+)$/);
+ if (($data eq 'award') || ($data eq 'awarddetail')) {
+ my $value = &format_previous_attempt_value($key,$lasthash{$key});
+ if ($key =~/$regexp$/ && (defined &$gradesub)) {
+ $value = &$gradesub($value);
+ }
+ $prevattempts.='<td>'.$value.' </td>';
+ } else {
+ $prevattempts.='<td> </td>';
+ }
+ } else {
+ my $value = &format_previous_attempt_value($key,$lasthash{$key});
+ if ($key =~/$regexp$/ && (defined &$gradesub)) {
+ $value = &$gradesub($value);
+ }
+ $prevattempts.='<td>'.$value.' </td>';
+ }
+ } else {
+ my $value = &format_previous_attempt_value($key,$lasthash{$key});
+ if ($key =~/$regexp$/ && (defined &$gradesub)) {
+ $value = &$gradesub($value);
+ }
+ $prevattempts.='<td>'.$value.' </td>';
+ }
}
$prevattempts.= &end_data_table_row().&end_data_table();
} else {