version 1.236, 2005/06/28 15:56:35
|
version 1.270, 2005/11/22 16:36:05
|
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)=@_; |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec); |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec,$cgroup); |
} |
} |
|
|
sub parmval_by_symb { |
sub parmval_by_symb { |
my ($what,$symb,$def,$uname,$udom,$csec)=@_; |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup)=@_; |
# load caches |
# load caches |
|
|
&cacheparmhash(); |
&cacheparmhash(); |
Line 121 sub parmval_by_symb {
|
Line 124 sub parmval_by_symb {
|
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 $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
|
|
|
|
my $result=''; |
my $result=''; |
my @outpar=(); |
my @outpar=(); |
# ----------------------------------------------------- Cascading lookup scheme |
# ----------------------------------------------------- Cascading lookup scheme |
Line 130 sub parmval_by_symb {
|
Line 132 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 145 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 gourse 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 289 sub preset_defaults {
|
Line 309 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 327 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,$cgroup,$recflag)=@_; |
unless ($recflag) { |
unless ($recflag) { |
# first time call |
# first time call |
%recstack=(); |
%recstack=(); |
Line 315 sub storeparm_by_symb {
|
Line 335 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 370 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,$cgroup,$recflag); |
} |
} |
} |
} |
} |
} |
Line 357 sub storeparm_by_symb {
|
Line 379 sub storeparm_by_symb {
|
|
|
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 399 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 422 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 527 sub plink {
|
Line 557 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 startpage { |
my $r=shift; |
my $r=shift; |
|
my $loaditems = qq|onUnload="pclose()" onLoad="group_or_section('cgroup')"|; |
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
'onUnload="pclose()"'); |
$loaditems); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table Mode Parameter Setting'); |
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(); |
Line 602 ENDHEAD
|
Line 632 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)=@_; |
# 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); |
# 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,$$defaulttype{$which},$uname,$udom,$csec); |
$rid,$$defaulttype{$which},$uname,$udom,$csec,$cgroup); |
# 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 643 sub print_row {
|
Line 673 sub print_row {
|
|
|
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 { |
|
|
&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) { |
&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); |
Line 699 sub print_td {
|
Line 740 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 956 sub partmenu {
|
Line 997 sub partmenu {
|
} |
} |
|
|
sub usermenu { |
sub usermenu { |
my ($r,$uname,$id,$udom,$csec)=@_; |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev)=@_; |
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; |
|
my %grouphash; |
|
my $numgrp = &Apache::loncommon::coursegroups( |
|
\%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 ('',sort keys %sectionhash) { |
foreach ('',sort keys %sectionhash) { |
$sections.='<option value="'.$_.'"'. |
$sections.='<option value="'.$_.'"'. |
($_ eq $csec?'selected="selected"':'').'>'.$_.'</option>'; |
($_ eq $csec?'selected="selected"':'').'>'.$_.'</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 ('',sort keys %grouphash) { |
|
$groups.='<option value="'.$_.'"'. |
|
($_ eq $cgroup?'selected="selected"':'').'>'. |
|
$_.'</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 1128 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 1145 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 1175 sub assessparms {
|
Line 1293 sub assessparms {
|
my $udom; |
my $udom; |
my $uhome; |
my $uhome; |
my $csec; |
my $csec; |
|
my $cgroup; |
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
Line 1196 sub assessparms {
|
Line 1315 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 1262 sub assessparms {
|
Line 1382 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 1276 sub assessparms {
|
Line 1398 sub assessparms {
|
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
} |
} |
|
my $grouplist = &Apache::lonnet::get_users_groups( |
|
$udom,$uname,$env{'request.course.id'}); |
|
if ($grouplist) { |
|
my @groups = split(/:/,$grouplist); |
|
@groups = sort(@groups); |
|
$cgroup = $groups[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 1298 sub assessparms {
|
Line 1428 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 1330 sub assessparms {
|
Line 1460 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); |
|
|
$r->print('<p>'.$message.'</p>'); |
$r->print('<p>'.$message.'</p>'); |
|
|
Line 1354 sub assessparms {
|
Line 1486 sub assessparms {
|
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?8:5; |
|
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>'); |
Line 1387 sub assessparms {
|
Line 1523 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 1400 ENDTABLEHEADFOUR
|
Line 1540 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) { |
$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 1408 ENDTABLEHEADFOUR
|
Line 1552 ENDTABLEHEADFOUR
|
|
|
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
|
my $defbgthree = ''; |
|
|
foreach (@ids) { |
foreach (@ids) { |
|
|
Line 1429 ENDTABLEHEADFOUR
|
Line 1574 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 1475 ENDTABLEHEADFOUR
|
Line 1626 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_bytype(\%name,\%keyorder)) { |
unless ($firstrow) { |
unless ($firstrow) { |
Line 1488 ENDTABLEHEADFOUR
|
Line 1634 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); |
} |
} |
} |
} |
} |
} |
Line 1503 ENDTABLEHEADFOUR
|
Line 1649 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 1574 Set Defaults for All Resources in $folde
|
Line 1721 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 1598 ENDMAPONE
|
Line 1746 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 1608 ENDMAPONE
|
Line 1756 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 1655 ENDMAPONE
|
Line 1804 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 1675 ENDMAPONE
|
Line 1822 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 |
Line 1772 sub crsenv {
|
Line 1920 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 1791 sub crsenv {
|
Line 1943 sub crsenv {
|
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
} |
} |
|
if (($name eq 'cloners') && ($failed_cloners)) { |
|
$setoutput.= &mt('Unable to include').' - <b>'.$failed_cloners.'</b>, '. |
|
&mt('reason').' - '.&mt('LON-CAPA user(s) do(es) not exist'). |
|
'.<br />'.&mt('Please '). |
|
' <a href="/adm/createuser">'. |
|
&mt('add the user(s)').'</a>, '. |
|
&mt('and then return to the '). |
|
'<a href="/admparmset?action=crsenv">'. |
|
&mt('Course Parameters page').'</a> '. |
|
&mt('to add the new user(s) to the list of possible cloners'). |
|
'.<br />'; |
|
} |
} |
} |
} |
} |
# ------------------------- Re-init course environment entries for this session |
# ------------------------- Re-init course environment entries for this session |
Line 1908 sub crsenv {
|
Line 2072 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>').')', |
'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>' |
); |
); |
Line 1934 sub crsenv {
|
Line 2101 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 2176 sub listdata {
|
Line 2344 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 2337 ENDOVER
|
Line 2531 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 2351 ENDOVER
|
Line 2546 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 2378 ENDOVER
|
Line 2575 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 2397 ENDOVER
|
Line 2598 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 2447 ENDOVER
|
Line 2619 ENDOVER
|
'</form></body></html>'); |
'</form></body></html>'); |
} |
} |
|
|
|
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=shift; |
my $bodytag=&Apache::loncommon::bodytag('Modify Parameters'); |
my $bodytag=&Apache::loncommon::bodytag('Modify Parameters'); |
Line 2488 ENDOVER
|
Line 2695 ENDOVER
|
################################################## |
################################################## |
|
|
=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 2516 sub change_clone {
|
Line 2774 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 2606 ENDMAINFORMHEAD
|
Line 2860 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 => 'Manange 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 2636 ENDMAINFORMHEAD
|
Line 2902 ENDMAINFORMHEAD
|
); |
); |
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 2655 ENDMAINFORMHEAD
|
Line 2925 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::lonxml::xmlbegin()); |
|
$r->print('<head> |
|
<title>LON-CAPA Restrict Metadata</title> |
|
</head>'); |
|
$r->print(&Apache::loncommon::bodytag('Restrict Metadata')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Restrict Metadata')); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
|
my $save_field = ''; |
|
if ($env{'form.restrictmeta'}) { |
|
foreach my $field (sort(keys(%env))) { |
|
if ($field=~m/^form.(.+)_(.+)$/) { |
|
my $options; |
|
my $meta_field = $1; |
|
my $meta_key = $2; |
|
if ($save_field ne $meta_field) { |
|
$save_field = $meta_field; |
|
if ($env{'form.'.$meta_field.'_stuadd'}) { |
|
$options.='stuadd,'; |
|
} |
|
if ($env{'form.'.$meta_field.'_onlyone'}) { |
|
$options.='onlyone,'; |
|
} |
|
if ($env{'form.'.$meta_field.'_active'}) { |
|
$options.='active,'; |
|
} |
|
my $name = $save_field; |
|
$put_result = &Apache::lonnet::put('environment', |
|
{'metadata.'.$meta_field.'.options'=>$options, |
|
'metadata.'.$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'}, |
|
},$dom,$crs); |
|
} |
|
} |
|
} |
|
} |
|
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
|
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
|
foreach my $field (sort(keys(%metadata_fields))) { |
|
&Apache::lonnet::logthis ($field); |
|
if ($field ne 'courserestricted') { |
|
$output.= &output_row($r, $field, $metadata_fields{$field}); |
|
} |
|
} |
|
$r->print(<<ENDenv); |
|
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
|
<p> |
|
$output |
|
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
|
</form> |
|
ENDenv |
|
$r->print('</body> |
|
</html>'); |
|
return 'ok'; |
|
} |
################################################## |
################################################## |
|
|
sub defaultsetter { |
sub defaultsetter { |
Line 2829 Main handler. Calls &assessparms and &c
|
Line 3184 Main handler. Calls &assessparms and &c
|
################################################## |
################################################## |
# use Data::Dumper; |
# use Data::Dumper; |
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
Line 2842 sub handler {
|
Line 3198 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 2889 sub handler {
|
Line 3245 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"}); |