version 1.6, 2011/11/29 11:50:53
|
version 1.7, 2012/12/08 20:10:32
|
Line 801 sub parse_param {
|
Line 801 sub parse_param {
|
# $lpc - Map nesting level (?) |
# $lpc - Map nesting level (?) |
# $ispage - True if this resource is encapsulated in a .page (assembled resourcde). |
# $ispage - True if this resource is encapsulated in a .page (assembled resourcde). |
# $uri - URI of the enclosing resource. |
# $uri - URI of the enclosing resource. |
|
# $code - CODE for which resource is being parsed (CODEd assignments). |
# $hash - Reference to the hash we are building. |
# $hash - Reference to the hash we are building. |
# |
# |
# Returns: |
# Returns: |
Line 823 sub parse_param {
|
Line 824 sub parse_param {
|
# |
# |
|
|
sub parse_resource { |
sub parse_resource { |
my ($token,$lpc,$ispage,$uri, $hash) = @_; |
my ($token,$lpc,$ispage,$uri,$code,$hash) = @_; |
|
|
# I refuse to countenance code like this that has |
# I refuse to countenance code like this that has |
# such a dirty side effect (and forcing this sub to be called within a loop). |
# such a dirty side effect (and forcing this sub to be called within a loop). |
Line 970 sub parse_resource {
|
Line 971 sub parse_resource {
|
if (($turi=~/\.sequence$/) || |
if (($turi=~/\.sequence$/) || |
($turi=~/\.page$/)) { |
($turi=~/\.page$/)) { |
$hash->{'is_map_'.$rid}='1'; # String in lonuserstate. |
$hash->{'is_map_'.$rid}='1'; # String in lonuserstate. |
&read_map($turi,$rid, $hash); |
&read_map($turi,$rid,$code,$hash); |
} |
} |
return $token->[2]->{'id'}; |
return $token->[2]->{'id'}; |
} |
} |
Line 1178 sub parse_mapalias_param {
|
Line 1179 sub parse_mapalias_param {
|
# $parent_rid - map number qualified id of the parent of the map being read. |
# $parent_rid - map number qualified id of the parent of the map being read. |
# For the top level course map this is 0.0. For the first nested |
# For the top level course map this is 0.0. For the first nested |
# map 1.n where n is the id of the resource within the |
# map 1.n where n is the id of the resource within the |
# top level map and so on. |
# top level map and so on. |
|
# $code - CODE for which map is being read (CODEd assignments). |
# $hash - Reference to a hash that will become the big hash for the course |
# $hash - Reference to a hash that will become the big hash for the course |
# This hash is modified as per the map description. |
# This hash is modified as per the map description. |
# Side-effects: |
# Side-effects: |
Line 1188 sub parse_mapalias_param {
|
Line 1190 sub parse_mapalias_param {
|
# |
# |
# |
# |
sub read_map { |
sub read_map { |
my ($uri, $parent_rid, $hash) = @_; |
my ($uri, $parent_rid, $code, $hash) = @_; |
|
|
|
|
# Check for duplication: A map may only be included once. |
# Check for duplication: A map may only be included once. |
Line 1289 sub read_map {
|
Line 1291 sub read_map {
|
# Resource |
# Resource |
|
|
if ($token->[1] eq 'resource') { |
if ($token->[1] eq 'resource') { |
my $resource_id = &parse_resource($token,$lmap_no,$ispage,$uri, $hash); |
my $resource_id = &parse_resource($token,$lmap_no,$ispage,$uri,$code,$hash); |
if (defined $resource_id) { |
if (defined $resource_id) { |
push(@map_ids, $resource_id); |
push(@map_ids, $resource_id); |
} |
} |
Line 1313 sub read_map {
|
Line 1315 sub read_map {
|
# |
# |
|
|
if ($randomize) { |
if ($randomize) { |
if (!&has_advanced_role($username, $userdomain) ) { |
if (!&has_advanced_role($username, $userdomain) || $code) { |
my $seed; |
my $seed; |
|
|
# In the advanced role, the map's random seed |
# In the advanced role, the map's random seed |
Line 1397 sub read_map {
|
Line 1399 sub read_map {
|
# $cdom - Domain in which the course is evaluated. |
# $cdom - Domain in which the course is evaluated. |
# $uname - Name of the user for whom the course is being read |
# $uname - Name of the user for whom the course is being read |
# $udom - Name of the domain of the user for whom the course is being read. |
# $udom - Name of the domain of the user for whom the course is being read. |
|
# $code - CODE for which course is being read (CODEd assignments) |
# $target_hash- Reference to the target hash into which all of this is read. |
# $target_hash- Reference to the target hash into which all of this is read. |
# Note tht some of the hash entries we need to build require knowledge of the |
# Note tht some of the hash entries we need to build require knowledge of the |
# course URI.. these are expected to be filled in by the caller. |
# course URI.. these are expected to be filled in by the caller. |
Line 1405 sub read_map {
|
Line 1408 sub read_map {
|
# |
# |
# |
# |
sub loadmap { |
sub loadmap { |
my ($cnum, $cdom, $uname, $udom, $target_hash) = @_; |
my ($cnum, $cdom, $uname, $udom, $code, $target_hash) = @_; |
|
|
|
|
|
|
Line 1477 sub loadmap {
|
Line 1480 sub loadmap {
|
$target_hash->{'context.courseid'} = $course_id; |
$target_hash->{'context.courseid'} = $course_id; |
|
|
|
|
&read_map($course_uri, '0.0', $target_hash); |
&read_map($course_uri, '0.0', $code, $target_hash); |
|
|
# |
# |
|
|