--- loncom/interface/lonnavmaps.pm 2003/02/07 22:16:53 1.141 +++ loncom/interface/lonnavmaps.pm 2003/02/13 23:44:30 1.143 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.141 2003/02/07 22:16:53 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.143 2003/02/13 23:44:30 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -521,6 +521,8 @@ Most of these parameters are only useful =item * B: If true, print the "Close all folders" or "open all folders" links. Default is true. +=item * B: A function that takes the resource object as its only parameter and returns a true or false value. If true, the resource is displayed. If false, it is simply skipped in the display. By default, all resources are showne. + =back =head2 Additional Info @@ -929,6 +931,8 @@ sub render { my $printKey = $args->{'printKey'}; my $printCloseAll = $args->{'printCloseAll'}; if (!defined($printCloseAll)) { $printCloseAll = 1; } + my $filterFunc = setDefault($args->{'filterFunc'}, + sub {return 1;}); # Print key? if ($printKey) { @@ -962,6 +966,7 @@ sub render { "&hereType=$hereType&here=" . Apache::lonnet::escape($here) . "\">Open All Folders"; } + $result .= "

\n"; } if ($r) { @@ -1027,6 +1032,13 @@ sub render { $args->{'counter'}++; + # If this has been filtered out, continue on + if (!(&$filterFunc($curRes))) { + $curRes = $it->next(); + $args->{'isNewBranch'} = 0; # Don't falsely remember this + next; + } + # Does it have multiple parts? $args->{'multipart'} = 0; $args->{'condensed'} = 0; @@ -2500,7 +2512,7 @@ sub getErrors { =pod -=item * B(): Returns a list reference containing sorted strings corresponding to each part of the problem. To count the number of parts, use the list in a scalar context, and subtract one if greater then two. (One part problems have a part 0. Multi-parts have a part 0, plus a part for each part. Filtering part 0 if you want it is up to you.) +=item * B(): Returns a list reference containing sorted strings corresponding to each part of the problem. To count the number of parts, use the list in a scalar context, and subtract one if greater than two. (One part problems have a part 0. Multi-parts have a part 0, plus a part for each part. Filtering part 0 if you want it is up to you.) =item * B(): Returns the number of parts of the problem a student can answer. Thus, for single part problems, returns 1. For multipart, it returns the number of parts in the problem, not including psuedo-part 0. Thus, B may return an array with fewer parts in it then countParts might lead you to believe.