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

raeburn raeburn@source.lon-capa.org
Tue, 11 Jan 2011 22:09:50 -0000


This is a MIME encoded message

--raeburn1294783790
Content-Type: text/plain

raeburn		Tue Jan 11 22:09:50 2011 EDT

  Modified files:              
    /loncom/interface	lonmodifycourse.pm lonpopulate.pm 
  Log:
  - Include co-owners as argument passed to lonnet::auto_new_course() whenever sections, crosslistings or course owner change in an "official" course.
  
  
--raeburn1294783790
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20110111220950.txt"

Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.57 loncom/interface/lonmodifycourse.pm:1.58
--- loncom/interface/lonmodifycourse.pm:1.57	Tue Aug 24 13:51:52 2010
+++ loncom/interface/lonmodifycourse.pm	Tue Jan 11 22:09:49 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # handler for DC-only modifiable course settings
 #
-# $Id: lonmodifycourse.pm,v 1.57 2010/08/24 13:51:52 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.58 2011/01/11 22:09:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -847,13 +847,15 @@
                 } else {
 	            if (@sections > 0) {
                         if ($changed{'code'}) {
+                            my %crsenv = &Apache::lonnet::get('environment',['internal.co-owners'],$cdom,$cnum);
+                            my $coowners = $crsenv{'internal.co-owners'};
 	                    foreach my $sec (@sections) {
 		                if ($sec =~ m/^(.+):/) {
                                     my $instsec = $1;
 		                    my $inst_course_id = $newattr{'coursecode'}.$1;
                                     my $course_check = &Apache::lonnet::auto_validate_courseID($cnum,$cdom,$inst_course_id);
 			            if ($course_check eq 'ok') {
-                                        my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'});
+                                        my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'},$coowners);
 			                unless ($outcome eq 'ok') {
                                
 				            push(@warnings,&mt('If automatic enrollment is enabled for "[_1]", automated enrollment may fail for "[_2]" - section: [_3] for the following reason: "[_4]".',$description,$newattr{'coursecode'},$instsec,$outcome).'<br/>');
@@ -870,7 +872,7 @@
                                 if ($sec =~ m/^(.+):/) {
                                     my $instsec = $1;
                                     my $inst_course_id = $newattr{'coursecode'}.$instsec;
-                                    my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'});
+                                    my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$inst_course_id,$newattr{'courseowner'},$coowners);
                                     unless ($outcome eq 'ok') {
                                         push(@warnings,&mt('If automatic enrollment is enabled for "[_1]", automated enrollment may fail for "[_2]" - section: [_3] for the following reason: "[_4]".',$description,$newattr{'coursecode'},$instsec,$outcome));
                                     }
@@ -886,7 +888,7 @@
 	                foreach my $xlist (@xlists) {
 		            if ($xlist =~ m/^(.+):/) {
                                 my $instxlist = $1;
-                                my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$instxlist,$newattr{'courseowner'});
+                                my $outcome = &Apache::lonnet::auto_new_course($cnum,$cdom,$instxlist,$newattr{'courseowner'},$coowners);
 		                unless ($outcome eq 'ok') {
 			            push(@warnings,&mt('If automatic enrollment is enabled for "[_1]", automated enrollment may fail for crosslisted class "[_2]" for the following reason: "[_3]".',$description,$instxlist,$outcome));
 		                }
@@ -1040,7 +1042,7 @@
             if ($designhash{$cdom.'.autoassign.co-owners'}) {
                 my @newcoowners = ();
                 if ($settings->{'internal.co-owners'}) {
-                    my @currcoown = split(',',$settings->{'internal.coowners'});
+                    my @currcoown = split(',',$settings->{'internal.co-owners'});
                     my ($updatecoowners,$delcoowners);
                     foreach my $person (@currcoown) {
                         my ($result,$desc) = &Apache::lonnet::auto_validate_instcode($cnum,$cdom,$newattr->{'coursecode'},$person);
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.67 loncom/interface/lonpopulate.pm:1.68
--- loncom/interface/lonpopulate.pm:1.67	Tue Nov 24 14:26:15 2009
+++ loncom/interface/lonpopulate.pm	Tue Jan 11 22:09:50 2011
@@ -1,5 +1,5 @@
 # automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.67 2009/11/24 14:26:15 wenzelju Exp $
+# $Id: lonpopulate.pm,v 1.68 2011/01/11 22:09:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1894,7 +1894,7 @@
 
 sub print_crosslistings_response () {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
-    my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode','internal.courseowner'],$dom,$crs);
+    my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode','internal.courseowner','internal.co-owners'],$dom,$crs);
     my @currxlists = ();
     my @xlists = ();
     my @allxlists = ();
@@ -1906,6 +1906,7 @@
     my $xliststr =  $settings{'internal.crosslistings'};
     my $coursecode = $settings{'internal.coursecode'};
     my $owner = $settings{'internal.courseowner'};
+    my $coowners = $settings{'internal.co-owners'};
     my $response = '';
     my $warning = '';
     my $warn_prefix = '';
@@ -1939,7 +1940,7 @@
 		$coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$env{"form.$xl"});
 		if ($coursecheck eq 'ok') {
 		    my $addcheck = '';
-		    $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$env{"form.$xl"},$owner);
+		    $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$env{"form.$xl"},$owner,$coowners);
 		    if ($addcheck eq 'ok') {
 			push @xlists,$env{"form.$xl"}.":".$env{"form.$lc_sec"};
 		    } else {
@@ -2029,7 +2030,7 @@
 
 sub print_sections_menu () {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
-    my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs);
+    my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner','internal.co-owners'],$dom,$crs);
     my @currsections = ();
     my @sections = ();
     my @badowner = ();
@@ -2043,6 +2044,7 @@
     my $warn_prefix = "";
     my $coursecode = $settings{'internal.coursecode'};
     my $owner = $settings{'internal.courseowner'};
+    my $coowners = $settings{'internal.co-owners'};
     if ($settings{'internal.sectionnums'} ne '') {
 	@currsections = split(/,/,$settings{'internal.sectionnums'});
     }
@@ -2067,7 +2069,7 @@
 		    my $newsec = $coursecode.$env{"form.$secnum"};
 		    my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
 		    if ($coursecheck eq 'ok') {
-			my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner);
+			my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);
 			if ($addcheck eq 'ok') {
 			    push @sections,$env{"form.$secnum"}.":".$env{"form.$lc_sec"};
 			    $seccount ++;
@@ -2211,7 +2213,7 @@
 
 sub print_sections_response () {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
-    my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs);
+    my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner','internal.co-owners'],$dom,$crs);
     my @currsections = ();
     my @sections = ();
     my @allsections = ();
@@ -2223,6 +2225,7 @@
     my $secstr =  $settings{'internal.sectionnums'};
     my $coursecode = $settings{'internal.coursecode'};
     my $owner = $settings{'internal.courseowner'};
+    my $coowners = $settings{'internal.co-owners'};
     my $response = '';
     my $putreply = '';
     my $warning = '';
@@ -2253,7 +2256,7 @@
 		    my $newsec = $coursecode.$env{"form.$sec"};
 		    my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
 		    if ($coursecheck eq 'ok') {
-			my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner);
+			my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);
 			if ($addcheck eq 'ok') {
 			    push @sections,$env{"form.$sec"}.":".$env{"form.$lc_sec"};
 			} else {

--raeburn1294783790--