[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 27 Sep 2002 18:29:15 -0000
matthew Fri Sep 27 14:29:15 2002 EDT
Modified files:
/loncom/interface lonspreadsheet.pm
Log:
Fixed indentation on loaderror code for some reason.
Sorting is now case insensitive.
Students are no longer allowed to enter perl code in their spreadsheet.
If they attempt to fake it by 'post'ing values, we catch that and ignore it.
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.110 loncom/interface/lonspreadsheet.pm:1.111
--- loncom/interface/lonspreadsheet.pm:1.110 Mon Sep 16 16:09:45 2002
+++ loncom/interface/lonspreadsheet.pm Fri Sep 27 14:29:15 2002
@@ -1,5 +1,5 @@
#
-# $Id: lonspreadsheet.pm,v 1.110 2002/09/16 20:09:45 www Exp $
+# $Id: lonspreadsheet.pm,v 1.111 2002/09/27 18:29:15 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1226,8 +1226,14 @@
if ($vl eq '') {
$vl='<font size=+2 color='.$bgcolor.'>#</font>';
}
- $rowdata.='<td bgcolor='.$bgcolor.'>'.
- '<a href="javascript:celledit('.$fm.');">'.$vl.'</a></td>';
+ $rowdata.='<td bgcolor='.$bgcolor.'>';
+ if ($ENV{'request.role'} =~ /^st\./) {
+ $rowdata.=$vl;
+ } else {
+ $rowdata.='<a href="javascript:celledit('.$fm.');">'.
+ $vl.'</a>';
+ }
+ $rowdata.='</td>';
} else {
$rowdata.='<td bgcolor='.$bgcolor.'> '.$vl.' </td>';
}
@@ -1299,7 +1305,7 @@
push (@sortby, $safeeval->reval('$f{"A'.$row.'"}'));
push (@sortidx, $row-1);
}
- @sortidx=sort { $sortby[$a] cmp $sortby[$b]; } @sortidx;
+ @sortidx=sort { lc($sortby[$a]) cmp lc($sortby[$b]); } @sortidx;
#
# Determine the type of child spreadsheets
my $what='Student';
@@ -2412,17 +2418,14 @@
# Interactive call to screen
#
#
-
-
sub handler {
my $r=shift;
- my $loaderror=&Apache::lonnet::overloaderror($r);
- if ($loaderror) { return $loaderror; }
- $loaderror=
- &Apache::lonnet::overloaderror($r,
- $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
- if ($loaderror) { return $loaderror; }
+ my $loaderror=&Apache::lonnet::overloaderror($r);
+ if ($loaderror) { return $loaderror; }
+ $loaderror= &Apache::lonnet::overloaderror($r,
+ $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
+ if ($loaderror) { return $loaderror; }
if ($r->header_only) {
$r->content_type('text/html');
@@ -2442,6 +2445,10 @@
# Get query string for limited number of parameters
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['uname','udom','usymb','ufn']);
+ if ($ENV{'request.role'} =~ /^st\./) {
+ delete $ENV{'form.unewfield'} if (exists($ENV{'form.unewfield'}));
+ delete $ENV{'form.unewformula'} if (exists($ENV{'form.unewformula'}));
+ }
if (($ENV{'form.usymb'}=~/^\_(\w+)/) && (!$ENV{'form.ufn'})) {
$ENV{'form.ufn'}='default_'.$1;
}
@@ -2468,7 +2475,8 @@
$r->send_http_header;
# Screen output
$r->print('<html><head><title>LON-CAPA Spreadsheet</title>');
- $r->print(<<ENDSCRIPT);
+ if ($ENV{'request.role'} !~ /^st\./) {
+ $r->print(<<ENDSCRIPT);
<script language="JavaScript">
function celledit(cn,cf) {
@@ -2494,6 +2502,7 @@
</script>
ENDSCRIPT
+ }
$r->print('</head>'.&Apache::loncommon::bodytag('Grades Spreadsheet').
'<form action="'.$r->uri.'" name=sheet method=post>');
$r->print(&hiddenfield('uname',$ENV{'form.uname'}).