version 1.258, 2004/04/13 15:49:42
|
version 1.267.2.6, 2004/09/20 15:28:10
|
Line 137 sub real_handler {
|
Line 137 sub real_handler {
|
$r->print('</head>'. |
$r->print('</head>'. |
&Apache::loncommon::bodytag('Navigate Course Contents','', |
&Apache::loncommon::bodytag('Navigate Course Contents','', |
$addentries,'','',$ENV{'form.register'})); |
$addentries,'','',$ENV{'form.register'})); |
$r->print('<script>window.focus();</script>'); |
$r->print('<script>window.focus();</script>'. |
|
&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); |
|
|
$r->rflush(); |
$r->rflush(); |
|
|
# Check that it's defined |
# Check that it's defined |
Line 512 sub timeToHumanString {
|
Line 513 sub timeToHumanString {
|
} |
} |
|
|
# Not this year, so show the year |
# Not this year, so show the year |
my $timeStr = strftime("on %A, %b %e %G at %I:%M %P", localtime($time)); |
my $timeStr = strftime("on %A, %b %e %Y at %I:%M %P", localtime($time)); |
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 pm/noon/; |
$timeStr =~ s/12:00 pm/noon/; |
return $timeStr; |
return $timeStr; |
Line 970 sub render_resource {
|
Line 971 sub render_resource {
|
$nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; |
$nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; |
} |
} |
|
|
if (!$params->{'resource_nolink'} && !$resource->is_sequence()) { |
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { |
$result .= " $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>"; |
$result .= " $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>"; |
} else { |
} else { |
$result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>"; |
$result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>"; |
Line 1259 sub render {
|
Line 1260 sub render {
|
# We only need to do this if we need to open the maps to show the |
# We only need to do this if we need to open the maps to show the |
# current position. This will change the counter so we can't count |
# current position. This will change the counter so we can't count |
# for the jump marker with this loop. |
# for the jump marker with this loop. |
while (($curRes = $mapIterator->next()) && !$found) { |
while ($here && ($curRes = $mapIterator->next()) && !$found) { |
if (ref($curRes) && $curRes->symb() eq $here) { |
if (ref($curRes) && $curRes->symb() eq $here) { |
my $mapStack = $mapIterator->getStack(); |
my $mapStack = $mapIterator->getStack(); |
|
|
Line 1368 sub render {
|
Line 1369 sub render {
|
"&here=" . Apache::lonnet::escape($here) . |
"&here=" . Apache::lonnet::escape($here) . |
"\">".&mt('Open All Folders')."</a>"; |
"\">".&mt('Open All Folders')."</a>"; |
} |
} |
$result .= "<br /><br />\n"; |
$result .= "\n"; |
} |
} |
|
|
|
# Check for any unread discussions in all resources. |
|
if (0 && !$args->{'resource_no_folder_link'}) { |
|
my $totdisc = 0; |
|
my $haveDisc = ''; |
|
my @allres=$navmap->retrieveResources(); |
|
foreach my $resource (@allres) { |
|
if ($resource->hasDiscussion()) { |
|
my $ressymb; |
|
if ($resource->symb() =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) { |
|
$ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; |
|
} else { |
|
$ressymb = $resource->symb(); |
|
} |
|
$haveDisc .= $ressymb.':'; |
|
$totdisc ++; |
|
} |
|
} |
|
if ($totdisc > 0) { |
|
$haveDisc =~ s/:$//; |
|
my %lt = &Apache::lonlocal::texthash( |
|
'mapr' => 'Mark all posts read', |
|
); |
|
$result .= (<<END); |
|
<a href="javascript:document.clearbubbles.submit()">$lt{'mapr'}</a> <a href="javascript:void(open('/adm/help/NavMaps_MarkPosts_Read.hlp', 'Help_for_NavMaps_MarkPosts', 'menubar=0,toolbar=1,scrollbars=1,width=350,height=400,resizable=yes'))" title="Online Help"><image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Help: NavMaps_MarkPostsLink)" /></a> |
|
<form name="clearbubbles" method="post" action="/adm/feedback"> |
|
<input type="hidden" name="navurl" value="$ENV{'QUERY_STRING'}" /> |
|
<input type="hidden" name="navmaps" value="$haveDisc" /> |
|
</form> |
|
END |
|
} else { |
|
$result .= '<br />'; |
|
} |
|
} |
|
$result .= "<br />\n"; |
if ($r) { |
if ($r) { |
$r->print($result); |
$r->print($result); |
$r->rflush(); |
$r->rflush(); |
Line 1813 sub generate_course_user_opt {
|
Line 1848 sub generate_course_user_opt {
|
|
|
sub generate_email_discuss_status { |
sub generate_email_discuss_status { |
my $self = shift; |
my $self = shift; |
|
my $symb = shift; |
if ($self->{EMAIL_DISCUSS_GENERATED}) { return; } |
if ($self->{EMAIL_DISCUSS_GENERATED}) { return; } |
|
|
my $cid=$ENV{'request.course.id'}; |
my $cid=$ENV{'request.course.id'}; |
Line 1825 sub generate_email_discuss_status {
|
Line 1861 sub generate_email_discuss_status {
|
$courseLeaveTime : $logoutTime); |
$courseLeaveTime : $logoutTime); |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
$cdom, $cnum); |
$cdom, $cnum); |
|
my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss', |
|
$ENV{'user.domain'},$ENV{'user.name'},'lastread'); |
|
my %lastreadtime = (); |
|
foreach (keys %lastread) { |
|
my $key = $_; |
|
$key =~ s/_lastread$//; |
|
$lastreadtime{$key} = $lastread{$_}; |
|
} |
|
|
my %feedback=(); |
my %feedback=(); |
my %error=(); |
my %error=(); |
my $keys = &Apache::lonnet::reply('keys:'. |
my $keys = &Apache::lonnet::reply('keys:'. |
Line 1858 sub generate_email_discuss_status {
|
Line 1903 sub generate_email_discuss_status {
|
$self->{ERROR_MSG} = \%error; # what is this? JB |
$self->{ERROR_MSG} = \%error; # what is this? JB |
$self->{DISCUSSION_TIME} = \%discussiontime; |
$self->{DISCUSSION_TIME} = \%discussiontime; |
$self->{EMAIL_STATUS} = \%emailstatus; |
$self->{EMAIL_STATUS} = \%emailstatus; |
|
$self->{LAST_READ} = \%lastreadtime; |
|
|
$self->{EMAIL_DISCUSS_GENERATED} = 1; |
$self->{EMAIL_DISCUSS_GENERATED} = 1; |
} |
} |
Line 1926 sub hasDiscussion {
|
Line 1972 sub hasDiscussion {
|
if (!defined($self->{DISCUSSION_TIME})) { return 0; } |
if (!defined($self->{DISCUSSION_TIME})) { return 0; } |
|
|
#return defined($self->{DISCUSSION_TIME}->{$symb}); |
#return defined($self->{DISCUSSION_TIME}->{$symb}); |
return $self->{DISCUSSION_TIME}->{$symb} > |
|
$self->{LAST_CHECK}; |
# backward compatibility (bulletin boards used to be 'wrapped') |
|
my $ressymb = $symb; |
|
if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) { |
|
unless ($ressymb =~ m|adm/wrapper/adm|) { |
|
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; |
|
} |
|
} |
|
|
|
if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) { |
|
return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb}; |
|
} else { |
|
# return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_CHECK}; # v.1.1 behavior |
|
return $self->{DISCUSSION_TIME}->{$ressymb} > 0; # in 1.2 will display speech bubble icons for all items with posts until marked as read (even if read in v 1.1). |
|
} |
} |
} |
|
|
# Private method: Does the given resource (as a symb string) have |
# Private method: Does the given resource (as a symb string) have |
Line 3218 sub is_sequence {
|
Line 3277 sub is_sequence {
|
return $self->navHash("is_map_", 1) && |
return $self->navHash("is_map_", 1) && |
$self->navHash("map_type_" . $self->map_pc()) eq 'sequence'; |
$self->navHash("map_type_" . $self->map_pc()) eq 'sequence'; |
} |
} |
|
sub is_survey { |
|
my $self = shift(); |
|
my $part = shift(); |
|
if ($self->parmval('type',$part) eq 'survey') { |
|
return 1; |
|
} |
|
if ($self->src() =~ /\.(survey)$/) { |
|
return 1; |
|
} |
|
return 0; |
|
} |
|
|
|
sub is_empty_sequence { |
|
my $self=shift; |
|
my $src = $self->src(); |
|
return !$self->is_page() && $self->navHash("is_map_", 1) && !$self->navHash("map_type_" . $self->map_pc()); |
|
} |
|
|
# Private method: Shells out to the parmval in the nav map, handler parts. |
# Private method: Shells out to the parmval in the nav map, handler parts. |
sub parmval { |
sub parmval { |
Line 3394 sub awarded {
|
Line 3470 sub awarded {
|
} |
} |
sub duedate { |
sub duedate { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
|
my $interval=$self->parmval("interval", $part); |
|
if ($interval) { |
|
my $first_access=&Apache::lonnet::get_first_access('map',$self->symb); |
|
if ($first_access) { return ($first_access+$interval); } |
|
} |
return $self->parmval("duedate", $part); |
return $self->parmval("duedate", $part); |
} |
} |
sub maxtries { |
sub maxtries { |
Line 3694 sub extractParts {
|
Line 3775 sub extractParts {
|
} |
} |
} |
} |
} |
} |
|
my $resorder = &Apache::lonnet::metadata($self->src(),'responseorder'); |
|
if ($resorder) { |
|
my @resorder=split(/,/,$resorder); |
|
foreach my $part (keys(%responseIdHash)) { |
|
my %resids = map { ($_,1) } @{ $responseIdHash{$part} }; |
|
my @neworder; |
|
foreach my $possibleid (@resorder) { |
|
if (exists($resids{$possibleid})) { |
|
push(@neworder,$possibleid); |
|
} |
|
} |
|
$responseIdHash{$part}=\@neworder; |
|
} |
|
} |
$self->{RESPONSE_IDS} = \%responseIdHash; |
$self->{RESPONSE_IDS} = \%responseIdHash; |
$self->{RESPONSE_TYPES} = \%responseTypeHash; |
$self->{RESPONSE_TYPES} = \%responseTypeHash; |
} |
} |
Line 3887 sub getCompletionStatus {
|
Line 3982 sub getCompletionStatus {
|
|
|
# Left as separate if statements in case we ever do more with this |
# Left as separate if statements in case we ever do more with this |
if ($status eq 'correct_by_student') {return $self->CORRECT;} |
if ($status eq 'correct_by_student') {return $self->CORRECT;} |
|
if ($status eq 'correct_by_scantron') {return $self->CORRECT;} |
if ($status eq 'correct_by_override') {return $self->CORRECT_BY_OVERRIDE; } |
if ($status eq 'correct_by_override') {return $self->CORRECT_BY_OVERRIDE; } |
if ($status eq 'incorrect_attempted') {return $self->INCORRECT; } |
if ($status eq 'incorrect_attempted') {return $self->INCORRECT; } |
if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; } |
if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; } |
Line 4037 sub status {
|
Line 4133 sub status {
|
|
|
if ($dateStatus == PAST_DUE_ANSWER_LATER || |
if ($dateStatus == PAST_DUE_ANSWER_LATER || |
$dateStatus == PAST_DUE_NO_ANSWER ) { |
$dateStatus == PAST_DUE_NO_ANSWER ) { |
return $dateStatus; |
return $suppressFeedback ? ANSWER_SUBMITTED : $dateStatus; |
} |
} |
|
|
if ($dateStatus == ANSWER_OPEN) { |
if ($dateStatus == ANSWER_OPEN) { |