--- loncom/interface/lonparmset.pm 2005/06/02 13:15:05 1.198 +++ loncom/interface/lonparmset.pm 2005/06/02 16:35:32 1.200 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.198 2005/06/02 13:15:05 www Exp $ +# $Id: lonparmset.pm,v 1.200 2005/06/02 16:35:32 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -66,12 +66,8 @@ use Apache::lonnavmaps; # --- Caches local to lonparmset -my $courseoptid=''; -my %courseopt=(); -my $useroptid=''; -my %useropt=(); -my $parmhashid=''; -my %parmhash=(); +my $parmhashid; +my %parmhash; # --- end local caches @@ -120,8 +116,15 @@ Returns: A list, the first item is the sub parmval { my ($what,$id,$def,$uname,$udom,$csec)=@_; # load caches + &cacheparmhash(); + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); + my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); + + my $result=''; my @outpar=(); # ----------------------------------------------------- Cascading lookup scheme @@ -141,13 +144,13 @@ sub parmval { # --------------------------------------------------------- first, check course - if (defined($courseopt{$courselevel})) { - $outpar[11]=$courseopt{$courselevel}; + if (defined($$courseopt{$courselevel})) { + $outpar[11]=$$courseopt{$courselevel}; $result=11; } - if (defined($courseopt{$courselevelm})) { - $outpar[10]=$courseopt{$courselevelm}; + if (defined($$courseopt{$courselevelm})) { + $outpar[10]=$$courseopt{$courselevelm}; $result=10; } @@ -160,24 +163,25 @@ sub parmval { my $thisparm=$parmhash{$symbparm}; if (defined($thisparm)) { $outpar[8]=$thisparm; $result=8; } - if (defined($courseopt{$courselevelr})) { - $outpar[7]=$courseopt{$courselevelr}; + if (defined($$courseopt{$courselevelr})) { + $outpar[7]=$$courseopt{$courselevelr}; $result=7; } # ------------------------------------------------------ fourth, back to course if (defined($csec)) { - if (defined($courseopt{$seclevel})) { - $outpar[6]=$courseopt{$seclevel}; + if (defined($$courseopt{$seclevel})) { + $outpar[6]=$$courseopt{$seclevel}; $result=6; } - if (defined($courseopt{$seclevelm})) { - $outpar[5]=$courseopt{$seclevelm}; + if (defined($$courseopt{$seclevelm})) { + $outpar[5]=$$courseopt{$seclevelm}; $result=5; } - if (defined($courseopt{$seclevelr})) { - $outpar[4]=$courseopt{$seclevelr}; + if (defined($$courseopt{$seclevelr})) { + $outpar[4]=$$courseopt +{$seclevelr}; $result=4; } } @@ -185,18 +189,18 @@ sub parmval { # ---------------------------------------------------------- fifth, check user if (defined($uname)) { - if (defined($useropt{$courselevel})) { - $outpar[3]=$useropt{$courselevel}; + if (defined($$useropt{$courselevel})) { + $outpar[3]=$$useropt{$courselevel}; $result=3; } - if (defined($useropt{$courselevelm})) { - $outpar[2]=$useropt{$courselevelm}; + if (defined($$useropt{$courselevelm})) { + $outpar[2]=$$useropt{$courselevelm}; $result=2; } - if (defined($useropt{$courselevelr})) { - $outpar[1]=$useropt{$courselevelr}; + if (defined($$useropt{$courselevelr})) { + $outpar[1]=$$useropt{$courselevelr}; $result=1; } } @@ -218,13 +222,6 @@ sub cacheparmhash { } } -sub cacheuseropt { - my ($uname,$udom)=@_; -} - -sub cachecourseopt { -} - ################################################## ################################################## # @@ -296,6 +293,8 @@ sub storeparm_by_symb { if ($snum>3) { # ---------------------------------------------------------------- Store Course # + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; # Expire sheets &Apache::lonnet::expirespread('','','studentcalc'); if (($snum==7) || ($snum==4)) { @@ -308,15 +307,12 @@ sub storeparm_by_symb { # Store parameter if ($delete) { $reply=&Apache::lonnet::del - ('resourcedata',[keys(%storecontent)], - $env{'course.'.$env{'request.course.id'}.'.domain'}, - $env{'course.'.$env{'request.course.id'}.'.num'}); + ('resourcedata',[keys(%storecontent)],$cdom,$cnum); } else { $reply=&Apache::lonnet::cput - ('resourcedata',\%storecontent, - $env{'course.'.$env{'request.course.id'}.'.domain'}, - $env{'course.'.$env{'request.course.id'}.'.num'}); + ('resourcedata',\%storecontent,$cdom,$cnum); } + &Apache::lonnet::devalidatecourseresdata($cnum,$cdom); } else { # ------------------------------------------------------------------ Store User # @@ -859,8 +855,6 @@ sub assessparms { my %allparts; my %defp; - %courseopt=(); - %useropt=(); @ids=(); %symbp=(); @@ -977,21 +971,6 @@ sub assessparms { # ---------------------------------------------------------------- Done storing $message.='