version 1.564, 2024/10/14 01:13:27
|
version 1.567, 2025/01/03 05:38:17
|
Line 2290 sub new {
|
Line 2290 sub new {
|
|
|
$self->{USERNAME} = shift || $env{'user.name'}; |
$self->{USERNAME} = shift || $env{'user.name'}; |
$self->{DOMAIN} = shift || $env{'user.domain'}; |
$self->{DOMAIN} = shift || $env{'user.domain'}; |
|
$self->{SECTION} = shift; |
$self->{CODE} = shift; |
$self->{CODE} = shift; |
$self->{NOHIDE} = shift; |
$self->{NOHIDE} = shift; |
|
|
|
|
|
if (($self->{SECTION} eq '') && ($env{'request.course.sec'} ne '')) { |
|
if (($self->{USERNAME} eq $env{'user.name'}) && |
|
($self->{USERNAME} eq $env{'user.domain'})) { |
|
$self->{SECTION} = $env{'request.course.sec'}; |
|
} |
|
} |
|
|
# Resource cache stores navmap resources as we reference them. We generate |
# Resource cache stores navmap resources as we reference them. We generate |
# them on-demand so we don't pay for creating resources unless we use them. |
# them on-demand so we don't pay for creating resources unless we use them. |
Line 2335 sub new {
|
Line 2342 sub new {
|
$self->{PARM_HASH} = \%parmhash; |
$self->{PARM_HASH} = \%parmhash; |
$self->{PARM_CACHE} = {}; |
$self->{PARM_CACHE} = {}; |
} else { |
} else { |
$self->change_user($self->{USERNAME}, $self->{DOMAIN}, $self->{CODE}, $self->{NOHIDE}); |
$self->change_user($self->{USERNAME}, $self->{DOMAIN}, $self->{SECTION}, $self->{CODE}, $self->{NOHIDE}); |
} |
} |
|
|
return $self; |
return $self; |
Line 2346 sub new {
|
Line 2353 sub new {
|
# username/domain associated with a navmap (e.g. to navigate for someone |
# username/domain associated with a navmap (e.g. to navigate for someone |
# else besides the current user...if sufficiently privileged. |
# else besides the current user...if sufficiently privileged. |
# Parameters: |
# Parameters: |
# user - New user. |
# user - New user. |
# domain- Domain the user belongs to. |
# domain - Domain to which the user belongs. |
# code - Anonymous CODE in use. |
# section - Section to which the user belongs. |
|
# code - Anonymous CODE in use. |
# Implicit inputs: |
# Implicit inputs: |
# |
# |
sub change_user { |
sub change_user { |
my $self = shift; |
my $self = shift; |
$self->{USERNAME} = shift; |
$self->{USERNAME} = shift; |
$self->{DOMAIN} = shift; |
$self->{DOMAIN} = shift; |
|
$self->{SECTION} = shift; |
$self->{CODE} = shift; |
$self->{CODE} = shift; |
$self->{NOHIDE} = shift; |
$self->{NOHIDE} = shift; |
|
|
Line 2861 sub parmval_real {
|
Line 2870 sub parmval_real {
|
$self->generate_course_user_opt(); |
$self->generate_course_user_opt(); |
|
|
my $cid=$env{'request.course.id'}; |
my $cid=$env{'request.course.id'}; |
my $csec=$env{'request.course.sec'}; |
my $csec=$self->{SECTION}; |
my $cgroup=''; |
my $cgroup=''; |
my @cgrps=split(/:/,$env{'request.course.groups'}); |
my @cgrps=split(/:/,$env{'request.course.groups'}); |
if (@cgrps > 0) { |
if (@cgrps > 0) { |
Line 3050 sub parmval_real {
|
Line 3059 sub parmval_real {
|
} |
} |
|
|
sub recurseup_maps { |
sub recurseup_maps { |
my ($self,$mapname) = @_; |
my ($self,$mapname,$getsymb) = @_; |
my @recurseup; |
my @recurseup; |
if ($mapname) { |
if ($mapname) { |
my $res = $self->getResourceByUrl($mapname); |
my $res = $self->getResourceByUrl($mapname); |
Line 3058 sub recurseup_maps {
|
Line 3067 sub recurseup_maps {
|
my @pcs = split(/,/,$res->map_hierarchy()); |
my @pcs = split(/,/,$res->map_hierarchy()); |
shift(@pcs); |
shift(@pcs); |
if (@pcs) { |
if (@pcs) { |
@recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->src()); } reverse(@pcs); |
if ($getsymb) { |
|
@recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->symb()); } reverse(@pcs); |
|
} else { |
|
@recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->src()); } reverse(@pcs); |
|
} |
} |
} |
} |
} |
} |
} |
Line 3186 sub get_mapparam {
|
Line 3199 sub get_mapparam {
|
# Get the course id and section if there is one. |
# Get the course id and section if there is one. |
|
|
my $cid=$env{'request.course.id'}; |
my $cid=$env{'request.course.id'}; |
my $csec=$env{'request.course.sec'}; |
my $csec=$self->{SECTION}; |
my $cgroup=''; |
my $cgroup=''; |
my @cgrps=split(/:/,$env{'request.course.groups'}); |
my @cgrps=split(/:/,$env{'request.course.groups'}); |
if (@cgrps > 0) { |
if (@cgrps > 0) { |
Line 3387 sub getcourseparam {
|
Line 3400 sub getcourseparam {
|
|
|
my $uname = $self->{USERNAME}; |
my $uname = $self->{USERNAME}; |
my $udom = $self->{DOMAIN}; |
my $udom = $self->{DOMAIN}; |
|
my $csec = $self->{SECTION}; |
|
|
# Course, section, group ids come from the env: |
# Course and group ids come from the env: |
|
|
my $cid = $env{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
my $csec = $env{'request.course.sec'}; |
|
my $cgroup = ''; # Assume no group |
my $cgroup = ''; # Assume no group |
|
|
my @cgroups = split(/:/, $env{'request.course.groups'}); |
my @cgroups = split(/:/, $env{'request.course.groups'}); |
Line 5249 sub weight {
|
Line 5262 sub weight {
|
my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight', |
my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight', |
$self->{SYMB}, $self->{DOMAIN}, |
$self->{SYMB}, $self->{DOMAIN}, |
$self->{USERNAME}, |
$self->{USERNAME}, |
$env{'request.course.sec'}); |
$self->{SECTION}); |
return $weight; |
return $weight; |
} |
} |
sub part_display { |
sub part_display { |