[LON-CAPA-cvs] cvs: loncom /automation Autocreate.pl batchcreatecourse.pm /enrollment Enrollment.pm /interface loncommon.pm loncreatecourse.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 02 Jul 2007 03:37:24 -0000


This is a MIME encoded message

--raeburn1183347444
Content-Type: text/plain

raeburn		Sun Jul  1 23:37:24 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm loncreatecourse.pm 
    /loncom/automation	Autocreate.pl batchcreatecourse.pm 
    /loncom/enrollment	Enrollment.pm 
  Log:
  - move clone authorization check from loncreatecourse.pm to loncommon.pm
  - more information stored in autocreation log
  - include context as argument in loncommon::commit_standardrole and commit_studentrole
    to set appropriate line feeds (with/without <br /> for web/auto context).
  - more information displayed on screen after course creation from uploaded attributes file (XML)
  - language handler for Autocreate.pl
  
  
--raeburn1183347444
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20070701233724.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.540 loncom/interface/loncommon.pm:1.541
--- loncom/interface/loncommon.pm:1.540	Wed Jun 27 18:44:03 2007
+++ loncom/interface/loncommon.pm	Sun Jul  1 23:36:28 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.540 2007/06/27 22:44:03 albertel Exp $
+# $Id: loncommon.pm,v 1.541 2007/07/02 03:36:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6452,35 +6452,53 @@
 }
 
 sub commit_standardrole {
-    my ($udom,$uname,$url,$three,$start,$end,$one,$two,$sec) = @_;
-    my $output;
-    my $logmsg;
+    my ($udom,$uname,$url,$three,$start,$end,$one,$two,$sec,$context) = @_;
+    my ($output,$logmsg,$linefeed);
+    if ($context eq 'auto') {
+        $linefeed = "\n";
+    } else {
+        $linefeed = "<br />\n";
+    }  
     if ($three eq 'st') {
-        my $result = &commit_studentrole(\$logmsg,$udom,$uname,$url,$three,$start,$end,$one,$two,$sec);
-        if (($result =~ /^error/) || ($result eq 'not_in_class') || ($result eq 'unknown_course')) {
+        my $result = &commit_studentrole(\$logmsg,$udom,$uname,$url,$three,$start,$end,
+                                         $one,$two,$sec,$context);
+        if (($result =~ /^error/) || ($result eq 'not_in_class') || 
+            ($result eq 'unknown_course')) {
             $output = "Error: $result\n"; 
         } else {
-            $output = &mt('Assigning').' '.$three.' in '.$url.
+            $output = $logmsg.$linefeed.&mt('Assigning').' '.$three.' in '.$url.
                ($start?', '.&mt('starting').' '.localtime($start):'').
-               ($end?', '.&mt('ending').' '.localtime($end):'').
-               ': <b>'.$result.'</b><br />'.
-               &mt('Add to classlist').': <b>ok</b><br />';
+               ($end?', '.&mt('ending').' '.localtime($end):'').': ';
+            if ($context eq 'auto') {
+                $output .= $result.$linefeed.&mt('Add to classlist').': ok';
+            } else {
+               $output .= '<b>'.$result.'</b>'.$linefeed.
+               &mt('Add to classlist').': <b>ok</b>';
+            }
+            $output .= $linefeed;
         }
     } else {
         $output = &mt('Assigning').' '.$three.' in '.$url.
                ($start?', '.&mt('starting').' '.localtime($start):'').
-               ($end?', '.&mt('ending').' '.localtime($end):'').': <b>'.
-               &Apache::lonnet::assignrole(
-                   $udom,$uname,$url,$three,$end,$start).
-                   '</b><br />';
+               ($end?', '.&mt('ending').' '.localtime($end):'').': ';
+        my $result = &Apache::lonnet::assignrole($udom,$uname,$url,$three,$end,$start);
+        if ($context eq 'auto') {
+            $output .= $result.$linefeed;
+        } else {
+            $output .= '<b>'.$result.'</b>'.$linefeed;
+        }
     }
     return $output;
 }
 
 sub commit_studentrole {
-    my ($logmsg,$udom,$uname,$url,$three,$start,$end,$one,$two,$sec) = @_;
-    my $linefeed =  '<br />'."\n";
-    my $result;
+    my ($logmsg,$udom,$uname,$url,$three,$start,$end,$one,$two,$sec,$context) = @_;
+    my ($result,$linefeed);
+    if ($context eq 'auto') {
+        $linefeed = "\n";
+    } else {
+        $linefeed = '<br />'."\n";
+    }
     if (defined($one) && defined($two)) {
         my $cid=$one.'_'.$two;
         my $oldsec=&Apache::lonnet::getsection($udom,$uname,$cid);
@@ -6527,9 +6545,12 @@
 ############################################################
 
 sub construct_course {
-    my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname) = @_;
+    my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context) = @_;
     my $outcome;
-
+    my $linefeed =  '<br />'."\n";
+    if ($context eq 'auto') {
+        $linefeed = "\n";
+    }
 #
 # Open course
 #
@@ -6549,27 +6570,65 @@
     # Utils::Course. This needs to at least be output as a comment
     # if anyone ever decides to not show this, and Utils::Course::new
     # will need to be suitably modified.
-    $outcome .= &mt('New LON-CAPA [_1] ID: [_2]<br />',$crstype,$$courseid);
+    $outcome .= &mt('New LON-CAPA [_1] ID: [_2]',$crstype,$$courseid).$linefeed;
+
 #
 # Check if created correctly
 #
     ($$crsudom,$$crsunum)= &LONCAPA::split_courseid($$courseid);
     my $crsuhome=&Apache::lonnet::homeserver($$crsunum,$$crsudom);
-    $outcome .= &mt('Created on').': '.$crsuhome.'<br>';
+    $outcome .= &mt('Created on').': '.$crsuhome.$linefeed;
 #
 # Are we cloning?
 #
     my $cloneid='';
     if (($args->{'clonecourse'}) && ($args->{'clonedomain'})) {
+        my $can_clone = 0;
 	$cloneid='/'.$args->{'clonedomain'}.'/'.$args->{'clonecourse'};
         my ($clonecrsudom,$clonecrsunum)= &LONCAPA::split_courseid($cloneid);
 	my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom);
+        my $clonemsg;
 	if ($clonehome eq 'no_host') {
-	    $outcome .=
-    '<br /><font color="red">'.&mt('Attempting to clone non-existing [_1]',$crstype).' '.$cloneid.'</font>';
+            $clonemsg = &mt('Attempting to clone non-existing [_1]',$crstype);
+            if ($context eq 'auto') {
+                $outcome .= $clonemsg;
+            } else {
+	        $outcome .= '<font color="red">'.$clonemsg.'</font>';
+            }
+            $outcome .= $linefeed;
 	} else {
-	    $outcome .= 
-    '<br /><font color="green">'.&mt('Cloning [_1] from [_2]',$crstype,$clonehome).'</font>';
+            my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1});
+            if ($env{'request.role.domain'} eq $args->{'form.clonedomain'}) {
+                $can_clone = 1;
+            } else {
+                my %clonehash = &Apache::lonnet::get('environment',['cloners'],
+                            $args->{'clonedomain'},$args->{'clonecourse'});
+                my @cloners = split(/,/,$clonehash{'cloners'});
+                my %roleshash =
+                    &Apache::lonnet::get_my_roles($args->{'ccuname'},
+                        $args->{'ccdomain'},'userroles',['active'],['cc'],
+                        [$args->{'clonedomain'}]);
+                if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':cc'}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) {
+                    $can_clone = 1;
+                } else {
+                    $clonemsg = &mt('The new course was not cloned from an existing course because the course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});
+                    if ($context eq 'auto') {
+                        $outcome .= $clonemsg;
+                    } else {
+                        $outcome .= '<font color="red">'.$clonemsg.'</font>';
+                    }
+                    $outcome .= $linefeed;
+                }
+            }
+        }
+        if ($can_clone) {
+	    $clonemsg = &mt('Cloning [_1] from [_2]',$crstype,$clonehome);
+            if ($context eq 'auto') {
+                $outcome = $clonemsg;
+            } else { 
+                $outcome .= '<font color="green">'.$clonemsg.'</font>';
+            }
+            $outcome .= $linefeed;
 	    my %oldcenv=&Apache::lonnet::dump('environment',$$crsudom,$$crsunum);
 # Copy all files
 	    &Apache::lonclonecourse::copycoursefiles($cloneid,$$courseid);
@@ -6690,11 +6749,24 @@
                 'dnhr' => 'does not have rights to access enrollment in these classes',
                 'adby' => 'as determined by the policies of your institution on access to official classlists'
         );
