--- loncom/lond 2009/06/11 19:19:51 1.416 +++ loncom/lond 2009/07/25 15:25:10 1.417 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.416 2009/06/11 19:19:51 raeburn Exp $ +# $Id: lond,v 1.417 2009/07/25 15:25:10 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.416 $'; #' stupid emacs +my $VERSION='$Revision: 1.417 $'; #' stupid emacs my $remoteVERSION; my $currenthostid="default"; my $currentdomainid; @@ -4641,6 +4641,33 @@ sub enrollment_enabled_handler { } ®ister_handler("autorun", \&enrollment_enabled_handler, 0, 1, 0); +# +# Validate an institutional code use for a LON-CAPA course. +# +# Formal Parameters: +# $cmd - The command request that got us dispatched. +# $tail - The tail of the command. In this case, +# this is a colon separated set of words that will be split +# into: +# $inst_course_id - The institutional cod3 from the +# institutions point of view. +# $cdom - The domain from the institutions +# point of view. +# $client - Socket open on the client. +# Returns: +# 1 - Indicating processing should continue. +# +sub validate_instcode_handler { + my ($cmd, $tail, $client) = @_; + my $userinput = "$cmd:$tail"; + my ($dom,$instcode,$owner) = split(/:/, $tail); + my $outcome=&localenroll::validate_instcode($dom,$instcode,$owner); + &Reply($client, \$outcome, $userinput); + + return 1; +} +®ister_handler("autovalidateinstcode", \&validate_instcode_handler, 0, 1, 0); + # Get the official sections for which auto-enrollment is possible. # Since the admin people won't know about 'unofficial sections' # we cannot auto-enroll on them. @@ -4934,13 +4961,15 @@ sub get_possible_instcodes_handler { my $reply; my $cdom = $tail; - my (@codetitles,%cat_titles,%cat_order); + my (@codetitles,%cat_titles,%cat_order,@code_order); my $formatreply = &localenroll::possible_instcodes($cdom, \@codetitles, \%cat_titles, - \%cat_order); + \%cat_order, + \@code_order); if ($formatreply eq 'ok') { my $result = join('&',map {&escape($_);} (@codetitles)).':'; + $result .= join('&',map {&escape($_);} (@code_order)).':'; foreach my $key (keys(%cat_titles)) { $result .= &escape($key).'='.&Apache::lonnet::freeze_escape($cat_titles{$key}).'&'; }