version 1.565, 2024/12/10 04:34:19
|
version 1.570, 2025/02/03 03:04:24
|
Line 48 described at http://www.lon-capa.org.
|
Line 48 described at http://www.lon-capa.org.
|
|
|
=head1 OVERVIEW |
=head1 OVERVIEW |
|
|
X<lonnavmaps, overview> When a user enters a course, LON-CAPA examines the |
X<lonnavmaps, overview> |
|
When a user enters a course, LON-CAPA examines the |
course structure and caches it in what is often referred to as the |
course structure and caches it in what is often referred to as the |
"big hash" X<big hash>. You can see it if you are logged into |
"big hash" X<big hash>. You can see it if you are logged into |
LON-CAPA, in a course, by going to /adm/test. The content of |
LON-CAPA, in a course, by going to /adm/test. The content of |
Line 1120 sub render_resource {
|
Line 1121 sub render_resource {
|
} |
} |
|
|
# Decide what to display |
# Decide what to display |
$result .= "$newBranchText$linkopen$icon$linkclose"; |
$result .= "$newBranchText$linkopen$icon"; |
|
|
my $curMarkerBegin = ''; |
my $curMarkerBegin = ''; |
my $curMarkerEnd = ''; |
my $curMarkerEnd = ''; |
Line 1160 sub render_resource {
|
Line 1161 sub render_resource {
|
$linkopen = "<a href=\"$link\">"; |
$linkopen = "<a href=\"$link\">"; |
} |
} |
} |
} |
$result .= "$curMarkerBegin$linkopen$title$partLabel$linkclose$curMarkerEnd$editmapLink$nonLinkedText</td>"; |
$result .= "$curMarkerBegin$title$partLabel$curMarkerEnd$linkclose$editmapLink$nonLinkedText</td>"; |
|
|
return $result; |
return $result; |
} |
} |
Line 1575 sub render {
|
Line 1576 sub render {
|
|
|
while (($curRes = $mapIterator->next()) && !$foundJump) { |
while (($curRes = $mapIterator->next()) && !$foundJump) { |
if (ref($curRes)) { $counter++; } |
if (ref($curRes)) { $counter++; } |
|
# Speed up display after course initialization |
|
# when $jump is empty. Note: we still need |
|
# $counter to be 1 in that case if there is at |
|
# least one resource. |
|
last if (($jump eq '') && ($counter)); |
|
|
if (ref($curRes) && $jump eq $curRes->symb()) { |
if (ref($curRes) && $jump eq $curRes->symb()) { |
|
|
# This is why we have to use the main iterator instead of the |
# This is why we have to use the main iterator instead of the |
Line 1594 sub render {
|
Line 1600 sub render {
|
my $printKey = $args->{'printKey'}; |
my $printKey = $args->{'printKey'}; |
my $printCloseAll = $args->{'printCloseAll'}; |
my $printCloseAll = $args->{'printCloseAll'}; |
if (!defined($printCloseAll)) { $printCloseAll = 1; } |
if (!defined($printCloseAll)) { $printCloseAll = 1; } |
|
|
# Print key? |
# Print key? |
if ($printKey) { |
if ($printKey) { |
$result .= '<table border="0" cellpadding="2" cellspacing="0">'; |
my $location = &Apache::loncommon::lonhttpdurl("/adm/lonMisc"); |
$result.='<tr><td align="right" valign="bottom">Key: </td>'; |
$result .= '<table border="0" cellpadding="2" cellspacing="0">'. |
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc"); |
'<tr><td align="right" valign="bottom">Key: </td>'. |
if ($navmap->{LAST_CHECK}) { |
'<td align="center" valign="bottom"> '. |
$result .= |
'<img src="'.$location.'/chat.gif" alt="" /> '.&mt('Unread Discussion'). |
'<img src="'.$location.'/chat.gif" alt="" /> '.&mt('New discussion since').' '. |
'</td><td align="center" valign="bottom">'. |
strftime("%A, %b %e at %I:%M %P", localtime($navmap->{LAST_CHECK})). |
' <img src="'.$location.'/feedback.gif" alt="" /> '. |
'</td><td align="center" valign="bottom"> '. |
&mt('New message (click to open)'). |
'<img src="'.$location.'/feedback.gif" alt="" /> '.&mt('New message (click to open)').'<p>'. |
'</td></tr></table>'."\n"; |
'</td>'; |
|
} else { |
|
$result .= '<td align="center" valign="bottom"> '. |
|
'<img src="'.$location.'/chat.gif" alt="" /> '.&mt('Discussions').'</td><td align="center" valign="bottom">'. |
|
' <img src="'.$location.'/feedback.gif" alt="" /> '.&mt('New message (click to open)'). |
|
'</td>'; |
|
} |
|
|
|
$result .= '</tr></table>'; |
|
} |
} |
|
|
if ($printCloseAll && !$args->{'resource_no_folder_link'}) { |
if ($printCloseAll && !$args->{'resource_no_folder_link'}) { |
Line 1711 END
|
Line 1708 END
|
$result .= "<br />\n"; |
$result .= "<br />\n"; |
|
|
# Data |
# Data |
$result.=&Apache::loncommon::start_data_table("LC_tableOfContent"); |
if ($counter) { |
|
$result.=&Apache::loncommon::start_data_table("LC_tableOfContent"); |
|
} |
|
|
my $res = "Apache::lonnavmaps::resource"; |
my $res = "Apache::lonnavmaps::resource"; |
my %condenseStatuses = |
my %condenseStatuses = |
Line 2109 END
|
Line 2108 END
|
} |
} |
} |
} |
|
|
$result.=&Apache::loncommon::end_data_table(); |
if ($counter) { |
|
$result.=&Apache::loncommon::end_data_table(); |
|
} |
|
|
# Print out the part that jumps to #curloc if it exists |
# Print out the part that jumps to #curloc if it exists |
# delay needed because the browser is processing the jump before |
# delay needed because the browser is processing the jump before |
Line 2290 sub new {
|
Line 2291 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 2343 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 2354 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 2871 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 3190 sub get_mapparam {
|
Line 3200 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 3391 sub getcourseparam {
|
Line 3401 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 5253 sub weight {
|
Line 5263 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 { |