--- loncom/interface/loncreatecourse.pm 2004/12/08 23:27:29 1.74 +++ loncom/interface/loncreatecourse.pm 2005/03/03 21:24:24 1.77 @@ -1,7 +1,7 @@ # The LearningOnline Network # Create a course # -# $Id: loncreatecourse.pm,v 1.74 2004/12/08 23:27:29 raeburn Exp $ +# $Id: loncreatecourse.pm,v 1.77 2005/03/03 21:24:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -193,7 +193,7 @@ sub copyresourcedb { my $thiskey=$_; $thiskey=~s/^$origcrsid/$newcrsid/; $newdata{$thiskey}=$data{$_}; - if ($data{$_.'.type'}=~/^date/) { + if ($data{$_.'.type'}=~/^date_(start|end)$/) { $newdata{$thiskey}=$newdata{$thiskey}+$delta; } } @@ -327,12 +327,15 @@ sub print_course_creation_page { 'pcda' => "Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process", 'nech' => "Notification of enrollment changes", 'nccl' => "Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?", + 'ndcl' => "Notification to domain coordinator via LON-CAPA message when enrollment changes occur during the automated update?", 'irsp' => "Include retrieval of student photographs?", 'rshm' => 'Resource Space Home', 'opco' => "Open Course" ); + my $html=&Apache::lonxml::xmlbegin(); $r->print(< +$html + $coursebrowserjs - The LearningOnline Network with CAPA $bodytag @@ -523,10 +525,18 @@ $locform $lt{'nech'}
$lt{'nccl'}
+
+$lt{'ndcl'}
+ +

$lt{'irsp'} @@ -547,11 +557,6 @@ $lt{'nccl'}
-

-

@@ -597,9 +602,10 @@ sub create_course { } my $logmsg; + my $html=&Apache::lonxml::xmlbegin(); my $bodytag=&Apache::loncommon::bodytag('Create a New Course'); $r->print(< +$html The LearningOnline Network with CAPA @@ -623,7 +629,8 @@ ENDENHEAD crsxlist => $ENV{'form.crsxlist'}, autoadds => $ENV{'form.autoadds'}, autodrops => $ENV{'form.autodrops'}, - notify => $ENV{'form.notify'}, + notify_owner => $ENV{'form.notify_owner'}, + notify_dc => $ENV{'form.notify_dc'}, no_end_date => $ENV{'form.no_end_date'}, showphotos => $ENV{'form.showphotos'}, authtype => $authtype, @@ -669,19 +676,10 @@ ENDENHEAD return; } my ($courseid,$crsudom,$crsunum); - $r->print(&construct_course($args,\$logmsg,\$courseid,\$crsudom,\$crsunum)); + $r->print(&construct_course($args,\$logmsg,\$courseid,\$crsudom,\$crsunum,$ENV{'user.domain'},$ENV{'user.name'})); # -# Make current user course adminstrator -# - my $end=undef; - my $addition=''; - if ($ENV{'form.expireown'}) { $end=time+5; $addition='expired'; } - $r->print(&mt('Assigning').' '.$addition.' '.&mt('role of course coordinator to self').': '. - &Apache::lonnet::assignrole( - $ENV{'user.domain'},$ENV{'user.name'},$courseid,'cc',$end).'
'); -# -# Make additional user course administrator +# Make the requested user a course coordinator # if (($ccdomain) && ($ccuname)) { $r->print(&mt('Assigning role of course coordinator to').' '. @@ -698,7 +696,7 @@ ENDENHEAD } sub construct_course { - my ($args,$logmsg,$courseid,$crsudom,$crsunum) = @_; + my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname) = @_; my $outcome; # @@ -822,10 +820,26 @@ sub construct_course { if ($args->{'autodrops'}) { $cenv{'internal.autodrops'}=$args->{'autodrops'}; } - if ($args->{'notify'}) { - if ($args->{'ccuname'}) { - $cenv{'internal.notifylist'} = $args->{'ccuname'}.'@'.$args->{'ccdomain'}; - } +# check for notification of enrollment changes + my @notified = (); + if ($args->{'notify_owner'}) { + if ($args->{'ccuname'} ne '') { + push(@notified,$args->{'ccuname'}.'@'.$args->{'ccdomain'}); + } + } + if ($args->{'notify_dc'}) { + if ($uname ne '') { + push(@notified,$uname.'@'.$udom); + } + } + if (@notified > 0) { + my $notifylist; + if (@notified > 1) { + $notifylist = join(',',@notified); + } else { + $notifylist = $notified[0]; + } + $cenv{'internal.notifylist'} = $notifylist; } if (@badclasses > 0) { my %lt=&Apache::lonlocal::texthash(