[LON-CAPA-cvs] cvs: loncom / lond

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 07 Jul 2008 15:23:41 -0000


raeburn		Mon Jul  7 11:23:41 2008 EDT

  Modified files:              
    /loncom	lond 
  Log:
  - If $catfilter provided, split on &, to support case where "Include subcategories within category" checkbox was checked.
  
  
Index: loncom/lond
diff -u loncom/lond:1.406 loncom/lond:1.407
--- loncom/lond:1.406	Sun Jun 29 23:59:23 2008
+++ loncom/lond	Mon Jul  7 11:23:41 2008
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.406 2008/06/30 03:59:23 raeburn Exp $
+# $Id: lond,v 1.407 2008/07/07 15:23:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.406 $'; #' stupid emacs
+my $VERSION='$Revision: 1.407 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -3619,9 +3619,9 @@
 #                                  now or in the future (selfenrollonly = 1).
 #                 catfilter - filter by course category, assigned to a course 
 #                             using manually defined categories (i.e., not
-#                             self-cataloging based on onstitutional code).   
+#                             self-cataloging based on on institutional code).   
 #                 showhidden - include course in results even if course  
-#                              was set to be excluded from course catalog (DC only). 
+#                              was set to be excluded from course catalog (DC only).
 #                 caller -  if set to 'coursecatalog', courses set to be hidden
 #                           from course catalog will be excluded from results (unless
 #                           overridden by "showhidden".
@@ -3723,8 +3723,16 @@
                 if ($catfilter ne '') {
                     next if ($items->{'categories'} eq '');
                     my @categories = split('&',$items->{'categories'}); 
-                    next if ((@categories == 0) || 
-                             (!grep(/^\Q$catfilter\E$/,@categories)));
+                    next if (@categories == 0);
+                    my @subcats = split('&',$catfilter);
+                    my $matchcat = 0;
+                    foreach my $cat (@categories) {
+                        if (grep(/^\Q$cat\E$/,@subcats)) {
+                            $matchcat = 1;
+                            last;
+                        }
+                    }
+                    next if (!$matchcat);
                 }
                 if ($caller eq 'coursecatalog') {
                     if ($items->{'hidefromcat'} eq 'yes') {