-        $outcome .= '<font color="red">'.$lt{'tclb'}.' ('.$cenv{'internal.courseowner'}.') - '.$lt{'dnhr'}.' ('.$lt{'adby'}.').<br /><ul>'."\n";
-        foreach (@badclasses) {
-            $outcome .= "<li>$_</li>\n";
-        }
-        $outcome .= "</ul><br /><br /></font>\n";
+        my $badclass_msg = $cenv{'internal.courseowner'}.') - '.$lt{'dnhr'}.
+                           ' ('.$lt{'adby'}.')';
+        if ($context eq 'auto') {
+            $outcome .= $badclass_msg.$linefeed;
+            $outcome .= '<font color="red">'.$badclass_msg.$linefeed.'<ul>'."\n";
+            foreach my $item (@badclasses) {
+                if ($context eq 'auto') {
+                    $outcome .= " - $item\n";
+                } else {
+                    $outcome .= "<li>$item</li>\n";
+                }
+            }
+            if ($context eq 'auto') {
+                $outcome .= $linefeed;
+            } else {
+                $outcome .= "</ul><br /><br /></font>\n";
+            }
+        } 
     }
     if ($args->{'no_end_date'}) {
         $args->{'endaccess'} = 0;
@@ -6710,8 +6782,13 @@
     $cenv{'internal.autharg'} = $args->{'autharg'}; 
     if ( ($cenv{'internal.authtype'} =~ /^krb/) && ($cenv{'internal.autoadds'} == 1)) {
         if (! defined($cenv{'internal.autharg'}) || $cenv{'internal.autharg'}  eq '') {
-            $outcome .= '<font color="red" size="+1">'.
-                      &mt('As you did not include the default Kerberos domain to be used for authentication in this class, the institutional data used by the automated enrollment process must include the Kerberos domain for each new student').'</font></p>';
+            my $krb_msg = &mt('As you did not include the default Kerberos domain to be used for authentication in this class, the institutional data used by the automated enrollment process must include the Kerberos domain for each new student'); 
+            if ($context eq 'auto') {
+                $outcome .= $krb_msg;
+            } else {
+                $outcome .= '<font color="red" size="+1">'.$krb_msg.'</font>';
+            }
+            $outcome .= $linefeed;
         }
     }
     if (($args->{'ccdomain'}) && ($args->{'ccuname'})) {
@@ -6767,8 +6844,8 @@
     # By default, use standard grading
     if (!defined($cenv{'grading'})) { $cenv{'grading'} = 'standard'; }
 
-    $outcome .= ('<br />'.&mt('Setting environment').': '.                 
-          &Apache::lonnet::put('environment',\%cenv,$$crsudom,$$crsunum).'<br>');
+    $outcome .= $linefeed.&mt('Setting environment').': '.                 
+          &Apache::lonnet::put('environment',\%cenv,$$crsudom,$$crsunum).$linefeed;
 #
 # Open all assignments
 #
@@ -6778,7 +6855,7 @@
                            $storeunder.'.type' => 'date_start');
        
        $outcome .= &mt('Opening all assignments').': '.&Apache::lonnet::cput
-                 ('resourcedata',\%storecontent,$$crsudom,$$crsunum).'<br>';
+                 ('resourcedata',\%storecontent,$$crsudom,$$crsunum).$linefeed;
    }
 #
 # Set first page
