--- loncom/interface/lonnavmaps.pm 2003/05/16 17:54:21 1.192
+++ loncom/interface/lonnavmaps.pm 2003/06/10 20:07:58 1.198
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.192 2003/05/16 17:54:21 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.198 2003/06/10 20:07:58 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -966,6 +966,10 @@ sub render_communication_status {
}
}
+ if ($params->{'multipart'} && $part != '0') {
+ $discussionHTML = $feedbackHTML = $errorHTML = '';
+ }
+
return "
$discussionHTML$feedbackHTML$errorHTML | ";
}
@@ -1021,8 +1025,6 @@ sub render_long_status {
$result .= '(randomly select ' . $resource->randompick() .')';
}
- $result .= " \n";
-
return $result;
}
@@ -1413,8 +1415,13 @@ sub render {
@parts = ($parts[0]);
$args->{'condensed'} = 1;
}
-
}
+ # Multipart problem with one part: always "condense" (happens
+ # to match the desirable behavior)
+ if ($curRes->countParts() == 1) {
+ @parts = ($parts[0]);
+ $args->{'condensed'} = 1;
+ }
}
}
@@ -1588,7 +1595,14 @@ sub new {
return undef;
}
- $self->{NAV_HASH} = \%navmaphash;
+ # try copying into memory
+ my %tmpnavhash;
+ while (my ($k, $v) = each(%navmaphash)) {
+ $tmpnavhash{$k} = $v;
+ }
+ untie %navmaphash;
+
+ $self->{NAV_HASH} = \%tmpnavhash;
$self->{PARM_HASH} = \%parmhash;
$self->{INITED} = 0;
@@ -1662,7 +1676,7 @@ sub init {
my %emailstatus = &Apache::lonnet::dump('email_status');
my $logoutTime = $emailstatus{'logout'};
my $courseLeaveTime = $emailstatus{'logout_'.$ENV{'request.course.id'}};
- $self->{LAST_CHECK} = ($courseLeaveTime < $logoutTime ?
+ $self->{LAST_CHECK} = (($courseLeaveTime > $logoutTime) ?
$courseLeaveTime : $logoutTime);
my %discussiontime = &Apache::lonnet::dump('discussiontimes',
$cdom, $cnum);
@@ -1779,6 +1793,16 @@ object for that resource. This method, o
(as in the resource object) is the only proper way to obtain a
resource object.
+=item * B(symb):
+
+Based on the symb of the resource, get a resource object for that
+resource. This is one of the proper ways to get a resource object.
+
+=item * B(map_pc):
+
+Based on the map_pc of the resource, get a resource object for
+the given map. This is one of the proper ways to get a resource object.
+
=cut
# The strategy here is to cache the resource objects, and only construct them
@@ -1809,6 +1833,14 @@ sub getBySymb {
return $self->getById($map->map_pc() . '.' . $id);
}
+sub getByMapPc {
+ my $self = shift;
+ my $map_pc = shift;
+ my $map_id = $self->{NAV_HASH}->{'map_id_' . $map_pc};
+ $map_id = $self->{NAV_HASH}->{'ids_' . $map_id};
+ return $self->getById($map_id);
+}
+
=pod
=item * B():
@@ -3211,31 +3243,30 @@ sub getErrors {
=item * B():
Returns a list reference containing sorted strings corresponding to
-each part of the problem. To count the number of parts, use the list
-in a scalar context, and subtract one if greater than two. (One part
-problems have a part 0. Multi-parts have a part 0, plus a part for
-each part. Filtering part 0 if you want it is up to you.)
+each part of the problem. Single part problems have only a part '0'.
+Multipart problems do not return their part '0', since they typically
+do not really matter.
=item * B():
Returns the number of parts of the problem a student can answer. Thus,
for single part problems, returns 1. For multipart, it returns the
-number of parts in the problem, not including psuedo-part 0. Thus,
-B may return an array with more parts in it then countParts
-might lead you to believe.
+number of parts in the problem, not including psuedo-part 0.
=item * B():
-Returns true if the problem is multipart, false otherwise.
+Returns true if the problem is multipart, false otherwise. Use this instead
+of countParts if all you want is multipart/not multipart.
=item * B($part):
Returns the response type of the part, without the word "response" on the
end. Example return values: 'string', 'essay', 'numeric', etc.
-=item * B($part):
+=item * B($part):
-Retreives the response ID for the given part, which may be an empty string.
+Retreives the response IDs for the given part as an array reference containing
+strings naming the response IDs. This may be empty.
=back
@@ -3281,7 +3312,7 @@ sub responseType {
return $self->{RESPONSE_TYPE}->{$part};
}
-sub responseId {
+sub responseIds {
my $self = shift;
my $part = shift;