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

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 03 Mar 2005 21:24:25 -0000


raeburn		Thu Mar  3 16:24:25 2005 EDT

  Modified files:              
    /loncom/interface	loncreatecourse.pm 
  Log:
  Bug 3800. DC requesting course creation is now longer added to course as a CC - can just use the 'Select course' link instead.
  
  
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.76 loncom/interface/loncreatecourse.pm:1.77
--- loncom/interface/loncreatecourse.pm:1.76	Thu Feb 17 03:29:42 2005
+++ loncom/interface/loncreatecourse.pm	Thu Mar  3 16:24:24 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.76 2005/02/17 08:29:42 albertel Exp $
+# $Id: loncreatecourse.pm,v 1.77 2005/03/03 21:24:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -327,6 +327,7 @@
                     '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"
@@ -524,10 +525,18 @@
 <b>$lt{'nech'}</b><br />
 $lt{'nccl'}<br/>
 <label>
-    <input type="radio" name="notify" value="1" />$lt{'yes'}
+    <input type="radio" name="notify_owner" value="1" />$lt{'yes'}
 </label> 
 <label>
-    <input type="radio" name="notify" value="0" checked="true" />$lt{'no'}
+    <input type="radio" name="notify_owner" value="0" checked="true" />$lt{'no'}
+</label>
+<br />
+$lt{'ndcl'}<br/>
+<label>
+    <input type="radio" name="notify_dc" value="1" />$lt{'yes'}
+</label>
+<label>
+    <input type="radio" name="notify_dc" value="0" checked="true" />$lt{'no'}
 </label>
 </p><p>
 <b>$lt{'irsp'}</b>
@@ -548,11 +557,6 @@
 <label>
     <b>$lt{'dmn'}:</b> $domform
 </label>
-</p><p>
-<label>
-    <b>$lt{'ierc'}:</b>
-    <input type="checkbox" name="expireown" checked />
-</label>
 </p>
 <p>
 <input type="hidden" name="phase" value="two" />
@@ -625,7 +629,8 @@
                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,
@@ -671,19 +676,10 @@
         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).'<br>');
-#
-# Make additional user course administrator
+# Make the requested user a course coordinator
 #
    if (($ccdomain) && ($ccuname)) {
     $r->print(&mt('Assigning role of course coordinator to').' '.
@@ -700,7 +696,7 @@
 }
 
 sub construct_course {
-    my ($args,$logmsg,$courseid,$crsudom,$crsunum) = @_;
+    my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname) = @_;
     my $outcome;
 
 #
@@ -824,10 +820,26 @@
     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(