@@ -6805,7 +6882,7 @@
 	(my $outtext,$errtext) = &LONCAPA::map::storemap($map,1);
 
 	if ($errtext) { $fatal=2; }
-        $outcome .= ($fatal?$errtext:'write ok').'<br />';
+        $outcome .= ($fatal?$errtext:'write ok').$linefeed;
     }
     return $outcome;
 }
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.102 loncom/interface/loncreatecourse.pm:1.103
--- loncom/interface/loncreatecourse.pm:1.102	Fri Jun 29 10:32:43 2007
+++ loncom/interface/loncreatecourse.pm	Sun Jul  1 23:36:28 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.102 2007/06/29 14:32:43 raeburn Exp $
+# $Id: loncreatecourse.pm,v 1.103 2007/07/02 03:36:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -581,33 +581,6 @@
 
     my $autharg;
     my $authtype;
-    my ($clonecourse,$clonedomain,$clonemsg);
-
-    if (($env{'form.clonecourse'} ne '') && ($env{'form.clonedomain'} ne '')) {
-        my $clonehome=&Apache::lonnet::homeserver($env{'form.clonecourse'},$env{'form.clonedomain'});
-        if ($clonehome eq 'no_host') {
-            $clonemsg = &mt('The new course was not cloned from an existing course because the requested course from which to create the clone does not appear to be a valid course.');
-        } else {
-            my %clonedesc = &Apache::lonnet::coursedescription($env{'form.clonedomain'}.'_'.$env{'form.clonecourse'},{'one_time' => 1});
-            if ($env{'request.role.domain'} eq $env{'form.clonedomain'}) {
-                $clonecourse = $env{'form.clonecourse'};
-                $clonedomain = $env{'form.clonedomain'};
-            } else {
-                my %clonehash = &Apache::lonnet::get('environment',['cloners'],
-                            $env{'form.clonedomain'},$env{'form.clonecourse'});
-                my @cloners = split(/,/,$clonehash{'cloners'});
-                my %roleshash = 
-                    &Apache::lonnet::get_my_roles($ccuname,$ccdomain,'userroles',
-                                     ['active'],['cc'],[$env{'form.clonedomain'}]);
-                if (($roleshash{$env{'form.clonecourse'}.':'.$env{'form.clonedomain'}.':cc'}) || (grep(/^\Q$ccuname\E:\Q$ccdomain\E$/,@cloners))) {
-                    $clonecourse = $env{'form.clonecourse'};
-                    $clonedomain = $env{'form.clonedomain'};
-                } else {
-                    $clonemsg = &mt('The new course was not cloned from an existing course because the course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$ccuname.':'.$ccdomain,$clonedesc{'description'});
-                }
-            }
-        }
-    }
 
     if ($env{'form.login'} eq 'krb') {
         $authtype = 'krb';
@@ -641,8 +614,8 @@
                nonstandard => $env{'form.nonstandard'},
                crscode => $env{'form.crscode'},
                crsquota => $env{'form.crsquota'},
-               clonecourse => $clonecourse,
-               clonedomain => $clonedomain,
+               clonecourse => $env{'form.clonecourse'},
+               clonedomain => $env{'form.clonedomain'},
                crsid => $env{'form.crsid'},
                curruser => $env{'user.name'}.':'.$env{'user.domain'},
                crssections => $env{'form.crssections'},
@@ -695,9 +668,6 @@
                   $env{'form.course_home'}.&Apache::loncommon::end_page());
         return;
     }
