[LON-CAPA-cvs] cvs: loncom / lond /enrollment Autoenroll.pl /interface lonmodifycourse.pm lonpickcourse.pm lonsupportreq.pm /lonnet/perl lonnet.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 12 Apr 2005 00:20:01 -0000


This is a MIME encoded message

--raeburn1113265201
Content-Type: text/plain

raeburn		Mon Apr 11 20:20:01 2005 EDT

  Modified files:              
    /loncom	lond 
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/interface	lonmodifycourse.pm lonsupportreq.pm 
                     	lonpickcourse.pm 
    /loncom/enrollment	Autoenroll.pl 
  Log:
  Bug 3912.  DCs can use courseID (e.g., 257472759ae4061msul1) as a filter when using pickcourse.
  
  
--raeburn1113265201
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20050411202001.txt"

Index: loncom/lond
diff -u loncom/lond:1.281 loncom/lond:1.282
--- loncom/lond:1.281	Sun Apr  3 15:33:34 2005
+++ loncom/lond	Mon Apr 11 20:19:59 2005
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.281 2005/04/03 19:33:34 matthew Exp $
+# $Id: lond,v 1.282 2005/04/12 00:19:59 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -58,7 +58,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.281 $'; #' stupid emacs
+my $VERSION='$Revision: 1.282 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -3252,7 +3252,7 @@
 
     my $userinput = "$cmd:$tail";
 
-    my ($udom,$since,$description,$instcodefilter,$ownerfilter) =split(/:/,$tail);
+    my ($udom,$since,$description,$instcodefilter,$ownerfilter,$coursefilter) =split(/:/,$tail);
     if (defined($description)) {
 	$description=&unescape($description);
     } else {
@@ -3268,6 +3268,11 @@
     } else {
         $ownerfilter='.';
     }
+    if (defined($coursefilter)) {
+        $coursefilter=&unescape($coursefilter);
+    } else {
+        $coursefilter='.';
+    }
 
     unless (defined($since)) { $since=0; }
     my $qresult='';
@@ -3298,6 +3303,12 @@
                     $match = 0;
                 }
             }
+            unless ($coursefilter eq '.' || !defined($coursefilter)) {
+                my $unescapeCourse = &unescape($key);
+                unless (eval('$unescapeCourse=~/^$udom(_)\Q$coursefilter\E$/')) {
+                    $match = 0;
+                }
+            }
             if ($match == 1) {
                 $qresult.=$key.'='.$descr.':'.$inst_code.':'.$owner.'&';
             }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.621 loncom/lonnet/perl/lonnet.pm:1.622
