[LON-CAPA-cvs] cvs: loncom /interface selfenroll.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 30 Jun 2008 17:04:16 -0000


raeburn		Mon Jun 30 13:04:16 2008 EDT

  Modified files:              
    /loncom/interface	selfenroll.pm 
  Log:
  - Users with no institutional type were not being assigned a type of 'other'.
  - Wording change to clarify "registered students" requirement
  - Add missing line feed.
  
  
Index: loncom/interface/selfenroll.pm
diff -u loncom/interface/selfenroll.pm:1.5 loncom/interface/selfenroll.pm:1.6
--- loncom/interface/selfenroll.pm:1.5	Mon Jun 23 11:52:52 2008
+++ loncom/interface/selfenroll.pm	Mon Jun 30 13:04:11 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Allow users to self-enroll in a course
 #
-# $Id: selfenroll.pm,v 1.5 2008/06/23 15:52:52 bisitz Exp $
+# $Id: selfenroll.pm,v 1.6 2008/06/30 17:04:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -280,9 +280,12 @@
     my %userhash = &Apache::lonnet::userenvironment($udom,$uname,@info);
     my ($enrolltypes,$longtypes,$alldoms) = 
         &get_selfenroll_filters($selfenroll_types,$udom);
-    my @inststatuses = &unescape(split(/:/,$userhash{'inststatus'}));
-    if (@inststatuses == 0) {
-        push(@inststatuses,'other');
+    my @inststatuses;
+    if ($userhash{'inststatus'} eq '') {
+        push(@inststatuses,'other'); 
+    } else {
+        my @esc_statuses = split(/:/,$userhash{'inststatus'});
+        @inststatuses = map { &unescape($_); } (@esc_statuses);
     }
     my $selfenroll = 0;
     if ($alldoms) {
@@ -310,7 +313,7 @@
             my ($registered,$instsec,$message) = &check_registered($cdom,$cnum);
             $usec = $instsec;
             if (!$registered) {
-                $r->print(&mt('Self-enrollment is restricted to officially registered students.').'<br />');
+                $r->print(&mt('Self-enrollment is restricted to students officially registered for this course.').'<br />');
                 if ($message) {
                     $r->print($message);
                 } else {
@@ -321,7 +324,8 @@
         }
         my $enrollresult = 
             &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,
-                    undef,undef,$usec,$selfenroll_access_end,$selfenroll_access_start,                    'manual',undef,$cdom.'_'.$cnum,$selfenroll);
+                    undef,undef,$usec,$selfenroll_access_end,$selfenroll_access_start,
+                   'manual',undef,$cdom.'_'.$cnum,$selfenroll);
         if ($enrollresult eq 'ok') {
             my (%userroles,%newrole,%newgroups);
             my $role = 'st';