-    if ($clonemsg ne '') {
-        $r->print('<p>'.$clonemsg.'</p>');
-    }
     my ($courseid,$crsudom,$crsunum);
     $r->print(&Apache::loncommon::construct_course($args,\$logmsg,\$courseid,\$crsudom,\$crsunum,$env{'user.domain'},$env{'user.name'}));
 
@@ -705,7 +675,7 @@
 # Make the requested user a course coordinator or group coordinator
 #
     if (($ccdomain) && ($ccuname)) {
-        $r->print(&mt('Assigning role of [_1] Coordinator to [_2] at [_3]:',
+        $r->print(&mt('Assigning role of [_1] Coordinator to [_2] at [_3]: ',
                      $crstype,$ccuname,$ccdomain).
                   &Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,
                                               'cc').'<p>');
@@ -823,7 +793,8 @@
             }
         }
     }
-    $r->print($start_page.$crumbs.$result.$end_page);
+    $r->print($start_page.$crumbs.$logmsg.$result.'<br /><a href="/adm/createcourse">'.
+              &mt('Creation options menu').'</a>'.$end_page);
  
 }
 
Index: loncom/automation/Autocreate.pl
diff -u loncom/automation/Autocreate.pl:1.5 loncom/automation/Autocreate.pl:1.6
--- loncom/automation/Autocreate.pl:1.5	Mon Jul 11 16:00:58 2005
+++ loncom/automation/Autocreate.pl	Sun Jul  1 23:36:47 2007
@@ -34,6 +34,7 @@
     use strict;
     use lib '/home/httpd/lib/perl';
     use Apache::lonnet;
+    use Apache::lonlocal;
     use LONCAPA::batchcreatecourse;
     use LONCAPA::Configuration;
 
@@ -60,7 +61,10 @@
         close($fh);
         exit;
     }
-                                                   
+
+    # Initialize language handler
+    &Apache::lonlocal::get_language_handle();
+
     my $batchdir = $$perlvarref{'lonDaemons'}.'/tmp/addcourse/'.$defdom.'/auto';
     opendir(DIR,"$batchdir/pending");
     my @requests = grep(!/^\.\.?$/,readdir(DIR));
@@ -71,6 +75,7 @@
     &set_permissions(\%permissionflags,\@permissions);
     $env{'user.name'} = $dcname;
     $env{'user.domain'} = $dcdom;
+    $env{'request.role.domain'} = $defdom;
     my $wwwid=getpwnam('www');
     if ($wwwid!=$<) {
         my $emailto=$$perlvarref{'lonAdmEMail'};
@@ -128,6 +133,7 @@
     &unset_permissions(\%permissionflags);
     delete($env{'user.name'});
     delete($env{'user.domain'});
+    delete($env{'request.role.domain'});
     print $fh "-- ".localtime(time)." Autocreation messages end\n*******************\n\n";
     close($fh);
 
Index: loncom/automation/batchcreatecourse.pm
diff -u loncom/automation/batchcreatecourse.pm:1.21 loncom/automation/batchcreatecourse.pm:1.22
--- loncom/automation/batchcreatecourse.pm:1.21	Thu May 10 21:48:26 2007
+++ loncom/automation/batchcreatecourse.pm	Sun Jul  1 23:36:47 2007
@@ -1,5 +1,5 @@
 #
-# $Id: batchcreatecourse.pm,v 1.21 2007/05/11 01:48:26 raeburn Exp $
+# $Id: batchcreatecourse.pm,v 1.22 2007/07/02 03:36:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -446,7 +446,7 @@
                     'linefeed' => $linefeed,
                     'role' => 'cc',
                    };
-        $outcome = &LONCAPA::Enrollment::create_newuser($ownerargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo);
+        $outcome = &LONCAPA::Enrollment::create_newuser($ownerargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo,$context);
     } else {
         $outcome = 'ok';
     }
@@ -498,7 +498,7 @@
             return;
         }
 
-        &Apache::loncommon::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname);
+        $$logmsg .= &Apache::loncommon::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname,$context);
     } else {
         return;
     }
@@ -543,7 +543,7 @@
                     'linefeed' => $linefeed,
                     'role' => $$details{$num}{'users'}{$userkey}{'roles'}[0], 
                    };
-                $outcome = &LONCAPA::Enrollment::create_newuser($userargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo);
+                $outcome = &LONCAPA::Enrollment::create_newuser($userargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo,$context);
 # now add other roles and other sections.
                 if ($outcome eq 'ok') {
                     if (($firstrole ne 'st') && (@{$$details{$num}{'users'}{$userkey}{$firstrole}{'usec'}} > 1)) {
@@ -556,7 +556,7 @@
                             if ($usec ne '') {
                                 $url .= '/'.$usec;
                             }
-                            $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+                            $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec,$context);
                         }
                     }
                     if (@{$$details{$num}{'users'}{$userkey}{'roles'}} > 1) {
@@ -570,14 +570,14 @@
                                 if ($usec ne '') {
                                     $url .= '/'.$usec;
                                 }
-                                $$output .= &Apache::loncommon::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+                                $$output .= &Apache::loncommon::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec,$context);
                             } else {
                                 foreach my $usec (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}}) {
                                     $url = '/'.$crsudom.'/'.$crsunum;
                                     if ($usec ne '') {
                                         $url .= '/'.$usec;
                                     }
-                                    $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+                                    $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec,$context);
                                 }
                             }
                         }
@@ -593,7 +593,7 @@
                         if ($usec ne '') {
                             $url .= '/'.$usec;
                         }
-                        $$output .= &Apache::loncommon::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+                        $$output .= &Apache::loncommon::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec,$context);
                     } else {
                         if (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}} > 0) {
                             foreach my $usec (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}}) {
@@ -601,12 +601,12 @@
                                 if ($usec ne '') {
                                     $url .= '/'.$usec;
                                 }
-                                my $stdresult = &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+                                my $stdresult = &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec,$context);
                                 $$output .= $stdresult;
                             }
                         } else {
                             $url = '/'.$crsudom.'/'.$crsunum;
-                            $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,'');
+                            $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,'',$context);
                         }
                     }
                 }
Index: loncom/enrollment/Enrollment.pm
diff -u loncom/enrollment/Enrollment.pm:1.34 loncom/enrollment/Enrollment.pm:1.35
--- loncom/enrollment/Enrollment.pm:1.34	Thu May 10 21:48:23 2007
+++ loncom/enrollment/Enrollment.pm	Sun Jul  1 23:37:19 2007
@@ -1,5 +1,5 @@
 # Automated Enrollment manager
-# $Id: Enrollment.pm,v 1.34 2007/05/11 01:48:23 raeburn Exp $
+# $Id: Enrollment.pm,v 1.35 2007/07/02 03:37:19 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -454,7 +454,7 @@
 }
 
 sub create_newuser {
-    my ($args,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,$courseinfo) = @_;
+    my ($args,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,$courseinfo,$context) = @_;
     my $auth = $args->{'auth'};
     my $authparam = $args->{'authparam'};
     my $emailenc = $args->{'emailenc'};
@@ -511,7 +511,7 @@
         if ($context eq 'createowner' || $context eq 'createcourse') {
             my $result = &Apache::lonnet::modifyuser($udom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,'1',undef,$emailaddr);
             if ($result eq 'ok' && $context eq 'createcourse') {
-                $outcome = &Apache::loncommon::commit_standardrole($udom,$uname,$userurl,$role,$start,$end,$cdom,$crs,$usec);
+                $outcome = &Apache::loncommon::commit_standardrole($udom,$uname,$userurl,$role,$start,$end,$cdom,$crs,$usec,$context);
                 unless ($outcome =~ /^Error:/) {
                     $outcome = 'ok';
                 }

--raeburn1183347444--