--- loncom/interface/spreadsheet/studentcalc.pm 2003/05/19 14:34:54 1.2
+++ loncom/interface/spreadsheet/studentcalc.pm 2003/05/23 14:52:51 1.5
@@ -1,5 +1,5 @@
#
-# $Id: studentcalc.pm,v 1.2 2003/05/19 14:34:54 matthew Exp $
+# $Id: studentcalc.pm,v 1.5 2003/05/23 14:52:51 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -48,9 +48,11 @@ package Apache::studentcalc;
use strict;
use Apache::Constants qw(:common :http);
use Apache::lonnet;
+use Apache::loncommon();
+use Apache::loncoursedata();
use Apache::lonnavmaps;
-use Apache::Spreadsheet;
-use Apache::assesscalc;
+use Apache::Spreadsheet();
+use Apache::assesscalc();
use HTML::Entities();
use Spreadsheet::WriteExcel;
use Time::HiRes;
@@ -90,8 +92,22 @@ sub clear_package {
sub get_title {
my $self = shift;
my $title = '';
- $title .= '
Spreadsheet for '.
- $self->{'name'}.'@'.$self->{'domain'}.'
';
+ my %userenv = &Apache::loncoursedata::GetUserName($self->{'name'},
+ $self->{'domain'});
+ &Apache::lonnet::logthis('userenv = '.join(' ',%userenv));
+ my $name =
+ join(' ',@userenv{'firstname','middlename','lastname','generation'});
+ $name =~ s/\s+$//;
+ $title .= ''.$name;
+ if ($ENV{'user.name'} ne $self->{'name'} &&
+ $ENV{'user.domain'} ne $self->{'domain'}) {
+ $title .= &Apache::loncommon::aboutmewrapper
+ ($self->{'name'}.'@'.$self->{'domain'},
+ $self->{'name'},$self->{'domain'});
+ }
+ $title .= "
\n";
+ $title .= ''.$self->{'coursedesc'}."
\n";
+ $title .= ''.localtime(time).'
';
return $title;
}
@@ -140,24 +156,40 @@ END
$label_num++;
}
$tableheader .="\n";
- #
- $r->print($tableheader);
- #
- # Print out template row
- $r->print('Template | | '.
- $self->html_template_row($num_uneditable)."
\n");
- #
- # Print out summary/export row
- $r->print('Export | 0 | '.
- $self->html_export_row()."
\n");
+ if ($self->blackout()) {
+ $r->print(''.
+ 'Some computations are not available at this time.
'.
+ 'There are problems whose status you are allowed to view.'.
+ '
'."\n");
+ } else {
+ $r->print($tableheader);
+ #
+ # Print out template row
+ if (exists($ENV{'request.role.adv'}) && $ENV{'request.role.adv'}) {
+ $r->print('Template | | '.
+ $self->html_template_row($num_uneditable)."
\n");
+ }
+ #
+ # Print out summary/export row
+ $r->print('Summary | 0 | '.
+ $self->html_export_row()."
\n");
+ }
$r->print("\n");
#
# Prepare to output rows
- $tableheader =<<"END";
+ if (exists($ENV{'request.role.adv'}) && $ENV{'request.role.adv'}) {
+ $tableheader =<<"END";
Row | Assessment |
END
+ } else {
+ $tableheader =<<"END";
+
+
+ | Assessment |
+END
+ }
foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){
if ($label_num<$num_uneditable) {
$tableheader.='';
@@ -187,19 +219,25 @@ END
''.
- $resource->{'title'}.' ';
+ '&usymb='.&Apache::lonnet::escape($resource->{'symb'}).
+ '">'.$resource->{'title'}.' ';
$row_output .= &assess_file_selector($rownum,
$assess_filename,
\@AssessFileNames).
' | ';
} else {
$row_output .= 'Go To';
$row_output .= ' | '.$resource->{'title'}.' | ';
}
- $row_output .= $self->html_row($num_uneditable,$rownum).
- "
\n";
+ if ($self->blackout() && $self->{'blackout_rows'}->{$rownum}>0) {
+ $row_output .=
+ 'Unavailable at this time | '."\n";
+ } else {
+ $row_output .= $self->html_row($num_uneditable,$rownum).
+ "\n";
+ }
$r->print($row_output);
}
$r->print("
\n");
@@ -340,6 +378,10 @@ sub compute {
$assess_filename,
$resource->{'symb'});
my @exportdata = $assessSheet->export_data();
+ if ($assessSheet->blackout()) {
+ $self->blackout(1);
+ $self->{'blackout_rows'}->{$rownum} = 1;
+ }
#
# Be sure not to disturb the formulas in the 'A' column
my $data = shift(@exportdata);
@@ -448,6 +490,7 @@ Writes the export data for this student
#############################################
sub save_export_data {
my $self = shift;
+ return if ($self->temporary());
my $student = $self->{'name'}.':'.$self->{'domain'};
return if (! exists($Exportrows{$student}));
return if (! $self->is_default());
---|