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

www lon-capa-cvs@mail.lon-capa.org
Wed, 26 Mar 2003 19:34:42 -0000


www		Wed Mar 26 14:34:42 2003 EDT

  Modified files:              
    /loncom	lond 
    /loncom/interface	loncommon.pm lonpickcourse.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Pick-a-course, continued.
  
  
Index: loncom/lond
diff -u loncom/lond:1.119 loncom/lond:1.120
--- loncom/lond:1.119	Tue Mar 25 19:17:04 2003
+++ loncom/lond	Wed Mar 26 14:34:42 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.119 2003/03/26 00:17:04 albertel Exp $
+# $Id: lond,v 1.120 2003/03/26 19:34:42 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1581,7 +1581,7 @@
                                    $qresult.=$key.'='.$descr.'&';
                                } else {
                                    my $unescapeVal = &unescape($descr);
-                                   if (eval('$unescapeVal=~/$description/')) {
+                                   if (eval('$unescapeVal=~/$description/i')) {
                                        $qresult.="$key=$descr&";
                                    }
                                }
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.89 loncom/interface/loncommon.pm:1.90
--- loncom/interface/loncommon.pm:1.89	Thu Mar 20 14:20:31 2003
+++ loncom/interface/loncommon.pm	Wed Mar 26 14:34:42 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.89 2003/03/20 19:20:31 www Exp $
+# $Id: loncommon.pm,v 1.90 2003/03/26 19:34:42 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -627,18 +627,22 @@
 
 =pod
 
-=item select_dom_form($defdom,$name)
+=item select_dom_form($defdom,$name,$includeempty)
 
 Returns a string containing a <select name='$name' size='1'> form to 
 allow a user to select the domain to preform an operation in.  
 See loncreateuser.pm for an example invocation and use.
 
+If the $includeempty flag is set, it also includes an empty choice ("no domain
+selected");
+
 =cut
 
 #-------------------------------------------
 sub select_dom_form {
-    my ($defdom,$name) = @_;
+    my ($defdom,$name,$includeempty) = @_;
     my @domains = get_domains();
+    if ($includeempty) { @domains=('',@domains); }
     my $selectdomain = "<select name=\"$name\" size=\"1\">\n";
     foreach (@domains) {
         $selectdomain.="<option value=\"$_\" ".
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.3 loncom/interface/lonpickcourse.pm:1.4
--- loncom/interface/lonpickcourse.pm:1.3	Wed Mar 26 11:39:40 2003
+++ loncom/interface/lonpickcourse.pm	Wed Mar 26 14:34:42 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.3 2003/03/26 16:39:40 www Exp $
+# $Id: lonpickcourse.pm,v 1.4 2003/03/26 19:34:42 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -54,10 +54,12 @@
                  'sincefilter','form','cnumelement','cdomelement']);
     my $domainfilter=$ENV{'form.domainfilter'};
     $domainfilter=~s/\W//g;
-    unless ($domainfilter) { $domainfilter='.'; }
+    unless ($domainfilter) { $domainfilter=''; }
+    my $domainselectform=&Apache::loncommon::select_dom_form($domainfilter,
+                                                          'domainfilter',1);
     my $descriptfilter=$ENV{'form.descriptfilter'};
-    $descriptfilter=~s/\W//g;
-    unless ($descriptfilter) { $descriptfilter='.'; }
+    $descriptfilter=~s/[^\w\s]//g;
+    unless ($descriptfilter) { $descriptfilter=''; }
     my $sincefilter=$ENV{'form.sincefilter'};
     $sincefilter=~s/\D//g;
     unless ($sincefilter) { $sincefilter=0; }
@@ -75,9 +77,19 @@
     self.close();
 }
 </script>
+<form method="post">
+<br />
+Course Domain: $domainselectform
+<br />
+Course Description:
+<input type="text" name="descriptfilter" size="40" value="$descriptfilter" />
+<input type="submit" name="gosearch" value="Search" />
+</form>
+
 ENDSCRIPT
     $r->rflush();
 # ---------------------------------------------------------------- Get the data
+    unless ($descriptfilter) { $descriptfilter='.'; }
     my %courses=
      &Apache::lonnet::courseiddump($domainfilter,$descriptfilter,$sincefilter);
     $r->print('<form>');
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.354 loncom/lonnet/perl/lonnet.pm:1.355
--- loncom/lonnet/perl/lonnet.pm:1.354	Wed Mar 26 10:49:02 2003
+++ loncom/lonnet/perl/lonnet.pm	Wed Mar 26 14:34:42 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.354 2003/03/26 15:49:02 www Exp $
+# $Id: lonnet.pm,v 1.355 2003/03/26 19:34:42 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1198,8 +1198,9 @@
 sub courseiddump {
     my ($domfilter,$descfilter,$sincefilter)=@_;
     my %returnhash=();
+    unless ($domfilter) { $domfilter=''; }
     foreach my $tryserver (keys %libserv) {
-	if ($hostdom{$tryserver}=~/$domfilter/) {
+	if ((!$domfilter) || ($hostdom{$tryserver} eq $domfilter)) {
 	    foreach (
              split(/\&/,&reply('courseiddump:'.$hostdom{$tryserver}.':'.
 			       $sincefilter.':'.&escape($descfilter),