--- loncom/lond 2009/08/18 20:08:13 1.422 +++ loncom/lond 2009/08/22 19:10:01 1.423 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.422 2009/08/18 20:08:13 raeburn Exp $ +# $Id: lond,v 1.423 2009/08/22 19:10:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -59,7 +59,7 @@ my $DEBUG = 0; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.422 $'; #' stupid emacs +my $VERSION='$Revision: 1.423 $'; #' stupid emacs my $remoteVERSION; my $currenthostid="default"; my $currentdomainid; @@ -4870,7 +4870,7 @@ sub enrollment_enabled_handler { ®ister_handler("autorun", \&enrollment_enabled_handler, 0, 1, 0); # -# Validate an institutional code use for a LON-CAPA course. +# Validate an institutional code used for a LON-CAPA course. # # Formal Parameters: # $cmd - The command request that got us dispatched. @@ -4888,13 +4888,10 @@ sub enrollment_enabled_handler { sub validate_instcode_handler { my ($cmd, $tail, $client) = @_; my $userinput = "$cmd:$tail"; - my ($dom,$instcode,$owner,$inststatus,$instseclist) = split(/:/, $tail); + my ($dom,$instcode,$owner) = split(/:/, $tail); $instcode = &unescape($instcode); $owner = &unescape($owner); - $inststatus = &unescape($inststatus); - $instseclist = &unescape($instseclist); - my $outcome=&localenroll::validate_instcode($dom,$instcode,$owner, - $inststatus,$instseclist); + my $outcome=&localenroll::validate_instcode($dom,$instcode,$owner); &Reply($client, \$outcome, $userinput); return 1; @@ -5104,6 +5101,59 @@ sub retrieve_auto_file_handler { } ®ister_handler("autoretrieve", \&retrieve_auto_file_handler, 0,1,0); +sub crsreq_checks_handler { + my ($cmd, $tail, $client) = @_; + my $userinput = "$cmd:$tail"; + my $dom = $tail; + my $result; + eval { + local($SIG{__DIE__})='DEFAULT'; + my %validations; + my $response = &localenroll::crsreq_checks($dom,\%validations); + if ($response eq 'ok') { + foreach my $key (keys(%validations)) { + $result .= &escape($key).'='.&Apache::lonnet::freeze_escape($validations{$key}).'&'; + } + $result =~ s/\&$//; + } else { + $result = 'error'; + } + }; + if (!$@) { + &Reply($client, \$result, $userinput); + } else { + &Failure($client,"unknown_cmd\n",$userinput); + } + return 1; +} +®ister_handler("autocrsreqchecks", \&crsreq_checks_handler, 0, 1, 0); + +sub validate_crsreq_handler { + my ($cmd, $tail, $client) = @_; + my $userinput = "$cmd:$tail"; + my ($dom,$owner,$crstype,$inststatuslist,$instcode,$instseclist) = split(/:/, $tail); + $instcode = &unescape($instcode); + $owner = &unescape($owner); + $crstype = &unescape($crstype); + $inststatuslist = &unescape($inststatuslist); + $instcode = &unescape($instcode); + $instseclist = &unescape($instseclist); + my $outcome; + eval { + local($SIG{__DIE__})='DEFAULT'; + $outcome = &localenroll::validate_crsreq($dom,$owner,$crstype, + $inststatuslist,$instcode, + $instseclist); + }; + if (!$@) { + &Reply($client, \$outcome, $userinput); + } else { + &Failure($client,"unknown_cmd\n",$userinput); + } + return 1; +} +®ister_handler("autocrsreqvalidation", \&validate_crsreq_handler, 0, 1, 0); + # # Read and retrieve institutional code format (for support form). # Formal Parameters: