version 1.132, 2001/07/26 20:44:42
|
version 1.133, 2001/07/26 21:40:27
|
Line 40
|
Line 40
|
# : returns hash for this symb, all args are optional |
# : returns hash for this symb, all args are optional |
# if they aren't given they will be derived from the |
# if they aren't given they will be derived from the |
# current enviroment |
# current enviroment |
# eget(namesp,array) : returns hash with keys from array filled in from namesp |
# |
|
# |
|
# for the next 4 functions udom and uname are optional |
|
# if supplied they use udom as the domain and uname |
|
# as the username for the function (supply a courseid |
|
# for the uname if you want a course database) |
|
# if not supplied it uses %ENV and looks at |
|
# user. attribute for the values |
|
# |
|
# eget(namesp,arrayref,udom,uname) |
|
# : returns hash with keys from array reference filled |
|
# in from namesp (encrypts the return communication) |
# get(namesp,arrayref,udom,uname) |
# get(namesp,arrayref,udom,uname) |
# : returns hash with keys from array reference filled |
# : returns hash with keys from array reference filled |
# in from namesp |
# in from namesp |
# if supplied uses udom as the domain and uname |
# dump(namesp,udom,uname) : dumps the complete namespace into a hash |
# as the username for the dump (supply a courseid |
# del(namesp,array,udom,uname) : deletes keys out of array from namesp |
# for the uname if you want a course database) |
# |
# if not supplied it uses %ENV to get the values |
# |
# del(namesp,array) : deletes keys out of array from namesp |
|
# put(namesp,hash) : stores hash in namesp |
# put(namesp,hash) : stores hash in namesp |
# cput(namesp,hash) : critical put |
# cput(namesp,hash) : critical put |
# dump(namesp,udom,uname) : dumps the complete namespace into a hash |
|
# if supplied uses udom as the domain and uname |
|
# as the username for the dump (supply a courseid |
|
# for the uname if you want a course database) |
|
# if not supplied it uses %ENV to get the values |
|
# ssi(url,hash) : does a complete request cycle on url to localhost, posts |
# ssi(url,hash) : does a complete request cycle on url to localhost, posts |
# hash |
# hash |
# coursedescription(id) : returns and caches course description for id |
# coursedescription(id) : returns and caches course description for id |
Line 678 sub devalidate {
|
Line 683 sub devalidate {
|
if ($cid) { |
if ($cid) { |
my $key=$ENV{'user.name'}.':'.$ENV{'user.domain'}.':'; |
my $key=$ENV{'user.name'}.':'.$ENV{'user.domain'}.':'; |
my $status= |
my $status= |
&reply('del:'.$ENV{'course.'.$cid.'.domain'}.':'. |
&del('nohist_calculatedsheet', |
$ENV{'course.'.$cid.'.num'}. |
[$key.'studentcalc'], |
':nohist_calculatedsheets:'. |
$ENV{'course.'.$cid.'.domain'}, |
&escape($key.'studentcalc:'), |
$ENV{'course.'.$cid.'.num'}) |
$ENV{'course.'.$cid.'.home'}) |
.' '. |
.' '. |
&del('nohist_calculatedsheets_'.$cid, |
&reply('del:'.$ENV{'user.domain'}.':'. |
[$key.'assesscalc:'.$symb]); |
$ENV{'user.name'}. |
|
':nohist_calculatedsheets_'.$cid.':'. |
|
&escape($key.'assesscalc:'.$symb), |
|
$ENV{'user.home'}); |
|
unless ($status eq 'ok ok') { |
unless ($status eq 'ok ok') { |
&logthis('Could not devalidate spreadsheet '. |
&logthis('Could not devalidate spreadsheet '. |
$ENV{'user.name'}.' at '.$ENV{'user.domain'}.' for '. |
$ENV{'user.name'}.' at '.$ENV{'user.domain'}.' for '. |
$symb.': '.$status); |
$symb.': '.$status); |
} |
} |
} |
} |
} |
} |
|
|
Line 932 sub get {
|
Line 933 sub get {
|
if (!$uname) { $uname=$ENV{'user.name'}; } |
if (!$uname) { $uname=$ENV{'user.name'}; } |
my $uhome=&homeserver($uname,$udomain); |
my $uhome=&homeserver($uname,$udomain); |
|
|
my $rep=reply("get:$udomain:$uname:$namespace:$items",$uhome); |
my $rep=&reply("get:$udomain:$uname:$namespace:$items",$uhome); |
my @pairs=split(/\&/,$rep); |
my @pairs=split(/\&/,$rep); |
my %returnhash=(); |
my %returnhash=(); |
my $i=0; |
my $i=0; |
Line 946 sub get {
|
Line 947 sub get {
|
# --------------------------------------------------------------- del interface |
# --------------------------------------------------------------- del interface |
|
|
sub del { |
sub del { |
my ($namespace,@storearr)=@_; |
my ($namespace,$storearr,$udomain,$uname)=@_; |
my $items=''; |
my $items=''; |
map { |
map { |
$items.=escape($_).'&'; |
$items.=escape($_).'&'; |
} @storearr; |
} @$storearr; |
$items=~s/\&$//; |
$items=~s/\&$//; |
return reply("del:$ENV{'user.domain'}:$ENV{'user.name'}:$namespace:$items", |
if (!$udomain) { $udomain=$ENV{'user.domain'}; } |
$ENV{'user.home'}); |
if (!$uname) { $uname=$ENV{'user.name'}; } |
|
my $uhome=&homeserver($uname,$udomain); |
|
|
|
return &reply("del:$udomain:$uname:$namespace:$items",$uhome); |
} |
} |
|
|
# -------------------------------------------------------------- dump interface |
# -------------------------------------------------------------- dump interface |
Line 1003 sub cput {
|
Line 1007 sub cput {
|
# -------------------------------------------------------------- eget interface |
# -------------------------------------------------------------- eget interface |
|
|
sub eget { |
sub eget { |
my ($namespace,@storearr)=@_; |
my ($namespace,$storearr,$udomain,$uname)=@_; |
my $items=''; |
my $items=''; |
map { |
map { |
$items.=escape($_).'&'; |
$items.=escape($_).'&'; |
} @storearr; |
} @$storearr; |
$items=~s/\&$//; |
$items=~s/\&$//; |
my $rep=reply("eget:$ENV{'user.domain'}:$ENV{'user.name'}:$namespace:$items", |
if (!$udomain) { $udomain=$ENV{'user.domain'}; } |
$ENV{'user.home'}); |
if (!$uname) { $uname=$ENV{'user.name'}; } |
|
my $uhome=&homeserver($uname,$udomain); |
|
my $rep=&reply("eget:$udomain:$uname:$namespace:$items",$uhome); |
my @pairs=split(/\&/,$rep); |
my @pairs=split(/\&/,$rep); |
my %returnhash=(); |
my %returnhash=(); |
my $i=0; |
my $i=0; |
map { |
map { |
$returnhash{$_}=unescape($pairs[$i]); |
$returnhash{$_}=unescape($pairs[$i]); |
$i++; |
$i++; |
} @storearr; |
} @$storearr; |
return %returnhash; |
return %returnhash; |
} |
} |
|
|