[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /interface lonpickcourse.pm /lonnet/perl lonnet.pm doc/loncapafiles loncapafiles.lpml

www lon-capa-cvs@mail.lon-capa.org
Wed, 26 Mar 2003 04:57:05 -0000


www		Tue Mar 25 23:57:05 2003 EDT

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom	loncapa_apache.conf 
    /loncom/interface	lonpickcourse.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Additional work on pick-a-course function from reverse lookup. Does not work
  yet, but getting there.
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.224 doc/loncapafiles/loncapafiles.lpml:1.225
--- doc/loncapafiles/loncapafiles.lpml:1.224	Sat Mar 15 10:02:21 2003
+++ doc/loncapafiles/loncapafiles.lpml	Tue Mar 25 23:57:04 2003
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.224 2003/03/15 15:02:21 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.225 2003/03/26 04:57:04 www Exp $ -->
 
 <!--
 
@@ -1554,6 +1554,15 @@
 <categoryname>handler</categoryname>
 <description>
 Handler to pick a student from classlist
+</description>
+<status>works/unverified</status>
+</file>
+<file>
+<source>loncom/interface/lonpickcourse.pm</source>
+<target dist='default'>home/httpd/lib/perl/Apache/lonpickcourse.pm</target>
+<categoryname>handler</categoryname>
+<description>
+Handler to pick a courseid from a list of courses
 </description>
 <status>works/unverified</status>
 </file>
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.39 loncom/loncapa_apache.conf:1.40
--- loncom/loncapa_apache.conf:1.39	Thu Mar 13 21:26:12 2003
+++ loncom/loncapa_apache.conf	Tue Mar 25 23:57:04 2003
@@ -1,7 +1,7 @@
 ##
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
-## $Id: loncapa_apache.conf,v 1.39 2003/03/14 02:26:12 www Exp $
+## $Id: loncapa_apache.conf,v 1.40 2003/03/26 04:57:04 www Exp $
 ##
 
 #
@@ -236,6 +236,14 @@
 PerlAccessHandler       Apache::lonacc
 SetHandler perl-script
 PerlHandler Apache::lonpickstudent
+ErrorDocument     403 /adm/login
+ErrorDocument	  500 /adm/errorhandler
+</Location>
+
+<Location /adm/pickcourse>
+PerlAccessHandler       Apache::lonacc
+SetHandler perl-script
+PerlHandler Apache::lonpickcourse
 ErrorDocument     403 /adm/login
 ErrorDocument	  500 /adm/errorhandler
 </Location>
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.1 loncom/interface/lonpickcourse.pm:1.2
--- loncom/interface/lonpickcourse.pm:1.1	Tue Mar 25 19:26:16 2003
+++ loncom/interface/lonpickcourse.pm	Tue Mar 25 23:57:04 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.1 2003/03/26 00:26:16 www Exp $
+# $Id: lonpickcourse.pm,v 1.2 2003/03/26 04:57:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -48,7 +48,6 @@
 </head>
 ENDDOCUMENT
 
-# Is this even in a course?
 
     &Apache::loncommon::get_unprocessed_cgi
         ($ENV{'QUERY_STRING'},['domainfilter','descriptfilter',
@@ -77,7 +76,13 @@
 }
 </script>
 ENDSCRIPT
-
+    $r->rflush();
+# ---------------------------------------------------------------- Get the data
+    my %courses=
+     &Apache::lonnet::courseiddump($domainfilter,$descriptfilter,$sincefilter);
+    foreach (keys %courses) {
+	$r->print($_.': '.$courses{$_}.'<br />');
+    }
     $r->print('</body></html>');
     return OK;
 } 
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.352 loncom/lonnet/perl/lonnet.pm:1.353
--- loncom/lonnet/perl/lonnet.pm:1.352	Tue Mar 25 17:03:23 2003
+++ loncom/lonnet/perl/lonnet.pm	Tue Mar 25 23:57:04 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.352 2003/03/25 22:03:23 www Exp $
+# $Id: lonnet.pm,v 1.353 2003/03/26 04:57:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1069,7 +1069,7 @@
 # Is used in pickcourse
 #
     foreach (keys %courseidbuffer) {
-        &reply('courseidput:'.$hostdom{$_}.':'.$courseidbuffer{$_},$_);
+        &courseidput($hostdom{$_},$courseidbuffer{$_},$_);
     }
 #
 # File accesses
@@ -1185,6 +1185,36 @@
     }
     return sort %returnhash;
 }
+
+# ---------------------------------------------------------- Course ID routines
+# Deal with domain's nohist_courseid.db files
+#
+
+sub courseidput {
+    my ($domain,$what,$coursehome)=@_;
+    return &reply('courseidput:'.$domain.':'.$what,$coursehome);
+}
+
+sub courseiddump {
+    my ($domfilter,$descfilter,$sincefilter)=@_;
+    my %returnhash=();
+    foreach my $tryserver (keys %libserv) {
+	if ($hostdom{$tryserver}=~/$domfilter/) {
+	    foreach (
+             split(/\&/,&reply('courseiddump:'.$hostdom{$tryserver}.':'.
+			       $sincefilter.':'.&escape($descfilter)))) {
+		my ($key,$value)=split(/\=/,$_);
+                if (($key) && ($value)) {
+		    $returnhash{&unescape($key)}=&unescape($value);
+                }
+            }
+
+        }
+    }
+    return %returnhash;
+}
+
+#
 # ----------------------------------------------------------- Check out an item
 
 sub checkout {