--- loncom/interface/lonparmset.pm 2006/04/13 21:32:23 1.285
+++ loncom/interface/lonparmset.pm 2006/04/18 20:35:47 1.294
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.285 2006/04/13 21:32:23 albertel Exp $
+# $Id: lonparmset.pm,v 1.294 2006/04/18 20:35:47 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -394,38 +394,13 @@ sub storeparm_by_symb {
return '';
}
-{
- my $logid;
- sub log_parmset {
- 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 log_parmset {
+ return &Apache::lonnet::instructor_log('parameterlog',@_);
}
sub storeparm_by_symb_inner {
# ---------------------------------------------------------- Get symb, map, etc
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_;
- &log_parmset(@_);
# ---------------------------------------------------------- Construct prefixes
$spnam=~s/\_([^\_]+)$/\.$1/;
my $map=(&Apache::lonnet::decode_symb($symb))[0];
@@ -479,9 +454,11 @@ sub storeparm_by_symb_inner {
if ($delete) {
$reply=&Apache::lonnet::del
('resourcedata',[keys(%storecontent)],$cdom,$cnum);
+ &log_parmset(\%storecontent,1);
} else {
$reply=&Apache::lonnet::cput
('resourcedata',\%storecontent,$cdom,$cnum);
+ &log_parmset(\%storecontent);
}
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom);
} else {
@@ -502,9 +479,11 @@ sub storeparm_by_symb_inner {
if ($delete) {
$reply=&Apache::lonnet::del
('resourcedata',[keys(%storecontent)],$udom,$uname);
+ &log_parmset(\%storecontent,1,$uname,$udom);
} else {
$reply=&Apache::lonnet::cput
('resourcedata',\%storecontent,$udom,$uname);
+ &log_parmset(\%storecontent,0,$uname,$udom);
}
&Apache::lonnet::devalidateuserresdata($uname,$udom);
}
@@ -2421,6 +2400,7 @@ sub storedata {
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,
$tkey.'.type' => $typeof},
$tudom,$tuname) eq 'ok') {
+ &log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom);
$r->print('
'.&mt('Stored modified parameter for').' '.
&Apache::loncommon::plainname($tuname,$tudom));
} else {
@@ -2436,6 +2416,7 @@ sub storedata {
} elsif ($cmd eq 'del') {
if ($tuname) {
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') {
+ &log_parmset({$tkey=>''},1,$tuname,$tudom);
$r->print('
'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom));
} else {
$r->print('
'.$time.' | +'.$about_me_link.
+ ' '.$parmlog{$id}{'exe_uname'}. + ':'.$parmlog{$id}{'exe_udom'}.''. + $send_msg_link.' | ');
+ my $makenewrow=0;
+ my %istype=();
+ foreach my $changed (reverse(sort(@changes))) {
+ my $value=$parmlog{$id}{'logentry'}->{$changed};
+ my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)=
+ &components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'});
+ if ($typeflag) { $istype{$parmname}=$value; }
+ if ($makenewrow) { $r->print('||||||
'.$realm.' | '.$section.' | '. + &standard_parameter_names($parmname).' | '. + ($part?&mt('Part: [_1]',$part):&mt('All Parts')).' | ');
+ my $stillactive=0;
+ if ($parmlog{$id}{'deleteflag'}) {
+ $r->print(&mt('Deleted'));
+ } else {
+ if ($typeflag) {
+ $r->print(&mt('Type: [_1]',&standard_parameter_names($value)));
+ } else {
+ my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what),
+ $uname,$udom,$issection,$issection,$courseopt);
+ if (&isdateparm($istype{$parmname})) {
+ $r->print(&Apache::lonlocal::locallocaltime($value));
+ } else {
+ $r->print($value);
+ }
+ if ($value ne $all[$level]) {
+ $r->print(' '.&mt('Not active anymore').''); + } else { + $stillactive=1; + } + } + } + $r->print(' | ');
+ if ($stillactive) {
+ if (($uname) && ($udom)) {
+ $r->print('Notify Link | '); + } else { + $r->print('Blog Link | '); + } + } else { + $r->print(''); + } + $r->print(' |