Diff for /loncom/interface/lonparmset.pm between versions 1.199 and 1.200

version 1.199, 2005/06/02 13:34:14 version 1.200, 2005/06/02 16:35:32
Line 66  use Apache::lonnavmaps; Line 66  use Apache::lonnavmaps;
   
 # --- Caches local to lonparmset  # --- Caches local to lonparmset
   
 my $courseoptid;  
 my %courseopt;  
 my $useroptid;  
 my %useropt;  
 my $parmhashid;  my $parmhashid;
 my %parmhash;  my %parmhash;
   
Line 120  Returns:  A list, the first item is the Line 116  Returns:  A list, the first item is the
 sub parmval {  sub parmval {
     my ($what,$id,$def,$uname,$udom,$csec)=@_;      my ($what,$id,$def,$uname,$udom,$csec)=@_;
 # load caches  # load caches
   
     &cacheparmhash();      &cacheparmhash();
     &cacheuseropt($uname,$udom);  
     &cachecourseopt();      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 $result='';
     my @outpar=();      my @outpar=();
Line 143  sub parmval { Line 144  sub parmval {
   
 # --------------------------------------------------------- first, check course  # --------------------------------------------------------- first, check course
   
     if (defined($courseopt{$courselevel})) {      if (defined($$courseopt{$courselevel})) {
  $outpar[11]=$courseopt{$courselevel};   $outpar[11]=$$courseopt{$courselevel};
  $result=11;   $result=11;
     }      }
   
     if (defined($courseopt{$courselevelm})) {      if (defined($$courseopt{$courselevelm})) {
  $outpar[10]=$courseopt{$courselevelm};   $outpar[10]=$$courseopt{$courselevelm};
  $result=10;   $result=10;
     }      }
   
Line 162  sub parmval { Line 163  sub parmval {
     my $thisparm=$parmhash{$symbparm};      my $thisparm=$parmhash{$symbparm};
     if (defined($thisparm)) { $outpar[8]=$thisparm; $result=8; }      if (defined($thisparm)) { $outpar[8]=$thisparm; $result=8; }
   
     if (defined($courseopt{$courselevelr})) {      if (defined($$courseopt{$courselevelr})) {
  $outpar[7]=$courseopt{$courselevelr};   $outpar[7]=$$courseopt{$courselevelr};
  $result=7;   $result=7;
     }      }
   
 # ------------------------------------------------------ fourth, back to course  # ------------------------------------------------------ fourth, back to course
     if (defined($csec)) {      if (defined($csec)) {
         if (defined($courseopt{$seclevel})) {          if (defined($$courseopt{$seclevel})) {
     $outpar[6]=$courseopt{$seclevel};      $outpar[6]=$$courseopt{$seclevel};
     $result=6;      $result=6;
  }   }
         if (defined($courseopt{$seclevelm})) {          if (defined($$courseopt{$seclevelm})) {
     $outpar[5]=$courseopt{$seclevelm};      $outpar[5]=$$courseopt{$seclevelm};
     $result=5;      $result=5;
  }   }
   
         if (defined($courseopt{$seclevelr})) {          if (defined($$courseopt{$seclevelr})) {
     $outpar[4]=$courseopt{$seclevelr};      $outpar[4]=$$courseopt
   {$seclevelr};
     $result=4;      $result=4;
  }   }
     }      }
Line 187  sub parmval { Line 189  sub parmval {
 # ---------------------------------------------------------- fifth, check user  # ---------------------------------------------------------- fifth, check user
   
     if (defined($uname)) {      if (defined($uname)) {
  if (defined($useropt{$courselevel})) {   if (defined($$useropt{$courselevel})) {
     $outpar[3]=$useropt{$courselevel};      $outpar[3]=$$useropt{$courselevel};
     $result=3;      $result=3;
  }   }
   
  if (defined($useropt{$courselevelm})) {   if (defined($$useropt{$courselevelm})) {
     $outpar[2]=$useropt{$courselevelm};      $outpar[2]=$$useropt{$courselevelm};
     $result=2;      $result=2;
  }   }
   
  if (defined($useropt{$courselevelr})) {   if (defined($$useropt{$courselevelr})) {
     $outpar[1]=$useropt{$courselevelr};      $outpar[1]=$$useropt{$courselevelr};
     $result=1;      $result=1;
  }   }
     }      }
Line 220  sub cacheparmhash { Line 222  sub cacheparmhash {
     }      }
 }  }
   
 sub resetuseropt {  
     $useroptid='';  
 }  
   
 sub cacheuseropt {  
     my ($uname,$udom)=@_;  
     unless ($uname) { return; }  
     if ($useroptid eq $uname.'@'.$udom) { return; }  
     %useropt=&Apache::lonnet::dump('resourcedata',$udom,$uname);  
     $useroptid=$uname.'@'.$udom;  
 }  
   
 sub resetcourseopt {  
     $courseoptid='';  
 }  
   
 sub cachecourseopt {  
     if ($courseoptid eq $env{'request.course.id'}) { return; };  
     %courseopt = &Apache::lonnet::dump  
         ('resourcedata',  
          $env{'course.'.$env{'request.course.id'}.'.domain'},  
          $env{'course.'.$env{'request.course.id'}.'.num'});  
     $courseoptid=$env{'request.course.id'};  
 }  
   
 ##################################################  ##################################################
 ##################################################  ##################################################
 #  #
Line 316  sub storeparm_by_symb { Line 293  sub storeparm_by_symb {
     if ($snum>3) {      if ($snum>3) {
 # ---------------------------------------------------------------- Store Course  # ---------------------------------------------------------------- Store Course
 #  #
    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
 # Expire sheets  # Expire sheets
  &Apache::lonnet::expirespread('','','studentcalc');   &Apache::lonnet::expirespread('','','studentcalc');
  if (($snum==7) || ($snum==4)) {   if (($snum==7) || ($snum==4)) {
Line 325  sub storeparm_by_symb { Line 304  sub storeparm_by_symb {
  } else {   } else {
     &Apache::lonnet::expirespread('','','assesscalc');      &Apache::lonnet::expirespread('','','assesscalc');
  }   }
  &resetcourseopt();  
 # Store parameter  # Store parameter
  if ($delete) {   if ($delete) {
     $reply=&Apache::lonnet::del      $reply=&Apache::lonnet::del
  ('resourcedata',[keys(%storecontent)],   ('resourcedata',[keys(%storecontent)],$cdom,$cnum);
  $env{'course.'.$env{'request.course.id'}.'.domain'},  
  $env{'course.'.$env{'request.course.id'}.'.num'});  
  } else {   } else {
     $reply=&Apache::lonnet::cput      $reply=&Apache::lonnet::cput
  ('resourcedata',\%storecontent,   ('resourcedata',\%storecontent,$cdom,$cnum);
  $env{'course.'.$env{'request.course.id'}.'.domain'},  
  $env{'course.'.$env{'request.course.id'}.'.num'});  
  }   }
    &Apache::lonnet::devalidatecourseresdata($cnum,$cdom);
     } else {      } else {
 # ------------------------------------------------------------------ Store User  # ------------------------------------------------------------------ Store User
 #  #
Line 352  sub storeparm_by_symb { Line 327  sub storeparm_by_symb {
  } else {   } else {
     &Apache::lonnet::expirespread($uname,$udom,'assesscalc');      &Apache::lonnet::expirespread($uname,$udom,'assesscalc');
  }   }
  &resetuseropt();  
 # Store parameter  # Store parameter
  if ($delete) {   if ($delete) {
     $reply=&Apache::lonnet::del      $reply=&Apache::lonnet::del
Line 997  sub assessparms { Line 971  sub assessparms {
 # ---------------------------------------------------------------- Done storing  # ---------------------------------------------------------------- Done storing
  $message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>';   $message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>';
     }      }
 # --------------------------------------------- Devalidate cache for this child  
     &Apache::lonnet::devalidatecourseresdata(  
                  $env{'course.'.$env{'request.course.id'}.'.num'},  
                  $env{'course.'.$env{'request.course.id'}.'.domain'});  
     #&Apache::lonnet::clear_EXT_cache_status();  
   
 # ------------------------------------------------------------------- Sort this  # ------------------------------------------------------------------- Sort this
   
     @ids=sort  {      @ids=sort  {

Removed from v.1.199  
changed lines
  Added in v.1.200


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>