--- loncom/lonnet/perl/lonnet.pm:1.621	Thu Apr  7 04:15:41 2005
+++ loncom/lonnet/perl/lonnet.pm	Mon Apr 11 20:20:00 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.621 2005/04/07 08:15:41 albertel Exp $
+# $Id: lonnet.pm,v 1.622 2005/04/12 00:20:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1614,7 +1614,7 @@
 }
 
 sub courseiddump {
-    my ($domfilter,$descfilter,$sincefilter,$instcodefilter,$ownerfilter,$hostidflag,$hostidref)=@_;
+    my ($domfilter,$descfilter,$sincefilter,$instcodefilter,$ownerfilter,$coursefilter,$hostidflag,$hostidref)=@_;
     my %returnhash=();
     unless ($domfilter) { $domfilter=''; }
     foreach my $tryserver (keys %libserv) {
@@ -1623,7 +1623,7 @@
 	        foreach (
                  split(/\&/,&reply('courseiddump:'.$hostdom{$tryserver}.':'.
 			       $sincefilter.':'.&escape($descfilter).':'.
-                               &escape($instcodefilter).':'.&escape($ownerfilter),
+                               &escape($instcodefilter).':'.&escape($ownerfilter).':'.&escape($coursefilter),
                                $tryserver))) {
 		    my ($key,$value)=split(/\=/,$_);
                     if (($key) && ($value)) {
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.16 loncom/interface/lonmodifycourse.pm:1.17
--- loncom/interface/lonmodifycourse.pm:1.16	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lonmodifycourse.pm	Mon Apr 11 20:20:00 2005
@@ -45,7 +45,7 @@
     );
                                                                                       
 # Determine the courses
-    my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1,'.','.');
+    my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.');
     &print_header($r,$tasklongref);
     $r->print(<<ENDBLOCK);
 <form action="/adm/modifycourse" method="post" name="cmod">
@@ -142,7 +142,6 @@
     } else {
         $ok_course = &check_course($dom,$course);
     }
-    print STDERR "Response was $ok_course for $dom,$course\n";
 
     unless ($ok_course eq 'ok') {
         &print_header($r,$tasklongref,'',\$javascript_validations);
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.27 loncom/interface/lonsupportreq.pm:1.28
--- loncom/interface/lonsupportreq.pm:1.27	Sun Apr 10 19:45:57 2005
+++ loncom/interface/lonsupportreq.pm	Mon Apr 11 20:20:00 2005
@@ -1,5 +1,5 @@
 #
-# $Id: lonsupportreq.pm,v 1.27 2005/04/10 23:45:57 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.28 2005/04/12 00:20:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -967,7 +967,7 @@
 
 sub retrieve_instcodes {
     my ($coursecodes,$codedom,$totcodes) = @_;
-    my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.');
+    my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.','.');
     foreach my $course (keys %courses) {
         if ($courses{$course} =~ m/^[^:]*:([^:]+)/) {
             $$coursecodes{$course} = &Apache::lonnet::unescape($1);
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.27 loncom/interface/lonpickcourse.pm:1.28
--- loncom/interface/lonpickcourse.pm:1.27	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lonpickcourse.pm	Mon Apr 11 20:20:01 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.27 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonpickcourse.pm,v 1.28 2005/04/12 00:20:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -54,7 +54,8 @@
         ($ENV{'QUERY_STRING'},['domainfilter','descriptfilter',
 			       'sincefilter','form','cnumelement',
 			       'cdomelement','cnameelement','roleelement',
-                               'pickedcourse','instcodefilter','ownerfilter']);
+                               'pickedcourse','instcodefilter',
+                               'ownerfilter','coursefilter']);
 # domain filter and selection
     my $domainfilter=$env{'form.domainfilter'};
     $domainfilter=~s/\W//g;
@@ -73,6 +74,18 @@
     my $ownerfilter=$env{'form.ownerfilter'};
     unless ($ownerfilter) { $ownerfilter=''; }
     my $listowner=&HTML::Entities::encode($ownerfilter,'<>&"');
+# course ID filter for DCs only
+    my ($courseidtag,$coursefilter);
+    if ($env{'user.adv'} && $domainfilter && exists($env{'user.role.dc./'.
+                        $domainfilter.'/'})) {
+        $coursefilter=$env{'form.coursefilter'};
+        unless ($coursefilter) { $coursefilter=''; }
+        my $listcourseid=&HTML::Entities::encode($coursefilter,'<>&"');
+        $courseidtag = &mt('LON-CAPA course ID');
+        $courseidtag .= qq|<input type="text" name="coursefilter" size="25" value="$listcourseid" />
+        <br />
+        |;
+    }
 # last course activity filter and selection
     my $sincefilter=$env{'form.sincefilter'};
     $sincefilter=~s/[^\d-]//g;
@@ -200,6 +213,7 @@
 $lt{'cow'}:
 <input type="text" name="ownerfilter" size="10" value="$listowner" />
 <br />
+$courseidtag
 $lt{'cde'}:
 <input type="text" name="descriptfilter" size="40" value="$listdescript" />
 <p><input type="submit" name="gosearch" value="Search" /></p>
@@ -213,10 +227,11 @@
 	unless ($descriptfilter) { $descriptfilter='.'; }
         unless ($instcodefilter) { $instcodefilter='.'; }
         unless ($ownerfilter) { $ownerfilter='.'; }
+        unless ($coursefilter) { $coursefilter='.'; }
         my $timefilter=($sincefilter==-1?1:time-$sincefilter);
 	my %courses=
 	    &Apache::lonnet::courseiddump
-	    ($domainfilter,$descriptfilter,$timefilter,$instcodefilter,$ownerfilter);
+	    ($domainfilter,$descriptfilter,$timefilter,$instcodefilter,$ownerfilter,$coursefilter);
 	$r->print('<form name="courselist">');
 	my %by_descrip;
 	foreach my $course (keys %courses) {
Index: loncom/enrollment/Autoenroll.pl
diff -u loncom/enrollment/Autoenroll.pl:1.13 loncom/enrollment/Autoenroll.pl:1.14
--- loncom/enrollment/Autoenroll.pl:1.13	Thu Apr  7 02:56:21 2005
+++ loncom/enrollment/Autoenroll.pl	Mon Apr 11 20:20:01 2005
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #
 #Automated Enrollment script
-# $Id: Autoenroll.pl,v 1.13 2005/04/07 06:56:21 albertel Exp $
+# $Id: Autoenroll.pl,v 1.14 2005/04/12 00:20:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,7 +50,7 @@
         if (! &localenroll::run($dom)) { next; }
         $env{'user.domain'} = $dom;
     # Determine the courses
-        my %courses = &Apache::lonnet::courseiddump($dom,'.',1,'.','.',1,\@hostids); 
+        my %courses = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',1,\@hostids); 
         my %affiliates = ();
         my %enrollvar = ();
         my %reply = ();

--raeburn1113265201--