--- loncom/lond 2008/02/24 22:59:06 1.396 +++ loncom/lond 2008/02/29 21:01:03 1.397 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.396 2008/02/24 22:59:06 raeburn Exp $ +# $Id: lond,v 1.397 2008/02/29 21:01:03 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.396 $'; #' stupid emacs +my $VERSION='$Revision: 1.397 $'; #' stupid emacs my $remoteVERSION; my $currenthostid="default"; my $currentdomainid; @@ -3446,7 +3446,8 @@ sub dump_course_id_handler { my $userinput = "$cmd:$tail"; my ($udom,$since,$description,$instcodefilter,$ownerfilter,$coursefilter, - $typefilter,$regexp_ok,$rtn_as_hash) =split(/:/,$tail); + $typefilter,$regexp_ok,$rtn_as_hash,$selfenrollonly) =split(/:/,$tail); + my $now = time; if (defined($description)) { $description=&unescape($description); } else { @@ -3496,7 +3497,9 @@ sub dump_course_id_handler { my $hashref = &tie_domain_hash($udom, "nohist_courseids", &GDBM_WRCREAT()); if ($hashref) { while (my ($key,$value) = each(%$hashref)) { - my ($unesc_key,$lasttime_key,$lasttime,$is_hash,%val,%unesc_val); + my ($unesc_key,$lasttime_key,$lasttime,$is_hash,%val, + %unesc_val,$selfenroll_start,$selfenroll_end, + $selfenroll_types); $unesc_key = &unescape($key); if ($unesc_key =~ /^lasttime:/) { next; @@ -3515,6 +3518,18 @@ sub dump_course_id_handler { $unesc_val{'inst_code'} = $items->{'inst_code'}; $unesc_val{'owner'} = $items->{'owner'}; $unesc_val{'type'} = $items->{'type'}; + $selfenroll_types = $items->{'selfenroll_types'}; + $selfenroll_start = $items->{'selfenroll_start_date'}; + $selfenroll_end = $items->{'selfenroll_end_date'}; + if ($selfenrollonly) { + next if (!$selfenroll_types); + if (($selfenroll_start > 0) && ($selfenroll_start > $now)) { + next; + } + if (($selfenroll_end > 0) && ($selfenroll_end <= $now)) { + next; + } + } } } else { $is_hash = 0; @@ -4703,7 +4718,7 @@ sub get_institutional_id_rules { } ®ister_handler("instidrules",\&get_institutional_id_rules,0,1,0); -sub get_institutional_selfenroll_rules { +sub get_institutional_selfcreate_rules { my ($cmd, $tail, $client) = @_; my $userinput = "$cmd:$tail"; my $dom = &unescape($tail); @@ -4711,7 +4726,7 @@ sub get_institutional_selfenroll_rules { my $outcome; eval { local($SIG{__DIE__})='DEFAULT'; - $outcome = &localenroll::selfenroll_rules($dom,\%rules_hash,\@rules_order); + $outcome = &localenroll::selfcreate_rules($dom,\%rules_hash,\@rules_order); }; if (!$@) { if ($outcome eq 'ok') { @@ -4735,7 +4750,7 @@ sub get_institutional_selfenroll_rules { &Failure($client,"unknown_cmd\n",$userinput); } } -®ister_handler("instemailrules",\&get_institutional_selfenroll_rules,0,1,0); +®ister_handler("instemailrules",\&get_institutional_selfcreate_rules,0,1,0); sub institutional_username_check { @@ -4796,7 +4811,7 @@ sub institutional_id_check { } ®ister_handler("instidrulecheck",\&institutional_id_check,0,1,0); -sub institutional_selfenroll_check { +sub institutional_selfcreate_check { my ($cmd, $tail, $client) = @_; my $userinput = "$cmd:$tail"; my %rulecheck; @@ -4807,7 +4822,7 @@ sub institutional_selfenroll_check { @rules = map {&unescape($_);} (@rules); eval { local($SIG{__DIE__})='DEFAULT'; - $outcome = &localenroll::selfenroll_check($udom,$email,\@rules,\%rulecheck); + $outcome = &localenroll::selfcreate_check($udom,$email,\@rules,\%rulecheck); }; if (!$@) { if ($outcome eq 'ok') { @@ -4823,7 +4838,7 @@ sub institutional_selfenroll_check { &Failure($client,"unknown_cmd\n",$userinput); } } -®ister_handler("instselfenrollcheck",\&institutional_selfenroll_check,0,1,0); +®ister_handler("instselfcreatecheck",\&institutional_selfcreate_check,0,1,0); # Get domain specific conditions for import of student photographs to a course #