[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn raeburn@source.lon-capa.org
Wed, 17 Mar 2010 20:22:06 -0000


raeburn		Wed Mar 17 20:22:06 2010 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - If auto assignment of co-owners is enabled for official courses
    - when CC role is assigned, check if:
      (a) new role will be active immediately
      (b) user with new role is official course personnel
  - Store creation date, creator and creation context in nohist_courseids.db entry for new course, when creating a course.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1055 loncom/lonnet/perl/lonnet.pm:1.1056
--- loncom/lonnet/perl/lonnet.pm:1.1055	Mon Mar 15 05:10:03 2010
+++ loncom/lonnet/perl/lonnet.pm	Wed Mar 17 20:22:06 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1055 2010/03/15 05:10:03 raeburn Exp $
+# $Id: lonnet.pm,v 1.1056 2010/03/17 20:22:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6418,12 +6418,12 @@
             my %coursehash = &coursedescription($cdom.'_'.$cnum);
             my $instcode = $coursehash{'internal.coursecode'};
             if ($instcode ne '') {
-                unless ($coursehash{'internal.courseowner'} eq $uname.':'.$udom) {
-                    my ($result,$desc) = &auto_validate_instcode($cnum,$cdom,$instcode,$uname.':'.$udom);
-                    if ($result eq 'valid') {
+                if (($start && $start <= $now) && ($end == 0) || ($end > $now)) {
+                    unless ($coursehash{'internal.courseowner'} eq $uname.':'.$udom) {
                         my ($delcoowners,@newcoowners,$putresult,$delresult,$coowners);
-                        if (($end == 0) || ($end > $now)) {
-                             if ($coursehash{'internal.co-owners'}) {
+                        my ($result,$desc) = &auto_validate_instcode($cnum,$cdom,$instcode,$uname.':'.$udom);
+                        if ($result eq 'valid') {
+                            if ($coursehash{'internal.co-owners'}) {
                                 foreach my $coowner (split(',',$coursehash{'internal.co-owners'})) {
                                     push(@newcoowners,$coowner);
                                 }
@@ -6873,8 +6873,13 @@
     }
 # ----------------------------------------------------------- Write preferences
     &writecoursepref($udom.'_'.$uname,
-                     ('description' => $description,
-                      'url'         => $topurl));
+                     ('description'              => $description,
+                      'url'                      => $topurl,
+                      'internal.creator'         => $env{'user.name'}.':'.
+                                                    $env{'user.domain'},
+                      'internal.created'         => $now,
+                      'internal.creationcontext' => $context)
+                    );
     return '/'.$udom.'/'.$uname;
 }