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

www lon-capa-cvs@mail.lon-capa.org
Thu, 13 Apr 2006 20:54:36 -0000


www		Thu Apr 13 16:54:36 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Saving my work: Bug #4186 - track parameter changes
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.283 loncom/interface/lonparmset.pm:1.284
--- loncom/interface/lonparmset.pm:1.283	Mon Apr 10 17:41:48 2006
+++ loncom/interface/lonparmset.pm	Thu Apr 13 16:54:35 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.283 2006/04/10 21:41:48 albertel Exp $
+# $Id: lonparmset.pm,v 1.284 2006/04/13 20:54:35 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -394,9 +394,36 @@
     return '';
 }
 
+{
+    my $logid;
+    sub logparmset {
+	my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_;
+	$logid++;
+	my $id=time.'00000'.$$.'00000'.$logid;
+	&Apache::lonnet::put('parameterlog',{
+			     $id.'_exe_uname' => $env{'user.name'},
+			     $id.'_exe_udom' => $env{'user.domain'},
+			     $id.'_exe_time' => time,
+			     $id.'_exe_ip' => $ENV{'REMOTE_ADDR'},
+			     $id.'_symb' => $symb,
+                             $id.'_spnam' => $spnam,
+                             $id.'_snum' => $snum,
+			     $id.'_nval' => $nval,
+			     $id.'_ntype' => $ntype,
+                             $id.'_uname' => $uname,
+			     $id.'_udom' => $udom,
+			     $id.'_csec' => $csec,
+			     $id.'_cgroup' => $cgroup},
+			     $env{'course.'.$env{'request.course.id'}.'.domain'},
+			     $env{'course.'.$env{'request.course.id'}.'.num'}
+			     );
+    }
+}
+
 sub storeparm_by_symb_inner {
 # ---------------------------------------------------------- Get symb, map, etc
     my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_;
+    &logparmset(@_);
 # ---------------------------------------------------------- Construct prefixes
     $spnam=~s/\_([^\_]+)$/\.$1/;
     my $map=(&Apache::lonnet::decode_symb($symb))[0];    
@@ -3016,6 +3043,10 @@
           { text => 'Set Parameter Setting Default Actions',
             action => 'setdefaults',
             permission => $parm_permission,
+            },          
+	  { text => 'Parameter Change Log and Course Blog Posting',
+            action => 'parameterchangelog',
+            permission => $parm_permission,
             },
           );
     my $menu_html = '';
@@ -3283,6 +3314,12 @@
     return;
 }
 
+sub parmchangelog {
+    my ($r)=@_;
+    &startpage($r);
+    $r->print(&Apache::loncommon::end_page());
+}
+
 ##################################################
 ##################################################
 
@@ -3375,8 +3412,11 @@
 						    text=>"Table Mode",
 						    help => 'Course_Setting_Parameters'});
 	    &assessparms($r);
-        }
-        
+        } elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) {
+            &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
+						    text=>"Parameter Change Log and Course Blog Posting"});
+	    &parmchangelog($r);
+	}       
     } else {
 # ----------------------------- Not in a course, or not allowed to modify parms
 	$env{'user.error.msg'}=