--- loncom/interface/lonnavmaps.pm 2010/11/15 22:46:47 1.440.2.3 +++ loncom/interface/lonnavmaps.pm 2010/08/15 00:03:25 1.444.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.440.2.3 2010/11/15 22:46:47 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.444.2.2 2010/08/15 00:03:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees @@ -478,6 +478,7 @@ use Apache::loncommon(); use Apache::lonenc(); use Apache::lonlocal; use Apache::lonnet; + use POSIX qw (floor strftime); use Time::HiRes qw( gettimeofday tv_interval ); use LONCAPA; @@ -492,7 +493,7 @@ sub NOTHING { return 3; } my $resObj = "Apache::lonnavmaps::resource"; -# Keep these mappings in sync with lonquickgrades, which uses the colors +# Keep these mappings in sync with lonquickgrades, which usesthe colors # instead of the icons. my %statusIconMap = ( @@ -526,6 +527,7 @@ my %colormap = $resObj->INCORRECT => '', $resObj->OPEN => '', $resObj->NOTHING_SET => '', + $resObj->CREDIT_ATTEMPTED => '', $resObj->ATTEMPTED => '', $resObj->ANSWER_SUBMITTED => '', $resObj->PARTIALLY_CORRECT => '#006600' @@ -699,12 +701,17 @@ sub getDescription { return &mt("Excused by instructor"); } if ($status == $res->ATTEMPTED) { - if ($res->src() eq '/res/gci/gci/internal/submission.problem') { - return &mt('Question(s) submitted for review'); + if ($res->is_anonsurvey($part) || $res->is_survey($part)) { + return &mt("Survey submission recorded"); } else { return &mt("Answer submitted, not yet graded"); } } + if ($status == $res->CREDIT_ATTEMPTED) { + if ($res->is_anonsurvey($part) || $res->is_survey($part)) { + return &mt("Credit for survey submission"); + } + } if ($status == $res->TRIES_LEFT) { my $tries = $res->tries($part); my $maxtries = $res->maxtries($part); @@ -723,11 +730,7 @@ sub getDescription { } } if ($status == $res->ANSWER_SUBMITTED) { - if ($res->src() eq '/res/gci/gci/internal/submission.problem') { - return &mt('Question(s) submitted for review'); - } else { - return &mt('Answer submitted'); - } + return &mt('Answer submitted'); } } @@ -1045,7 +1048,7 @@ sub render_communication_status { my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc"); if ($resource->hasDiscussion()) { $discussionHTML = $linkopen . - '' . + '' . $linkclose; } @@ -1055,7 +1058,7 @@ sub render_communication_status { if ($msgid) { $feedbackHTML .= ' ' - . ''; + . ''; } } } @@ -1069,7 +1072,7 @@ sub render_communication_status { $errorcount++; $errorHTML .= ' ' - . ''; + . ''; } } } @@ -1444,19 +1447,22 @@ sub render { if ($printCloseAll && !$args->{'resource_no_folder_link'}) { my ($link,$text); if ($condition) { - $link='"navmaps?condition=0&filter=&'.$queryString. - '&here='.&escape($here).'"'; + $link='navmaps?condition=0&filter=&'.$queryString. + '&here='.&escape($here); $text='Close all folders'; } else { - $link='"navmaps?condition=1&filter=&'.$queryString. - '&here='.&escape($here).'"'; + $link='navmaps?condition=1&filter=&'.$queryString. + '&here='.&escape($here); $text='Open all folders'; } + if ($env{'form.register'}) { + $link .= '®ister='.$env{'form.register'}; + } if ($args->{'caller'} eq 'navmapsdisplay') { &add_linkitem($args->{'linkitems'},'changefolder', - 'location.href='.$link,$text); + "location.href='$link'",$text); } else { - $result.=''.&mt($text).''; + $result.= ''.&mt($text).''; } $result .= "\n"; } @@ -1472,6 +1478,9 @@ sub render { END + if ($env{'form.register'}) { + $result .= ''; + } if ($args->{'sort'} eq 'discussion') { my $totdisc = 0; my $haveDisc = ''; @@ -1493,18 +1502,22 @@ END $result.=''; } - if ($args->{'caller'} eq 'navmapsdisplay') { $result .= '
'. - &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').' | '; - $result.=" | ".mt('Tools:')." | "; + &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').''; + if ($env{'environment.remotenavmap'} ne 'on') { + $result .= ''; + } else { + $result .= ' | |
'.&mt('Tools:').' | '; $result.=&show_linkitems_toolbar($args->{'linkitems'}); if ($args->{'sort_html'}) { if ($env{'environment.remotenavmap'} ne 'on') { $result.=''. ' | '.$args->{'sort_html'}.' | ||
'. + $result.=' | ||||
'. $args->{'sort_html'}.' |
- '."\n
'."\n".
+ ''."\n".
+ ' | '."\n";
-
+ $result .= '
| '."\n";
return $result;
}
@@ -3543,7 +3514,11 @@ sub navHash {
my $self = shift;
my $param = shift;
my $id = shift;
- return $self->{NAV_MAP}->navhash($param . ($id?$self->{ID}:""));
+ my $arg = $param . ($id?$self->{ID}:"");
+ if (defined($arg)) {
+ return $self->{NAV_MAP}->navhash($arg);
+ }
+ return;
}
=pod
@@ -3786,6 +3761,35 @@ sub is_problem {
}
return 0;
}
+#
+# The has below is the set of status that are considered 'incomplete'
+#
+my %incomplete_hash =
+(
+ TRIES_LEFT() => 1,
+ OPEN() => 1,
+ ATTEMPTED() => 1
+
+ );
+#
+# Return tru if a problem is incomplete... for now incomplete means that
+# any part of the problem is incomplete.
+# Note that if the resources is not a problem, 0 is returned.
+#
+sub is_incomplete {
+ my $self = shift;
+ if ($self->is_problem()) {
+ &Apache::lonnet::logthis('is problem');
+ foreach my $part (@{$self->parts()}) {
+ &Apache::lonnet::logthis("$part status ".$self->status($part));
+ if (exists($incomplete_hash{$self->status($part)})) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+
+}
sub is_raw_problem {
my $self=shift;
my $src = $self->src();
@@ -3821,7 +3825,7 @@ sub is_survey {
my $self = shift();
my $part = shift();
my $type = $self->parmval('type',$part);
- if ($type eq 'survey') {
+ if (($type eq 'survey') || ($type eq 'surveycred')) {
return 1;
}
if ($self->src() =~ /\.(survey)$/) {
@@ -3829,6 +3833,15 @@ sub is_survey {
}
return 0;
}
+sub is_anonsurvey {
+ my $self = shift();
+ my $part = shift();
+ my $type = $self->parmval('type',$part);
+ if (($type eq 'anonsurvey') || ($type eq 'anonsurveycred')) {
+ return 1;
+ }
+ return 0;
+}
sub is_task {
my $self=shift;
my $src = $self->src();
@@ -3924,6 +3937,7 @@ sub map_hierarchy {
return $self->navHash("map_hierarchy_$pc", 0);
}
+
#####
# Property queries
#####
@@ -4678,6 +4692,10 @@ Information not available due to network
Attempted, and not yet graded.
+=item * B