version 1.235, 2005/06/28 15:28:08
|
version 1.299, 2006/05/09 14:38:10
|
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 129 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 142 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 275 sub preset_defaults {
|
Line 292 sub preset_defaults {
|
} |
} |
|
|
################################################## |
################################################## |
|
|
|
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; |
|
} |
|
################################################## |
################################################## |
################################################## |
# |
# |
# Store a parameter by ID |
# Store a parameter by ID |
Line 289 sub preset_defaults {
|
Line 325 sub preset_defaults {
|
# - 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 307 sub storeparm {
|
Line 343 sub storeparm {
|
|
|
my %recstack; |
my %recstack; |
sub storeparm_by_symb { |
sub storeparm_by_symb { |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
unless ($recflag) { |
unless ($recflag) { |
# first time call |
# first time call |
%recstack=(); |
%recstack=(); |
Line 315 sub storeparm_by_symb {
|
Line 351 sub storeparm_by_symb {
|
} |
} |
# store parameter |
# store parameter |
&storeparm_by_symb_inner |
&storeparm_by_symb_inner |
($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec); |
($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup); |
|
# don't do anything if parameter was reset |
|
unless ($nval) { return; } |
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
# remember that this was set |
# remember that this was set |
$recstack{$parm}=1; |
$recstack{$parm}=1; |
Line 348 sub storeparm_by_symb {
|
Line 386 sub storeparm_by_symb {
|
} |
} |
if ($active) { |
if ($active) { |
&storeparm_by_symb($symb,$newspnam,$snum,$newvalue,&rulescache($triggered.'_type'), |
&storeparm_by_symb($symb,$newspnam,$snum,$newvalue,&rulescache($triggered.'_type'), |
$uname,$udom,$csec,$recflag); |
$uname,$udom,$csec,$recflag,$cgroup); |
} |
} |
} |
} |
} |
} |
return ''; |
return ''; |
} |
} |
|
|
|
sub log_parmset { |
|
return &Apache::lonnet::instructor_log('parameterlog',@_); |
|
} |
|
|
sub storeparm_by_symb_inner { |
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 373 sub storeparm_by_symb_inner {
|
Line 419 sub storeparm_by_symb_inner {
|
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 392 sub storeparm_by_symb_inner {
|
Line 442 sub storeparm_by_symb_inner {
|
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 403 sub storeparm_by_symb_inner {
|
Line 453 sub storeparm_by_symb_inner {
|
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 426 sub storeparm_by_symb_inner {
|
Line 478 sub storeparm_by_symb_inner {
|
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 488 sub valout {
|
Line 542 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 527 sub plink {
|
Line 581 sub plink {
|
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
unless (defined($winvalue)) { $winvalue=$val; } |
unless (defined($winvalue)) { $winvalue=$val; } |
return |
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."','".$hour."','".$min."','".$sec."'".');">'. |
.$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 588 $html
|
Line 635 $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('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 638 sub print_row {
|
Line 703 sub print_row {
|
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 699 sub print_td {
|
Line 794 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 709 sub print_td {
|
Line 804 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 956 sub partmenu {
|
Line 1106 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 = &Apache::loncommon::coursegroups(); |
$sections.='<option value="'.$_.'"'. |
|
($_ eq $csec?'selected="selected"':'').'>'.$_.'</option>'; |
if ($numsec > 0) { |
|
$sections=$lt{'se'}.': <select name="csec"'; |
|
if (%grouphash && $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 && %grouphash && $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 (%grouphash) { |
|
$groups=$lt{'gr'}.': <select name="cgroup"'; |
|
if ($numsec && $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 1035 sub levelmenu {
|
Line 1246 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 1051 sub sectionmenu {
|
Line 1263 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 = &Apache::loncommon::coursegroups(); |
|
return if (!%grouphash); |
|
|
|
$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 1067 sub keysinorder {
|
Line 1299 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 1076 sub keysindisplayorder {
|
Line 1320 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 1162 sub assessparms {
|
Line 1407 sub assessparms {
|
my $udom; |
my $udom; |
my $uhome; |
my $uhome; |
my $csec; |
my $csec; |
|
my $cgroup; |
|
my @usersgroups = (); |
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
Line 1183 sub assessparms {
|
Line 1430 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 1249 sub assessparms {
|
Line 1497 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 1263 sub assessparms {
|
Line 1513 sub assessparms {
|
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
} |
} |
|
@usersgroups = &Apache::lonnet::get_users_groups( |
|
$udom,$uname,$env{'request.course.id'}); |
|
if (@usersgroups > 0) { |
|
unless (grep/^\Q$cgroup\E$/,@usersgroups) { |
|
$cgroup = $usersgroups[0]; |
|
} |
|
} |
} |
} |
} |
} |
|
|
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 1285 sub assessparms {
|
Line 1543 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 1317 sub assessparms {
|
Line 1575 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 1341 sub assessparms {
|
Line 1601 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 1374 sub assessparms {
|
Line 1642 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 1387 ENDTABLEHEADFOUR
|
Line 1659 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 1395 ENDTABLEHEADFOUR
|
Line 1674 ENDTABLEHEADFOUR
|
|
|
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
|
my $defbgthree = ''; |
|
|
foreach (@ids) { |
foreach (@ids) { |
|
|
Line 1416 ENDTABLEHEADFOUR
|
Line 1696 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 1441 ENDTABLEHEADFOUR
|
Line 1727 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 1462 ENDTABLEHEADFOUR
|
Line 1749 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_bytype(\%name,\%keyorder)) { |
|
|
foreach (&keysinorder(\%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 1490 ENDTABLEHEADFOUR
|
Line 1772 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 1561 Set Defaults for All Resources in $folde
|
Line 1844 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 1585 ENDMAPONE
|
Line 1869 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 1595 ENDMAPONE
|
Line 1879 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 1642 ENDMAPONE
|
Line 1927 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 1662 ENDMAPONE
|
Line 1945 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 1692 Returns: nothing
|
Line 1976 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 = |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef, |
&Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment'); |
'Edit Course Environment'); |
|
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'}; |
|
|
Line 1759 sub crsenv {
|
Line 2042 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 1778 sub crsenv {
|
Line 2065 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 |
|
|
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
&Apache::lonnet::coursedescription($env{'request.course.id'} |
|
{'freshen_cache' => 1}); |
|
|
# -------------------------------------------------------- Get parameters again |
# -------------------------------------------------------- Get parameters again |
|
|
Line 1861 sub crsenv {
|
Line 2161 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 1871 sub crsenv {
|
Line 2174 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 1895 sub crsenv {
|
Line 2198 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 1921 sub crsenv {
|
Line 2230 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 1976 sub crsenv {
|
Line 2286 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 1997 $output
|
Line 2308 $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 2011 sub tablestart {
|
Line 2321 sub tablestart {
|
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
return '<table border="2"><tr><th>'.&mt('Parameter').'</th><th>'. |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
} |
} |
} |
} |
Line 2019 sub tablestart {
|
Line 2329 sub tablestart {
|
sub tableend { |
sub tableend { |
if ($tableopen) { |
if ($tableopen) { |
$tableopen=0; |
$tableopen=0; |
return '</table>'; |
return &Apache::loncommon::end_data_table(); |
} else { |
} else { |
return''; |
return''; |
} |
} |
Line 2078 sub storedata {
|
Line 2388 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 2093 sub storedata {
|
Line 2404 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 2110 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 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 2130 sub storedata {
|
Line 2443 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 2139 sub storedata {
|
Line 2454 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 2163 sub listdata {
|
Line 2479 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 2238 sub listdata {
|
Line 2580 sub listdata {
|
# |
# |
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart().'<tr><td><b>'.$name. |
$r->print(&tablestart(). |
':</b></td><td><input type="checkbox" name="del_'. |
&Apache::loncommon::start_data_table_row(). |
|
'<td><b>'.&standard_parameter_names($name). |
|
'</b></td><td><input type="checkbox" name="del_'. |
$thiskey.'" /></td><td>'); |
$thiskey.'" /></td><td>'); |
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
Line 2250 sub listdata {
|
Line 2594 sub listdata {
|
$jskey, |
$jskey, |
$$resourcedata{$thiskey}, |
$$resourcedata{$thiskey}, |
'',1,'','',$hour,$min,$sec). |
'',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; |
my $showval; |
Line 2283 sub listdata {
|
Line 2628 sub listdata {
|
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'">'); |
$r->print('</td></tr>'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
return $foundkeys; |
return $foundkeys; |
} |
} |
|
|
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 $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $html=&Apache::lonxml::xmlbegin(); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$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 2324 ENDOVER
|
Line 2665 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 2338 ENDOVER
|
Line 2680 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 2365 ENDOVER
|
Line 2709 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 2384 ENDOVER
|
Line 2732 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 2431 ENDOVER
|
Line 2750 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 $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
|
my $html=&Apache::lonxml::xmlbegin(); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$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="parmform"> |
<form method="post" action="/adm/parmset?action=setoverview" name="parmform"> |
ENDOVER |
ENDOVER |
Line 2468 ENDOVER
|
Line 2818 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 2503 sub change_clone {
|
Line 2905 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 2570 Output html header for page
|
Line 2968 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 2593 ENDMAINFORMHEAD
|
Line 2982 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 2619 ENDMAINFORMHEAD
|
Line 3020 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/User Notification', |
|
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 2642 ENDMAINFORMHEAD
|
Line 3051 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('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'}, |
|
{'freshen_cache' => 1}); |
|
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('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 |
|
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my @ids=(); |
my @ids=(); |
my %typep=(); |
my %typep=(); |
my %keyp=(); |
my %keyp=(); |
Line 2798 ENDYESNO
|
Line 3286 ENDYESNO
|
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
} |
} |
$r->print("</table>\n<input type='submit' name='storerules' value='". |
$r->print("</table>\n<input type='submit' name='storerules' value='". |
&mt('Store Rules')."' /></form>\n</body>\n</html>"); |
&mt('Store Rules')."' /></form>\n". |
|
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
|
sub components { |
|
my ($key,$uname,$udom,$exeuser,$exedomain)=@_; |
|
my $typeflag=0; |
|
if ($key=~/\.type$/) { |
|
$key=~s/\.type$//; |
|
$typeflag=1; |
|
} |
|
my $issection; |
|
my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
|
my $section=&mt('All Students'); |
|
if ($middle=~/^\[(.*)\]/) { |
|
$issection=$1; |
|
$section=&mt('Group/Section').': '.$issection; |
|
$middle=~s/^\[(.*)\]//; |
|
} |
|
$middle=~s/\.+$//; |
|
$middle=~s/^\.+//; |
|
if ($uname) { |
|
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
|
$issection=''; |
|
} |
|
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>'; |
|
} |
|
my $what=$part.'.'.$name; |
|
return ($realm,$section,$name,$part,$typeflag, |
|
$what,$middle,$uname,$udom,$issection); |
|
} |
|
|
|
sub standard_parameter_names { |
|
my ($name)=@_; |
|
my %standard_parms=&Apache::lonlocal::texthash('duedate' => 'Due Date', |
|
'answerdate' => 'Answer Date', |
|
'opendate' => 'Open Date', |
|
'maxtries' => 'Max. Number of Tries', |
|
'weight' => 'Weight', |
|
'date_start' => 'Starting Date', |
|
'date_end' => 'Ending Date', |
|
'int_pos' => 'Positive Integer', |
|
'int_zero_pos' => 'Positive Integer or Zero', |
|
'hinttries' => 'Number of Tries till Hints appear'); |
|
if ($standard_parms{$name}) { |
|
return $standard_parms{$name}; |
|
} else { |
|
return $name; |
|
} |
|
} |
|
|
|
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 $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
|
$r->print('<table border="2">'); |
|
my $bgcolor='#EEEEEE'; |
|
foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { |
|
if ($bgcolor eq '#EEEEEE') { $bgcolor='#FFFFCC'; } else { $bgcolor='#EEEEEE'; } |
|
my @changes=keys(%{$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'}))) { |
|
$send_msg_link ='<br />'. |
|
&Apache::loncommon::messagewrapper(&mt('Send message'), |
|
$parmlog{$id}{'exe_uname'}, |
|
$parmlog{$id}{'exe_udom'}); |
|
} |
|
$r->print('<tr bgcolor="'.$bgcolor.'"><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 (reverse(sort(@changes))) { |
|
my $value=$parmlog{$id}{'logentry'}->{$changed}; |
|
my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)= |
|
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'}); |
|
if ($typeflag) { $istype{$parmname}=$value; } |
|
if ($makenewrow) { $r->print('<tr bgcolor="'.$bgcolor.'">'); } else { $makenewrow=1; } |
|
$r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
|
&standard_parameter_names($parmname).'</td><td>'. |
|
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'); |
|
my $stillactive=0; |
|
if ($parmlog{$id}{'deleteflag'}) { |
|
$r->print(&mt('Deleted')); |
|
} else { |
|
if ($typeflag) { |
|
$r->print(&mt('Type: [_1]',&standard_parameter_names($value))); |
|
} else { |
|
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
|
$uname,$udom,$issection,$issection,$courseopt); |
|
if (&isdateparm($istype{$parmname})) { |
|
$r->print(&Apache::lonlocal::locallocaltime($value)); |
|
} else { |
|
$r->print($value); |
|
} |
|
if ($value ne $all[$level]) { |
|
$r->print('<br /><font color="red">'.&mt('Not active anymore').'</font>'); |
|
} else { |
|
$stillactive=1; |
|
} |
|
} |
|
} |
|
$r->print('</td>'); |
|
if ($stillactive) { |
|
if (($uname) && ($udom)) { |
|
$r->print('<td>Notify Link</td>'); |
|
} else { |
|
$r->print('<td>Blog Link</td>'); |
|
} |
|
} else { |
|
$r->print('<td> </td>'); |
|
} |
|
$r->print('</tr>'); |
|
} |
|
} |
|
$r->print('</table>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 2816 Main handler. Calls &assessparms and &c
|
Line 3442 Main handler. Calls &assessparms and &c
|
################################################## |
################################################## |
# use Data::Dumper; |
# use Data::Dumper; |
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
Line 2829 sub handler {
|
Line 3456 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 2865 sub handler {
|
Line 3492 sub handler {
|
|
|
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
$r->print(&header()); |
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
'Parameter Manager')); |
|
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} 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', |
Line 2876 sub handler {
|
Line 3502 sub handler {
|
&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 2889 sub handler {
|
Line 3519 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"}); |
|
&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'}= |