[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Thu, 13 Feb 2003 23:44:30 -0000
bowersj2 Thu Feb 13 18:44:30 2003 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
Adds ability to filter what resources are rendered, which the wizard uses.
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.142 loncom/interface/lonnavmaps.pm:1.143
--- loncom/interface/lonnavmaps.pm:1.142 Fri Feb 7 17:17:51 2003
+++ loncom/interface/lonnavmaps.pm Thu Feb 13 18:44:30 2003
@@ -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 @@
=item * B<printCloseAll>: If true, print the "Close all folders" or "open all folders" links. Default is true.
+=item * B<filterFunc>: 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 @@
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 @@
"&hereType=$hereType&here=" . Apache::lonnet::escape($here) .
"\">Open All Folders</a>";
}
+ $result .= "<br /><br />\n";
}
if ($r) {
@@ -1026,6 +1031,13 @@
}
$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;