version 1.77, 2002/10/14 16:43:58
|
version 1.82, 2002/10/15 19:51:25
|
Line 823 sub new_handle {
|
Line 823 sub new_handle {
|
# Initialize the nav map |
# Initialize the nav map |
my $navmap = Apache::lonnavmaps::navmap->new( |
my $navmap = Apache::lonnavmaps::navmap->new( |
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}."_parms.db", 1); |
$ENV{"request.course.fn"}."_parms.db", 1, 1); |
|
|
|
|
if (!defined($navmap)) { |
if (!defined($navmap)) { |
Line 977 sub new_handle {
|
Line 977 sub new_handle {
|
my $now = time(); |
my $now = time(); |
my $in24Hours = $now + 24 * 60 * 60; |
my $in24Hours = $now + 24 * 60 * 60; |
my $depth = 1; |
my $depth = 1; |
|
my $displayedHereMarker = 0; |
|
|
# We know the first thing is a BEGIN_MAP (see "$self->{STARTED}" |
# We know the first thing is a BEGIN_MAP (see "$self->{STARTED}" |
# code in iterator->next), so ignore the first one |
# code in iterator->next), so ignore the first one |
Line 1103 sub new_handle {
|
Line 1104 sub new_handle {
|
'symb='.&Apache::lonnet::escape($curRes->symb()). |
'symb='.&Apache::lonnet::escape($curRes->symb()). |
'"'; |
'"'; |
my $title = $curRes->title(); |
my $title = $curRes->title(); |
|
if (!$title) { |
|
$title = $curRes->src(); |
|
$title = substr ($title, rindex($title, "/") + 1); |
|
} |
my $partLabel = ""; |
my $partLabel = ""; |
my $newBranchText = ""; |
my $newBranchText = ""; |
|
|
Line 1130 sub new_handle {
|
Line 1135 sub new_handle {
|
# Display the correct icon, link to open or shut map |
# Display the correct icon, link to open or shut map |
if ($curRes->is_map()) { |
if ($curRes->is_map()) { |
my $mapId = $curRes->map_pc(); |
my $mapId = $curRes->map_pc(); |
my $nowOpen = !defined($filterHash{$mapId}); |
my $nowOpen = (!defined($filterHash{$mapId})); |
|
if ($condition) {$nowOpen = !$nowOpen;} |
$icon = $nowOpen ? |
$icon = $nowOpen ? |
"navmap.folder.closed.gif" : "navmap.folder.open.gif"; |
"navmap.folder.closed.gif" : "navmap.folder.open.gif"; |
$icon = "<img src=\"/adm/lonIcons/$icon\" alt=\"\" border=\"0\" />"; |
$icon = "<img src=\"/adm/lonIcons/$icon\" alt=\"\" border=\"0\" />"; |
Line 1155 sub new_handle {
|
Line 1161 sub new_handle {
|
$curRes->duedate() > time()) { |
$curRes->duedate() > time()) { |
$color = $hurryUpColor; |
$color = $hurryUpColor; |
} |
} |
|
# Special case: If this is the last try, and there is |
|
# more then one available, give a bit of urgency |
|
my $tries = $curRes->tries($part); |
|
my $maxtries = $curRes->maxtries($part); |
|
if ($tries && $maxtries && $maxtries > 1 && |
|
$maxtries - $tries == 1) { |
|
$color = $hurryUpColor; |
|
} |
if ($color ne "") { |
if ($color ne "") { |
$colorizer = "bgcolor=\"$color\""; |
$colorizer = "bgcolor=\"$color\""; |
} |
} |
Line 1178 sub new_handle {
|
Line 1192 sub new_handle {
|
my $curMarkerEnd = ""; |
my $curMarkerEnd = ""; |
|
|
# Is this the current resource? |
# Is this the current resource? |
if ($curRes->src() eq $currenturl) { |
if ($curRes->src() eq $currenturl && !$displayedHereMarker) { |
$curMarkerBegin = '<a name="curloc" /><font color="red" size="+2">> </font>'; |
$curMarkerBegin = '<a name="curloc" /><font color="red" size="+2">> </font>'; |
$curMarkerEnd = '<font color="red" size="+2"> <</font>'; |
$curMarkerEnd = '<font color="red" size="+2"> <</font>'; |
|
$displayedHereMarker = 1; |
} |
} |
|
|
if ($curRes->is_problem() && $part ne "0" && !$condensed) { |
if ($curRes->is_problem() && $part ne "0" && !$condensed) { |
$partLabel = " (Part $part)"; |
$partLabel = " (Part $part)"; |
$title = ""; |
$title = ""; |
} |
} |
if ($multipart && $condensed) { |
if ($multipart && $condensed && $curRes->countParts > 1) { |
$nonLinkedText .= ' (' . $curRes->countParts() . ' parts)'; |
$nonLinkedText .= ' (' . $curRes->countParts() . ' parts)'; |
} |
} |
|
|
Line 1330 sub getDescription {
|
Line 1345 sub getDescription {
|
return "Open " . timeToHumanString($res->opendate($part)); |
return "Open " . timeToHumanString($res->opendate($part)); |
} |
} |
if ($status == $res->OPEN) { |
if ($status == $res->OPEN) { |
if ($res->duedate()) { |
if ($res->duedate($part)) { |
return "Due " . timeToHumanString($res->duedate($part)); |
return "Due " . timeToHumanString($res->duedate($part)); |
} else { |
} else { |
return "Open, no due date"; |
return "Open, no due date"; |
Line 1352 sub getDescription {
|
Line 1367 sub getDescription {
|
return "Not yet graded."; |
return "Not yet graded."; |
} |
} |
if ($status == $res->TRIES_LEFT) { |
if ($status == $res->TRIES_LEFT) { |
my $tries = $res->tries(); |
my $tries = $res->tries($part); |
my $maxtries = $res->maxtries(); |
my $maxtries = $res->maxtries($part); |
my $triesString = "($tries of $maxtries tries used)"; |
my $triesString = ""; |
|
if ($tries && $maxtries) { |
|
$triesString = "<font size=\"-1\"><i>($tries of $maxtries tries used)</i></font>"; |
|
if ($maxtries > 1 && $maxtries - $tries == 1) { |
|
$triesString = "<b>$triesString</b>"; |
|
} |
|
} |
if ($res->duedate()) { |
if ($res->duedate()) { |
return "Due " . timeToHumanString($res->duedate($part)) . |
return "Due " . timeToHumanString($res->duedate($part)) . |
" $triesString"; |
" $triesString"; |
Line 2561 sub extractParts {
|
Line 2582 sub extractParts {
|
|
|
$self->{PARTS} = []; |
$self->{PARTS} = []; |
|
|
# Retrieve part count |
# Retrieve part count, if this is a problem |
my $metadata = &Apache::lonnet::metadata($self->src(), 'allpossiblekeys'); |
if ($self->is_problem()) { |
if (!$metadata) { |
my $metadata = &Apache::lonnet::metadata($self->src(), 'allpossiblekeys'); |
$self->{RESOURCE_ERROR} = 1; |
if (!$metadata) { |
$self->{PARTS} = []; |
$self->{RESOURCE_ERROR} = 1; |
return; |
$self->{PARTS} = []; |
} |
return; |
|
|
foreach (split(/\,/,$metadata)) { |
|
if ($_ =~ /^parameter\_(.*)\_opendate$/) { |
|
push @{$self->{PARTS}}, $1; |
|
} |
} |
|
|
|
foreach (split(/\,/,$metadata)) { |
|
if ($_ =~ /^parameter\_(.*)\_opendate$/) { |
|
push @{$self->{PARTS}}, $1; |
|
} |
|
} |
|
|
|
|
|
# Is this possible to do in one line? - Jeremy |
|
my @sortedParts = sort @{$self->{PARTS}}; |
|
$self->{PARTS} = \@sortedParts; |
} |
} |
|
|
|
|
# Is this possible to do in one line? - Jeremy |
|
my @sortedParts = sort @{$self->{PARTS}}; |
|
$self->{PARTS} = \@sortedParts; |
|
|
|
return; |
return; |
} |
} |
|
|
Line 2828 sub status {
|
Line 2851 sub status {
|
# If it's WRONG... |
# If it's WRONG... |
if ($completionStatus == INCORRECT || $completionStatus == INCORRECT_BY_OVERRIDE) { |
if ($completionStatus == INCORRECT || $completionStatus == INCORRECT_BY_OVERRIDE) { |
# and there are TRIES LEFT: |
# and there are TRIES LEFT: |
if ($self->tries() < $self->maxtries()) { |
if ($self->tries($part) < $self->maxtries($part) || !$self->maxtries($part)) { |
return TRIES_LEFT; |
return TRIES_LEFT; |
} |
} |
return INCORRECT; # otherwise, return orange; student can't fix this |
return INCORRECT; # otherwise, return orange; student can't fix this |