[LON-CAPA-cvs] cvs: loncom /html/adm/helper resettimes.helper /interface lonhelper.pm lonnavmaps.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Sat, 01 Sep 2007 00:41:43 -0000
albertel Fri Aug 31 20:41:43 2007 EDT
Modified files:
/loncom/html/adm/helper resettimes.helper
/loncom/interface lonnavmaps.pm lonhelper.pm
Log:
- BUG#5387
- resttimes helper wasn't including the top level sequence
when attempting to reset inital access times for groups of users
Index: loncom/html/adm/helper/resettimes.helper
diff -u loncom/html/adm/helper/resettimes.helper:1.5 loncom/html/adm/helper/resettimes.helper:1.6
--- loncom/html/adm/helper/resettimes.helper:1.5 Wed Jun 6 16:21:42 2007
+++ loncom/html/adm/helper/resettimes.helper Fri Aug 31 20:41:34 2007
@@ -5,7 +5,7 @@
</message>
<choices variable="harry">
<choice computer='1' nextstate="Student">Reset times on one or more folders/maps for a single student.</choice>
- <choice computer='0' nextstate="Class">Reset times on a single folder/map for a section or whole clase.</choice>
+ <choice computer='0' nextstate="Class">Reset times on a single folder/map for a section or whole class.</choice>
</choices>
</state>
<state name="Student" title="Select Student">
@@ -82,14 +82,13 @@
<state name="Class">
<message nextstate="SelectMap">
- <message_text>Select:<br /></message_text>
</message>
<student variable='stu1' coursepersonnel='true' activeonly='true' multichoice='true' />
</state>
<state name="SelectMap" title="Select a folder/map">
- <resource variable="res2">
- <filterfunc>return $res->is_map()</filterfunc>
+ <resource variable="res2" includecourse="true">
+ <filterfunc>return ($res->is_map() && $res->map_contains_problem());</filterfunc>
<valuefunc>return $res->symb()</valuefunc>
<nextstate>ShowPlan</nextstate>
</resource>
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.400 loncom/interface/lonnavmaps.pm:1.401
--- loncom/interface/lonnavmaps.pm:1.400 Tue Aug 28 20:55:37 2007
+++ loncom/interface/lonnavmaps.pm Fri Aug 31 20:41:42 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.400 2007/08/29 00:55:37 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.401 2007/09/01 00:41:42 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -170,7 +170,10 @@
if (defined($item)) { $res = $item; }
}
- return ($res->link(),$res->shown_symb());
+ if ($res) {
+ return ($res->link(),$res->shown_symb());
+ }
+ return;
}
# Convenience function: This separates the logic of how to create
@@ -604,6 +607,11 @@
the source of the map you want to process, like
'/res/103/jerf/navmap.course.sequence'.
+=item * B<include_top_level_map>: default: false
+
+If you need to include the top level map (meaning the course) in the
+rendered output set this to true
+
=item * B<navmap>: default: constructs one from %env
A reference to a navmap, used only if an iterator is not passed in. If
@@ -1236,7 +1244,7 @@
$args->{'iterator'} = $it = $navmap->getIterator($firstResource, $finishResource, $filterHash, $condition);
} else {
- $args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition);
+ $args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition,undef,$args->{'include_top_level_map'});
}
}
@@ -2858,6 +2866,10 @@
$self->{HAVE_RETURNED_0} = 1;
return $self->{NAV_MAP}->getById('0.0');
}
+ if ($self->{RETURN_0} && !$self->{HAVE_RETURNED_0_BEGIN_MAP}) {
+ $self->{HAVE_RETURNED_0_BEGIN_MAP} = 1;
+ return $self->BEGIN_MAP();
+ }
if ($self->{RECURSIVE_ITERATOR_FLAG}) {
# grab the next from the recursive iterator
@@ -3576,6 +3588,15 @@
}
return 0;
}
+sub map_contains_problem {
+ my $self=shift;
+ if ($self->is_map()) {
+ my $has_problem=
+ $self->hasResource($self,sub { $_[0]->is_problem() },1);
+ return $has_problem;
+ }
+ return 0;
+}
sub is_sequence {
my $self=shift;
return $self->navHash("is_map_", 1) &&
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.162 loncom/interface/lonhelper.pm:1.163
--- loncom/interface/lonhelper.pm:1.162 Tue Aug 28 20:46:39 2007
+++ loncom/interface/lonhelper.pm Fri Aug 31 20:41:42 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.162 2007/08/29 00:46:39 albertel Exp $
+# $Id: lonhelper.pm,v 1.163 2007/09/01 00:41:42 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2000,7 +2000,8 @@
be filtered out. The 'addstatus' attribute, if true, will add the icon
and long status display columns to the display. The 'addparts'
attribute will add in a part selector beside problems that have more
-than 1 part.
+than 1 part. The 'includecourse' attribute if true, will include
+the toplevel default.sequence in the results.
=head3 SUB-TAGS
@@ -2073,6 +2074,7 @@
$helper->declareVar($paramHash->{'variable'}.'_part');
}
$paramHash->{'closeallpages'} = $token->[2]{'closeallpages'};
+ $paramHash->{'include_top_level_map'} = $token->[2]{'includecourse'};
return '';
}
@@ -2398,6 +2400,7 @@
'resource_no_folder_link' => 1,
'closeAllPages' => $self->{'closeallpages'},
'suppressEmptySequences' => $self->{'suppressEmptySequences'},
+ 'include_top_level_map' => $self->{'include_top_level_map'},
'iterator_map' => $mapUrl }
);