--- loncom/interface/lonnavmaps.pm 2013/03/18 23:04:06 1.494
+++ loncom/interface/lonnavmaps.pm 2014/12/11 01:56:34 1.504
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.494 2013/03/18 23:04:06 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.504 2014/12/11 01:56:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
@@ -494,7 +494,7 @@ use HTML::Entities;
# For debugging
-use Data::Dumper;
+#use Data::Dumper;
# symbolic constants
@@ -990,7 +990,7 @@ sub render_resource {
if (!$params->{'map_no_edit_link'}) {
my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png';
$editmapLink=' '.
- ''.
+ ''.
'
'.
'';
}
@@ -1140,12 +1140,17 @@ sub render_long_status {
my $info = '';
if ($resource->is_problem() || $resource->is_practice()) {
$color = $colormap{$resource->status};
-
- if (dueInLessThan24Hours($resource, $part) ||
- lastTry($resource, $part)) {
+
+ if (dueInLessThan24Hours($resource, $part)) {
$color = $hurryUpColor;
$info = ' title="'.&mt('Due in less than 24 hours!').'"';
- }
+ } elsif (lastTry($resource, $part)) {
+ unless (($resource->problemstatus($part) eq 'no') ||
+ ($resource->problemstatus($part) eq 'no_feedback_ever')) {
+ $color = $hurryUpColor;
+ $info = ' title="'.&mt('One try remaining!').'"';
+ }
+ }
}
if ($resource->kind() eq "res" &&
@@ -2015,11 +2020,12 @@ sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
- bless($self); # So we can call change_user if neceesary
+ bless($self); # So we can call change_user if necessary
$self->{USERNAME} = shift || $env{'user.name'};
$self->{DOMAIN} = shift || $env{'user.domain'};
$self->{CODE} = shift;
+ $self->{NOHIDE} = shift;
@@ -2033,10 +2039,14 @@ sub new {
# We can only tie the nav hash as done below if the username/domain
# match the env one. Otherwise change_user does everything we need...since we can't
- # assume there are course hashes for the specific requested user@domamin:
+ # assume there are course hashes for the specific requested user:domain
+ # Note: change_user is also called if we need the nav hash when printing CODEd
+ # assignments or printing an exam, in which the enclosing folder for the items in
+ # the exam has hidden set.
#
- if (($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'}) && !$self->{CODE}) {
+ if (($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'}) &&
+ !$self->{CODE} && !$self->{NOHIDE}) {
# tie the nav hash
@@ -2059,7 +2069,7 @@ sub new {
$self->{PARM_HASH} = \%parmhash;
$self->{PARM_CACHE} = {};
} else {
- $self->change_user($self->{USERNAME}, $self->{DOMAIN}, $self->{CODE});
+ $self->change_user($self->{USERNAME}, $self->{DOMAIN}, $self->{CODE}, $self->{NOHIDE});
}
return $self;
@@ -2080,6 +2090,7 @@ sub change_user {
$self->{USERNAME} = shift;
$self->{DOMAIN} = shift;
$self->{CODE} = shift;
+ $self->{NOHIDE} = shift;
# If the hashes are already tied make sure to break that bond:
@@ -2095,7 +2106,7 @@ sub change_user {
my ($cdom, $cnum) = split(/\_/, $env{'request.course.id'});
my %big_hash;
- &Apache::lonmap::loadmap($cnum, $cdom, $self->{USERNAME}, $self->{DOMAIN}, $self->{CODE}, \%big_hash);
+ &Apache::lonmap::loadmap($cnum, $cdom, $self->{USERNAME}, $self->{DOMAIN}, $self->{CODE}, $self->{NOHIDE}, \%big_hash);
$self->{NAV_HASH} = \%big_hash;
@@ -2106,7 +2117,7 @@ sub change_user {
$self->{PARM_CACHE} = {};
my %parm_hash = {};
- foreach my $key (keys %big_hash) {
+ foreach my $key (keys(%big_hash)) {
if ($key =~ /^param\./) {
my $param_key = $key;
$param_key =~ s/^param\.//;
@@ -2116,9 +2127,7 @@ sub change_user {
$self->{PARM_HASH} = \%parm_hash;
-
-
-}
+}
sub generate_course_user_opt {
my $self = shift;
@@ -2181,7 +2190,7 @@ sub generate_email_discuss_status {
my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss',
$self->{DOMAIN},$self->{USERNAME},'lastread');
my %lastreadtime = ();
- foreach my $key (keys %lastread) {
+ foreach my $key (keys(%lastread)) {
my $shortkey = $key;
$shortkey =~ s/_lastread$//;
$lastreadtime{$shortkey} = $lastread{$key};
@@ -3327,15 +3336,11 @@ sub new {
if ($resourceCount == 1 && $resource->is_sequence() && !$self->{FORCE_TOP}) {
my $firstResource = $resource->map_start();
my $finishResource = $resource->map_finish();
- my $result;
- $result = Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource,
- $finishResource, $self->{FILTER},
- $self->{ALREADY_SEEN},
- $self->{CONDITION},
- $self->{FORCE_TOP});
- return $result;
-
-
+ return Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource,
+ $finishResource, $self->{FILTER},
+ $self->{ALREADY_SEEN},
+ $self->{CONDITION},
+ $self->{FORCE_TOP});
}
# Set up some bookkeeping information.
@@ -4233,7 +4238,7 @@ resource of the map.
Returns a string with the type of the map in it.
-=item *B:
+=item * B:
Returns a string with a comma-separated ordered list of map_pc IDs
for the hierarchy of maps containing a map, with the top level
@@ -4376,9 +4381,6 @@ sub printable {
my ($self, $part) = @_;
- &Apache::lonnet::logthis($self->symb());
-
-
# The following cases apply:
# - If a start date is not set, it is replaced by the open date.
# - Ditto for start/open replaced by content open.
@@ -4872,7 +4874,7 @@ sub extractParts {
}
}
}
- my @sortedParts = sort keys %parts;
+ my @sortedParts = sort(keys(%parts));
$self->{PARTS} = \@sortedParts;
}
@@ -4893,13 +4895,13 @@ sub extractParts {
# 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
# to construct ambiguous situations.
- foreach my $data (split /,/, $metadata) {
+ foreach my $data (split(/,/, $metadata)) {
if ($data =~ /^([a-zA-Z]+)response_(.*)/
|| $data =~ /^(Task)_(.*)/) {
my $responseType = $1;
my $partStuff = $2;
my $partIdSoFar = '';
- my @partChunks = split /_/, $partStuff;
+ my @partChunks = split(/_/, $partStuff);
my $i = 0;
for ($i = 0; $i < scalar(@partChunks); $i++) {
if ($partIdSoFar) { $partIdSoFar .= '_'; }
@@ -5400,7 +5402,7 @@ sub check_for_slot {
} else {
if ($ip ne '') {
if (!&Apache::loncommon::check_ip_acc($ip)) {
- return (RESERVED_LOCATION,$ip,$slot_name);
+ return (RESERVED_LOCATION,$end,$slot_name);
}
}
my @proctors;
@@ -5643,7 +5645,7 @@ sub getPrevious {
my $self = shift;
my @branches;
my $from = $self->from();
- foreach my $branch ( split /,/, $from) {
+ foreach my $branch ( split(/,/, $from)) {
my $choice = $self->{NAV_MAP}->getById($branch);
my $prev = $choice->comesfrom();
$prev = $self->{NAV_MAP}->getById($prev);