--- loncom/interface/Attic/lonspreadsheet.pm 2002/08/16 18:25:24 1.100 +++ loncom/interface/Attic/lonspreadsheet.pm 2002/09/27 20:41:25 1.100.4.2 @@ -1,5 +1,5 @@ # -# $Id: lonspreadsheet.pm,v 1.100 2002/08/16 18:25:24 matthew Exp $ +# $Id: lonspreadsheet.pm,v 1.100.4.2 2002/09/27 20:41:25 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -822,7 +822,7 @@ sub sett { # Deal with the normal cells foreach (keys(%f)) { - if (($f{$_}) && ($_!~/template\_/)) { + if (exists($f{$_}) && ($_!~/template\_/)) { my $matches=($_=~/^$pattern(\d+)/); if (($matches) && ($1)) { unless ($f{$_}=~/^\!/) { @@ -1187,9 +1187,14 @@ sub rown { if ($vl eq '') { $vl='#'; } - $rowdata.= - ''.$vl. - ''; + $rowdata.=''; + if ($ENV{'request.role'} =~ /^st\./) { + $rowdata.=$vl; + } else { + $rowdata.=''. + $vl.''; + } + $rowdata.=''; } else { $rowdata.=' '.$vl.' '; } @@ -1667,15 +1672,15 @@ sub updateclasssheet { $name=&Apache::lonnet::unescape($name); my ($sname,$sdom)=split(/\:/,$name); my $ssec=&Apache::lonnet::usection($sdom,$sname,$cid); - if ($ssec==-1) { - unless ($ENV{'form.showcsv'}) { - $rowlabel='Data not available: '.$name. - ''; - } else { - $rowlabel='ERROR","'.$name. - '","Data not available","","","'; - } - } else { +# if ($ssec==-1) { +# unless ($ENV{'form.showcsv'}) { +# $rowlabel='Data not available: '.$name. +# ''; +# } else { +# $rowlabel='ERROR","'.$name. +# '","Data not available","","","'; +# } +# } else { my %reply=&Apache::lonnet::idrget($sdom,$sname); my $reply=&Apache::lonnet::reply('get:'.$sdom.':'.$sname. ':environment:firstname&middlename&lastname&generation', @@ -1698,7 +1703,7 @@ sub updateclasssheet { unless ($ncount==4) { $rowlabel.=',""'; } $rowlabel=~s/\"$//; } - } +# } $currentlist{&Apache::lonnet::unescape($name)}=$rowlabel; } } # end of foreach (split(/\&/,$classlst)) @@ -1750,8 +1755,11 @@ sub updatestudentassesssheet { my $safeeval=shift; my %bighash; my $stype=&gettype($safeeval); + my $uname=&getuname($safeeval); + my $udom =&getudom($safeeval); my %current=(); - unless ($updatedata{$ENV{'request.course.fn'}.'_'.$stype}) { + unless ($updatedata{ + $ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}) { # -------------------------------------------------------------------- Tie hash if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', &GDBM_READER(),0640)) { @@ -1832,7 +1840,7 @@ sub updatestudentassesssheet { } elsif ($stype eq 'studentcalc') { %current=%allassess; } - $updatedata{$ENV{'request.course.fn'}.'_'.$stype}= + $updatedata{$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}= join('___;___',%current); } else { return 'Could not access course data'; @@ -1840,7 +1848,7 @@ sub updatestudentassesssheet { # ------------------------------------------------------ Get current from cache } else { %current=split(/\_\_\_\;\_\_\_/, - $updatedata{$ENV{'request.course.fn'}.'_'.$stype}); + $updatedata{$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}); } # -------------------- Find discrepancies between the course row table and this # @@ -2458,6 +2466,11 @@ sub handler { return OK; } + if ($ENV{'request.role'} =~ /^st\./) { + delete $ENV{'form.unewfield'} if (exists($ENV{'form.unewfield'})); + delete $ENV{'form.unewformula'} if (exists($ENV{'form.unewformula'})); + } + # ---------------------------------------------------- Global directory configs $includedir=$r->dir_config('lonIncludes'); @@ -2503,7 +2516,8 @@ $tmpdir=$r->dir_config('lonDaemons').'/t # --------------------------------------------------------------- Screen output $r->print('LON-CAPA Spreadsheet'); - $r->print(<print(< function celledit(cn,cf) { @@ -2529,6 +2543,7 @@ $tmpdir=$r->dir_config('lonDaemons').'/t ENDSCRIPT + } $r->print(''. ''. '

LON-CAPA Spreadsheet

'. @@ -2584,12 +2599,12 @@ ENDSCRIPT unless (&gettype($asheet) eq 'classcalc') { $r->print('

User: '.&getuname($asheet). '
Domain: '.&getudom($asheet)); - if (&getcsec($asheet) eq '-1') { - $r->print('

'. - 'Not a student in this course

'); - } else { +# if (&getcsec($asheet) eq '-1') { +# $r->print('

'. +# 'Not a student in this course

'); +# } else { $r->print('
Section/Group: '.&getcsec($asheet)); - } +# } if ($ENV{'form.usymb'}) { $r->print('
Assessment: '.$ENV{'form.usymb'}.''); }