--- loncom/interface/Attic/lonspreadsheet.pm 2002/12/04 21:49:33 1.154
+++ loncom/interface/Attic/lonspreadsheet.pm 2002/12/09 14:50:11 1.156
@@ -1,5 +1,5 @@
#
-# $Id: lonspreadsheet.pm,v 1.154 2002/12/04 21:49:33 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.156 2002/12/09 14:50:11 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1284,6 +1284,7 @@ sub html_uneditable_cell {
sub outsheet_html {
my ($sheet,$r) = @_;
my ($num_uneditable,$realm,$row_type);
+ my $requester_is_student = ($ENV{'request.role'} =~ /^st\./);
if ($sheet->{'sheettype'} eq 'assesscalc') {
$num_uneditable = 1;
$realm = 'Assessment';
@@ -1328,34 +1329,39 @@ END
####################################
# Print out template row
####################################
- my ($rowlabel,@rowdata) = &get_row($sheet,'-');
- my $row_html = '
'.&format_html_rowlabel($sheet,$rowlabel).' | ';
- my $num_cols_output = 0;
- foreach my $cell (@rowdata) {
- if ($num_cols_output++ < $num_uneditable) {
- $row_html .= '';
- $row_html .= &html_uneditable_cell($cell,'#FFDDDD');
- } else {
- $row_html .= ' | ';
- $row_html .= &html_editable_cell($cell,'#E0FFDD');
+ my ($num_cols_output,$row_html,$rowlabel,@rowdata);
+
+ if (! $requester_is_student) {
+ ($rowlabel,@rowdata) = &get_row($sheet,'-');
+ $row_html = ' |
'.&format_html_rowlabel($sheet,$rowlabel).' | ';
+ $num_cols_output = 0;
+ foreach my $cell (@rowdata) {
+ if ($requester_is_student ||
+ $num_cols_output++ < $num_uneditable) {
+ $row_html .= '';
+ $row_html .= &html_uneditable_cell($cell,'#FFDDDD');
+ } else {
+ $row_html .= ' | ';
+ $row_html .= &html_editable_cell($cell,'#E0FFDD');
+ }
+ $row_html .= ' | ';
}
- $row_html .= '';
+ $row_html.= "
\n";
+ $r->print($row_html);
}
- $row_html.= "\n";
- $r->print($row_html);
####################################
# Print out summary/export row
####################################
($rowlabel,@rowdata) = &get_row($sheet,'0');
- $row_html = ''.&format_html_rowlabel($sheet,$rowlabel).' | ';
+ $row_html = '
'.&format_html_rowlabel($sheet,'Summary').' | ';
$num_cols_output = 0;
foreach my $cell (@rowdata) {
- if ($num_cols_output++ < 26) {
+ if ($num_cols_output++ < 26 && ! $requester_is_student) {
$row_html .= '';
$row_html .= &html_editable_cell($cell,'#CCCCFF');
} else {
$row_html .= ' | ';
- $row_html .= &html_uneditable_cell(undef,'#CCCCFF');
+ $row_html .= &html_uneditable_cell($cell,'#CCCCFF');
}
$row_html .= ' | ';
}
@@ -1432,7 +1438,7 @@ END
$bgcolor='#FFDDDD' if ($shown_cells < $num_uneditable);
#
$row_html.='';
- if ($shown_cells < $num_uneditable) {
+ if ($requester_is_student || $shown_cells < $num_uneditable) {
$row_html .= &html_uneditable_cell($cell,$bgcolor);
} else {
$row_html .= &html_editable_cell($cell,$bgcolor);
@@ -3123,7 +3129,7 @@ ENDSCRIPT
# If a new formula had been entered, go from work copy
if ($ENV{'form.unewfield'}) {
$r->print('Modified Workcopy');
- $ENV{'form.unewformula'}=~s/\'/\"/g;
+ #$ENV{'form.unewformula'}=~s/\'/\"/g;
$r->print('Cell '.$ENV{'form.unewfield'}.' = ');
$r->print(&HTML::Entities::encode($ENV{'form.unewformula'}).
' ');
|