--- loncom/lonnet/perl/lonnet.pm 2001/04/17 13:53:26 1.123 +++ loncom/lonnet/perl/lonnet.pm 2001/05/26 19:57:47 1.124 @@ -28,18 +28,18 @@ # revokecustomrole (udom,uname,url,rdom,rnam,rolename) : Revoke a custom role # appenv(hash) : adds hash to session environment # delenv(varname) : deletes all environment entries starting with varname -# store(hashref,symb,courseid,udom,uname,homeserver) +# store(hashref,symb,courseid,udom,uname) # : stores hash permanently for this url # hashref needs to be given, and should be a \%hashname # the remaining args aren't required and if they aren't # passed or are '' they will be derived from the ENV -# cstore(hashref,symb,courseid,udom,uname,homeserver) +# cstore(hashref,symb,courseid,udom,uname) # : same as store but uses the critical interface to # guarentee a store -# restore(symb,courseid,udom,uname,homeserver) +# restore(symb,courseid,udom,uname) # : returns hash for this symb, all args are optional -# if they aren't given they will be derived from the current -# enviroment +# if they aren't given they will be derived from the +# current enviroment # eget(namesp,array) : returns hash with keys from array filled in from namesp # get(namesp,array) : returns hash with keys from array filled in from namesp # del(namesp,array) : deletes keys out of array from namesp @@ -103,7 +103,8 @@ # 3/15,3/19 Scott Harrison # 3/19,3/20 Gerd Kortemeyer # 3/22,3/27,4/2,4/16,4/17 Scott Harrison - +# 5/26 Gerd Kortemeyer +# package Apache::lonnet; use strict; @@ -686,7 +687,13 @@ sub devalidate { # ----------------------------------------------------------------------- Store sub store { - my ($storehash,$symb,$namespace,$domain,$stuname,$home) = @_; + my ($storehash,$symb,$namespace,$domain,$stuname) = @_; + my $home=''; + + if ($stuname) { + $home=&homeserver($stuname,$domain); + } + if (!$symb) { unless ($symb=&symbread()) { return ''; } } &devalidate($symb); @@ -701,13 +708,19 @@ sub store { $namevalue.=escape($_).'='.escape($$storehash{$_}).'&'; } keys %$storehash; $namevalue=~s/\&$//; - return critical("store:$domain:$stuname:$namespace:$symb:$namevalue","$home"); + return reply("store:$domain:$stuname:$namespace:$symb:$namevalue","$home"); } # -------------------------------------------------------------- Critical Store sub cstore { - my ($storehash,$symb,$namespace,$domain,$stuname,$home) = @_; + my ($storehash,$symb,$namespace,$domain,$stuname) = @_; + my $home=''; + + if ($stuname) { + $home=&homeserver($stuname,$domain); + } + if (!$symb) { unless ($symb=&symbread()) { return ''; } } &devalidate($symb); @@ -729,7 +742,13 @@ sub cstore { # --------------------------------------------------------------------- Restore sub restore { - my ($symb,$namespace,$domain,$stuname,$home) = @_; + my ($symb,$namespace,$domain,$stuname) = @_; + my $home=''; + + if ($stuname) { + $home=&homeserver($stuname,$domain); + } + if (!$symb) { unless ($symb=escape(&symbread())) { return ''; } } else {