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

raeburn raeburn@source.lon-capa.org
Sat, 22 Aug 2009 18:53:41 -0000


raeburn		Sat Aug 22 18:53:41 2009 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Revert &auto_validate_instcode() to take four args: $cnum, $cdom , $instcode and (optional) $owner where $owner is $username:$domain of course requestor.
  - Add functionality for &auto_courserequest_checks() - used to determine whether
   'validate' option should appear in Domain Configuration menu for course requests.
  - auto_courserequest_validation() added. 
    - used to check if a course request of type 'validate' should be processed immediately, or placed in the queue with status of 'pending', i.e., awaiting institutional administrative action. 
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1019 loncom/lonnet/perl/lonnet.pm:1.1020
--- loncom/lonnet/perl/lonnet.pm:1.1019	Tue Aug 18 20:08:25 2009
+++ loncom/lonnet/perl/lonnet.pm	Sat Aug 22 18:53:41 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1019 2009/08/18 20:08:25 raeburn Exp $
+# $Id: lonnet.pm,v 1.1020 2009/08/22 18:53:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5645,7 +5645,7 @@
 }
 
 sub auto_validate_instcode {
-    my ($cnum,$cdom,$instcode,$owner,$inststatuslist,$instseclist) = @_;
+    my ($cnum,$cdom,$instcode,$owner) = @_;
     my ($homeserver,$response);
     if (($cdom =~ /^$match_domain$/) && ($cnum =~ /^$match_courseid$/)) {
         $homeserver = &homeserver($cnum,$cdom);
@@ -5656,9 +5656,7 @@
         }
     }
     my $response=&unescape(&reply('autovalidateinstcode:'.$cdom.':'.
-                           &escape($instcode).':'.&escape($owner).':'.
-                           &escape($inststatuslist).':'.&escape($instseclist),
-                           $homeserver));
+                           &escape($instcode).':'.&escape($owner),$homeserver));
     return $response;
 }
 
@@ -5876,10 +5874,38 @@
 
 sub auto_courserequest_checks {
     my ($dom) = @_;
-    my %validations;
+    my ($homeserver,%validations);
+    if ($dom =~ /^$match_domain$/) {
+        $homeserver = &domain($dom,'primary');
+    }
+    unless ($homeserver eq 'no_host') {
+        my $response=&reply('autocrsreqchecks:'.$dom,$homeserver);
+        unless ($response =~ /(con_lost|error|no_such_host|refused)/) {
+            my @items = split(/&/,$response);
+            foreach my $item (@items) {
+                my ($key,$value) = split('=',$item);
+                $validations{&unescape($key)} = &thaw_unescape($value);
+            }
+        }
+    }
     return %validations; 
 }
 
+sub auto_courserequest_validation {
+    my ($dom,$owner,$crstype,$inststatuslist,$instcode,$instseclist) = @_;
+    my ($homeserver,$response);
+    if ($dom =~ /^$match_domain$/) {
+        $homeserver = &domain($dom,'primary');
+    }
+    unless ($homeserver eq 'no_host') {  
+        $response=&unescape(&reply('autocrsreqvalidation:'.$dom.':'.&escape($owner).
+                                    ':'.&escape($crstype).':'/&escape($inststatuslist).
+                                    ':'.&escape($instcode).':'.&escape($instseclist),
+                                    $homeserver));
+    }
+    return $response;
+}
+
 sub auto_validate_class_sec {
     my ($cdom,$cnum,$owners,$inst_class) = @_;
     my $homeserver = &homeserver($cnum,$cdom);