[LON-CAPA-cvs] cvs: loncom / lond /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 26 Jun 2008 19:54:20 -0000


raeburn		Thu Jun 26 15:54:20 2008 EDT

  Modified files:              
    /loncom	lond 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Update documentation in lond for &dump_course_id_handler().
     - Add the ability to filter on course category, and to exclude a course from
       results returned for course catalog display.  
  - lonnet::courseiddump() accepts two additional arguments
    - $showhidden (DC only, if 1, exclusions based on $caller (below) will not apply). 
  
  
Index: loncom/lond
diff -u loncom/lond:1.403 loncom/lond:1.404
--- loncom/lond:1.403	Fri May 30 17:33:21 2008
+++ loncom/lond	Thu Jun 26 15:54:15 2008
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.403 2008/05/30 21:33:21 raeburn Exp $
+# $Id: lond,v 1.404 2008/06/26 19:54:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.403 $'; #' stupid emacs
+my $VERSION='$Revision: 1.404 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -3615,7 +3615,17 @@
 #                            key, value pairs in the item's hash, or as a 
 #                            colon-separated list of (in order) description,
 #                            institutional code, and course owner.
-#    
+#                 selfenrollonly - filter by courses allowing self-enrollment  
+#                                  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).   
+#                 showhidden - include course in results even if course  
+#                              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".
+#
 #     $client  - The socket open on the client.
 # Returns:
 #    1     - Continue processing.
@@ -3626,7 +3636,8 @@
     my $userinput = "$cmd:$tail";
 
     my ($udom,$since,$description,$instcodefilter,$ownerfilter,$coursefilter,
-        $typefilter,$regexp_ok,$rtn_as_hash,$selfenrollonly,$catfilter) =split(/:/,$tail);
+        $typefilter,$regexp_ok,$rtn_as_hash,$selfenrollonly,$catfilter,$showhidden,
+        $caller) =split(/:/,$tail);
     my $now = time;
     if (defined($description)) {
 	$description=&unescape($description);
@@ -3700,16 +3711,21 @@
                     $unesc_val{'inst_code'} = $items->{'inst_code'};
                     $unesc_val{'owner'} = $items->{'owner'};
                     $unesc_val{'type'} = $items->{'type'};
-                    $selfenroll_types = $items->{'selfenroll_types'};
-                    $selfenroll_end = $items->{'selfenroll_end_date'};
-                    if ($selfenrollonly) {
-                        next if (!$selfenroll_types);
-                        if (($selfenroll_end > 0) && ($selfenroll_end <= $now)) {
-                            next;
-                        }
+                }
+                $selfenroll_types = $items->{'selfenroll_types'};
+                $selfenroll_end = $items->{'selfenroll_end_date'};
+                if ($selfenrollonly) {
+                    next if (!$selfenroll_types);
+                    if (($selfenroll_end > 0) && ($selfenroll_end <= $now)) {
+                        next;
                     }
-                    if ($catfilter ne '') {
-                        next if ($items->{'category'} ne $catfilter);
+                }
+                if ($catfilter ne '') {
+                    next if ($items->{'category'} ne $catfilter);
+                }
+                if ($caller eq 'coursecatalog') {
+                    if (!$showhidden) {
+                        next if ($items->{'hidefromcat'});
                     }
                 }
             } else {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.961 loncom/lonnet/perl/lonnet.pm:1.962
--- loncom/lonnet/perl/lonnet.pm:1.961	Mon Jun  9 18:35:00 2008
+++ loncom/lonnet/perl/lonnet.pm	Thu Jun 26 15:54:19 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.961 2008/06/09 22:35:00 raeburn Exp $
+# $Id: lonnet.pm,v 1.962 2008/06/26 19:54:19 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2766,7 +2766,7 @@
 sub courseiddump {
     my ($domfilter,$descfilter,$sincefilter,$instcodefilter,$ownerfilter,
         $coursefilter,$hostidflag,$hostidref,$typefilter,$regexp_ok,
-        $selfenrollonly,$catfilter)=@_;
+        $selfenrollonly,$catfilter,$showhidden,$caller)=@_;
     my $as_hash = 1;
     my %returnhash;
     if (!$domfilter) { $domfilter=''; }
@@ -2784,7 +2784,8 @@
                          &escape($instcodefilter).':'.&escape($ownerfilter).
                          ':'.&escape($coursefilter).':'.&escape($typefilter).
                          ':'.&escape($regexp_ok).':'.$as_hash.':'.
-                         &escape($selfenrollonly).':'.&escape($catfilter),$tryserver);
+                         &escape($selfenrollonly).':'.&escape($catfilter).':'.
+                         $showhidden.':'.$caller,$tryserver);
                 my @pairs=split(/\&/,$rep);
                 foreach my $item (@pairs) {
                     my ($key,$value)=split(/\=/,$item,2);