--- loncom/interface/lonnavmaps.pm 2003/02/07 22:17:51 1.142 +++ 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.142 2003/02/07 22:17:51 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;