version 1.371, 2006/03/16 20:48:30
|
version 1.382, 2006/05/15 19:29:03
|
Line 203 MENU
|
Line 203 MENU
|
|
|
</script> |
</script> |
ENDSUBM |
ENDSUBM |
$r->print(&Apache::lonxml::xmlbegin(). |
$r->print(&Apache::loncommon::start_page(undef,$js, |
&Apache::loncommon::head(undef,$js). |
{'only_body' => 1, |
'<body bgcolor="#FFFFFF" onLoad="submitthis()">'. |
'bgcolor' => '#FFFFFF', |
&Apache::loncommon::end_page(undef,$js)); |
'add_entries' => |
|
{'onload' => |
|
"submitthis()"}}). |
|
&Apache::loncommon::end_page()); |
|
|
return OK; |
return OK; |
} |
} |
Line 243 MENU
|
Line 246 MENU
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework','postsymb']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework','postsymb']); |
|
|
# ----------------------------------------------------- Force menu registration |
# ----------------------------------------------------- Force menu registration |
my $addentries=''; |
|
my $more_unload; |
|
my $body_only=''; |
my $body_only=''; |
my $js; |
my $js; |
if ($env{'environment.remotenavmap'} eq 'on') { |
if ($env{'environment.remotenavmap'} eq 'on') { |
Line 253 MENU
|
Line 254 MENU
|
this.document.location="/adm/navmaps?collapseExternal"; |
this.document.location="/adm/navmaps?collapseExternal"; |
} |
} |
</script>'; |
</script>'; |
# FIXME need to be smarter to only catch window close events |
|
# $more_unload="collapse()" |
|
$body_only=1; |
$body_only=1; |
} |
} |
if ($env{'form.register'}) { |
|
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
|
'" onUnload="'.&Apache::lonmenu::unloadevents().';'. |
|
$more_unload.'"'; |
|
$r->print(&Apache::lonmenu::registerurl(1)); |
|
} else { |
|
$addentries=' onUnload="'.$more_unload.'"'; |
|
} |
|
|
|
# Header |
# Header |
$r->print(&Apache::lonxml::xmlbegin(). |
$r->print(&Apache::loncommon::start_page('Navigate Course Contents',$js, |
&Apache::loncommon::head('Navigate Course Contents',$js). |
{'only_body' => $body_only, |
&Apache::loncommon::bodytag('Navigate Course Contents','', |
'force_register' => |
$addentries,$body_only,'', |
$env{'form.register'},})); |
$env{'form.register'})); |
$r->print('<script type="text/javascript">window.focus();</script>'); |
$r->print('<script>window.focus();</script>'); |
|
|
|
$r->rflush(); |
$r->rflush(); |
|
|
# Check that it's defined |
# Check that it's defined |
if (!($navmap->courseMapDefined())) { |
if (!($navmap->courseMapDefined())) { |
$r->print(&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); |
$r->print(&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); |
$r->print('<font size="+2" color="red">Coursemap undefined.</font>' . |
$r->print('<font size="+2" color="red">'.&mt('Coursemap undefined.'). |
|
'</font>' . |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
Line 327 MENU
|
Line 318 MENU
|
"Close navigation window"); |
"Close navigation window"); |
} |
} |
|
|
my $jumpToFirstHomework = 0; |
|
# Check to see if the student is jumping to next open, do-able problem |
# Check to see if the student is jumping to next open, do-able problem |
if ($ENV{QUERY_STRING} =~ /^jumpToFirstHomework/) { |
if ($ENV{QUERY_STRING} =~ /^jumpToFirstHomework/) { |
$jumpToFirstHomework = 1; |
|
# Find the next homework problem that they can do. |
# Find the next homework problem that they can do. |
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $curRes; |
my $curRes; |
my $foundDoableProblem = 0; |
my $foundDoableProblem = 0; |
my $problemRes; |
my $minimumduedate; |
|
|
while (($curRes = $iterator->next()) && !$foundDoableProblem) { |
while ($curRes = $iterator->next()) { |
if (ref($curRes) && $curRes->is_problem()) { |
if (ref($curRes) && $curRes->is_problem()) { |
my $status = $curRes->status(); |
my $status = $curRes->status(); |
if ($curRes->completable()) { |
if ($curRes->completable()) { |
$problemRes = $curRes; |
my $thisduedate=$curRes->duedate(); |
|
unless ($foundDoableProblem) { |
|
$minimumduedate=$thisduedate; |
|
} |
|
|
$foundDoableProblem = 1; |
$foundDoableProblem = 1; |
|
|
# Pop open all previous maps |
if ($thisduedate<=$minimumduedate) { |
my $stack = $iterator->getStack(); |
# Pop open all previous maps |
pop @$stack; # last resource in the stack is the problem |
my $stack = $iterator->getStack(); |
# itself, which we don't need in the map stack |
pop @$stack; # last resource in the stack is the problem |
my @mapPcs = map {$_->map_pc()} @$stack; |
# itself, which we don't need in the map stack |
$env{'form.filter'} = join(',', @mapPcs); |
my @mapPcs = map {$_->map_pc()} @$stack; |
|
$env{'form.filter'} = join(',', @mapPcs); |
# Mark as both "here" and "jump" |
|
$env{'form.postsymb'} = $curRes->symb(); |
# Mark as both "here" and "jump" |
|
$env{'form.postsymb'} = $curRes->symb(); |
|
$minimumduedate=$thisduedate; |
|
} |
} |
} |
} |
} |
} |
} |
Line 364 MENU
|
Line 361 MENU
|
} else { |
} else { |
&add_linkitem(\%toplinkitems,'firsthomework', |
&add_linkitem(\%toplinkitems,'firsthomework', |
'location.href="navmaps?jumpToFirstHomework"', |
'location.href="navmaps?jumpToFirstHomework"', |
"Show Me My First Homework Problem"); |
"Show my first due problem"); |
} |
} |
|
|
my $suppressEmptySequences = 0; |
my $suppressEmptySequences = 0; |
Line 381 MENU
|
Line 378 MENU
|
}; |
}; |
&add_linkitem(\%toplinkitems,'everything', |
&add_linkitem(\%toplinkitems,'everything', |
'location.href="navmaps?sort='.$env{'form.sort'}.'"', |
'location.href="navmaps?sort='.$env{'form.sort'}.'"', |
"Show Everything"); |
"Show everything"); |
$r->print("<p><font size='+2'>".&mt("Uncompleted Homework")."</font></p>"); |
$r->print("<p><font size='+2'>".&mt("Uncompleted Problems")."</font></p>"); |
$env{'form.filter'} = ''; |
$env{'form.filter'} = ''; |
$env{'form.condition'} = 1; |
$env{'form.condition'} = 1; |
$resource_no_folder_link = 1; |
$resource_no_folder_link = 1; |
Line 390 MENU
|
Line 387 MENU
|
&add_linkitem(\%toplinkitems,'uncompleted', |
&add_linkitem(\%toplinkitems,'uncompleted', |
'location.href="navmaps?sort='.$env{'form.sort'}. |
'location.href="navmaps?sort='.$env{'form.sort'}. |
'&showOnlyHomework=1"', |
'&showOnlyHomework=1"', |
"Show Only Uncompleted Homework"); |
"Show only uncompleted problems"); |
} |
} |
|
|
my %selected=($env{'form.sort'} => 'selected=on'); |
my %selected=($env{'form.sort'} => 'selected=on'); |
Line 682 sub timeToHumanString {
|
Line 679 sub timeToHumanString {
|
|
|
if($format ne '') { |
if($format ne '') { |
my $timeStr = strftime($format, localtime($time)); |
my $timeStr = strftime($format, localtime($time)); |
return $timeStr.&Apache::lonlocal::gettimezone(); |
return $timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
|
|
# Less then 5 days away, display day of the week and |
# Less then 5 days away, display day of the week and |
Line 693 sub timeToHumanString {
|
Line 690 sub timeToHumanString {
|
$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 ($inPast ? "last " : "this ") . |
return ($inPast ? "last " : "this ") . |
$timeStr.&Apache::lonlocal::gettimezone(); |
$timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
|
|
my $conjunction='on'; |
my $conjunction='on'; |
Line 708 sub timeToHumanString {
|
Line 705 sub timeToHumanString {
|
my $timeStr = strftime("$conjunction %A, %b %e at %I:%M %P", localtime($time)); |
my $timeStr = strftime("$conjunction %A, %b %e 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.&Apache::lonlocal::gettimezone(); |
return $timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
|
|
# Not this year, so show the year |
# Not this year, so show the year |
my $timeStr = strftime("$conjunction %A, %b %e %Y at %I:%M %P", localtime($time)); |
my $timeStr = strftime("$conjunction %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.&Apache::lonlocal::gettimezone(); |
return $timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
} |
} |
|
|
Line 1612 sub render {
|
Line 1609 sub render {
|
if ($condition) { |
if ($condition) { |
$link='"navmaps?condition=0&filter=&'.$queryString. |
$link='"navmaps?condition=0&filter=&'.$queryString. |
'&here='.&Apache::lonnet::escape($here).'"'; |
'&here='.&Apache::lonnet::escape($here).'"'; |
$text='Close All Folders'; |
$text='Close all folders'; |
} else { |
} else { |
$link='"navmaps?condition=1&filter=&'.$queryString. |
$link='"navmaps?condition=1&filter=&'.$queryString. |
'&here='.&Apache::lonnet::escape($here).'"'; |
'&here='.&Apache::lonnet::escape($here).'"'; |
$text='Open All Folders'; |
$text='Open all folders'; |
} |
} |
if ($args->{'caller'} eq 'navmapsdisplay') { |
if ($args->{'caller'} eq 'navmapsdisplay') { |
&add_linkitem($args->{'linkitems'},'changefolder', |
&add_linkitem($args->{'linkitems'},'changefolder', |
Line 2355 sub unread_discussion {
|
Line 2352 sub unread_discussion {
|
my $symb = shift; |
my $symb = shift; |
|
|
$self->get_discussion_data(); |
$self->get_discussion_data(); |
|
|
my $ressymb = $self->wrap_symb($symb); |
|
|
|
my $version = $self->{DISCUSSION_DATA}{'version:'.$ressymb}; |
my $ressymb = $self->wrap_symb($symb); |
|
# keys used to store bulletinboard postings use 'unwrapped' symb. |
|
my $discsymb = $self->unwrap_symb($ressymb); |
|
my $version = $self->{DISCUSSION_DATA}{'version:'.$discsymb}; |
if (!$version) { return; } |
if (!$version) { return; } |
|
|
my $prevread = $self->{LAST_READ}{$ressymb}; |
my $prevread = $self->{LAST_READ}{$ressymb}; |
Line 2371 sub unread_discussion {
|
Line 2369 sub unread_discussion {
|
my %subjects; |
my %subjects; |
|
|
for (my $id=$version; $id>0; $id--) { |
for (my $id=$version; $id>0; $id--) { |
my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$ressymb}; |
my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$discsymb}; |
my @keys=split(/:/,$vkeys); |
my @keys=split(/:/,$vkeys); |
if (grep(/^hidden$/ ,@keys)) { |
if (grep(/^hidden$/ ,@keys)) { |
if (!$hiddenflag) { |
if (!$hiddenflag) { |
$hidden = $self->{DISCUSSION_DATA}{$id.':'.$ressymb.':hidden'}; |
$hidden = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':hidden'}; |
$hiddenflag = 1; |
$hiddenflag = 1; |
} |
} |
} elsif (grep(/^deleted$/,@keys)) { |
} elsif (grep(/^deleted$/,@keys)) { |
if (!$deletedflag) { |
if (!$deletedflag) { |
$deleted = $self->{DISCUSSION_DATA}{$id.':'.$ressymb.':deleted'}; |
$deleted = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':deleted'}; |
$deletedflag = 1; |
$deletedflag = 1; |
} |
} |
} else { |
} else { |
if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./) |
if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./) |
&& $prevread < $self->{DISCUSSION_DATA}{$id.':'.$ressymb.':timestamp'}) { |
&& $prevread < $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}) { |
$unreadcount++; |
$unreadcount++; |
$subjects{$unreadcount}= |
$subjects{$unreadcount}= |
$id.': '.$self->{DISCUSSION_DATA}{$id.':'.$ressymb.':subject'}; |
$id.': '.$self->{DISCUSSION_DATA}{$id.':'.$discsymb.':subject'}; |
} |
} |
} |
} |
} |
} |
Line 2401 sub unread_discussion {
|
Line 2399 sub unread_discussion {
|
sub wrap_symb { |
sub wrap_symb { |
my $self = shift; |
my $self = shift; |
my $symb = shift; |
my $symb = shift; |
if ($symb =~ m-___(adm/\w+/\w+/)(\d+)(/bulletinboard)$-) { |
if ($symb =~ m-___(adm/[^/]+/[^/]+/)(\d+)(/bulletinboard)$-) { |
unless ($symb =~ m|adm/wrapper/adm|) { |
unless ($symb =~ m|adm/wrapper/adm|) { |
$symb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3; |
$symb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3; |
} |
} |
Line 2409 sub wrap_symb {
|
Line 2407 sub wrap_symb {
|
return $symb; |
return $symb; |
} |
} |
|
|
|
sub unwrap_symb { |
|
my $self = shift; |
|
my $ressymb = shift; |
|
my $discsymb = $ressymb; |
|
if ($ressymb =~ m-^(bulletin___\d+___)adm/wrapper/(adm/[^/]+/[^/]+/\d+/bulletinboard)$-) { |
|
$discsymb = $1.$2; |
|
} |
|
return $discsymb; |
|
} |
|
|
# Private method: Does the given resource (as a symb string) have |
# Private method: Does the given resource (as a symb string) have |
# current feedback? Returns the string in the feedback hash, which |
# current feedback? Returns the string in the feedback hash, which |
# will be false if it does not exist. |
# will be false if it does not exist. |
Line 3822 sub contains_problem {
|
Line 3830 sub contains_problem {
|
} |
} |
sub is_sequence { |
sub is_sequence { |
my $self=shift; |
my $self=shift; |
my $src = $self->src(); |
|
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'; |
} |
} |
Line 3897 Returns a string with the type of the ma
|
Line 3904 Returns a string with the type of the ma
|
sub map_finish { |
sub map_finish { |
my $self = shift; |
my $self = shift; |
my $src = $self->src(); |
my $src = $self->src(); |
$src = Apache::lonnet::clutter($src); |
$src = &Apache::lonnet::clutter($src); |
my $res = $self->navHash("map_finish_$src", 0); |
my $res = $self->navHash("map_finish_$src", 0); |
$res = $self->{NAV_MAP}->getById($res); |
$res = $self->{NAV_MAP}->getById($res); |
return $res; |
return $res; |
Line 3910 sub map_pc {
|
Line 3917 sub map_pc {
|
sub map_start { |
sub map_start { |
my $self = shift; |
my $self = shift; |
my $src = $self->src(); |
my $src = $self->src(); |
$src = Apache::lonnet::clutter($src); |
$src = &Apache::lonnet::clutter($src); |
my $res = $self->navHash("map_start_$src", 0); |
my $res = $self->navHash("map_start_$src", 0); |
$res = $self->{NAV_MAP}->getById($res); |
$res = $self->{NAV_MAP}->getById($res); |
return $res; |
return $res; |
Line 4022 sub awarded {
|
Line 4029 sub awarded {
|
if (!defined($part)) { $part = '0'; } |
if (!defined($part)) { $part = '0'; } |
return $self->{NAV_MAP}->{STUDENT_DATA}->{$self->symb()}->{'resource.'.$part.'.awarded'}; |
return $self->{NAV_MAP}->{STUDENT_DATA}->{$self->symb()}->{'resource.'.$part.'.awarded'}; |
} |
} |
|
# this should work exactly like the copy in lonhomework.pm |
sub duedate { |
sub duedate { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
|
my $date; |
my $interval=$self->parmval("interval", $part); |
my $interval=$self->parmval("interval", $part); |
if ($interval) { |
my $due_date=$self->parmval("duedate", $part); |
|
if (defined($interval)) { |
my $first_access=&Apache::lonnet::get_first_access('map',$self->symb); |
my $first_access=&Apache::lonnet::get_first_access('map',$self->symb); |
if ($first_access) { return ($first_access+$interval); } |
if (defined($first_access)) { |
|
$interval = $first_access+$interval; |
|
$date = ($interval < $due_date)? $interval : $due_date; |
|
} else { |
|
$date = $due_date; |
|
} |
|
} else { |
|
$date = $due_date; |
} |
} |
return $self->parmval("duedate", $part); |
return $date; |
} |
} |
sub handgrade { |
sub handgrade { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
Line 4377 sub extractParts {
|
Line 4394 sub extractParts {
|
# So we have to use our knowlege of part names to figure out |
# So we have to use our knowlege of part names to figure out |
# where the part names begin and end, and even then, it is possible |
# where the part names begin and end, and even then, it is possible |
# to construct ambiguous situations. |
# to construct ambiguous situations. |
foreach (split /,/, $metadata) { |
foreach my $data (split /,/, $metadata) { |
if ($_ =~ /^([a-zA-Z]+)response_(.*)/ |
if ($data =~ /^([a-zA-Z]+)response_(.*)/ |
|| $_ =~ /^(Task)_(.*)/) { |
|| $data =~ /^(Task)_(.*)/) { |
my $responseType = $1; |
my $responseType = $1; |
my $partStuff = $2; |
my $partStuff = $2; |
my $partIdSoFar = ''; |
my $partIdSoFar = ''; |
Line 4391 sub extractParts {
|
Line 4408 sub extractParts {
|
if ($parts{$partIdSoFar}) { |
if ($parts{$partIdSoFar}) { |
my @otherChunks = @partChunks[$i+1..$#partChunks]; |
my @otherChunks = @partChunks[$i+1..$#partChunks]; |
my $responseId = join('_', @otherChunks); |
my $responseId = join('_', @otherChunks); |
push @{$responseIdHash{$partIdSoFar}}, $responseId; |
if ($self->is_task()) { |
push @{$responseTypeHash{$partIdSoFar}}, $responseType; |
push(@{$responseIdHash{$partIdSoFar}}, |
|
$partIdSoFar); |
|
} else { |
|
push(@{$responseIdHash{$partIdSoFar}}, |
|
$responseId); |
|
} |
|
push(@{$responseTypeHash{$partIdSoFar}}, |
|
$responseType); |
} |
} |
} |
} |
} |
} |