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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 06 Mar 2008 21:37:59 -0000


raeburn		Thu Mar  6 16:37:59 2008 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - When course parameter changed is a date, show the result as a human readble date instead of Unix-like seconds after epoch.
  - Store changes in users permitted to clone under 'cloners' key in domain's nohist_courseids.db. (Will make it easier to offer courses with wildcard cloning definitions as possible source courses to users requesting courses).
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.391 loncom/interface/lonparmset.pm:1.392
--- loncom/interface/lonparmset.pm:1.391	Sat Jan 26 14:22:24 2008
+++ loncom/interface/lonparmset.pm	Thu Mar  6 16:37:59 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.391 2008/01/26 19:22:24 www Exp $
+# $Id: lonparmset.pm,v 1.392 2008/03/06 21:37:59 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2026,6 +2026,8 @@
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
 
+    my (%crsinfo,$chome);
+
     #
     # Go through list of changes
     foreach (keys %env) {
@@ -2120,19 +2122,37 @@
             my $put_result = &Apache::lonnet::put('environment',
                                                   {$name=>$value},$dom,$crs);
             if ($put_result eq 'ok') {
-                $setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>'.$value.'</b>.<br />';
+                $setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>';
+                if ($name =~ /^default_enrollment_(start|end)_date$/) {
+                    $setoutput .= &Apache::lonlocal::locallocaltime($value);
+                } else {
+                    $setoutput .= $value;
+                }
+                $setoutput .= '</b>.<br />';
                 if ($name eq 'cloners') {
                     &change_clone($value,\@oldcloner);
                 }
                 # Update environment and nohist_courseids.db
-                if ($name eq 'description' && defined($value)) {
-                    my %crsinfo = 
-                        &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
+                if ($name eq 'description' || $name eq 'cloners') {
+                    if ($chome eq '') {
+                        %crsinfo =
+                            &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
                                                  $crs,undef,undef,'Course');
+                        $chome = &Apache::lonnet::homeserver($crs,$dom);
+                    }
+                }
+                if ($name eq 'description' && defined($value)) {
                     &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.description' => $value);
                     if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
                         $crsinfo{$env{'request.course.id'}}{'description'} = $value; 
-                        my $chome = &Apache::lonnet::homeserver($crs,$dom);
+                        my $putresult =
+                            &Apache::lonnet::courseidput($dom,\%crsinfo,
+                                                         $chome,'notime');
+                    }
+                }
+                if ($name eq 'cloners') {
+                    if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
+                        $crsinfo{$env{'request.course.id'}}{'cloners'} = $value;
                         my $putresult =
                             &Apache::lonnet::courseidput($dom,\%crsinfo,
                                                          $chome,'notime');
@@ -2318,6 +2338,7 @@
 
 	     'texengine'
 	         => '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'.&mt('(Valid options are [_1].)','"tth", "jsMath", "mimetex"').'</b>',
+
              ); 
         my @Display_Order = ('url','description','courseid','cloners','grading',
                              'externalsyllabus',