version 1.266, 2005/11/14 14:01:52
|
version 1.294, 2006/04/18 20:35:47
|
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 275 sub preset_defaults {
|
Line 293 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 326 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 344 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 352 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 |
# don't do anything if parameter was reset |
unless ($nval) { return; } |
unless ($nval) { return; } |
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
Line 350 sub storeparm_by_symb {
|
Line 387 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 375 sub storeparm_by_symb_inner {
|
Line 420 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 394 sub storeparm_by_symb_inner {
|
Line 443 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 405 sub storeparm_by_symb_inner {
|
Line 454 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 428 sub storeparm_by_symb_inner {
|
Line 479 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 490 sub valout {
|
Line 543 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 529 sub plink {
|
Line 582 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 590 $html
|
Line 636 $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 640 sub print_row {
|
Line 705 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 701 sub print_td {
|
Line 796 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 711 sub print_td {
|
Line 806 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 958 sub partmenu {
|
Line 1108 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 1037 sub levelmenu {
|
Line 1250 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 1053 sub sectionmenu {
|
Line 1267 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 1177 sub assessparms {
|
Line 1415 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 1198 sub assessparms {
|
Line 1439 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 1264 sub assessparms {
|
Line 1506 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 1278 sub assessparms {
|
Line 1522 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 1300 sub assessparms {
|
Line 1556 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 1336 sub assessparms {
|
Line 1592 sub assessparms {
|
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
($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 1358 sub assessparms {
|
Line 1614 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 1391 sub assessparms {
|
Line 1655 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 1404 ENDTABLEHEADFOUR
|
Line 1672 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 1412 ENDTABLEHEADFOUR
|
Line 1687 ENDTABLEHEADFOUR
|
|
|
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
|
my $defbgthree = ''; |
|
|
foreach (@ids) { |
foreach (@ids) { |
|
|
Line 1433 ENDTABLEHEADFOUR
|
Line 1709 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 1458 ENDTABLEHEADFOUR
|
Line 1740 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 1487 ENDTABLEHEADFOUR
|
Line 1770 ENDTABLEHEADFOUR
|
} 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 1502 ENDTABLEHEADFOUR
|
Line 1785 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 1573 Set Defaults for All Resources in $folde
|
Line 1857 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 1597 ENDMAPONE
|
Line 1882 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 1607 ENDMAPONE
|
Line 1892 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 1654 ENDMAPONE
|
Line 1940 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 1674 ENDMAPONE
|
Line 1958 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 1704 Returns: nothing
|
Line 1989 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 1889 sub crsenv {
|
Line 2173 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 1899 sub crsenv {
|
Line 2186 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 1926 sub crsenv {
|
Line 2213 sub crsenv {
|
'disableexampointprint' |
'disableexampointprint' |
=> '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'. |
=> '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&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 2008 sub crsenv {
|
Line 2298 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 2029 $output
|
Line 2320 $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 2110 sub storedata {
|
Line 2400 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 2125 sub storedata {
|
Line 2416 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 2142 sub storedata {
|
Line 2434 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 2162 sub storedata {
|
Line 2455 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 2171 sub storedata {
|
Line 2466 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 2296 sub listdata {
|
Line 2592 sub listdata {
|
# |
# |
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart().'<tr><td><b>'.$name. |
$r->print(&tablestart().'<tr><td><b>'.&standard_parameter_names($name). |
':</b></td><td><input type="checkbox" name="del_'. |
'</b></td><td><input type="checkbox" name="del_'. |
$thiskey.'" /></td><td>'); |
$thiskey.'" /></td><td>'); |
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
Line 2308 sub listdata {
|
Line 2604 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 2348 sub listdata {
|
Line 2645 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 2382 ENDOVER
|
Line 2675 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 2396 ENDOVER
|
Line 2690 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 2423 ENDOVER
|
Line 2719 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 2442 ENDOVER
|
Line 2742 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 2489 ENDOVER
|
Line 2760 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="parmform"> |
<form method="post" action="/adm/parmset?action=setoverview" name="parmform"> |
ENDOVER |
ENDOVER |
Line 2526 ENDOVER
|
Line 2828 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()); |
} |
} |
|
|
################################################## |
################################################## |
Line 2675 Output html header for page
|
Line 2978 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 2698 ENDMAINFORMHEAD
|
Line 2992 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', |
Line 2708 ENDMAINFORMHEAD
|
Line 3004 ENDMAINFORMHEAD
|
action => 'setrestrictmeta', |
action => 'setrestrictmeta', |
permission => $parm_permission, |
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 2728 ENDMAINFORMHEAD
|
Line 3030 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 2782 sub setrestrictmeta {
|
Line 3092 sub setrestrictmeta {
|
my $output; |
my $output; |
my $item_num; |
my $item_num; |
my $put_result; |
my $put_result; |
$r->print(&Apache::lonxml::xmlbegin()); |
|
$r->print('<head> |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
<title>LON-CAPA Restrict Metadata</title> |
|
</head>'); |
|
$r->print(&Apache::loncommon::bodytag('Restrict Metadata')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
'Restrict Metadata')); |
'Restrict Metadata')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 2834 sub setrestrictmeta {
|
Line 3141 sub setrestrictmeta {
|
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
</form> |
</form> |
ENDenv |
ENDenv |
$r->print('</body> |
$r->print(&Apache::loncommon::end_page()); |
</html>'); |
|
return 'ok'; |
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 |
|
|
|
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 2992 ENDYESNO
|
Line 3296 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 3088 sub handler {
|
Line 3530 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'}= |