\E}{
}gs; if (wantarray) { return ($output, $response); } else { @@ -6749,7 +6753,7 @@ sub store { # -------------------------------------------------------------- Critical Store sub cstore { - my ($storehash,$symb,$namespace,$domain,$stuname,$laststore,$ip,$nolog) = @_; + my ($storehash,$symb,$namespace,$domain,$stuname,$laststore) = @_; my $home=''; if ($stuname) { $home=&homeserver($stuname,$domain); } @@ -6774,11 +6778,7 @@ sub cstore { } if (!$home) { $home=$env{'user.home'}; } - if ($ip ne '') { - $$storehash{'ip'} = $ip; - } else { - $$storehash{'ip'} = &get_requestor_ip(); - } + $$storehash{'ip'} = &get_requestor_ip(); $$storehash{'host'}=$perlvar{'lonHostID'}; my $namevalue=''; @@ -6786,9 +6786,7 @@ sub cstore { $namevalue.=&escape($key).'='.&freeze_escape($$storehash{$key}).'&'; } $namevalue=~s/\&$//; - unless ($nolog) { - &courselog($symb.':'.$stuname.':'.$domain.':CSTORE:'.$namevalue); - } + &courselog($symb.':'.$stuname.':'.$domain.':CSTORE:'.$namevalue); return critical ("store:$domain:$stuname:$namespace:$symb:$namevalue:$laststore","$home"); } @@ -7530,6 +7528,27 @@ sub set_adhoc_privileges { if (&allowed('adv') eq 'F') { $tadv=1; } &appenv({'request.role.adv' => $tadv}); } + if ($role eq 'ca') { + my @ca_settings = ('authoreditors','coauthorlist'); + my %info = &userenvironment($dcdom,$pickedcourse,@ca_settings); + foreach my $item (@ca_settings) { + if (exists($info{$item})) { + my $name = $item; + if ($item eq 'authoreditors') { + $name = 'editors'; + unless ($info{'authoreditors'}) { + my %domdefs = &get_domain_defaults($dcdom); + if ($domdefs{$name} ne '') { + $info{'authoreditors'} = $domdefs{$name}; + } else { + $info{'authoreditors'} = 'edit,xml'; + } + } + } + &appenv({"environment.internal.$name./$dcdom/$pickedcourse" => $info{$item}}); + } + } + } } # --------------------------------------------------------------- get interface @@ -11690,7 +11709,7 @@ sub is_course { } sub store_userdata { - my ($storehash,$datakey,$namespace,$udom,$uname) = @_; + my ($storehash,$datakey,$namespace,$udom,$uname,$ip) = @_; my $result; if ($datakey ne '') { if (ref($storehash) eq 'HASH') { @@ -11702,7 +11721,11 @@ sub store_userdata { if (($uhome eq '') || ($uhome eq 'no_host')) { $result = 'error: no_host'; } else { - $storehash->{'ip'} = &get_requestor_ip(); + if ($ip ne '') { + $storehash->{'ip'} = $ip; + } else { + $storehash->{'ip'} = &get_requestor_ip(); + } $storehash->{'host'} = $perlvar{'lonHostID'}; my $namevalue=''; @@ -13193,6 +13216,15 @@ my %cachedmaps=(); # When this was last done my $cachedmaptime=''; +# Cache (5 seconds) of mapsymb hierarchy for speedup of reservations display +# +# The course for which we cache +my $cachedmapsymbkey=''; +# The cached recursive map symbs for this course +my %cachedmapsymbs=(); +# When this was last done +my $cachedmapsymbtime=''; + sub clear_EXT_cache_status { &delenv('cache.EXT.'); } @@ -13384,6 +13416,43 @@ sub EXT { #print '
'.$space.' - '.$qualifier.' - '.$spacequalifierrest; +# --------------------------------------------- Special handling for encrypturl + + if ($spacequalifierrest eq '0.encrypturl') { + unless ($recursed) { + my ($map_from_symb,@mapsymbs); + if ($symbparm =~ /\.(page|sequence)$/) { + push(@mapsymbs,$symbparm); + $map_from_symb = &deversion((&decode_symb($symbparm))[2]); + } else { + $map_from_symb = &deversion((&decode_symb($symbparm))[0]); + } + if (($map_from_symb ne '') && ($map_from_symb !~ /default\.sequence$/)) { + my @parents = &get_mapsymb_hierarchy($map_from_symb,$courseid); + if (@parents) { + push(@mapsymbs,@parents); + } + } + if (@mapsymbs) { + my $earlyout; + my %parmhash=(); + if (tie(%parmhash,'GDBM_File', + $env{'request.course.fn'}.'_parms.db', + &GDBM_READER(),0640)) { + foreach my $mapsymb (@mapsymbs) { + if ((exists($parmhash{$mapsymb.'.'.$spacequalifierrest})) && + (lc($parmhash{$mapsymb.'.'.$spacequalifierrest}) eq 'yes')) { + $earlyout = $parmhash{$mapsymb.'.'.$spacequalifierrest}; + last; + } + } + untie(%parmhash); + } + if ($earlyout) { return &get_reply([$earlyout,'map']); } + } + } + } + # ----------------------------------------------------- Cascading lookup scheme my $symbp=$symbparm; $mapp=&deversion((&decode_symb($symbp))[0]); @@ -13587,6 +13656,30 @@ sub get_map_hierarchy { return @recurseup; } +sub get_mapsymb_hierarchy { + my ($mapname,$courseid) = @_; + my @recurseup; + if ($mapname) { + if (($cachedmapsymbkey eq $courseid) && + (abs($cachedmapsymbtime-time)<5)) { + if (ref($cachedmapsymbs{$mapname}) eq 'ARRAY') { + return @{$cachedmapsymbs{$mapname}}; + } + } + my $navmap = Apache::lonnavmaps::navmap->new(); + if (ref($navmap)) { + my $getsymb = 1; + my $inclusive = 1; + @recurseup = $navmap->recurseup_maps($mapname,$getsymb,$inclusive); + undef($navmap); + $cachedmapsymbs{$mapname} = \@recurseup; + $cachedmapsymbtime=time; + $cachedmapsymbkey=$courseid; + } + } + return @recurseup; +} + } sub sort_course_groups { # Sort groups based on defined rankings. Default is sort(). @@ -15094,6 +15187,9 @@ sub whichuser { $courseid=$tmp_courseid; ($domain)=&get_env_multiple('form.grade_domain'); ($name)=&get_env_multiple('form.grade_username'); + if ($name eq 'public' && $domain eq 'public') { + $publicuser = 1; + } return ($symb,$courseid,$domain,$name,$publicuser); } } @@ -15110,6 +15206,7 @@ sub whichuser { $env{'form.username'}.=time.rand(10000000); } $name.=$env{'form.username'}; + $publicuser = 1; } return ($symb,$courseid,$domain,$name,$publicuser);