--- loncom/interface/Attic/lonspreadsheet.pm 2002/09/27 20:41:25 1.100.4.2 +++ loncom/interface/Attic/lonspreadsheet.pm 2002/08/21 17:18:08 1.101 @@ -1,5 +1,5 @@ # -# $Id: lonspreadsheet.pm,v 1.100.4.2 2002/09/27 20:41:25 matthew Exp $ +# $Id: lonspreadsheet.pm,v 1.101 2002/08/21 17:18:08 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -822,7 +822,7 @@ sub sett { # Deal with the normal cells foreach (keys(%f)) { - if (exists($f{$_}) && ($_!~/template\_/)) { + if (($f{$_}) && ($_!~/template\_/)) { my $matches=($_=~/^$pattern(\d+)/); if (($matches) && ($1)) { unless ($f{$_}=~/^\!/) { @@ -1187,14 +1187,9 @@ sub rown { if ($vl eq '') { $vl='#'; } - $rowdata.=''; - if ($ENV{'request.role'} =~ /^st\./) { - $rowdata.=$vl; - } else { - $rowdata.=''. - $vl.''; - } - $rowdata.=''; + $rowdata.= + ''.$vl. + ''; } else { $rowdata.=' '.$vl.' '; } @@ -1672,15 +1667,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', @@ -1703,7 +1698,7 @@ sub updateclasssheet { unless ($ncount==4) { $rowlabel.=',""'; } $rowlabel=~s/\"$//; } -# } + } $currentlist{&Apache::lonnet::unescape($name)}=$rowlabel; } } # end of foreach (split(/\&/,$classlst)) @@ -1755,11 +1750,8 @@ 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.'_'.$uname.'_'.$udom}) { + unless ($updatedata{$ENV{'request.course.fn'}.'_'.$stype}) { # -------------------------------------------------------------------- Tie hash if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', &GDBM_READER(),0640)) { @@ -1840,7 +1832,7 @@ sub updatestudentassesssheet { } elsif ($stype eq 'studentcalc') { %current=%allassess; } - $updatedata{$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}= + $updatedata{$ENV{'request.course.fn'}.'_'.$stype}= join('___;___',%current); } else { return 'Could not access course data'; @@ -1848,7 +1840,7 @@ sub updatestudentassesssheet { # ------------------------------------------------------ Get current from cache } else { %current=split(/\_\_\_\;\_\_\_/, - $updatedata{$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}); + $updatedata{$ENV{'request.course.fn'}.'_'.$stype}); } # -------------------- Find discrepancies between the course row table and this # @@ -2466,11 +2458,6 @@ 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'); @@ -2516,8 +2503,7 @@ $tmpdir=$r->dir_config('lonDaemons').'/t # --------------------------------------------------------------- Screen output $r->print('LON-CAPA Spreadsheet'); - if ($ENV{'request.role'} !~ /^st\./) { - $r->print(<print(< function celledit(cn,cf) { @@ -2543,10 +2529,7 @@ $tmpdir=$r->dir_config('lonDaemons').'/t ENDSCRIPT - } - $r->print(''. - ''. - '

LON-CAPA Spreadsheet

'. + $r->print(''.&Apache::loncommon::bodytag('Grades Spreadsheet'). '
'. &hiddenfield('uname',$ENV{'form.uname'}). &hiddenfield('udom',$ENV{'form.udom'}). @@ -2599,23 +2582,17 @@ 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'}.''); } } -# ---------------------------------------------------------------- Course title - - $r->print('

'. - $ENV{'course.'.$ENV{'request.course.id'}.'.description'}. - '

'.localtime().'

'); - # ---------------------------------------------------- See if user can see this if ((&gettype($asheet) eq 'classcalc') ||