--- loncom/interface/lonparmset.pm 2006/04/14 11:55:58 1.286
+++ loncom/interface/lonparmset.pm 2006/12/11 23:57:17 1.351
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.286 2006/04/14 11:55:58 www Exp $
+# $Id: lonparmset.pm,v 1.351 2006/12/11 23:57:17 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -63,6 +63,9 @@ use Apache::lonhomework;
use Apache::lonxml;
use Apache::lonlocal;
use Apache::lonnavmaps;
+use Apache::longroup;
+use Apache::lonrss;
+use LONCAPA qw(:DEFAULT :match);
# --- Caches local to lonparmset
@@ -90,11 +93,11 @@ Inputs: $what - a parameter spec (inclu
Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels
-14 - General Course
-13 - Map or Folder level in course
+14- General Course
+13- Map or Folder level in course
12- resource default
11- map default
-10 - resource level in course
+10- resource level in course
9 - General for section
8 - Map or Folder level for section
7 - resource level in section
@@ -117,7 +120,6 @@ sub parmval {
sub parmval_by_symb {
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_;
# load caches
-
&cacheparmhash();
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom);
@@ -126,6 +128,7 @@ sub parmval_by_symb {
my @outpar=();
# ----------------------------------------------------- Cascading lookup scheme
my $map=(&Apache::lonnet::decode_symb($symb))[0];
+ $map = &Apache::lonnet::deversion($map);
my $symbparm=$symb.'.'.$what;
my $mapparm=$map.'___(all).'.$what;
@@ -394,41 +397,18 @@ 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('nohist_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];
+ $map = &Apache::lonnet::deversion($map);
+
my $symbparm=$symb.'.'.$spnam;
my $mapparm=$map.'___(all).'.$spnam;
@@ -479,9 +459,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,15 +484,17 @@ 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);
}
if ($reply=~/^error\:(.*)/) {
- return "Write Error: $1";
+ return "Write Error: $1";
}
return '';
}
@@ -524,21 +508,26 @@ sub storeparm_by_symb_inner {
Format a value for output.
-Inputs: $value, $type
+Inputs: $value, $type, $editable
Returns: $value, formatted for output. If $type indicates it is a date,
localtime($value) is returned.
+$editable will return an icon to click on
=cut
##################################################
##################################################
sub valout {
- my ($value,$type)=@_;
+ my ($value,$type,$editable)=@_;
my $result = '';
# Values of zero are valid.
if (! $value && $value ne '0') {
- $result = ' ';
+ if ($editable) {
+ $result = '*';
+ } else {
+ $result=' ';
+ }
} else {
if ($type eq 'date_interval') {
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
@@ -606,7 +595,7 @@ sub plink {
return '
';
+ &valout($value,$type,1).'';
}
sub page_js {
@@ -671,8 +660,7 @@ sub startpage {
&page_js(),
{'add_entries' => \%loaditems,});
my $breadcrumbs =
- &Apache::lonhtmlcommon::breadcrumbs(undef,
- 'Table Mode Parameter Setting');
+ &Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode');
$r->print(<
'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'';
+ $parm.='
'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'';
}
$r->print(''.$parm.' | ');
@@ -1074,15 +1062,15 @@ sub parmmenu {
ENDSCRIPT
$r->print();
- $r->print("\n