--- rat/lonratedt.pm 2004/04/24 15:05:16 1.55 +++ rat/lonratedt.pm 2004/04/24 15:37:30 1.56 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.55 2004/04/24 15:05:16 www Exp $ +# $Id: lonratedt.pm,v 1.56 2004/04/24 15:37:30 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -536,6 +536,43 @@ sub storemap { &Apache::lonratsrv::loadmap($fn,&Apache::lonratsrv::savemap($fn,'')); } +# ------------------------------------------ Store and get parameters in global + +sub storeparameter { + my ($to,$name,$value,$ptype)=@_; + my $newentry=''; + my $nametype=''; + foreach (split('&&&',$resparms[$to])) { + my ($thistype,$thisname,$thisvalue)=split('___',$_); + if ($thisname) { + unless ($thisname eq $name) { + $newentry.=$_.'&&&'; + } else { + $nametype=$thistype; + } + } + } + unless ($ptype) { $ptype=$nametype; } + unless ($ptype) { $ptype='string'; } + $newentry.=$ptype.'___'.$name.'___'.$value; + $resparms[$to]=$newentry; +} + +sub getparameter { + my ($to,$name); + my $value=undef; + my $ptype=undef; + foreach (split('&&&',$resparms[$to])) { + my ($thistype,$thisname,$thisvalue)=split('___',$_); + if ($thisname eq $name) { + $value=$thisvalue; + $ptype=$thistype; + } + } + return ($value,$ptype); +} + +# ----------------------------------------------------------------- Edit script sub editscript { my $mode=shift; my $resurl=&Apache::loncommon::lastresurl();