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

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 13 Oct 2006 04:23:16 -0000


raeburn		Fri Oct 13 00:23:16 2006 EDT

  Modified files:              
    /loncom	lond 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Allow institutional code filter to be a regular expression (default is no regexp), when getting data from nohist_courseids.db via courseiddump.
  
  
Index: loncom/lond
diff -u loncom/lond:1.343 loncom/lond:1.344
--- loncom/lond:1.343	Wed Oct 11 15:15:47 2006
+++ loncom/lond	Fri Oct 13 00:23:02 2006
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.343 2006/10/11 19:15:47 albertel Exp $
+# $Id: lond,v 1.344 2006/10/13 04:23:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.343 $'; #' stupid emacs
+my $VERSION='$Revision: 1.344 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -3357,7 +3357,7 @@
     my $userinput = "$cmd:$tail";
 
     my ($udom,$since,$description,$instcodefilter,$ownerfilter,$coursefilter,
-        $typefilter) =split(/:/,$tail);
+        $typefilter,$regexp_ok) =split(/:/,$tail);
     if (defined($description)) {
 	$description=&unescape($description);
     } else {
@@ -3394,6 +3394,9 @@
     } else {
         $typefilter='.';
     }
+    if (defined($regexp_ok)) {
+        $regexp_ok=&unescape($regexp_ok);
+    }
 
     unless (defined($since)) { $since=0; }
     my $qresult='';
@@ -3414,8 +3417,14 @@
             }
             unless ($instcodefilter eq '.' || !defined($instcodefilter)) {
                 my $unescapeInstcode = &unescape($inst_code);
-                unless (eval('$unescapeInstcode=~/\Q$instcodefilter\E/i')) {
-                    $match = 0;
+                if ($regexp_ok) {
+                    unless (eval('$unescapeInstcode=~/$instcodefilter/')) {
+                        $match = 0;
+                    }
+                } else {
+                    unless (eval('$unescapeInstcode=~/\Q$instcodefilter\E/i')) {
+                        $match = 0;
+                    }
                 }
 	    }
             unless ($ownerfilter eq '.' || !defined($ownerfilter)) {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.790 loncom/lonnet/perl/lonnet.pm:1.791
--- loncom/lonnet/perl/lonnet.pm:1.790	Thu Oct 12 12:35:02 2006
+++ loncom/lonnet/perl/lonnet.pm	Fri Oct 13 00:23:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.790 2006/10/12 16:35:02 albertel Exp $
+# $Id: lonnet.pm,v 1.791 2006/10/13 04:23:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1979,7 +1979,7 @@
 }
 
 sub courseiddump {
-    my ($domfilter,$descfilter,$sincefilter,$instcodefilter,$ownerfilter,$coursefilter,$hostidflag,$hostidref,$typefilter)=@_;
+    my ($domfilter,$descfilter,$sincefilter,$instcodefilter,$ownerfilter,$coursefilter,$hostidflag,$hostidref,$typefilter,$regexp_ok)=@_;
     my %returnhash=();
     unless ($domfilter) { $domfilter=''; }
     foreach my $tryserver (keys %libserv) {
@@ -1988,7 +1988,7 @@
 	        foreach (
                  split(/\&/,&reply('courseiddump:'.$hostdom{$tryserver}.':'.
 			       $sincefilter.':'.&escape($descfilter).':'.
-                               &escape($instcodefilter).':'.&escape($ownerfilter).':'.&escape($coursefilter).':'.&escape($typefilter),
+                               &escape($instcodefilter).':'.&escape($ownerfilter).':'.&escape($coursefilter).':'.&escape($typefilter).':'.&escape($regexp_ok),
                                $tryserver))) {
 		    my ($key,$value)=split(/\=/,$_);
                     if (($key) && ($value)) {