version 1.222, 2005/06/14 15:43:54
|
version 1.290, 2006/04/15 21:12:56
|
Line 88 Inputs: $what - a parameter spec (inclu
|
Line 88 Inputs: $what - a parameter spec (inclu
|
$id - a bighash Id number |
$id - a bighash Id number |
$def - the resource's default value 'stupid emacs |
$def - the resource's default value 'stupid emacs |
|
|
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 11 possible levels |
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 |
|
|
11 - General Course |
14 - General Course |
10 - Map or Folder level in course |
13 - Map or Folder level in course |
9- resource default |
12- resource default |
8- map default |
11- map default |
7 - resource level in course |
10 - resource level in course |
6 - General for section |
9 - General for section |
5 - Map or Folder level for section |
8 - Map or Folder level for section |
4 - resource level in section |
7 - resource level in section |
|
6 - General for group |
|
5 - Map or Folder level for group |
|
4 - resource level in group |
3 - General for specific student |
3 - General for specific student |
2 - Map or Folder level for specific student |
2 - Map or Folder level for specific student |
1 - resource level for specific student |
1 - resource level for specific student |
Line 106 Returns: A list, the first item is the
|
Line 109 Returns: A list, the first item is the
|
|
|
################################################## |
################################################## |
sub parmval { |
sub parmval { |
my ($what,$id,$def,$uname,$udom,$csec)=@_; |
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec); |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, |
|
$cgroup,$courseopt); |
} |
} |
|
|
sub parmval_by_symb { |
sub parmval_by_symb { |
my ($what,$symb,$def,$uname,$udom,$csec)=@_; |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
# load caches |
# load caches |
|
|
&cacheparmhash(); |
&cacheparmhash(); |
|
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
|
|
|
|
|
my $result=''; |
my $result=''; |
my @outpar=(); |
my @outpar=(); |
Line 130 sub parmval_by_symb {
|
Line 130 sub parmval_by_symb {
|
my $symbparm=$symb.'.'.$what; |
my $symbparm=$symb.'.'.$what; |
my $mapparm=$map.'___(all).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
|
|
|
my $grplevel=$env{'request.course.id'}.'.['.$cgroup.'].'.$what; |
|
my $grplevelr=$env{'request.course.id'}.'.['.$cgroup.'].'.$symbparm; |
|
my $grplevelm=$env{'request.course.id'}.'.['.$cgroup.'].'.$mapparm; |
|
|
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what; |
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
Line 139 sub parmval_by_symb {
|
Line 143 sub parmval_by_symb {
|
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
|
|
|
|
# --------------------------------------------------------- first, check course |
# --------------------------------------------------------- first, check course |
|
|
if (defined($$courseopt{$courselevel})) { |
if (defined($$courseopt{$courselevel})) { |
$outpar[11]=$$courseopt{$courselevel}; |
$outpar[14]=$$courseopt{$courselevel}; |
$result=11; |
$result=14; |
} |
} |
|
|
if (defined($$courseopt{$courselevelm})) { |
if (defined($$courseopt{$courselevelm})) { |
$outpar[10]=$$courseopt{$courselevelm}; |
$outpar[13]=$$courseopt{$courselevelm}; |
$result=10; |
$result=13; |
} |
} |
|
|
# ------------------------------------------------------- second, check default |
# ------------------------------------------------------- second, check default |
|
|
if (defined($def)) { $outpar[9]=$def; $result=9; } |
if (defined($def)) { $outpar[12]=$def; $result=12; } |
|
|
# ------------------------------------------------------ third, check map parms |
# ------------------------------------------------------ third, check map parms |
|
|
my $thisparm=$parmhash{$symbparm}; |
my $thisparm=$parmhash{$symbparm}; |
if (defined($thisparm)) { $outpar[8]=$thisparm; $result=8; } |
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
|
|
if (defined($$courseopt{$courselevelr})) { |
if (defined($$courseopt{$courselevelr})) { |
$outpar[7]=$$courseopt{$courselevelr}; |
$outpar[10]=$$courseopt{$courselevelr}; |
$result=7; |
$result=10; |
} |
} |
|
|
# ------------------------------------------------------ fourth, back to course |
# ------------------------------------------------------ fourth, back to course |
if (defined($csec)) { |
if (defined($csec)) { |
if (defined($$courseopt{$seclevel})) { |
if (defined($$courseopt{$seclevel})) { |
$outpar[6]=$$courseopt{$seclevel}; |
$outpar[9]=$$courseopt{$seclevel}; |
$result=6; |
$result=9; |
} |
} |
if (defined($$courseopt{$seclevelm})) { |
if (defined($$courseopt{$seclevelm})) { |
$outpar[5]=$$courseopt{$seclevelm}; |
$outpar[8]=$$courseopt{$seclevelm}; |
$result=5; |
$result=8; |
} |
} |
|
|
if (defined($$courseopt{$seclevelr})) { |
if (defined($$courseopt{$seclevelr})) { |
$outpar[4]=$$courseopt{$seclevelr}; |
$outpar[7]=$$courseopt{$seclevelr}; |
$result=4; |
$result=7; |
} |
} |
} |
} |
|
# ------------------------------------------------------ fifth, check course group |
|
if (defined($cgroup)) { |
|
if (defined($$courseopt{$grplevel})) { |
|
$outpar[6]=$$courseopt{$grplevel}; |
|
$result=6; |
|
} |
|
if (defined($$courseopt{$grplevelm})) { |
|
$outpar[5]=$$courseopt{$grplevelm}; |
|
$result=5; |
|
} |
|
if (defined($$courseopt{$grplevelr})) { |
|
$outpar[4]=$$courseopt{$grplevelr}; |
|
$result=4; |
|
} |
|
} |
|
|
# ---------------------------------------------------------- fifth, check user |
# ---------------------------------------------------------- fifth, check user |
|
|
Line 251 sub rulescache {
|
Line 269 sub rulescache {
|
if ($rulesid ne $env{'request.course.id'}) { |
if ($rulesid ne $env{'request.course.id'}) { |
%rules=(); |
%rules=(); |
} |
} |
unless ($rules{$id}) { |
unless (defined($rules{$id})) { |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
$rulesid=$env{'request.course.id'}; |
$rulesid=$env{'request.course.id'}; |
} |
} |
return $rules{$id}; |
return $rules{$id}; |
} |
} |
|
|
|
sub preset_defaults { |
|
my $type=shift; |
|
if (&rulescache($type.'_action') eq 'default') { |
|
# yes, there is something |
|
return (&rulescache($type.'_hours'), |
|
&rulescache($type.'_min'), |
|
&rulescache($type.'_sec'), |
|
&rulescache($type.'_value')); |
|
} else { |
|
# nothing there or something else |
|
return ('','','','',''); |
|
} |
|
} |
|
|
|
################################################## |
|
|
|
sub date_sanity_info { |
|
my $checkdate=shift; |
|
unless ($checkdate) { return ''; } |
|
my $result=''; |
|
my $crsprefix='course.'.$env{'request.course.id'}.'.'; |
|
if ($env{$crsprefix.'default_enrollment_end_date'}) { |
|
if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) { |
|
$result.='<br />'.&mt('After course enrollment end!'); |
|
} |
|
} |
|
if ($env{$crsprefix.'default_enrollment_start_date'}) { |
|
if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) { |
|
$result.='<br />'.&mt('Before course enrollment start!'); |
|
} |
|
} |
|
return $result; |
|
} |
################################################## |
################################################## |
################################################## |
################################################## |
# |
# |
Line 275 sub rulescache {
|
Line 326 sub rulescache {
|
# - userdomain |
# - userdomain |
|
|
sub storeparm { |
sub storeparm { |
my ($sresid,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; |
my ($sresid,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
&storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec); |
&storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,'',$cgroup); |
} |
} |
|
|
# |
# |
Line 291 sub storeparm {
|
Line 342 sub storeparm {
|
# - username |
# - username |
# - userdomain |
# - userdomain |
|
|
|
my %recstack; |
sub storeparm_by_symb { |
sub storeparm_by_symb { |
|
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
|
unless ($recflag) { |
|
# first time call |
|
%recstack=(); |
|
$recflag=1; |
|
} |
|
# store parameter |
|
&storeparm_by_symb_inner |
|
($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup); |
|
# don't do anything if parameter was reset |
|
unless ($nval) { return; } |
|
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
|
# remember that this was set |
|
$recstack{$parm}=1; |
|
# what does this trigger? |
|
foreach my $triggered (split(/\:/,&rulescache($parm.'_triggers'))) { |
|
# don't backfire |
|
unless ((!$triggered) || ($recstack{$triggered})) { |
|
my $action=&rulescache($triggered.'_action'); |
|
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
|
# set triggered parameter on same level |
|
my $newspnam=$prefix.$triggered; |
|
my $newvalue=''; |
|
my $active=1; |
|
if ($action=~/^when\_setting/) { |
|
# are there restrictions? |
|
if (&rulescache($triggered.'_triggervalue')=~/\w/) { |
|
$active=0; |
|
foreach my $possiblevalue (split(/\s*\,\s*/,&rulescache($triggered.'_triggervalue'))) { |
|
if (lc($possiblevalue) eq lc($nval)) { $active=1; } |
|
} |
|
} |
|
$newvalue=&rulescache($triggered.'_value'); |
|
} else { |
|
my $totalsecs=((&rulescache($triggered.'_days')*24+&rulescache($triggered.'_hours'))*60+&rulescache($triggered.'_min'))*60+&rulescache($triggered.'_sec'); |
|
if ($action=~/^later\_than/) { |
|
$newvalue=$nval+$totalsecs; |
|
} else { |
|
$newvalue=$nval-$totalsecs; |
|
} |
|
} |
|
if ($active) { |
|
&storeparm_by_symb($symb,$newspnam,$snum,$newvalue,&rulescache($triggered.'_type'), |
|
$uname,$udom,$csec,$recflag,$cgroup); |
|
} |
|
} |
|
} |
|
return ''; |
|
} |
|
|
|
{ |
|
my $logid; |
|
sub log_parmset { |
|
my ($storehash,$delflag,$uname,$udom)=@_; |
|
my $logentry=join(',',map { |
|
&Apache::lonnet::escape($_).'=>'.&Apache::lonnet::escape($$storehash{$_}); |
|
} keys %$storehash); |
|
$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.'_delflag' => $delflag, |
|
$id.'_logentry' => $logentry, |
|
$id.'_uname' => $uname, |
|
$id.'_udom' => $udom, |
|
}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'} |
|
); |
|
} |
|
} |
|
|
|
sub storeparm_by_symb_inner { |
# ---------------------------------------------------------- Get symb, map, etc |
# ---------------------------------------------------------- Get symb, map, etc |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
# ---------------------------------------------------------- Construct prefixes |
# ---------------------------------------------------------- Construct prefixes |
$spnam=~s/\_([^\_]+)$/\.$1/; |
$spnam=~s/\_([^\_]+)$/\.$1/; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $symbparm=$symb.'.'.$spnam; |
my $symbparm=$symb.'.'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
|
|
|
my $grplevel=$env{'request.course.id'}.'.['.$cgroup.'].'.$spnam; |
|
my $grplevelr=$env{'request.course.id'}.'.['.$cgroup.'].'.$symbparm; |
|
my $grplevelm=$env{'request.course.id'}.'.['.$cgroup.'].'.$mapparm; |
|
|
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
Line 309 sub storeparm_by_symb {
|
Line 442 sub storeparm_by_symb {
|
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
my $storeunder=''; |
my $storeunder=''; |
if (($snum==11) || ($snum==3)) { $storeunder=$courselevel; } |
if (($snum==14) || ($snum==3)) { $storeunder=$courselevel; } |
if (($snum==10) || ($snum==2)) { $storeunder=$courselevelm; } |
if (($snum==13) || ($snum==2)) { $storeunder=$courselevelm; } |
if (($snum==7) || ($snum==1)) { $storeunder=$courselevelr; } |
if (($snum==10) || ($snum==1)) { $storeunder=$courselevelr; } |
if ($snum==6) { $storeunder=$seclevel; } |
if ($snum==9) { $storeunder=$seclevel; } |
if ($snum==5) { $storeunder=$seclevelm; } |
if ($snum==8) { $storeunder=$seclevelm; } |
if ($snum==4) { $storeunder=$seclevelr; } |
if ($snum==7) { $storeunder=$seclevelr; } |
|
if ($snum==6) { $storeunder=$grplevel; } |
|
if ($snum==5) { $storeunder=$grplevelm; } |
|
if ($snum==4) { $storeunder=$grplevelr; } |
|
|
|
|
my $delete; |
my $delete; |
if ($nval eq '') { $delete=1;} |
if ($nval eq '') { $delete=1;} |
Line 328 sub storeparm_by_symb {
|
Line 465 sub storeparm_by_symb {
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
# Expire sheets |
# Expire sheets |
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','studentcalc'); |
if (($snum==7) || ($snum==4)) { |
if (($snum==10) || ($snum==7) || ($snum==4)) { |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
} elsif (($snum==8) || ($snum==5)) { |
} elsif (($snum==11) || ($snum==8) || ($snum==5)) { |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
} else { |
} else { |
&Apache::lonnet::expirespread('','','assesscalc'); |
&Apache::lonnet::expirespread('','','assesscalc'); |
Line 339 sub storeparm_by_symb {
|
Line 476 sub storeparm_by_symb {
|
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
|
&log_parmset(\%storecontent,1); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$cdom,$cnum); |
('resourcedata',\%storecontent,$cdom,$cnum); |
|
&log_parmset(\%storecontent); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
} else { |
} else { |
Line 362 sub storeparm_by_symb {
|
Line 501 sub storeparm_by_symb {
|
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
|
&log_parmset(\%storecontent,1,$uname,$udom); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$udom,$uname); |
('resourcedata',\%storecontent,$udom,$uname); |
|
&log_parmset(\%storecontent,0,$uname,$udom); |
} |
} |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
} |
} |
Line 424 sub valout {
|
Line 565 sub valout {
|
} |
} |
$result=~s/\s+$//; |
$result=~s/\s+$//; |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = localtime($value); |
$result = localtime($value).&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
} |
} |
Line 460 sub plink {
|
Line 601 sub plink {
|
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
} |
} |
} |
} |
|
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
|
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
return |
unless (defined($winvalue)) { $winvalue=$val; } |
|
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
&valout($value,$type).'</a><a name="'.$marker.'"></a>'; |
&valout($value,$type).'</a></td></tr></table>'; |
} |
} |
|
|
sub startpage { |
sub page_js { |
my $r=shift; |
|
|
|
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
|
'onUnload="pclose()"'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table Mode Parameter Setting'); |
|
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDHEAD); |
return(<<ENDJS); |
$html |
<script type="text/javascript"> |
<head> |
|
<title>LON-CAPA Course Parameters</title> |
|
<script> |
|
|
|
function pclose() { |
function pclose() { |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
Line 523 $html
|
Line 658 $html
|
} |
} |
</script> |
</script> |
$selscript |
$selscript |
</head> |
ENDJS |
$bodytag |
|
|
} |
|
sub startpage { |
|
my ($r) = @_; |
|
|
|
my %loaditems = ('onunload' => "pclose()", |
|
'onload' => "group_or_section('cgroup')",); |
|
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
|
&page_js(), |
|
{'add_entries' => \%loaditems,}); |
|
my $breadcrumbs = |
|
&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Table Mode Parameter Setting'); |
|
$r->print(<<ENDHEAD); |
|
$start_page |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<input type="hidden" value='' name="pres_value"> |
<input type="hidden" value='' name="pres_value" /> |
<input type="hidden" value='' name="pres_type"> |
<input type="hidden" value='' name="pres_type" /> |
<input type="hidden" value='' name="pres_marker"> |
<input type="hidden" value='' name="pres_marker" /> |
<input type="hidden" value='1' name="prevvisit"> |
<input type="hidden" value='1' name="prevvisit" /> |
ENDHEAD |
ENDHEAD |
} |
} |
|
|
|
|
sub print_row { |
sub print_row { |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
$defbgtwo,$parmlev,$uname,$udom,$csec)=@_; |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
# get the values for the parameter in cascading order |
# get the values for the parameter in cascading order |
# empty levels will remain empty |
# empty levels will remain empty |
my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which}, |
my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which}, |
$rid,$$default{$which},$uname,$udom,$csec); |
$rid,$$default{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
# get the type for the parameters |
# get the type for the parameters |
# problem: these may not be set for all levels |
# problem: these may not be set for all levels |
my ($typeresult,@typeoutpar)=&parmval($$part{$which}.'.'. |
my ($typeresult,@typeoutpar)=&parmval($$part{$which}.'.'. |
$$name{$which}.'.type', |
$$name{$which}.'.type',$rid, |
$rid,$$defaulttype{$which},$uname,$udom,$csec); |
$$defaulttype{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
# cascade down manually |
# cascade down manually |
my $cascadetype=$$defaulttype{$which}; |
my $cascadetype=$$defaulttype{$which}; |
for (my $i=11;$i>0;$i--) { |
for (my $i=14;$i>0;$i--) { |
if ($typeoutpar[$i]) { |
if ($typeoutpar[$i]) { |
$cascadetype=$typeoutpar[$i]; |
$cascadetype=$typeoutpar[$i]; |
} else { |
} else { |
Line 564 sub print_row {
|
Line 718 sub print_row {
|
} else { |
} else { |
$parm=~s|\[.*\]\s||g; |
$parm=~s|\[.*\]\s||g; |
} |
} |
|
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
|
if ($automatic) { |
|
$parm.='<font color="red"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</font>'; |
|
} |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
|
|
my $thismarker=$which; |
my $thismarker=$which; |
$thismarker=~s/^parameter\_//; |
$thismarker=~s/^parameter\_//; |
my $mprefix=$rid.'&'.$thismarker.'&'; |
my $mprefix=$rid.'&'.$thismarker.'&'; |
|
my $effective_parm = &valout($outpar[$result],$typeoutpar[$result]); |
|
my ($othergrp,$grp_parm,$controlgrp); |
|
|
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
} elsif ($cgroup) { |
|
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,11,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
} elsif ($cgroup) { |
|
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
} else { |
} else { |
|
if ($uname) { |
|
if (@{$usersgroups} > 1) { |
|
my ($coursereply,$grp_parm,$controlgrp); |
|
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
|
&print_usergroups($r,$$part{$which}.'.'.$$name{$which}, |
|
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); |
|
if ($coursereply && $result > 3) { |
|
if (defined($controlgrp)) { |
|
if ($cgroup ne $controlgrp) { |
|
$effective_parm = $grp_parm; |
|
$result = 0; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
&print_td($r,11,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
|
|
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
&print_td($r,8,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
&print_td($r,7,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
|
if ($cgroup) { |
|
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
} |
|
|
if ($uname) { |
if ($uname) { |
|
if ($othergrp) { |
|
$r->print($othergrp); |
|
} |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
} # end of $parmlev if/else |
} # end of $parmlev if/else |
|
$r->print('<td bgcolor="#CCCCFF" align="center">'.$effective_parm.'</td>'); |
$r->print('<td bgcolor=#CCCCFF align="center">'. |
|
&valout($outpar[$result],$typeoutpar[$result]).'</td>'); |
|
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
'.'.$$name{$which},$$symbp{$rid}); |
'.'.$$name{$which},$$symbp{$rid}); |
my $sessionvaltype=$typeoutpar[$result]; |
my $sessionvaltype=$typeoutpar[$result]; |
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
$r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'. |
$r->print('<td bgcolor="#999999" align="center"><font color="#FFFFFF">'. |
&valout($sessionval,$sessionvaltype).' '. |
&valout($sessionval,$sessionvaltype).' '. |
'</font></td>'); |
'</font></td>'); |
} |
} |
Line 631 sub print_td {
|
Line 818 sub print_td {
|
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
$r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg). |
$r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg). |
' align="center">'); |
' align="center">'); |
if ($which<8 || $which > 9) { |
if ($which<11 || $which > 12) { |
$r->print(&plink($$typeoutpar[$which], |
$r->print(&plink($$typeoutpar[$which], |
$$display{$value},$$outpar[$which], |
$$display{$value},$$outpar[$which], |
$mprefix."$which",'parmform.pres','psub')); |
$mprefix."$which",'parmform.pres','psub')); |
Line 641 sub print_td {
|
Line 828 sub print_td {
|
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
|
|
|
sub print_usergroups { |
|
my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
|
my $courseid = $env{'request.course.id'}; |
|
my $output; |
|
my $symb = &symbcache($rid); |
|
my $symbparm=$symb.'.'.$what; |
|
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
|
my $mapparm=$map.'___(all).'.$what; |
|
my ($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype) = |
|
&parm_control_group($courseid,$usersgroups,$symbparm,$mapparm,$what, |
|
$courseopt); |
|
my $bgcolor = $defbg; |
|
my $grp_parm; |
|
if (($coursereply) && ($cgroup ne $resultgroup)) { |
|
if ($result > 3) { |
|
$bgcolor = '"#AAFFAA"'; |
|
$grp_parm = &valout($coursereply,$resulttype); |
|
} |
|
$grp_parm = &valout($coursereply,$resulttype); |
|
$output = '<td bgcolor='.$bgcolor.' align="center">'; |
|
if ($resultgroup && $resultlevel) { |
|
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm; |
|
} else { |
|
$output .= ' '; |
|
} |
|
$output .= '</td>'; |
|
} else { |
|
$output .= '<td bgcolor='.$bgcolor.'> </td>'; |
|
} |
|
return ($coursereply,$output,$grp_parm,$resultgroup); |
|
} |
|
|
|
sub parm_control_group { |
|
my ($courseid,$usersgroups,$symbparm,$mapparm,$what,$courseopt) = @_; |
|
my ($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); |
|
my $grpfound = 0; |
|
my @levels = ($symbparm,$mapparm,$what); |
|
my @levelnames = ('resource','map/folder','general'); |
|
foreach my $group (@{$usersgroups}) { |
|
if ($grpfound) { last; } |
|
for (my $i=0; $i<@levels; $i++) { |
|
my $item = $courseid.'.['.$group.'].'.$levels[$i]; |
|
if (defined($$courseopt{$item})) { |
|
$coursereply = $$courseopt{$item}; |
|
$resultitem = $item; |
|
$resultgroup = $group; |
|
$resultlevel = $levelnames[$i]; |
|
$resulttype = $$courseopt{$item.'.type'}; |
|
$grpfound = 1; |
|
last; |
|
} |
|
} |
|
} |
|
return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); |
|
} |
|
|
=pod |
=pod |
|
|
Line 836 ENDSCRIPT
|
Line 1078 ENDSCRIPT
|
$r->print("\n<table><tr>"); |
$r->print("\n<table><tr>"); |
my $cnt=0; |
my $cnt=0; |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print("\n<td><font size='-1'><input type='checkbox' name='pscat' "); |
$r->print("\n<td><font size='-1'><label><input type='checkbox' name='pscat' "); |
$r->print('value="'.$tempkey.'"'); |
$r->print('value="'.$tempkey.'"'); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print(' checked'); |
$r->print(' checked'); |
} |
} |
$r->print('>'.$$allparms{$tempkey}.'</font></td>'); |
$r->print('>'.$$allparms{$tempkey}.'</label></font></td>'); |
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==3) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
Line 850 ENDSCRIPT
|
Line 1092 ENDSCRIPT
|
} |
} |
$r->print(' |
$r->print(' |
</tr><tr><td> |
</tr><tr><td> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
<a href="javascript:checkstandard()">Select Common Only</a> |
<a href="javascript:checkstandard()">Select Common Only</a> |
</td><td> |
</td><td> |
<a href="javascript:checkdates()">Add Problem Dates</a> |
<a href="javascript:checkdates()">Add Problem Dates</a> |
<a href="javascript:checkcontdates()">Add Content Dates</a><br /> |
<a href="javascript:checkcontdates()">Add Content Dates</a><br /> |
<a href="javascript:checkdisset()">Add Discussion Settings</a> |
<a href="javascript:checkdisset()">Add Discussion Settings</a> |
<a href="javascript:checkvisi()">Add Visibilities</a><br /> |
<a href="javascript:checkvisi()">Add Visibilities</a><br /> |
<a href="javascript:checkparts()">Add Part Parameters</a> |
<a href="javascript:checkparts()">Add Part Parameters</a> |
</td><td> |
</td><td> |
<a href="javascript:checkall(false, \'pscat\')">Unselect All</a> |
<a href="javascript:checkall(false, \'pscat\')">Unselect All</a> |
</td> |
</td> |
'); |
'); |
$r->print('</tr></table>'); |
$r->print('</tr></table>'); |
Line 873 sub partmenu {
|
Line 1115 sub partmenu {
|
$r->print('>'.&mt('All Parts').'</option>'); |
$r->print('>'.&mt('All Parts').'</option>'); |
my %temphash=(); |
my %temphash=(); |
foreach (@{$psprt}) { $temphash{$_}=1; } |
foreach (@{$psprt}) { $temphash{$_}=1; } |
foreach my $tempkey (sort keys %{$allparts}) { |
foreach my $tempkey (sort { |
|
if ($a==$b) { return ($a cmp $b) } else { return ($a <=> $b); } |
|
} keys(%{$allparts})) { |
unless ($tempkey =~ /\./) { |
unless ($tempkey =~ /\./) { |
$r->print('<option value="'.$tempkey.'"'); |
$r->print('<option value="'.$tempkey.'"'); |
if ($$psprt[0] eq "all" || $temphash{$tempkey}) { |
if ($$psprt[0] eq "all" || $temphash{$tempkey}) { |
Line 886 sub partmenu {
|
Line 1130 sub partmenu {
|
} |
} |
|
|
sub usermenu { |
sub usermenu { |
my ($r,$uname,$id,$udom,$csec)=@_; |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_; |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'sg' => "Section/Group", |
'se' => "Section", |
|
'gr' => "Group", |
'fu' => "For User", |
'fu' => "For User", |
'oi' => "or ID", |
'oi' => "or ID", |
'ad' => "at Domain" |
'ad' => "at Domain" |
); |
); |
my %sectionhash=(); |
my %sectionhash=(); |
my $sections=''; |
my $sections=''; |
if (&Apache::loncommon::get_sections( |
my $numsec = &Apache::loncommon::get_sections( |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
\%sectionhash)) { |
\%sectionhash); |
$sections=$lt{'sg'}.': <select name="csec">'; |
my $groups; |
foreach ('',sort keys %sectionhash) { |
my %grouphash; |
$sections.='<option value="'.$_.'"'. |
my $numgrp = &Apache::loncommon::coursegroups( |
($_ eq $csec?'selected="selected"':'').'>'.$_.'</option>'; |
\%grouphash, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
if ($numsec > 0) { |
|
$sections=$lt{'se'}.': <select name="csec"'; |
|
if ($numsec && $numgrp && $parmlev ne 'full') { |
|
$sections .= qq| onchange="group_or_section('csec')" |; |
|
} |
|
$sections .= '>'; |
|
foreach my $section ('',sort keys %sectionhash) { |
|
$sections.='<option value="'.$section.'" '. |
|
($section eq $csec?'selected="selected"':'').'>'.$section. |
|
'</option>'; |
} |
} |
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
$r->print(<<ENDMENU); |
if ($numsec && $numgrp && $parmlev ne 'full') { |
|
$sections .= ' or '; |
|
$sections .= qq| |
|
<script type="text/javascript"> |
|
function group_or_section(caller) { |
|
if (caller == "cgroup") { |
|
if (document.parmform.cgroup.selectedIndex != 0) { |
|
document.parmform.csec.selectedIndex = 0; |
|
} |
|
} else { |
|
if (document.parmform.csec.selectedIndex != 0) { |
|
document.parmform.cgroup.selectedIndex = 0; |
|
} |
|
} |
|
} |
|
</script> |
|
|; |
|
} else { |
|
$sections .= qq| |
|
<script type="text/javascript"> |
|
function group_or_section(caller) { |
|
return; |
|
} |
|
</script> |
|
|; |
|
} |
|
if ($numgrp > 0) { |
|
$groups=$lt{'gr'}.': <select name="cgroup"'; |
|
if ($numsec && $numgrp && $env{'form.action'} eq 'settable') { |
|
$groups .= qq| onchange="group_or_section('cgroup')" |; |
|
} |
|
$groups .= '>'; |
|
foreach my $grp ('',sort keys %grouphash) { |
|
$groups.='<option value="'.$grp.'" '; |
|
if ($grp eq $cgroup) { |
|
unless ((defined($uname)) && ($grp eq '')) { |
|
$groups .= 'selected="selected" '; |
|
} |
|
} elsif (!defined($cgroup)) { |
|
if (@{$usersgroups} == 1) { |
|
if ($grp eq $$usersgroups[0]) { |
|
$groups .= 'selected="selected" '; |
|
} |
|
} |
|
} |
|
$groups .= '>'.$grp.'</option>'; |
|
} |
|
$groups.='</select>'; |
|
} |
|
$r->print(<<ENDMENU); |
<b> |
<b> |
$sections |
$sections |
|
$groups |
<br /> |
<br /> |
$lt{'fu'} |
$lt{'fu'} |
<input type="text" value="$uname" size="12" name="uname" /> |
<input type="text" value="$uname" size="12" name="uname" /> |
Line 935 sub displaymenu {
|
Line 1242 sub displaymenu {
|
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
$r->print(&mt('Select Enclosing Map or Folder').' '); |
$r->print('<b>'.&mt('Select Enclosing Map or Folder').'</b> '); |
$r->print('<select name="pschp">'); |
$r->print('<select name="pschp">'); |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
Line 948 sub mapmenu {
|
Line 1255 sub mapmenu {
|
|
|
sub levelmenu { |
sub levelmenu { |
my ($r,$alllevs,$parmlev)=@_; |
my ($r,$alllevs,$parmlev)=@_; |
$r->print(&mt('Select Parameter Level'). |
$r->print('<b>'.&mt('Select Parameter Level'). |
&Apache::loncommon::help_open_topic('Course_Parameter_Levels').' '); |
&Apache::loncommon::help_open_topic('Course_Parameter_Levels').'</b> '); |
$r->print('<select name="parmlev">'); |
$r->print('<select name="parmlev">'); |
foreach (reverse sort keys %{$alllevs}) { |
foreach (reverse sort keys %{$alllevs}) { |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
Line 965 sub levelmenu {
|
Line 1272 sub levelmenu {
|
sub sectionmenu { |
sub sectionmenu { |
my ($r,$selectedsections)=@_; |
my ($r,$selectedsections)=@_; |
my %sectionhash=(); |
my %sectionhash=(); |
|
my $sections=''; |
if (&Apache::loncommon::get_sections( |
my $numsec = &Apache::loncommon::get_sections( |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
\%sectionhash)) { |
\%sectionhash); |
|
if ($numsec) { |
$r->print('<select name="Section" multiple="true" size="8" >'); |
$r->print('<select name="Section" multiple="true" size="8" >'); |
foreach my $s ('all',sort keys %sectionhash) { |
foreach my $s ('all',sort keys %sectionhash) { |
$r->print(' <option value="'.$s.'"'); |
$r->print(' <option value="'.$s.'"'); |
Line 981 sub sectionmenu {
|
Line 1289 sub sectionmenu {
|
} |
} |
$r->print('>'.$s."</option>\n"); |
$r->print('>'.$s."</option>\n"); |
} |
} |
$r->print("</select>\n"); |
$r->print("</select>\n"); |
|
} |
|
} |
|
|
|
sub groupmenu { |
|
my ($r,$selectedgroups)=@_; |
|
my %grouphash; |
|
my $numgrp = &Apache::loncommon::coursegroups( |
|
\%grouphash, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
if ($numgrp) { |
|
$r->print('<select name="Group" multiple="true" size="8" >'); |
|
foreach my $group (sort(keys(%grouphash))) { |
|
$r->print(' <option value="'.$group.'"'); |
|
foreach (@{$selectedgroups}) { |
|
if ($group eq $_) { |
|
$r->print(' selected'); |
|
last; |
|
} |
|
} |
|
$r->print('>'.$group."</option>\n"); |
|
} |
|
$r->print("</select>\n"); |
} |
} |
} |
} |
|
|
|
|
sub keysplit { |
sub keysplit { |
my $keyp=shift; |
my $keyp=shift; |
return (split(/\,/,$keyp)); |
return (split(/\,/,$keyp)); |
Line 997 sub keysinorder {
|
Line 1329 sub keysinorder {
|
} (keys %{$name}); |
} (keys %{$name}); |
} |
} |
|
|
|
sub keysinorder_bytype { |
|
my ($name,$keyorder)=@_; |
|
return sort { |
|
my $ta=(split('_',$a))[-1]; |
|
my $tb=(split('_',$b))[-1]; |
|
if ($$keyorder{'parameter_0_'.$ta} == $$keyorder{'parameter_0_'.$tb}) { |
|
return ($a cmp $b); |
|
} |
|
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb}; |
|
} (keys %{$name}); |
|
} |
|
|
sub keysindisplayorder { |
sub keysindisplayorder { |
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
Line 1006 sub keysindisplayorder {
|
Line 1350 sub keysindisplayorder {
|
|
|
sub sortmenu { |
sub sortmenu { |
my ($r,$sortorder)=@_; |
my ($r,$sortorder)=@_; |
$r->print('<br /><input type="radio" name="sortorder" value="realmstudent"'); |
$r->print('<br /><label><input type="radio" name="sortorder" value="realmstudent"'); |
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
$r->print(' checked="on"'); |
$r->print(' checked="on"'); |
} |
} |
$r->print(' />'.&mt('Sort by realm first, then student (group/section)')); |
$r->print(' />'.&mt('Sort by realm first, then student (group/section)')); |
$r->print('<br /><input type="radio" name="sortorder" value="studentrealm"'); |
$r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"'); |
if ($sortorder eq 'studentrealm') { |
if ($sortorder eq 'studentrealm') { |
$r->print(' checked="on"'); |
$r->print(' checked="on"'); |
} |
} |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm')); |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm'). |
|
'</label>'); |
} |
} |
|
|
sub standardkeyorder { |
sub standardkeyorder { |
Line 1092 sub assessparms {
|
Line 1437 sub assessparms {
|
my $udom; |
my $udom; |
my $uhome; |
my $uhome; |
my $csec; |
my $csec; |
|
my $cgroup; |
|
my $grouplist; |
|
my @usersgroups = (); |
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
Line 1113 sub assessparms {
|
Line 1461 sub assessparms {
|
my $message=''; |
my $message=''; |
|
|
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
|
$cgroup=$env{'form.cgroup'}; |
|
|
if ($udom=$env{'form.udom'}) { |
if ($udom=$env{'form.udom'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
Line 1179 sub assessparms {
|
Line 1528 sub assessparms {
|
} else { |
} else { |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
|
|
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message="<font color=red>". |
$message="<font color=red>". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("not in this course")."</font>"; |
&mt("not in this course")."</font>"; |
$uname=''; |
$uname=''; |
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
|
$cgroup=$env{'form.cgroup'}; |
} else { |
} else { |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
('firstname','middlename','lastname','generation','id')); |
('firstname','middlename','lastname','generation','id')); |
Line 1193 sub assessparms {
|
Line 1544 sub assessparms {
|
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
} |
} |
|
$grouplist = &Apache::lonnet::get_users_groups( |
|
$udom,$uname,$env{'request.course.id'}); |
|
if ($grouplist) { |
|
@usersgroups = &Apache::lonnet::sort_course_groups($grouplist, |
|
$env{'request.course.id'}); |
|
unless (grep/^\Q$cgroup\E$/,@usersgroups) { |
|
$cgroup = $usersgroups[0]; |
|
} |
|
} else { |
|
$cgroup = ''; |
|
} |
} |
} |
} |
} |
|
|
unless ($csec) { $csec=''; } |
unless ($csec) { $csec=''; } |
|
unless ($cgroup) { $cgroup=''; } |
|
|
# --------------------------------------------------------- Get all assessments |
# --------------------------------------------------------- Get all assessments |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
Line 1215 sub assessparms {
|
Line 1578 sub assessparms {
|
$message.=&storeparm(split(/\&/,$markers[$i]), |
$message.=&storeparm(split(/\&/,$markers[$i]), |
$values[$i], |
$values[$i], |
$types[$i], |
$types[$i], |
$uname,$udom,$csec); |
$uname,$udom,$csec,$cgroup); |
} |
} |
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>'; |
$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>'; |
Line 1247 sub assessparms {
|
Line 1610 sub assessparms {
|
} else { |
} else { |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
$r->print(&mt('Specific Resource').": ".$resource. |
$r->print(&mt('Specific Resource').": ".$resource. |
'<input type="hidden" value="'.$pssymb.'" name="symb"><br />'); |
'<input type="hidden" value="'.$pssymb.'" name="symb">'. |
|
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
|
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
} |
} |
&usermenu($r,$uname,$id,$udom,$csec); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
|
|
$r->print('<p>'.$message.'</p>'); |
$r->print('<p>'.$message.'</p>'); |
|
|
Line 1271 sub assessparms {
|
Line 1636 sub assessparms {
|
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?8:5; |
|
my $userspan=3; |
|
if ($cgroup ne '') { |
|
$coursespan += 3; |
|
} |
|
|
$r->print('<p><table border=2>'); |
$r->print('<p><table border=2>'); |
$r->print('<tr><td colspan=5></td>'); |
$r->print('<tr><td colspan=5></td>'); |
$r->print('<th colspan='.($coursespan).'>'.&mt('Any User').'</th>'); |
$r->print('<th colspan='.($coursespan).'>'.&mt('Any User').'</th>'); |
if ($uname) { |
if ($uname) { |
$r->print("<th colspan=3 rowspan=2>"); |
if (@usersgroups > 1) { |
|
$userspan ++; |
|
} |
|
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
} |
} |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
Line 1304 sub assessparms {
|
Line 1677 sub assessparms {
|
ENDTABLETWO |
ENDTABLETWO |
if ($csec) { |
if ($csec) { |
$r->print("<th colspan=3>". |
$r->print("<th colspan=3>". |
&mt("in Section/Group")." $csec</th>"); |
&mt("in Section")." $csec</th>"); |
|
} |
|
if ($cgroup) { |
|
$r->print("<th colspan=3>". |
|
&mt("in Group")." $cgroup</th>"); |
} |
} |
$r->print(<<ENDTABLEHEADFOUR); |
$r->print(<<ENDTABLEHEADFOUR); |
</tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th> |
</tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th> |
Line 1317 ENDTABLEHEADFOUR
|
Line 1694 ENDTABLEHEADFOUR
|
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
} |
} |
|
|
|
if ($cgroup) { |
|
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
|
} |
|
|
if ($uname) { |
if ($uname) { |
|
if (@usersgroups > 1) { |
|
$r->print('<th>'.&mt('Control by other group?').'</th>'); |
|
} |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
} |
} |
|
|
Line 1325 ENDTABLEHEADFOUR
|
Line 1709 ENDTABLEHEADFOUR
|
|
|
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
|
my $defbgthree = ''; |
|
|
foreach (@ids) { |
foreach (@ids) { |
|
|
Line 1346 ENDTABLEHEADFOUR
|
Line 1731 ENDTABLEHEADFOUR
|
} else { |
} else { |
$defbgtwo='"#FFFF99"'; |
$defbgtwo='"#FFFF99"'; |
} |
} |
|
if ($defbgthree eq '"#FFBB99"') { |
|
$defbgthree='"#FFBBDD"'; |
|
} else { |
|
$defbgthree='"#FFBB99"'; |
|
} |
|
|
my $thistitle=''; |
my $thistitle=''; |
my %name= (); |
my %name= (); |
undef %name; |
undef %name; |
Line 1371 ENDTABLEHEADFOUR
|
Line 1762 ENDTABLEHEADFOUR
|
my $totalparms=scalar keys %name; |
my $totalparms=scalar keys %name; |
if ($totalparms>0) { |
if ($totalparms>0) { |
my $firstrow=1; |
my $firstrow=1; |
my $title=&Apache::lonnet::gettitle($uri); |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
$r->print('<tr><td bgcolor='.$defbgone. |
$r->print('<tr><td bgcolor='.$defbgone. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'><tt><font size=-1>'. |
'><tt><font size=-1>'. |
join(' / ',split(/\//,$uri)). |
join(' / ',split(/\//,$uri)). |
'</font></tt><p><b>'. |
'</font></tt><p><b>'. |
"<a href=\"javascript:openWindow('". |
"<a href=\"javascript:openWindow('". |
&Apache::lonnet::clutter($uri). |
&Apache::lonnet::clutter($uri).'?symb='. |
|
&Apache::lonnet::escape($symbp{$rid}). |
"', 'metadatafile', '450', '500', 'no', 'yes')\";". |
"', 'metadatafile', '450', '500', 'no', 'yes')\";". |
" TARGET=_self>$title"); |
" TARGET=_self>$title"); |
|
|
Line 1392 ENDTABLEHEADFOUR
|
Line 1784 ENDTABLEHEADFOUR
|
|
|
$r->print('<td bgcolor='.$defbgone. |
$r->print('<td bgcolor='.$defbgone. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'><tt><font size=-1>'); |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
|
|
$r->print(' / res / '); |
|
$r->print(join(' / ', split(/\//,$mapp{$rid}))); |
|
|
|
$r->print('</font></tt></td>'); |
|
|
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder_bytype(\%name,\%keyorder)) { |
unless ($firstrow) { |
unless ($firstrow) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
} else { |
} else { |
undef $firstrow; |
undef $firstrow; |
} |
} |
|
|
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$parmlev,$uname,$udom,$csec); |
$defbgthree,$parmlev,$uname,$udom,$csec, |
|
$cgroup,\@usersgroups); |
} |
} |
} |
} |
} |
} |
Line 1420 ENDTABLEHEADFOUR
|
Line 1807 ENDTABLEHEADFOUR
|
if ($parmlev eq 'map') { |
if ($parmlev eq 'map') { |
my $defbgone = '"E0E099"'; |
my $defbgone = '"E0E099"'; |
my $defbgtwo = '"FFFF99"'; |
my $defbgtwo = '"FFFF99"'; |
|
my $defbgthree = '"FFBB99"'; |
|
|
my %maplist; |
my %maplist; |
|
|
Line 1491 Set Defaults for All Resources in $folde
|
Line 1879 Set Defaults for All Resources in $folde
|
Specifically for |
Specifically for |
ENDMAPONE |
ENDMAPONE |
if ($uname) { |
if ($uname) { |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my $person=&Apache::loncommon::plainname($uname,$udom); |
('firstname','middlename','lastname','generation', 'id')); |
|
my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' |
|
.$name{'lastname'}.' '.$name{'generation'}; |
|
$r->print(&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ". |
$r->print(&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ". |
&mt('in')." \n"); |
&mt('in')." \n"); |
} else { |
} else { |
$r->print("<font color=\"red\"><i>".&mt('all').'</i></font> '.&mt('users in')." \n"); |
$r->print("<font color=\"red\"><i>".&mt('all').'</i></font> '.&mt('users in')." \n"); |
} |
} |
|
if ($cgroup) { |
if ($csec) {$r->print(&mt("Section")." <font color=\"red\"><i>$csec</i></font> ". |
$r->print(&mt("Group")." <font color=\"red\"><i>$cgroup". |
&mt('of')." \n")}; |
"</i></font> ".&mt('of')." \n"); |
|
$csec = ''; |
|
} elsif ($csec) { |
|
$r->print(&mt("Section")." <font color=\"red\"><i>$csec". |
|
"</i></font> ".&mt('of')." \n"); |
|
} |
$r->print("<font color=\"red\"><i>$coursename</i></font><br />"); |
$r->print("<font color=\"red\"><i>$coursename</i></font><br />"); |
$r->print("</h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
Line 1515 ENDMAPONE
|
Line 1904 ENDMAPONE
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec); |
$parmlev,$uname,$udom,$csec,$cgroup); |
} |
} |
$r->print("</table></center>"); |
$r->print("</table></center>"); |
} # end each map |
} # end each map |
Line 1525 ENDMAPONE
|
Line 1914 ENDMAPONE
|
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
my $defbgone = '"E0E099"'; |
my $defbgone = '"E0E099"'; |
my $defbgtwo = '"FFFF99"'; |
my $defbgtwo = '"FFFF99"'; |
|
my $defbgthree = '"FFBB99"'; |
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid="0.0"; |
my $mapid="0.0"; |
Line 1572 ENDMAPONE
|
Line 1962 ENDMAPONE
|
<font color="red"><i>$coursename</i></font><br /> |
<font color="red"><i>$coursename</i></font><br /> |
ENDMAPONE |
ENDMAPONE |
if ($uname) { |
if ($uname) { |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my $person=&Apache::loncommon::plainname($uname,$udom); |
('firstname','middlename','lastname','generation', 'id')); |
|
my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' |
|
.$name{'lastname'}.' '.$name{'generation'}; |
|
$r->print(" ".&mt("User")."<font color=\"red\"> <i>$uname \($person\) </i></font> \n"); |
$r->print(" ".&mt("User")."<font color=\"red\"> <i>$uname \($person\) </i></font> \n"); |
} else { |
} else { |
$r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n"); |
$r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n"); |
} |
} |
|
|
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
|
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
$r->print("</h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
Line 1592 ENDMAPONE
|
Line 1980 ENDMAPONE
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec); |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
|
$parmlev,$uname,$udom,$csec,$cgroup); |
} |
} |
$r->print("</table></center>"); |
$r->print("</table></center>"); |
} # end of $parmlev eq general |
} # end of $parmlev eq general |
} |
} |
$r->print('</form></body></html>'); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
|
|
Line 1622 Returns: nothing
|
Line 2011 Returns: nothing
|
sub crsenv { |
sub crsenv { |
my $r=shift; |
my $r=shift; |
my $setoutput=''; |
my $setoutput=''; |
my $bodytag=&Apache::loncommon::bodytag( |
|
'Set Course Environment Parameters'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef, |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef, |
'Edit Course Environment'); |
'Edit Course Environment'); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 1689 sub crsenv {
|
Line 2077 sub crsenv {
|
# |
# |
# Let the user know we made the changes |
# Let the user know we made the changes |
if ($name && defined($value)) { |
if ($name && defined($value)) { |
|
my $failed_cloners; |
if ($name eq 'cloners') { |
if ($name eq 'cloners') { |
|
$value =~ s/\s//g; |
$value =~ s/^,//; |
$value =~ s/^,//; |
$value =~ s/,$//; |
$value =~ s/,$//; |
|
# check requested clones are valid users. |
|
$failed_cloners = &check_cloners(\$value,\@oldcloner); |
} |
} |
my $put_result = &Apache::lonnet::put('environment', |
my $put_result = &Apache::lonnet::put('environment', |
{$name=>$value},$dom,$crs); |
{$name=>$value},$dom,$crs); |
Line 1708 sub crsenv {
|
Line 2100 sub crsenv {
|
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
} |
} |
|
if (($name eq 'cloners') && ($failed_cloners)) { |
|
$setoutput.= &mt('Unable to include').' - <b>'.$failed_cloners.'</b>, '. |
|
&mt('reason').' - '.&mt('LON-CAPA user(s) do(es) not exist'). |
|
'.<br />'.&mt('Please '). |
|
' <a href="/adm/createuser">'. |
|
&mt('add the user(s)').'</a>, '. |
|
&mt('and then return to the '). |
|
'<a href="/admparmset?action=crsenv">'. |
|
&mt('Course Parameters page').'</a> '. |
|
&mt('to add the new user(s) to the list of possible cloners'). |
|
'.<br />'; |
|
} |
} |
} |
} |
} |
# ------------------------- Re-init course environment entries for this session |
# ------------------------- Re-init course environment entries for this session |
Line 1791 sub crsenv {
|
Line 2195 sub crsenv {
|
=> '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'. |
=> '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'. |
'('.&mt('Set value to "[_1]" to allow',"<tt>yes</tt>").')', |
'('.&mt('Set value to "[_1]" to allow',"<tt>yes</tt>").')', |
'allow_discussion_post_editing' |
'allow_discussion_post_editing' |
=> '<b>'.&mt('Allow users to edit/delete their own discussion posts').'</b><br />'. |
=> '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />"<tt>st</tt>": '. |
'('.&mt('Set value to "[_1]" to allow',"<tt>yes</tt>").')', |
&mt('student').', "<tt>ta</tt>": '. |
|
'TA, "<tt>in</tt>": '. |
|
&mt('instructor').'; (<tt>'.&mt('role:section,role:section,..., e.g., st:001,st:002,in,cc would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').'</tt>)<br />'. |
|
'('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')', |
'rndseed' |
'rndseed' |
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'. |
'<font color="red">'.&mt('Modifying this will make problems').' '. |
'<font color="red">'.&mt('Modifying this will make problems').' '. |
Line 1801 sub crsenv {
|
Line 2208 sub crsenv {
|
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
&mt('This controls how receipt numbers are generated.'), |
&mt('This controls how receipt numbers are generated.'), |
'suppress_tries' |
'suppress_tries' |
=> '<b>'.&mt('Suppress number of tries in printing').'</b>('. |
=> '<b>'.&mt('Suppress number of tries in printing').'</b><br />'. |
&mt('yes if supress').')', |
' ('.&mt('"[_1]" to suppress, anything else to not suppress','<tt>yes</tt>').')', |
'problem_stream_switch' |
'problem_stream_switch' |
=> '<b>'.&mt('Allow problems to be split over pages').'</b><br />'. |
=> '<b>'.&mt('Allow problems to be split over pages').'</b><br />'. |
' ('.&mt('"[_1]" if allowed, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" if allowed, anything else if not','<tt>yes</tt>').')', |
Line 1825 sub crsenv {
|
Line 2232 sub crsenv {
|
'disablesigfigs' |
'disablesigfigs' |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'disableexampointprint' |
|
=> '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'. |
|
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'externalsyllabus' |
|
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
'tthoptions' |
'tthoptions' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>' |
); |
); |
my @Display_Order = ('url','description','courseid','cloners','grading', |
my @Display_Order = ('url','description','courseid','cloners','grading', |
|
'externalsyllabus', |
'default_xml_style','pageseparators', |
'default_xml_style','pageseparators', |
'question.email','comment.email','policy.email', |
'question.email','comment.email','policy.email', |
'student_classlist_view', |
'student_classlist_view', |
Line 1851 sub crsenv {
|
Line 2264 sub crsenv {
|
'default_enrollment_start_date', |
'default_enrollment_start_date', |
'default_enrollment_end_date', |
'default_enrollment_end_date', |
'tthoptions', |
'tthoptions', |
'disablesigfigs' |
'disablesigfigs', |
|
'disableexampointprint' |
); |
); |
foreach my $parameter (sort(keys(%values))) { |
foreach my $parameter (sort(keys(%values))) { |
unless ($parameter =~ m/^internal\./) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { |
if (! $descriptions{$parameter}) { |
if (! $descriptions{$parameter}) { |
$descriptions{$parameter}=$parameter; |
$descriptions{$parameter}=$parameter; |
push(@Display_Order,$parameter); |
push(@Display_Order,$parameter); |
Line 1906 sub crsenv {
|
Line 2320 sub crsenv {
|
my $Parameter=&mt('Parameter'); |
my $Parameter=&mt('Parameter'); |
my $Value=&mt('Value'); |
my $Value=&mt('Value'); |
my $Set=&mt('Set'); |
my $Set=&mt('Set'); |
my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js= |
my $html=&Apache::lonxml::xmlbegin(); |
'<script type="text/javascript" language="Javascript">'. |
$r->print(<<ENDenv); |
&Apache::loncommon::browser_and_searcher_javascript('parmset'). |
$html |
'</script>'; |
<head> |
|
<script type="text/javascript" language="Javascript" > |
my $start_page = |
$browse_js |
&Apache::loncommon::start_page('Set Course Environment Parameters', |
</script> |
$browse_js); |
<title>LON-CAPA Course Environment</title> |
my $end_page = |
</head> |
&Apache::loncommon::end_page(); |
$bodytag |
$r->print(<<ENDENV); |
|
$start_page |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
$setoutput |
$setoutput |
Line 1927 $output
|
Line 2342 $output
|
</table> |
</table> |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
</form> |
</form> |
</body> |
$end_page |
</html> |
ENDENV |
ENDenv |
|
} |
} |
################################################## |
################################################## |
# Overview mode |
# Overview mode |
Line 2008 sub storedata {
|
Line 2422 sub storedata {
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
&Apache::loncommon::plainname($tuname,$tudom)); |
&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
Line 2023 sub storedata {
|
Line 2438 sub storedata {
|
} elsif ($cmd eq 'del') { |
} elsif ($cmd eq 'del') { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<h2><font color="red">'. |
Line 2040 sub storedata {
|
Line 2456 sub storedata {
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<h2><font color="red">'. |
Line 2060 sub storedata {
|
Line 2477 sub storedata {
|
my $putentries=$#newdatakeys+1; |
my $putentries=$#newdatakeys+1; |
if ($delentries) { |
if ($delentries) { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
|
my %loghash=map { $_ => '' } @deldata; |
|
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<h2><font color="red">'. |
Line 2069 sub storedata {
|
Line 2488 sub storedata {
|
} |
} |
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
|
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<h2><font color="red">'. |
Line 2093 sub listdata {
|
Line 2513 sub listdata {
|
my $pointer=0; |
my $pointer=0; |
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
|
my %keyorder=&standardkeyorder(); |
foreach my $thiskey (sort { |
foreach my $thiskey (sort { |
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
my ($astudent,$arealm)=($a=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/); |
my ($astudent,$arealm)=($a=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/); |
my ($bstudent,$brealm)=($b=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/); |
my ($bstudent,$brealm)=($b=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/); |
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
if (!defined($astudent)) { |
|
($arealm)=($a=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
|
} |
|
if (!defined($bstudent)) { |
|
($brealm)=($b=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
|
} |
|
$arealm=~s/\.type//; |
|
my ($ares, $aparm) = ($arealm=~/^(.*)\.(.*)$/); |
|
$aparm=$keyorder{'parameter_0_'.$aparm}; |
|
$brealm=~s/\.type//; |
|
my ($bres, $bparm) = ($brealm=~/^(.*)\.(.*)$/); |
|
$bparm=$keyorder{'parameter_0_'.$bparm}; |
|
if ($ares eq $bres) { |
|
if (defined($aparm) && defined($bparm)) { |
|
($aparm <=> $bparm); |
|
} elsif (defined($aparm)) { |
|
-1; |
|
} elsif (defined($bparm)) { |
|
1; |
|
} else { |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} |
|
} else { |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} |
} else { |
} else { |
$a cmp $b; |
$a cmp $b; |
} |
} |
} keys %{$listdata}) { |
} keys %{$listdata}) { |
|
|
if ($$listdata{$thiskey.'.type'}) { |
if ($$listdata{$thiskey.'.type'}) { |
my $thistype=$$listdata{$thiskey.'.type'}; |
my $thistype=$$listdata{$thiskey.'.type'}; |
if ($$resourcedata{$thiskey.'.type'}) { |
if ($$resourcedata{$thiskey.'.type'}) { |
Line 2157 sub listdata {
|
Line 2603 sub listdata {
|
$oldpart=$part; |
$oldpart=$part; |
} |
} |
# |
# |
|
# Preset defaults? |
|
# |
|
my ($hour,$min,$sec,$val)=('','','',''); |
|
unless ($$resourcedata{$thiskey}) { |
|
my ($parmname)=($thiskey=~/\.(\w+)$/); |
|
($hour,$min,$sec,$val)=&preset_defaults($parmname); |
|
} |
|
|
|
# |
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart().'<tr><td><b>'.$name. |
$r->print(&tablestart().'<tr><td><b>'.$name. |
Line 2167 sub listdata {
|
Line 2622 sub listdata {
|
my $jskey='key_'.$pointer; |
my $jskey='key_'.$pointer; |
$pointer++; |
$pointer++; |
$r->print( |
$r->print( |
&Apache::lonhtmlcommon::date_setter('overviewform', |
&Apache::lonhtmlcommon::date_setter('parmform', |
$jskey, |
$jskey, |
$$resourcedata{$thiskey}, |
$$resourcedata{$thiskey}, |
'',1). |
'',1,'','',$hour,$min,$sec). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
|
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
} elsif ($thistype eq 'string_yesno') { |
} elsif ($thistype eq 'string_yesno') { |
|
my $showval; |
|
if (defined($$resourcedata{$thiskey})) { |
|
$showval=$$resourcedata{$thiskey}; |
|
} else { |
|
$showval=$val; |
|
} |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
'" value="yes"'); |
'" value="yes"'); |
if ($$resourcedata{$thiskey} eq 'yes') { |
if ($showval eq 'yes') { |
$r->print(' checked="checked"'); |
$r->print(' checked="checked"'); |
} |
} |
$r->print(' />'.&mt('Yes').'</label> '); |
$r->print(' />'.&mt('Yes').'</label> '); |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
'" value="no"'); |
'" value="no"'); |
if ($$resourcedata{$thiskey} eq 'no') { |
if ($showval eq 'no') { |
$r->print(' checked="checked"'); |
$r->print(' checked="checked"'); |
} |
} |
$r->print(' />'.&mt('No').'</label>'); |
$r->print(' />'.&mt('No').'</label>'); |
} else { |
} else { |
|
my $showval; |
|
if (defined($$resourcedata{$thiskey})) { |
|
$showval=$$resourcedata{$thiskey}; |
|
} else { |
|
$showval=$val; |
|
} |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$$resourcedata{$thiskey}.'">'); |
$showval.'">'); |
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'">'); |
Line 2199 sub listdata {
|
Line 2667 sub listdata {
|
} |
} |
|
|
sub newoverview { |
sub newoverview { |
my $r=shift; |
my ($r) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Set Parameters'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$html |
$start_page |
<head> |
|
<title>LON-CAPA Parameters</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
ENDOVER |
ENDOVER |
Line 2233 ENDOVER
|
Line 2697 ENDOVER
|
$alllevs{'Course Level'}='general'; |
$alllevs{'Course Level'}='general'; |
|
|
my $csec=$env{'form.csec'}; |
my $csec=$env{'form.csec'}; |
|
my $cgroup=$env{'form.cgroup'}; |
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my $pschp=$env{'form.pschp'}; |
my $pschp=$env{'form.pschp'}; |
Line 2247 ENDOVER
|
Line 2712 ENDOVER
|
@selected_sections = ('all'); |
@selected_sections = ('all'); |
} |
} |
} |
} |
|
my @selected_groups = |
|
&Apache::loncommon::get_env_multiple('form.Group'); |
|
|
my $pssymb=''; |
my $pssymb=''; |
my $parmlev=''; |
my $parmlev=''; |
Line 2274 ENDOVER
|
Line 2741 ENDOVER
|
|
|
$r->print('<table border="1"><tr><td>'); |
$r->print('<table border="1"><tr><td>'); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
$r->print('</td><td>'); |
$r->print('</td><td><table border="0" cellspacing="0" cellpadding="0">'. |
|
'<tr><td>'.&mt('Parts').'</td><td></td><td>'.&mt('Section(s)'). |
|
'</td><td></td><td>'.&mt('Group(s)').'</td></tr><tr><td>'); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
$r->print('</td><td>'); |
$r->print('</td><td> </td><td>'); |
§ionmenu($r,\@selected_sections); |
§ionmenu($r,\@selected_sections); |
|
$r->print('</td><td> </td><td>'); |
|
&groupmenu($r,\@selected_groups); |
|
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
|
|
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
Line 2293 ENDOVER
|
Line 2764 ENDOVER
|
%{$listdata}=(); |
%{$listdata}=(); |
|
|
foreach my $cat (@pscat) { |
foreach my $cat (@pscat) { |
foreach my $section (@selected_sections) { |
&secgroup_lister($cat,$pschp,$parmlev,$listdata,\@psprt,\@selected_sections,\%defkeytype,\%allmaps,\@ids,\%symbp); |
foreach my $part (@psprt) { |
&secgroup_lister($cat,$pschp,$parmlev,$listdata,\@psprt,\@selected_groups,\%defkeytype,\%allmaps,\@ids,\%symbp); |
my $rootparmkey=$env{'request.course.id'}; |
|
if (($section ne 'all') && ($section ne 'none') && ($section)) { |
|
$rootparmkey.='.['.$section.']'; |
|
} |
|
if ($parmlev eq 'general') { |
|
# course-level parameter |
|
my $newparmkey=$rootparmkey.'.'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$defkeytype{$cat}; |
|
} elsif ($parmlev eq 'map') { |
|
# map-level parameter |
|
foreach my $mapid (keys %allmaps) { |
|
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; } |
|
my $newparmkey=$rootparmkey.'.'.$allmaps{$mapid}.'___(all).'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$defkeytype{$cat}; |
|
} |
|
} else { |
|
# resource-level parameter |
|
foreach my $rid (@ids) { |
|
my ($map,$resid,$url)=&Apache::lonnet::decode_symb($symbp{$rid}); |
|
if (($pschp ne 'all') && ($allmaps{$pschp} ne $map)) { next; } |
|
my $newparmkey=$rootparmkey.'.'.$symbp{$rid}.'.'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$defkeytype{$cat}; |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
|
|
if (($env{'form.store'}) || ($env{'form.dis'})) { |
if (($env{'form.store'}) || ($env{'form.dis'})) { |
Line 2340 ENDOVER
|
Line 2782 ENDOVER
|
} |
} |
$r->print(&tableend(). |
$r->print(&tableend(). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
'</form></body></html>'); |
'</form>'.&Apache::loncommon::end_page()); |
|
} |
|
|
|
sub secgroup_lister { |
|
my ($cat,$pschp,$parmlev,$listdata,$psprt,$selections,$defkeytype,$allmaps,$ids,$symbp) = @_; |
|
foreach my $item (@{$selections}) { |
|
foreach my $part (@{$psprt}) { |
|
my $rootparmkey=$env{'request.course.id'}; |
|
if (($item ne 'all') && ($item ne 'none') && ($item)) { |
|
$rootparmkey.='.['.$item.']'; |
|
} |
|
if ($parmlev eq 'general') { |
|
# course-level parameter |
|
my $newparmkey=$rootparmkey.'.'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
|
} elsif ($parmlev eq 'map') { |
|
# map-level parameter |
|
foreach my $mapid (keys %{$allmaps}) { |
|
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; } |
|
my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
|
} |
|
} else { |
|
# resource-level parameter |
|
foreach my $rid (@{$ids}) { |
|
my ($map,$resid,$url)=&Apache::lonnet::decode_symb($$symbp{$rid}); |
|
if (($pschp ne 'all') && ($$allmaps{$pschp} ne $map)) { next; } |
|
my $newparmkey=$rootparmkey.'.'.$$symbp{$rid}.'.'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
|
} |
|
} |
|
} |
|
} |
} |
} |
|
|
sub overview { |
sub overview { |
my $r=shift; |
my ($r) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Modify Parameters'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$html |
$start_page |
<head> |
|
<title>LON-CAPA Parameters</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=setoverview" name="overviewform"> |
<form method="post" action="/adm/parmset?action=setoverview" name="parmform"> |
ENDOVER |
ENDOVER |
# Store modified |
# Store modified |
|
|
Line 2377 ENDOVER
|
Line 2850 ENDOVER
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'. |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>'); |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form>'. |
|
&Apache::loncommon::end_page()); |
} |
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
=pod |
=pod |
|
|
=item change clone |
=item check_cloners |
|
|
|
Checks if new users included in list of allowed cloners |
|
are valid users. Replaces supplied list with |
|
cleaned list containing only users with valid usernames |
|
and domains. |
|
|
|
Inputs: $clonelist, $oldcloner |
|
where $clonelist is ref to array of requested cloners, |
|
and $oldcloner is ref to array of currently allowed |
|
cloners. |
|
|
|
Returns: string - comma separated list of requested |
|
cloners (username:domain) who do not exist in system. |
|
|
|
=item change_clone |
|
|
Modifies the list of courses a user can clone (stored |
Modifies the list of courses a user can clone (stored |
in the user's environemnt.db file), called when a |
in the user's environment.db file), called when a |
change is made to the list of users allowed to clone |
change is made to the list of users allowed to clone |
a course. |
a course. |
|
|
Inputs: $action,$cloner |
Inputs: $action,$cloner |
where $action is add or drop, and $cloner is identity of |
where $action is add or drop, and $cloner is identity of |
user for whom cloning ability is to be changed in course. |
user for whom cloning ability is to be changed in course. |
|
|
Returns: |
|
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
|
sub extract_cloners { |
|
my ($clonelist,$allowclone) = @_; |
|
if ($clonelist =~ /,/) { |
|
@{$allowclone} = split/,/,$clonelist; |
|
} else { |
|
$$allowclone[0] = $clonelist; |
|
} |
|
} |
|
|
|
|
|
sub check_cloners { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($clean_clonelist,$disallowed); |
|
my @allowclone = (); |
|
&extract_cloners($$clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep/^$currclone$/,@$oldcloner) { |
|
my ($uname,$udom) = split/:/,$currclone; |
|
if ($uname && $udom) { |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$disallowed .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
if ($disallowed) { |
|
$disallowed =~ s/,$//; |
|
} |
|
if ($clean_clonelist) { |
|
$clean_clonelist =~ s/,$//; |
|
} |
|
$$clonelist = $clean_clonelist; |
|
return $disallowed; |
|
} |
|
|
sub change_clone { |
sub change_clone { |
my ($clonelist,$oldcloner) = @_; |
my ($clonelist,$oldcloner) = @_; |
Line 2412 sub change_clone {
|
Line 2937 sub change_clone {
|
my $clone_crs = $cnum.':'.$cdom; |
my $clone_crs = $cnum.':'.$cdom; |
|
|
if ($cnum && $cdom) { |
if ($cnum && $cdom) { |
my @allowclone = (); |
my @allowclone; |
if ($clonelist =~ /,/) { |
&extract_cloners($clonelist,\@allowclone); |
@allowclone = split/,/,$clonelist; |
|
} else { |
|
$allowclone[0] = $clonelist; |
|
} |
|
foreach my $currclone (@allowclone) { |
foreach my $currclone (@allowclone) { |
if (!grep/^$currclone$/,@$oldcloner) { |
if (!grep/^$currclone$/,@$oldcloner) { |
($uname,$udom) = split/:/,$currclone; |
($uname,$udom) = split/:/,$currclone; |
Line 2479 Output html header for page
|
Line 3000 Output html header for page
|
################################################## |
################################################## |
################################################## |
################################################## |
sub header { |
sub header { |
my $html=&Apache::lonxml::xmlbegin(); |
return &Apache::loncommon::start_page('Parameter Manager'); |
my $bodytag=&Apache::loncommon::bodytag('Parameter Manager'); |
|
my $title = &mt('LON-CAPA Parameter Manager'); |
|
return(<<ENDHEAD); |
|
$html |
|
<head> |
|
<title>$title</title> |
|
</head> |
|
$bodytag |
|
ENDHEAD |
|
} |
} |
################################################## |
################################################## |
################################################## |
################################################## |
Line 2502 ENDMAINFORMHEAD
|
Line 3014 ENDMAINFORMHEAD
|
# |
# |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
|
|
my @menu = |
my @menu = |
( |
( |
{ text => 'Set Course Environment Parameters', |
{ text => 'Set Course Environment Parameters', |
action => 'crsenv', |
action => 'crsenv', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
|
{ text => 'Set Portfolio Metadata', |
|
action => 'setrestrictmeta', |
|
permission => $parm_permission, |
|
}, |
|
{ text => 'Manage Course Slots', |
|
url => '/adm/slotrequest?command=showslots', |
|
permission => $vgr, |
|
}, |
|
{ divider => 1, |
|
}, |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission, |
Line 2528 ENDMAINFORMHEAD
|
Line 3052 ENDMAINFORMHEAD
|
{ text => 'Set Parameter Setting Default Actions', |
{ text => 'Set Parameter Setting Default Actions', |
action => 'setdefaults', |
action => 'setdefaults', |
permission => $parm_permission, |
permission => $parm_permission, |
|
}, |
|
{ text => 'Parameter Change Log and Course Blog Posting', |
|
action => 'parameterchangelog', |
|
permission => $parm_permission, |
}, |
}, |
); |
); |
my $menu_html = ''; |
my $menu_html = ''; |
foreach my $menu_item (@menu) { |
foreach my $menu_item (@menu) { |
|
if ($menu_item->{'divider'}) { |
|
$menu_html .= '<hr />'; |
|
next; |
|
} |
next if (! $menu_item->{'permission'}); |
next if (! $menu_item->{'permission'}); |
$menu_html.='<p>'; |
$menu_html.='<p>'; |
$menu_html.='<font size="+1">'; |
$menu_html.='<font size="+1">'; |
Line 2551 ENDMAINFORMHEAD
|
Line 3083 ENDMAINFORMHEAD
|
$r->print($menu_html); |
$r->print($menu_html); |
return; |
return; |
} |
} |
|
### Set portfolio metadata |
|
sub output_row { |
|
my ($r, $field_name, $field_text) = @_; |
|
my $output; |
|
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
|
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
|
unless (defined($options)) { |
|
$options = 'active,stuadd'; |
|
$values = ''; |
|
} |
|
$output.='<strong>'.$field_text.':</strong>'; |
|
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /><br />'; |
|
|
|
my @options= ( ['active', 'Show to student'], |
|
['onlyone','Student may select only one choice'], |
|
['stuadd', 'Student may type choices']); |
|
foreach my $opt (@options) { |
|
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
|
$output.=(' 'x5).'<label><input type="checkbox" name="'. |
|
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
|
&mt($opt->[1]).'</label> <br />'; |
|
} |
|
return ($output); |
|
} |
|
|
|
sub setrestrictmeta { |
|
my ($r)=@_; |
|
my $next_meta; |
|
my $output; |
|
my $item_num; |
|
my $put_result; |
|
|
|
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Restrict Metadata')); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
|
my $save_field = ''; |
|
if ($env{'form.restrictmeta'}) { |
|
foreach my $field (sort(keys(%env))) { |
|
if ($field=~m/^form.(.+)_(.+)$/) { |
|
my $options; |
|
my $meta_field = $1; |
|
my $meta_key = $2; |
|
if ($save_field ne $meta_field) { |
|
$save_field = $meta_field; |
|
if ($env{'form.'.$meta_field.'_stuadd'}) { |
|
$options.='stuadd,'; |
|
} |
|
if ($env{'form.'.$meta_field.'_onlyone'}) { |
|
$options.='onlyone,'; |
|
} |
|
if ($env{'form.'.$meta_field.'_active'}) { |
|
$options.='active,'; |
|
} |
|
my $name = $save_field; |
|
$put_result = &Apache::lonnet::put('environment', |
|
{'metadata.'.$meta_field.'.options'=>$options, |
|
'metadata.'.$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
|
},$dom,$crs); |
|
} |
|
} |
|
} |
|
} |
|
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
|
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
|
foreach my $field (sort(keys(%metadata_fields))) { |
|
&Apache::lonnet::logthis ($field); |
|
if ($field ne 'courserestricted') { |
|
$output.= &output_row($r, $field, $metadata_fields{$field}); |
|
} |
|
} |
|
$r->print(<<ENDenv); |
|
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
|
<p> |
|
$output |
|
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
|
</form> |
|
ENDenv |
|
$r->print(&Apache::loncommon::end_page()); |
|
return 'ok'; |
|
} |
################################################## |
################################################## |
|
|
sub defaultsetter { |
sub defaultsetter { |
my $r=shift; |
my ($r) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Parameter Setting Default Actions'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $start_page = |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults'); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDDEFHEAD); |
$r->print(<<ENDDEFHEAD); |
$html |
$start_page |
<head> |
|
<title>LON-CAPA Parameters</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform"> |
<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform"> |
ENDDEFHEAD |
ENDDEFHEAD |
if ($env{'form.storerules'}) { |
|
# storage here |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
&resetrulescache(); |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
} |
|
my @ids=(); |
my @ids=(); |
my %typep=(); |
my %typep=(); |
my %keyp=(); |
my %keyp=(); |
Line 2591 ENDDEFHEAD
|
Line 3198 ENDDEFHEAD
|
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder,\%defkeytype); |
\%keyorder,\%defkeytype); |
my %lt=&Apache::lonlocal::texthash('hours' => 'Hours', |
if ($env{'form.storerules'}) { |
|
my %newrules=(); |
|
my @delrules=(); |
|
my %triggers=(); |
|
foreach my $key (keys(%env)) { |
|
if ($key=~/^form\.(\w+)\_action$/) { |
|
my $tempkey=$1; |
|
my $action=$env{$key}; |
|
if ($action) { |
|
$newrules{$tempkey.'_action'}=$action; |
|
if ($action ne 'default') { |
|
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
|
$triggers{$whichparm}.=$tempkey.':'; |
|
} |
|
$newrules{$tempkey.'_type'}=$defkeytype{$tempkey}; |
|
if (&isdateparm($defkeytype{$tempkey})) { |
|
$newrules{$tempkey.'_days'}=$env{'form.'.$tempkey.'_days'}; |
|
$newrules{$tempkey.'_hours'}=$env{'form.'.$tempkey.'_hours'}; |
|
$newrules{$tempkey.'_min'}=$env{'form.'.$tempkey.'_min'}; |
|
$newrules{$tempkey.'_sec'}=$env{'form.'.$tempkey.'_sec'}; |
|
} else { |
|
$newrules{$tempkey.'_value'}=$env{'form.'.$tempkey.'_value'}; |
|
$newrules{$tempkey.'_triggervalue'}=$env{'form.'.$tempkey.'_triggervalue'}; |
|
} |
|
} else { |
|
push(@delrules,$tempkey.'_action'); |
|
push(@delrules,$tempkey.'_type'); |
|
push(@delrules,$tempkey.'_hours'); |
|
push(@delrules,$tempkey.'_min'); |
|
push(@delrules,$tempkey.'_sec'); |
|
push(@delrules,$tempkey.'_value'); |
|
} |
|
} |
|
} |
|
foreach my $key (keys %allparms) { |
|
$newrules{$key.'_triggers'}=$triggers{$key}; |
|
} |
|
&Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs); |
|
&Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs); |
|
&resetrulescache(); |
|
} |
|
my %lt=&Apache::lonlocal::texthash('days' => 'Days', |
|
'hours' => 'Hours', |
'min' => 'Minutes', |
'min' => 'Minutes', |
'sec' => 'Seconds', |
'sec' => 'Seconds', |
'yes' => 'Yes', |
'yes' => 'Yes', |
Line 2611 ENDDEFHEAD
|
Line 3260 ENDDEFHEAD
|
push @datedisplay,&mt('Automatically set earlier than ').$tempkey; |
push @datedisplay,&mt('Automatically set earlier than ').$tempkey; |
} |
} |
} |
} |
|
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
|
&mt('Automatic setting rules apply to table mode interfaces only.')); |
$r->print("\n<table border='1'><tr><th>".&mt('Rule for parameter').'</th><th>'. |
$r->print("\n<table border='1'><tr><th>".&mt('Rule for parameter').'</th><th>'. |
&mt('Action').'</th><th>'.&mt('Value').'</th></tr>'); |
&mt('Action').'</th><th>'.&mt('Value').'</th></tr>'); |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
unless ($tempkey) { next; } |
unless ($tempkey) { next; } |
$r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
$r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
|
|
my $action=&rulescache($tempkey.'_action'); |
my $action=&rulescache($tempkey.'_action'); |
$r->print('<select name="'.$tempkey.'_action">'); |
$r->print('<select name="'.$tempkey.'_action">'); |
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
Line 2635 ENDDEFHEAD
|
Line 3285 ENDDEFHEAD
|
} |
} |
} |
} |
$r->print('</select>'); |
$r->print('</select>'); |
|
unless (&isdateparm($defkeytype{$tempkey})) { |
|
$r->print("\n<br />".&mt('Triggering value(s) of other parameter (optional, comma-separated):'). |
|
'<input type="text" size="20" name="'.$tempkey.'_triggervalue" value="'.&rulescache($tempkey.'_triggervalue').'" />'); |
|
} |
$r->print("\n</td><td>\n"); |
$r->print("\n</td><td>\n"); |
|
|
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
|
my $days=&rulescache($tempkey.'_days'); |
my $hours=&rulescache($tempkey.'_hours'); |
my $hours=&rulescache($tempkey.'_hours'); |
my $min=&rulescache($tempkey.'_min'); |
my $min=&rulescache($tempkey.'_min'); |
my $sec=&rulescache($tempkey.'_sec'); |
my $sec=&rulescache($tempkey.'_sec'); |
$r->print(<<ENDINPUTDATE); |
$r->print(<<ENDINPUTDATE); |
|
<input name="$tempkey\_days" type="text" size="4" value="$days" />$lt{'days'}<br /> |
<input name="$tempkey\_hours" type="text" size="4" value="$hours" />$lt{'hours'}<br /> |
<input name="$tempkey\_hours" type="text" size="4" value="$hours" />$lt{'hours'}<br /> |
<input name="$tempkey\_min" type="text" size="4" value="$min" />$lt{'min'}<br /> |
<input name="$tempkey\_min" type="text" size="4" value="$min" />$lt{'min'}<br /> |
<input name="$tempkey\_sec" type="text" size="4" value="$sec" />$lt{'sec'} |
<input name="$tempkey\_sec" type="text" size="4" value="$sec" />$lt{'sec'} |
Line 2655 ENDINPUTDATE
|
Line 3309 ENDINPUTDATE
|
if (&rulescache($tempkey.'_value') eq 'no') { $nochecked='checked="checked"'; } |
if (&rulescache($tempkey.'_value') eq 'no') { $nochecked='checked="checked"'; } |
|
|
$r->print(<<ENDYESNO); |
$r->print(<<ENDYESNO); |
<label><input type="radio" name="$tempkey" value="yes" $yeschecked /> $lt{'yes'}</label><br /> |
<label><input type="radio" name="$tempkey\_value" value="yes" $yeschecked /> $lt{'yes'}</label><br /> |
<label><input type="radio" name="$tempkey" value="no" $nochecked /> $lt{'no'}</label> |
<label><input type="radio" name="$tempkey\_value" value="no" $nochecked /> $lt{'no'}</label> |
ENDYESNO |
ENDYESNO |
} else { |
} else { |
$r->print('<input type="text" size="20" name="'.$tempkey.'" value="'.&rulescache($tempkey.'_value').'" />'); |
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
} |
} |
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
} |
} |
$r->print("</table></form></body></html>"); |
$r->print("</table>\n<input type='submit' name='storerules' value='". |
|
&mt('Store Rules')."' /></form>\n". |
|
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
|
sub components { |
|
my ($key,$uname,$udom)=@_; |
|
my $typeflag=0; |
|
if ($key=~/\.type$/) { |
|
$key=~s/\.type$//; |
|
$typeflag=1; |
|
} |
|
my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
|
my $section=&mt('All Students'); |
|
if ($middle=~/^\[(.*)\]/) { |
|
my $issection=$1; |
|
if ($uname) { |
|
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
|
} else { |
|
$section=&mt('Group/Section').': '.$issection; |
|
} |
|
$middle=~s/^\[(.*)\]//; |
|
} |
|
$middle=~s/\.+$//; |
|
$middle=~s/^\.+//; |
|
my $realm='<font color="red">'.&mt('All Resources').'</font>'; |
|
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
|
$realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>'; |
|
} elsif ($middle) { |
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
|
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
|
} |
|
return ($realm,$section,$name,$part,$typeflag); |
|
} |
|
|
|
sub parm_change_log { |
|
my ($r)=@_; |
|
&startpage($r); |
|
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
my %exetime=(); |
|
foreach my $key (keys(%parmlog)) { |
|
if ($key=~/^(.+)\_exe\_time$/) { |
|
$exetime{$1}=$parmlog{$key}; |
|
} |
|
} |
|
$r->print('<table border="2">'); |
|
foreach my $id (sort { $exetime{$a}<=>$exetime{$b} } (keys(%exetime))) { |
|
my @changes=split(/\,/,$parmlog{$id.'_logentry'}); |
|
my $count=$#changes+1; |
|
my $time = |
|
&Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'}); |
|
my $plainname = |
|
&Apache::loncommon::plainname($parmlog{$id.'_exe_uname'}, |
|
$parmlog{$id.'_exe_udom'}); |
|
my $about_me_link = |
|
&Apache::loncommon::aboutmewrapper($plainname, |
|
$parmlog{$id.'_exe_uname'}, |
|
$parmlog{$id.'_exe_udom'}); |
|
|
|
my $send_msg_link; |
|
if ((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) |
|
|| ($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))) { |
|
my $send_msg_link ='<br />'. |
|
&Apache::loncommon::messagewrapper(&mt('Send message'), |
|
$parmlog{$id.'_exe_uname'}, |
|
$parmlog{$id.'_exe_udom'}); |
|
} |
|
$r->print('<tr><td rowspan="'.$count.'">'.$time.'</td> |
|
<td rowspan="'.$count.'">'.$about_me_link. |
|
'<br /><tt>'.$parmlog{$id.'_exe_uname'}. |
|
':'.$parmlog{$id.'_exe_udom'}.'</tt>'. |
|
$send_msg_link.'</td>'); |
|
my $makenewrow=0; |
|
my %istype=(); |
|
foreach my $changed (sort @changes) { |
|
my ($key,$value)=split(/\=\>/,&Apache::lonnet::unescape($changed)); |
|
my ($realm,$section,$parmname,$part,$typeflag)= |
|
&components($key,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'}); |
|
if ($typeflag) { $istype{$parmname}=$value; } |
|
if ($makenewrow) { $r->print('<tr>'); } else { $makenewrow=1; } |
|
$r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
|
&mt('Part: [_1]',$part).'</td><td>'); |
|
if ($parmlog{$id.'_deleteflag'}) { |
|
$r->print(&mt('Deleted')); |
|
} else { |
|
if ($typeflag) { |
|
$r->print(&mt('Type: [_1]',$value)); |
|
} elsif (&isdateparm($istype{$parmname})) { |
|
$r->print(&Apache::lonlocal::locallocaltime($value)); |
|
} else { |
|
$r->print($value); |
|
} |
|
} |
|
$r->print('</td></tr>'); |
|
} |
|
} |
|
$r->print('</table>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 2681 Main handler. Calls &assessparms and &c
|
Line 3434 Main handler. Calls &assessparms and &c
|
################################################## |
################################################## |
# use Data::Dumper; |
# use Data::Dumper; |
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
Line 2694 sub handler {
|
Line 3448 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
'udom','uname','symb']); |
'udom','uname','symb','serial']); |
|
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 2736 sub handler {
|
Line 3490 sub handler {
|
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
text=>"Course Environment"}); |
text=>"Course Environment"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Edit Course Environment')); |
|
&crsenv($r); |
&crsenv($r); |
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
&overview($r); |
&overview($r); |
|
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
|
text=>"Restrict Metadata"}); |
|
&setrestrictmeta($r); |
} elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
Line 2756 sub handler {
|
Line 3512 sub handler {
|
text=>"Table Mode", |
text=>"Table Mode", |
help => 'Course_Setting_Parameters'}); |
help => 'Course_Setting_Parameters'}); |
&assessparms($r); |
&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"}); |
|
&parm_change_log($r); |
|
} |
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |