--- loncom/interface/lonnavmaps.pm 2017/09/10 00:11:27 1.535
+++ loncom/interface/lonnavmaps.pm 2017/12/21 03:50:57 1.538
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.535 2017/09/10 00:11:27 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.538 2017/12/21 03:50:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -658,6 +658,9 @@ sub getDescription {
} elsif ($slot_status == $res->RESERVABLE) {
$slotmsg = &mt('Reservable, reservations close [_1]',
timeToHumanString($slot_time,'end'));
+ } elsif ($slot_status == $res->NEEDS_CHECKIN) {
+ $slotmsg = &mt('Reserved, check-in needed - ends [_1]',
+ timeToHumanString($slot_time,'end'));
} elsif ($slot_status == $res->RESERVABLE_LATER) {
$slotmsg = &mt('Reservable, reservations open [_1]',
timeToHumanString($slot_time,'start'));
@@ -1146,7 +1149,7 @@ sub render_quick_status {
my $linkclose = "";
$result .= '
';
- if ($resource->is_problem() &&
+ if ($resource->is_gradable() &&
!$firstDisplayed) {
my $icon = $statusIconMap{$resource->simpleStatus($part)};
my $alt = $iconAltTags{$icon};
@@ -1171,7 +1174,7 @@ sub render_long_status {
my $color;
my $info = '';
- if ($resource->is_problem() || $resource->is_practice()) {
+ if ($resource->is_gradable() || $resource->is_practice()) {
$color = $colormap{$resource->status};
if (dueInLessThan24Hours($resource, $part)) {
@@ -1185,9 +1188,9 @@ sub render_long_status {
}
}
}
-
- if ($resource->kind() eq "res" &&
- $resource->is_raw_problem() &&
+
+ if (($resource->kind() eq "res") &&
+ ($resource->is_raw_problem() || $resource->is_gradable()) &&
!$firstDisplayed) {
if ($color) {$result .= ''; }
$result .= getDescription($resource, $part);
@@ -1234,7 +1237,7 @@ my @statuses = ($resObj->CORRECT, $resOb
sub render_parts_summary_status {
my ($resource, $part, $params) = @_;
- if (!$resource->is_problem() && !$resource->contains_problem) { return ' | | '; }
+ if (!$resource->is_gradable() && !$resource->contains_problem) { return ' | '; }
if ($params->{showParts}) {
return ' | ';
}
@@ -2290,7 +2293,7 @@ sub generate_email_discuss_status {
foreach my $msgid (@keys) {
if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) {
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid,
- $symb,$error) = &Apache::lonmsg::unpackmsgid($msgid);
+ $symb,$error) = &Apache::lonmsg::unpackmsgid(&LONCAPA::escape($msgid));
&Apache::lonenc::check_decrypt(\$symb);
if (($fromcid ne '') && ($fromcid ne $cid)) {
next;
@@ -2696,6 +2699,10 @@ sub parmval_real {
my ($mapname,$id,$fn)=&Apache::lonnet::decode_symb($symb);
$mapname = &Apache::lonnet::deversion($mapname);
+ my $toolsymb = '';
+ if ($fn =~ /ext\.tool$/) {
+ $toolsymb = $symb;
+ }
my ($recursed,@recurseup);
# ----------------------------------------------------- Cascading lookup scheme
@@ -2816,9 +2823,9 @@ sub parmval_real {
my $meta_rwhat=$rwhat;
$meta_rwhat=~s/\./_/g;
- my $default=&Apache::lonnet::metadata($fn,$meta_rwhat);
+ my $default=&Apache::lonnet::metadata($fn,$meta_rwhat,$toolsymb);
if (defined($default)) { return [$default,'resource']}
- $default=&Apache::lonnet::metadata($fn,'parameter_'.$meta_rwhat);
+ $default=&Apache::lonnet::metadata($fn,'parameter_'.$meta_rwhat,$toolsymb);
if (defined($default)) { return [$default,'resource']}
# --------------------------------------------------- fifth, check more course
if (defined($courseopt)) {
@@ -2860,7 +2867,7 @@ sub parmval_real {
if (defined($partgeneral[0])) { return \@partgeneral; }
}
if ($recurse) { return []; }
- my $pack_def=&Apache::lonnet::packages_tab_default($fn,'resource.'.$rwhat);
+ my $pack_def=&Apache::lonnet::packages_tab_default($fn,'resource.'.$rwhat,$toolsymb);
if (defined($pack_def)) { return [$pack_def,'resource']; }
return [''];
}
@@ -4475,6 +4482,19 @@ sub is_problem {
}
return 0;
}
+sub is_tool {
+ my $self=shift;
+ my $src = $self->src();
+ return ($src =~ /ext\.tool$/);
+}
+sub is_gradable {
+ my $self=shift;
+ my $src = $self->src();
+ if (($src =~ /$LONCAPA::assess_re/) ||
+ (($self->is_tool()) && ($self->parmval('gradable',0) =~ /^yes$/i))) {
+ return !($self->is_practice());
+ }
+}
#
# The has below is the set of status that are considered 'incomplete'
#
@@ -5136,6 +5156,8 @@ sub parts {
my $self = shift;
if ($self->ext) { return []; }
+ if (($self->is_tool()) &&
+ ($self->is_gradable())) { return ['0']; }
$self->extractParts();
return $self->{PARTS};
@@ -5510,6 +5532,14 @@ Attempted, and not yet graded.
Attempted, and credit received for attempt (survey and anonymous survey only).
+=item * B:
+
+Attempted, but wrong for LTI Tool Provider by passback of grade
+
+=item * B:
+
+Correct for LTI Tool Provider by passback of grade
+
=back
=cut
@@ -5522,6 +5552,8 @@ sub CORRECT_BY_OVERRIDE { return 14; }
sub EXCUSED { return 15; }
sub ATTEMPTED { return 16; }
sub CREDIT_ATTEMPTED { return 17; }
+sub INCORRECT_BY_PASSBACK { return 18; }
+sub CORRECT_BY_PASSBACK { return 19; }
sub getCompletionStatus {
my $self = shift;
@@ -5536,8 +5568,12 @@ sub getCompletionStatus {
if ($status eq 'correct_by_override') {
return $self->CORRECT_BY_OVERRIDE;
}
+ if ($status eq 'correct_by_passback') {
+ return $self->CORRECT_BY_PASSBACK;
+ }
if ($status eq 'incorrect_attempted') {return $self->INCORRECT; }
if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; }
+ if ($status eq 'incorrect_by_passback') {return $self->INCORRECT_BY_PASSBACK; }
if ($status eq 'excused') {return $self->EXCUSED; }
if ($status eq 'ungraded_attempted') {return $self->ATTEMPTED; }
if ($status eq 'credit_attempted') {
@@ -5691,7 +5727,8 @@ sub status {
# There are a few whole rows we can dispose of:
if ($completionStatus == CORRECT ||
- $completionStatus == CORRECT_BY_OVERRIDE ) {
+ $completionStatus == CORRECT_BY_OVERRIDE ||
+ $completionStatus == CORRECT_BY_PASSBACK ) {
if ( $suppressFeedback ) { return ANSWER_SUBMITTED }
my $awarded=$self->awarded($part);
if ($awarded < 1 && $awarded > 0) {
@@ -5704,7 +5741,8 @@ sub status {
# If it's WRONG... and not open
if ( ($completionStatus == INCORRECT ||
- $completionStatus == INCORRECT_BY_OVERRIDE)
+ $completionStatus == INCORRECT_BY_OVERRIDE ||
+ $completionStatus == INCORRECT_BY_PASSBACK)
&& (!$self->opendate($part) || $self->opendate($part) > time()) ) {
return INCORRECT;
}
@@ -5746,7 +5784,8 @@ sub status {
}
# If it's WRONG...
- if ($completionStatus == INCORRECT || $completionStatus == INCORRECT_BY_OVERRIDE) {
+ if ($completionStatus == INCORRECT || $completionStatus == INCORRECT_BY_OVERRIDE ||
+ $completionStatus == INCORRECT_BY_PASSBACK) {
# and there are TRIES LEFT:
if ($self->tries($part) < $self->maxtries($part) || !$self->maxtries($part)) {
return $suppressFeedback ? ANSWER_SUBMITTED : TRIES_LEFT;
@@ -5800,7 +5839,7 @@ sub check_for_slot {
($checkedin,$checkedinslot) = $self->checkedin();
unless ((grep(/^\Q$checkedin\E/,@proctors)) &&
($checkedinslot eq $slot_name)) {
- return (NEEDS_CHECKIN,undef,$slot_name);
+ return (NEEDS_CHECKIN,$end,$slot_name);
}
}
return (RESERVED,$end,$slot_name);