version 1.207, 2003/06/18 15:14:23
|
version 1.215, 2003/07/16 19:22:49
|
Line 1021 sub render_long_status {
|
Line 1021 sub render_long_status {
|
$params->{'multipart'} && $part eq "0"; |
$params->{'multipart'} && $part eq "0"; |
|
|
my $color; |
my $color; |
if ($resource->is_problem() && ($resource->countParts() <= 1) ) { |
if ($resource->is_problem()) { |
$color = $colormap{$resource->status}; |
$color = $colormap{$resource->status}; |
|
|
if (dueInLessThen24Hours($resource, $part) || |
if (dueInLessThen24Hours($resource, $part) || |
Line 1040 sub render_long_status {
|
Line 1040 sub render_long_status {
|
if ($resource->is_map() && advancedUser() && $resource->randompick()) { |
if ($resource->is_map() && advancedUser() && $resource->randompick()) { |
$result .= '(randomly select ' . $resource->randompick() .')'; |
$result .= '(randomly select ' . $resource->randompick() .')'; |
} |
} |
|
|
|
# Debugging code |
|
#$result .= " " . $resource->awarded($part) . '/' . $resource->weight($part) . |
|
# ' - Part: ' . $part; |
|
|
|
$result .= "</td>\n"; |
|
|
return $result; |
return $result; |
} |
} |
Line 1499 sub render {
|
Line 1505 sub render {
|
} |
} |
} continue { |
} continue { |
$curRes = $it->next(); |
$curRes = $it->next(); |
|
|
|
if ($r) { |
|
# If we have the connection, make sure the user is still connected |
|
my $c = $r->connection; |
|
if ($c->aborted()) { |
|
Apache::lonnet::logthis("navmaps aborted"); |
|
# Who cares what we do, nobody will see it anyhow. |
|
return ''; |
|
} |
|
} |
} |
} |
|
|
# Print out the part that jumps to #curloc if it exists |
# Print out the part that jumps to #curloc if it exists |
Line 1554 You must obtain resource objects through
|
Line 1570 You must obtain resource objects through
|
=over 4 |
=over 4 |
|
|
=item * B<new>(navHashFile, parmHashFile, genCourseAndUserOptions, |
=item * B<new>(navHashFile, parmHashFile, genCourseAndUserOptions, |
genMailDiscussStatus): |
genMailDiscussStatus, getUserData): |
|
|
Binds a new navmap object to the compiled nav map hash and parm hash |
Binds a new navmap object to the compiled nav map hash and parm hash |
given as filenames. genCourseAndUserOptions is a flag saying whether |
given as filenames. genCourseAndUserOptions is a flag saying whether |
Line 1565 documentation. genMailDiscussStatus caus
|
Line 1581 documentation. genMailDiscussStatus caus
|
information about the email and discussion status of |
information about the email and discussion status of |
resources. Returns the navmap object if this is successful, or |
resources. Returns the navmap object if this is successful, or |
B<undef> if not. You must check for undef; errors will occur when you |
B<undef> if not. You must check for undef; errors will occur when you |
try to use the other methods otherwise. |
try to use the other methods otherwise. getUserData, if true, will |
|
retreive the user's performance data for various problems. |
|
|
=item * B<getIterator>(first, finish, filter, condition): |
=item * B<getIterator>(first, finish, filter, condition): |
|
|
Line 1586 sub new {
|
Line 1603 sub new {
|
$self->{PARM_HASH_FILE} = shift; |
$self->{PARM_HASH_FILE} = shift; |
$self->{GENERATE_COURSE_USER_OPT} = shift; |
$self->{GENERATE_COURSE_USER_OPT} = shift; |
$self->{GENERATE_EMAIL_DISCUSS_STATUS} = shift; |
$self->{GENERATE_EMAIL_DISCUSS_STATUS} = shift; |
|
$self->{GET_USER_DATA} = shift; |
|
|
# 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 1723 sub init {
|
Line 1741 sub init {
|
$self->{DISCUSSION_TIME} = \%discussiontime; |
$self->{DISCUSSION_TIME} = \%discussiontime; |
$self->{EMAIL_STATUS} = \%emailstatus; |
$self->{EMAIL_STATUS} = \%emailstatus; |
|
|
} |
} |
|
|
|
if ($self->{GET_USER_DATA}) { |
|
# Retreive performance data on problems |
|
my %student_data = Apache::lonnet::currentdump($ENV{'request.course.id'}, |
|
$ENV{'user.domain'}, |
|
$ENV{'user.name'}); |
|
$self->{STUDENT_DATA} = \%student_data; |
|
} |
|
|
$self->{PARM_CACHE} = {}; |
$self->{PARM_CACHE} = {}; |
$self->{INITED} = 1; |
$self->{INITED} = 1; |
Line 2055 sub retrieveResources {
|
Line 2081 sub retrieveResources {
|
$map = $self->getResourceByUrl($map); |
$map = $self->getResourceByUrl($map); |
} |
} |
|
|
|
# If nothing was passed, assume top-level map |
|
if (!$map) { |
|
$map = $self->getById('0.0'); |
|
} |
|
|
# Check the map's validity. |
# Check the map's validity. |
if (!$map || !$map->is_map()) { |
if (!$map->is_map()) { |
# Oh, to throw an exception.... how I'd love that! |
# Oh, to throw an exception.... how I'd love that! |
return (); |
return (); |
} |
} |
|
|
# Get an iterator. |
# Get an iterator. |
my $it = $self->getIterator($map->map_start(), $map->map_finish(), |
my $it = $self->getIterator($map->map_start(), $map->map_finish(), |
!$recursive); |
undef, $recursive); |
|
|
my @resources = (); |
my @resources = (); |
|
|
Line 2092 sub retrieveResources {
|
Line 2123 sub retrieveResources {
|
} |
} |
} |
} |
|
|
|
} continue { |
$curRes = $it->next(); |
$curRes = $it->next(); |
} |
} |
|
|
Line 2216 sub min {
|
Line 2248 sub min {
|
if ($a < $b) { return $a; } else { return $b; } |
if ($a < $b) { return $a; } else { return $b; } |
} |
} |
|
|
# In the CVS repository, documentation of this algorithm is included |
|
# in /doc/lonnavdocs, as a PDF and .tex source. Markers like **1** |
|
# will reference the same location in the text as the part of the |
|
# algorithm is running through. |
|
|
|
sub new { |
sub new { |
# magic invocation to create a class instance |
# magic invocation to create a class instance |
my $proto = shift; |
my $proto = shift; |
Line 2276 sub new {
|
Line 2303 sub new {
|
# that isn't just a redirector. |
# that isn't just a redirector. |
my $resource; my $resourceCount = 0; |
my $resource; my $resourceCount = 0; |
|
|
|
# Documentation on this algorithm can be found in the CVS repository at |
|
# /docs/lonnavdocs; these "**#**" markers correspond to documentation |
|
# in that file. |
# **1** |
# **1** |
|
|
foreach my $pass (@iterations) { |
foreach my $pass (@iterations) { |
Line 2902 sub symb {
|
Line 2932 sub symb {
|
$self->navHash('map_id_'.$first)) |
$self->navHash('map_id_'.$first)) |
. '___' . $second . '___' . $symbSrc; |
. '___' . $second . '___' . $symbSrc; |
} |
} |
sub title { my $self=shift; return $self->navHash("title_", 1); } |
sub title { |
|
my $self=shift; |
|
if ($self->{ID} eq '0.0') { |
|
# If this is the top-level map, return the title of the course |
|
# since this map can not be titled otherwise. |
|
return $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
|
} |
|
return $self->navHash("title_", 1); } |
sub to { my $self=shift; return $self->navHash("to_", 1); } |
sub to { my $self=shift; return $self->navHash("to_", 1); } |
sub compTitle { |
sub compTitle { |
my $self = shift; |
my $self = shift; |
Line 3078 Get the Client IP/Name Access Control in
|
Line 3115 Get the Client IP/Name Access Control in
|
|
|
Get the answer-reveal date for the problem. |
Get the answer-reveal date for the problem. |
|
|
|
=item * B<awarded>: |
|
|
|
Gets the awarded value for the problem part. Requires genUserData set to |
|
true when the navmap object was created. |
|
|
=item * B<duedate>: |
=item * B<duedate>: |
|
|
Get the due date for the problem. |
Get the due date for the problem. |
Line 3131 sub answerdate {
|
Line 3173 sub answerdate {
|
} |
} |
return $self->parmval("answerdate", $part); |
return $self->parmval("answerdate", $part); |
} |
} |
sub awarded { my $self = shift; return $self->queryRestoreHash('awarded', shift); } |
sub awarded { |
|
my $self = shift; my $part = shift; |
|
if (!defined($part)) { $part = '0'; } |
|
return $self->{NAV_MAP}->{STUDENT_DATA}->{$self->symb()}->{'resource.'.$part.'.awarded'}; |
|
} |
sub duedate { |
sub duedate { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
return $self->parmval("duedate", $part); |
return $self->parmval("duedate", $part); |
Line 3172 sub type {
|
Line 3218 sub type {
|
} |
} |
sub weight { |
sub weight { |
my $self = shift; my $part = shift; |
my $self = shift; my $part = shift; |
return $self->parmval("weight", $part); |
if (!defined($part)) { $part = '0'; } |
|
return &Apache::lonnet::EXT('resource.'.$part.'.weight', |
|
$self->symb(), $ENV{'user.domain'}, |
|
$ENV{'user.name'}, |
|
$ENV{'request.course.sec'}); |
|
|
} |
} |
|
|
# Multiple things need this |
# Multiple things need this |
Line 3318 sub responseType {
|
Line 3369 sub responseType {
|
my $part = shift; |
my $part = shift; |
|
|
$self->extractParts(); |
$self->extractParts(); |
return $self->{RESPONSE_TYPE}->{$part}; |
return $self->{RESPONSE_TYPES}->{$part}; |
} |
} |
|
|
sub responseIds { |
sub responseIds { |