--- rat/lonuserstate.pm 2020/07/19 15:24:11 1.149.2.2.2.3 +++ rat/lonuserstate.pm 2020/04/22 14:52:56 1.159 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construct and maintain state and binary representation of course for user # -# $Id: lonuserstate.pm,v 1.149.2.2.2.3 2020/07/19 15:24:11 raeburn Exp $ +# $Id: lonuserstate.pm,v 1.159 2020/04/22 14:52:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,6 +62,7 @@ my %randomorder; # maps to order content my %randomizationcode; # code used to grade folder for bubblesheet exam my %encurl; # URLs in this folder are supposed to be encrypted my %hiddenurl; # this URL (or complete folder) is supposed to be hidden +my %deeplinkonly; # this URL (or complete folder) is deep-link only my %rescount; # count of unhidden items in each map my %mapcount; # count of unhidden maps in each map @@ -255,9 +256,9 @@ sub loadmap { push(@map_ids, $resource_id); if ($hash{'src_'.$lpc.'.'.$resource_id}) { $rescount{$lpc} ++; - if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) || + if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) || ($hash{'src_'.$lpc.'.'.$resource_id}=~/\.page$/)) { - $mapcount{$lpc} ++; + $mapcount{$lpc} ++; } } unless ($codechecked) { @@ -569,7 +570,7 @@ sub parse_resource { if (($turi=~/\.sequence$/) || ($turi=~/\.page$/)) { $hash{'is_map_'.$rid}=1; - if ((!$hiddenurl{$rid}) || (&is_advanced($courseid))) { + if ((&is_advanced($courseid)) || (!$hiddenurl{$rid})) { &loadmap($turi,$rid,$courseid); } } @@ -927,6 +928,14 @@ sub traceroute { && ($hash{'src_'.$rid}!~/\.sequence$/)) { $retfrid=$rid; } + my @deeplink=&Apache::lonnet::EXT('resource.0.deeplink',$symb); + unless ((@deeplink == 0) || ($deeplink[0] eq 'full')) { + $deeplinkonly{$rid}=join(':',@deeplink); + if ($deeplink[1] eq 'map') { + my $parent = (split(/\,/,$hash{'map_hierarchy_'.$mapid}))[-1]; + $deeplinkonly{"$parent.$mapid"}=$deeplinkonly{$rid}; + } + } if (defined($hash{'conditions_'.$rid})) { $hash{'conditions_'.$rid}=simplify( @@ -1242,6 +1251,7 @@ sub readmap { undef %randomizationcode; undef %hiddenurl; undef %encurl; + undef %deeplinkonly; undef %rescount; undef %mapcount; $retfrid=''; @@ -1390,6 +1400,7 @@ sub readmap { undef %randomizationcode; undef %hiddenurl; undef %encurl; + undef %deeplinkonly; undef %rescount; undef %mapcount; $errtext=''; @@ -1528,6 +1539,10 @@ sub build_tmp_hashes { # $hash{'src_'.$id}=&Apache::lonenc::encrypted($hash{'src_'.$id}); $hash{'encrypted_'.$id}=1; } +# ------------------------------------------------------------ Deep-linked URLs + foreach my $id (keys(%deeplinkonly)) { + $hash{'deeplinkonly_'.$id}=$deeplinkonly{$id}; + } # ----------------------------------------------- Close hashes to finally store # --------------------------------- Routine must pass this point, no early outs $hash{'first_rid'}=$retfrid;