version 1.566, 2016/08/10 21:05:42
|
version 1.585, 2018/09/03 16:43:47
|
Line 36 lonparmset - Handler to set parameters f
|
Line 36 lonparmset - Handler to set parameters f
|
|
|
=head1 SYNOPSIS |
=head1 SYNOPSIS |
|
|
lonparmset provides an interface to setting course parameters. |
lonparmset provides an interface to setting content parameters in a |
|
course. |
|
|
It contains all the code for the "Content and Problem Settings" UI, except |
It contains all the code for the "Content and Problem Settings" UI, except |
for the helpers parameter.helper and resettimes.helper, and lonhelper.pm, |
for the helpers parameter.helper and resettimes.helper, and lonhelper.pm, |
Line 137 javascript function 'pjump'.
|
Line 138 javascript function 'pjump'.
|
|
|
=item print_td() |
=item print_td() |
|
|
=item print_usergroups() |
=item check_other_groups() |
|
|
=item parm_control_group() |
=item parm_control_group() |
|
|
Line 846 sub storeparm_by_symb_inner {
|
Line 847 sub storeparm_by_symb_inner {
|
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
my $storeunder=''; |
my $storeunder=''; |
|
my $possreplace=''; |
if (($snum==18) || ($snum==4)) { $storeunder=$courselevel; } |
if (($snum==18) || ($snum==4)) { $storeunder=$courselevel; } |
if (($snum==17) || ($snum==3)) { $storeunder=$courseleveli; } |
if (($snum==17) || ($snum==3)) { |
if (($snum==16) || ($snum==2)) { $storeunder=$courselevelm; } |
$storeunder=$courseleveli; |
|
$possreplace=$courselevelm; |
|
} |
|
if (($snum==16) || ($snum==2)) { |
|
$storeunder=$courselevelm; |
|
$possreplace=$courseleveli; |
|
} |
if (($snum==13) || ($snum==1)) { $storeunder=$courselevelr; } |
if (($snum==13) || ($snum==1)) { $storeunder=$courselevelr; } |
if ($snum==12) { $storeunder=$seclevel; } |
if ($snum==12) { $storeunder=$seclevel; } |
if ($snum==11) { $storeunder=$secleveli; } |
if ($snum==11) { |
if ($snum==10) { $storeunder=$seclevelm; } |
$storeunder=$secleveli; |
|
$possreplace=$seclevelm; |
|
} |
|
if ($snum==10) { |
|
$storeunder=$seclevelm; |
|
$possreplace=$secleveli; |
|
} |
if ($snum==9) { $storeunder=$seclevelr; } |
if ($snum==9) { $storeunder=$seclevelr; } |
if ($snum==8) { $storeunder=$grplevel; } |
if ($snum==8) { $storeunder=$grplevel; } |
if ($snum==7) { $storeunder=$grpleveli; } |
if ($snum==7) { |
if ($snum==6) { $storeunder=$grplevelm; } |
$storeunder=$grpleveli; |
|
$possreplace=$grplevelm; |
|
} |
|
if ($snum==6) { |
|
$storeunder=$grplevelm; |
|
$possreplace=$grpleveli; |
|
} |
if ($snum==5) { $storeunder=$grplevelr; } |
if ($snum==5) { $storeunder=$grplevelr; } |
|
|
|
|
Line 875 sub storeparm_by_symb_inner {
|
Line 895 sub storeparm_by_symb_inner {
|
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','studentcalc'); |
if (($snum==13) || ($snum==9) || ($snum==5)) { |
if (($snum==13) || ($snum==9) || ($snum==5)) { |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
} elsif (($snum==14) || ($snum==10) || ($snum==6)) { |
} elsif (($snum==17) || ($snum==16) || ($snum==11) || ($snum==10) || ($snum==7) || ($snum==6)) { |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
} else { |
} else { |
&Apache::lonnet::expirespread('','','assesscalc'); |
&Apache::lonnet::expirespread('','','assesscalc'); |
Line 889 sub storeparm_by_symb_inner {
|
Line 909 sub storeparm_by_symb_inner {
|
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$cdom,$cnum); |
('resourcedata',\%storecontent,$cdom,$cnum); |
&log_parmset(\%storecontent); |
&log_parmset(\%storecontent); |
|
if ($possreplace) { |
|
my $resdata = &Apache::lonnet::get_courseresdata($cnum,$cdom); |
|
if (ref($resdata) eq 'HASH') { |
|
if (exists($resdata->{$possreplace})) { |
|
if (&Apache::lonnet::del |
|
('resourcedata',[$possreplace,$possreplace.'.type'],$cdom,$cnum) eq 'ok') { |
|
&log_parmset({$possreplace => '', $possreplace.'.type' => $ntype},1); |
|
} |
|
} |
|
} |
|
} |
} |
} |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
} else { |
} else { |
Line 899 sub storeparm_by_symb_inner {
|
Line 930 sub storeparm_by_symb_inner {
|
if ($snum==1) { |
if ($snum==1) { |
&Apache::lonnet::expirespread |
&Apache::lonnet::expirespread |
($uname,$udom,'assesscalc',$symb); |
($uname,$udom,'assesscalc',$symb); |
} elsif ($snum==2) { |
} elsif (($snum==2) || ($snum==3)) { |
&Apache::lonnet::expirespread |
&Apache::lonnet::expirespread |
($uname,$udom,'assesscalc',$map); |
($uname,$udom,'assesscalc',$map); |
} else { |
} else { |
Line 914 sub storeparm_by_symb_inner {
|
Line 945 sub storeparm_by_symb_inner {
|
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$udom,$uname); |
('resourcedata',\%storecontent,$udom,$uname); |
&log_parmset(\%storecontent,0,$uname,$udom); |
&log_parmset(\%storecontent,0,$uname,$udom); |
|
if ($possreplace) { |
|
my $resdata = &Apache::lonnet::get_userresdata($uname,$udom); |
|
if (ref($resdata) eq 'HASH') { |
|
if (exists($resdata->{$possreplace})) { |
|
if (&Apache::lonnet::del |
|
('resourcedata',[$possreplace,$possreplace.'.type'],$udom,$uname) eq 'ok') { |
|
&log_parmset({$possreplace => '',$possreplace.'.type' => $ntype},1, |
|
$uname,$udom); |
|
} |
|
} |
|
} |
|
} |
} |
} |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
} |
} |
Line 1022 sub valout {
|
Line 1065 sub valout {
|
# @param {string} $marker - identifier for the parameter, "resource id&part_parameter name&level", will be passed as pres_marker when the user submits a change. |
# @param {string} $marker - identifier for the parameter, "resource id&part_parameter name&level", will be passed as pres_marker when the user submits a change. |
# @param {string} $return - prefix for the name of the form and field names that will be used to submit the form ('parmform.pres') |
# @param {string} $return - prefix for the name of the form and field names that will be used to submit the form ('parmform.pres') |
# @param {string} $call - javascript function to call to submit the form ('psub') |
# @param {string} $call - javascript function to call to submit the form ('psub') |
|
# @param {boolean} $recursive - true if link is for a map/folder where parameter is currently set to be recursive. |
sub plink { |
sub plink { |
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my ($type,$dis,$value,$marker,$return,$call,$recursive)=@_; |
my $winvalue=$value; |
my $winvalue=$value; |
unless ($winvalue) { |
unless ($winvalue) { |
if (&isdateparm($type)) { |
if (&isdateparm($type)) { |
Line 1045 sub plink {
|
Line 1089 sub plink {
|
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></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.'</a></td></tr></table>'; |
$valout.'</a></td></tr>'.($recursive?'<tr><td align="center" class="LC_parm_recursive">'. |
|
&mt('recursive').'</td></tr>' : '').'</table>'; |
|
|
} |
} |
|
|
# Javascript for table mode. |
# Javascript for table mode. |
Line 1380 ENDHEAD
|
Line 1426 ENDHEAD
|
# @param {string} $cgroup - group name |
# @param {string} $cgroup - group name |
# @param {array reference} $usersgroups - list of groups the user belongs to, if any |
# @param {array reference} $usersgroups - list of groups the user belongs to, if any |
# @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters |
# @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters |
|
# @param {boolean} $readonly - true if no editing allowed. |
|
# @param {array reference} - $recurseup - list of maps containing current one, ending at top-level. |
|
# @param {hash reference} - $maptitles - - hash map id or src -> map title |
|
# @param {hash reference} - $allmaps_inverted - hash map src -> map pc |
|
# @param {scalar reference} - $reclinks - number of "parameter in effect" cells with link to map where recursive param was set |
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,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp)=@_; |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp, |
|
$readonly,$recurseup,$maptitles,$allmaps_inverted,$reclinks)=@_; |
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 $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
|
my $numlinks = 0; |
|
|
# 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 |
Line 1422 sub print_row {
|
Line 1475 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],$thismarker); |
my ($parmname)=($thismarker=~/\_([^\_]+)$/); |
my ($othergrp,$grp_parm,$controlgrp); |
my ($othergrp,$grp_parm,$controlgrp,$effective_parm,$effparm_rec,$effparm_level, |
|
$eff_groupparm,$recurse_check,$recursinfo); |
|
if ((ref($recurseup) eq 'ARRAY') && (@{$recurseup} > 0)) { |
|
if ($result eq '') { |
|
$recurse_check = 1; |
|
} elsif (($uname ne '') && ($result > 3)) { |
|
$recurse_check = 1; |
|
} elsif (($cgroup ne '') && ($result > 7)) { |
|
$recurse_check = 1; |
|
} elsif (($csec ne '') && ($result > 11)) { |
|
$recurse_check = 1; |
|
} elsif ($result > 17) { |
|
$recurse_check = 1; |
|
} |
|
if ($recurse_check) { |
|
my $what = $$part{$which}.'.'.$$name{$which}; |
|
my $prefix; |
|
if (($uname ne '') && ($udom ne '')) { |
|
my $useropt = &Apache::lonnet::get_userresdata($uname,$udom); |
|
$prefix = $env{'request.course.id'}; |
|
$recursinfo = &get_recursive($recurseup,$useropt,$what,$prefix); |
|
if (ref($recursinfo) eq 'ARRAY') { |
|
$effparm_rec = 1; |
|
$effparm_level = &mt('user: [_1]',$uname); |
|
} |
|
} |
|
if (($cgroup ne '') && (!$effparm_rec)) { |
|
$prefix = $env{'request.course.id'}.'.['.$cgroup.']'; |
|
$recursinfo = &get_recursive($recurseup,$courseopt,$what,$prefix); |
|
if (ref($recursinfo) eq 'ARRAY') { |
|
$effparm_rec = 1; |
|
$effparm_level = &mt('group: [_1]',$cgroup); |
|
} |
|
} |
|
if (($csec ne '') && (!$effparm_rec)) { |
|
$prefix = $env{'request.course.id'}.'.['.$csec.']'; |
|
$recursinfo = &get_recursive($recurseup,$courseopt,$what,$prefix); |
|
if (ref($recursinfo) eq 'ARRAY') { |
|
$effparm_rec = 1; |
|
$effparm_level = &mt('section: [_1]',$csec); |
|
} |
|
} |
|
if (!$effparm_rec) { |
|
$prefix = $env{'request.course.id'}; |
|
$recursinfo = &get_recursive($recurseup,$courseopt,$what,$prefix); |
|
if (ref($recursinfo) eq 'ARRAY') { |
|
$effparm_rec = 1; |
|
} |
|
} |
|
} |
|
} |
|
if ((!$effparm_rec) && ($result == 17 || $result == 11 || $result == 7 || $result == 3)) { |
|
$effparm_rec = 1; |
|
} |
|
if ((!$effparm_rec) && |
|
(($$name{$which} eq 'encrypturl') || ($$name{$which} eq 'hiddenresource')) && |
|
($result == 16 || $result == 10 || $result == 6 || $result == 2)) { |
|
$effparm_rec = 1; |
|
} |
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
if ($uname) { |
if ($uname) { |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
} else { |
} else { |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
if ($uname) { |
if ($uname) { |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
|
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
} else { |
} else { |
&print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
} |
} |
} else { |
} else { |
if ($uname) { |
if ($uname) { |
if (@{$usersgroups} > 1) { |
if (@{$usersgroups} > 1) { |
my ($coursereply,$grp_parm,$controlgrp); |
(my $coursereply,$othergrp,$grp_parm,$controlgrp,my $grp_is_rec) = |
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
&check_other_groups($$part{$which}.'.'.$$name{$which}, |
&print_usergroups($r,$$part{$which}.'.'.$$name{$which}, |
|
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); |
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); |
if ($coursereply && $result > 4) { |
if (($coursereply) && ($result > 4)) { |
if (defined($controlgrp)) { |
if (defined($controlgrp)) { |
if ($cgroup ne $controlgrp) { |
if ($cgroup ne $controlgrp) { |
$effective_parm = $grp_parm; |
$eff_groupparm = $grp_parm; |
$result = 0; |
undef($result); |
|
undef($effparm_rec); |
|
if ($grp_is_rec) { |
|
$effparm_rec = 1; |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp.$readonly); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
|
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if ($othergrp) { |
if ($othergrp) { |
$r->print($othergrp); |
$r->print($othergrp); |
} |
} |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
} |
} |
|
|
} # end of $parmlev if/else |
} # end of $parmlev if/else |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>'); |
if (ref($recursinfo) eq 'ARRAY') { |
|
my $rectitle = &mt('recursive'); |
|
if ((ref($maptitles) eq 'HASH') && (exists($maptitles->{$recursinfo->[2]}))) { |
|
if ((ref($allmaps_inverted) eq 'HASH') && (exists($allmaps_inverted->{$recursinfo->[2]}))) { |
|
$rectitle = &mt('set in: [_1]','"'. |
|
'<a href="javascript:pjumprec('."'".$allmaps_inverted->{$recursinfo->[2]}."',". |
|
"'$parmname','$$part{$which}'".');">'. |
|
$maptitles->{$recursinfo->[2]}.'</a>"'); |
|
|
|
$numlinks ++; |
|
} |
|
} |
|
my ($parmname)=($thismarker=~/\_([^\_]+)$/); |
|
$effective_parm = &valout($recursinfo->[0],$recursinfo->[1],$parmname); |
|
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm. |
|
'<br /><span class="LC_parm_recursive">'.$rectitle.' '. |
|
$effparm_level.'</span></td>'); |
|
} else { |
|
if ($result) { |
|
$effective_parm = &valout($outpar[$result],$typeoutpar[$result],$parmname); |
|
} |
|
if ($eff_groupparm) { |
|
$effective_parm = $eff_groupparm; |
|
} |
|
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm. |
|
($effparm_rec?'<br /><span class="LC_parm_recursive">'.&mt('recursive'). |
|
'</span>':'').'</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}); |
Line 1514 sub print_row {
|
Line 1644 sub print_row {
|
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
$r->print("\n"); |
$r->print("\n"); |
|
if (($numlinks) && (ref($reclinks))) { |
|
$$reclinks = $numlinks; |
|
} |
} |
} |
|
|
# Prints a cell for table mode. |
# Prints a cell for table mode. |
Line 1532 sub print_row {
|
Line 1665 sub print_row {
|
# @param {array reference} $typeoutpar - array level -> parameter type (when defined) |
# @param {array reference} $typeoutpar - array level -> parameter type (when defined) |
# @param {hash reference} $display - parameter key -> full title for the parameter |
# @param {hash reference} $display - parameter key -> full title for the parameter |
# @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters |
# @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters |
|
# @param {boolean} $readonly -true if editing not allowed. |
|
# @param {boolean} $ismaplevel - true if level is for a map. |
sub print_td { |
sub print_td { |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp)=@_; |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display, |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
$noeditgrp,$readonly,$ismaplevel)=@_; |
|
my ($ineffect,$recursive,$currval,$currtype,$currlevel); |
|
$ineffect = 0; |
|
$currval = $$outpar[$which]; |
|
$currtype = $$typeoutpar[$which]; |
|
$currlevel = $which; |
|
if (($result) && ($result == $which)) { |
|
$ineffect = 1; |
|
} |
|
if ($ismaplevel) { |
|
if ($mprefix =~ /(hiddenresource|encrypturl)\&/) { |
|
if (($result) && ($result == $which)) { |
|
$recursive = 1; |
|
} |
|
} elsif ($$outpar[$which+1] ne '') { |
|
$recursive = 1; |
|
$currlevel = $which+1; |
|
$currval = $$outpar[$currlevel]; |
|
$currtype = $$typeoutpar[$currlevel]; |
|
if (($result) && ($result == $currlevel)) { |
|
$ineffect = 1; |
|
} |
|
} |
|
} |
|
$r->print('<td style="background-color:'.($ineffect?'#AAFFAA':$defbg). |
';" align="center">'); |
';" align="center">'); |
my $nolink = 0; |
my $nolink = 0; |
if ($which == 14 || $which == 15) { |
if ($readonly) { |
$nolink = 1; |
|
} elsif (($env{'request.course.sec'} ne '') && ($which > 12)) { |
|
$nolink = 1; |
$nolink = 1; |
} elsif ($which == 5 || $which == 6 || $which == 7 || $which == 8) { |
} else { |
if ($noeditgrp) { |
if ($which == 14 || $which == 15 || $mprefix =~ /mapalias\&$/) { |
$nolink = 1; |
$nolink = 1; |
} |
} elsif (($env{'request.course.sec'} ne '') && ($which > 12)) { |
} elsif ($mprefix =~ /availablestudent\&$/) { |
|
if ($which > 4) { |
|
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /examcode\&$/) { |
|
unless ($which == 2) { |
|
$nolink = 1; |
$nolink = 1; |
|
} elsif ($which == 5 || $which == 6 || $which == 7 || $which == 8) { |
|
if ($noeditgrp) { |
|
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /availablestudent\&$/) { |
|
if ($which > 4) { |
|
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /examcode\&$/) { |
|
unless ($which == 2) { |
|
$nolink = 1; |
|
} |
} |
} |
} |
} |
if ($nolink) { |
if ($nolink) { |
$r->print(&valout($$outpar[$which],$$typeoutpar[$which],$mprefix)); |
my ($parmname)=((split(/\&/,$mprefix))[1]=~/\_([^\_]+)$/); |
# FIXME: probably a good thing that mprefix is not used in valout, because it does not look like a parameter name ! |
$r->print(&valout($currval,$currtype,$parmname)); |
} else { |
} else { |
$r->print(&plink($$typeoutpar[$which], |
$r->print(&plink($currtype, |
$$display{$value},$$outpar[$which], |
$$display{$value},$currval, |
$mprefix."$which",'parmform.pres','psub')); |
$mprefix.$currlevel,'parmform.pres','psub',$recursive)); |
} |
} |
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
|
|
# FIXME: Despite the name, this does not print anything, the $r parameter is unused. |
|
# Returns HTML and other info for the cell added when a user is selected |
# Returns HTML and other info for the cell added when a user is selected |
# and that user is in several groups. This is the cell with the title "Control by other group". |
# and that user is in several groups. This is the cell with the title "Control by other group". |
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request (unused) |
|
# @param {string} $what - parameter part.'.'.parameter name |
# @param {string} $what - parameter part.'.'.parameter name |
# @param {string} $rid - resource id |
# @param {string} $rid - resource id |
# @param {string} $cgroup - group name |
# @param {string} $cgroup - group name |
Line 1577 sub print_td {
|
Line 1738 sub print_td {
|
# @param {array reference} $usersgroups - list of groups the user belongs to, if any |
# @param {array reference} $usersgroups - list of groups the user belongs to, if any |
# @param {integer} $result - level |
# @param {integer} $result - level |
# @param {hash reference} $courseopt - course parameters hash (result of lonnet::get_courseresdata, dump of course's resourcedata.db) |
# @param {hash reference} $courseopt - course parameters hash (result of lonnet::get_courseresdata, dump of course's resourcedata.db) |
# @returns {Array} - array (parameter value for the other group, HTML for the cell, HTML with the value, name of the other group) |
# @returns {Array} - array (parameter value for the other group, HTML for the cell, HTML with the value, name of the other group, true if recursive) |
sub print_usergroups { |
sub check_other_groups { |
my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
my $courseid = $env{'request.course.id'}; |
my $courseid = $env{'request.course.id'}; |
my $output; |
my $output; |
my $symb = &symbcache($rid); |
my $symb = &symbcache($rid); |
Line 1591 sub print_usergroups {
|
Line 1752 sub print_usergroups {
|
&parm_control_group($courseid,$usersgroups,$symbparm,$mapparm, |
&parm_control_group($courseid,$usersgroups,$symbparm,$mapparm, |
$recurseparm,$what,$courseopt); |
$recurseparm,$what,$courseopt); |
my $bgcolor = $defbg; |
my $bgcolor = $defbg; |
my $grp_parm; |
my ($grp_parm,$grp_is_rec); |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
|
my ($parmname) = ($what =~ /\.([^.]+)$/); |
if ($result > 3) { |
if ($result > 3) { |
$bgcolor = '#AAFFAA'; |
$bgcolor = '#AAFFAA'; |
$grp_parm = &valout($coursereply,$resulttype,$what); |
|
} |
} |
$grp_parm = &valout($coursereply,$resulttype,$what); |
$grp_parm = &valout($coursereply,$resulttype,$parmname); |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
if ($resultgroup && $resultlevel) { |
if ($resultgroup && $resultlevel) { |
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm; |
if ($resultlevel eq 'recursive') { |
|
$resultlevel = 'map/folder'; |
|
$grp_is_rec = 1; |
|
} |
|
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm. |
|
($grp_is_rec?'<span class="LC_parm_recursive">'.&mt('recursive').'</span>':''); |
|
|
} else { |
} else { |
$output .= ' '; |
$output .= ' '; |
} |
} |
Line 1608 sub print_usergroups {
|
Line 1775 sub print_usergroups {
|
} else { |
} else { |
$output .= '<td style="background-color:'.$bgcolor.';"> </td>'; |
$output .= '<td style="background-color:'.$bgcolor.';"> </td>'; |
} |
} |
return ($coursereply,$output,$grp_parm,$resultgroup); |
return ($coursereply,$output,$grp_parm,$resultgroup,$grp_is_rec); |
} |
} |
|
|
# Looks for a group with a defined parameter for given user and parameter. |
# Looks for a group with a defined parameter for given user and parameter. |
# Used by print_usergroups. |
# Used by check_other_groups. |
# |
# |
# @param {string} $courseid - the course id |
# @param {string} $courseid - the course id |
# @param {array reference} $usersgroups - list of groups the user belongs to, if any |
# @param {array reference} $usersgroups - list of groups the user belongs to, if any |
Line 1689 sub extractResourceInformation {
|
Line 1856 sub extractResourceInformation {
|
my $srcf=$resource->src(); |
my $srcf=$resource->src(); |
$srcf=~/\.(\w+)$/; |
$srcf=~/\.(\w+)$/; |
$$typep{$id}=$1; |
$$typep{$id}=$1; |
|
my $toolsymb; |
|
if ($srcf =~ /ext\.tool$/) { |
|
$toolsymb = $resource->symb(); |
|
} |
$$keyp{$id}=''; |
$$keyp{$id}=''; |
$$uris{$id}=$srcf; |
$$uris{$id}=$srcf; |
|
|
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys',$toolsymb))) { |
next if ($key!~/^parameter_/); |
next if ($key!~/^parameter_/); |
|
|
# Hidden parameters |
# Hidden parameters |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm'); |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden',$toolsymb) eq 'parm'); |
# |
# |
# allparms is a hash of parameter names |
# allparms is a hash of parameter names |
# |
# |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name',$toolsymb); |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
my ($display,$parmdis); |
my ($display,$parmdis); |
$display = &standard_parameter_names($name); |
$display = &standard_parameter_names($name); |
if ($display eq '') { |
if ($display eq '') { |
$display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
$display= &Apache::lonnet::metadata($srcf,$key.'.display',$toolsymb); |
$parmdis = $display; |
$parmdis = $display; |
$parmdis =~ s/\s*\[Part.*$//g; |
$parmdis =~ s/\s*\[Part.*$//g; |
} else { |
} else { |
Line 1714 sub extractResourceInformation {
|
Line 1885 sub extractResourceInformation {
|
$$allparms{$name}=$parmdis; |
$$allparms{$name}=$parmdis; |
if (ref($defkeytype)) { |
if (ref($defkeytype)) { |
$$defkeytype{$name}= |
$$defkeytype{$name}= |
&Apache::lonnet::metadata($srcf,$key.'.type'); |
&Apache::lonnet::metadata($srcf,$key.'.type',$toolsymb); |
} |
} |
} |
} |
|
|
# |
# |
# allparts is a hash of all parts |
# allparts is a hash of all parts |
# |
# |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part',$toolsymb); |
$$allparts{$part} = &mt('Part: [_1]',$part); |
$$allparts{$part} = &mt('Part: [_1]',$part); |
# |
# |
# Remember all keys going with this resource |
# Remember all keys going with this resource |
Line 1762 sub extractResourceInformation {
|
Line 1933 sub extractResourceInformation {
|
} |
} |
} |
} |
|
|
|
sub get_recursive { |
|
my ($recurseup,$resdata,$what,$prefix) = @_; |
|
if ((ref($resdata) eq 'HASH') && (ref($recurseup) eq 'ARRAY')) { |
|
foreach my $item (@{$recurseup}) { |
|
my $norecursechk=$prefix.'.'.$item.'___(all).'.$what; |
|
if (defined($resdata->{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
my $type = $resdata->{$norecursechk.'.type'}; |
|
return [$resdata->{$norecursechk},$type,$item]; |
|
} else { |
|
last; |
|
} |
|
} |
|
my $recursechk=$prefix.'.'.$item.'___(rec).'.$what; |
|
if (defined($resdata->{$recursechk})) { |
|
my $type = $resdata->{$recursechk.'.type'}; |
|
return [$resdata->{$recursechk},$type,$item]; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
|
# Tells if a parameter type is a date. |
# Tells if a parameter type is a date. |
# |
# |
Line 1773 sub isdateparm {
|
Line 1967 sub isdateparm {
|
} |
} |
|
|
# Prints the HTML and Javascript to select parameters, with various shortcuts. |
# Prints the HTML and Javascript to select parameters, with various shortcuts. |
# FIXME: remove unused parameters |
|
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request (unused) |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {hash reference} $allparms - hash parameter name -> parameter title |
|
# @param {array reference} $pscat - list of selected parameter names (unused) |
|
# @param {hash reference} $keyorder - hash parameter key -> appearance rank (unused) |
|
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r)=@_; |
my $tempkey; |
|
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1858 sub parmmenu {
|
Line 2047 sub parmmenu {
|
ENDSCRIPT |
ENDSCRIPT |
|
|
$r->print('<hr />'); |
$r->print('<hr />'); |
&shortCuts($r,$allparms,$pscat,$keyorder); |
&shortCuts($r); |
$r->print('<hr />'); |
$r->print('<hr />'); |
} |
} |
|
|
Line 1927 sub lookUpTableParameter {
|
Line 2116 sub lookUpTableParameter {
|
'lenient' => 'grading', |
'lenient' => 'grading', |
'retrypartial' => 'tries', |
'retrypartial' => 'tries', |
'discussvote' => 'misc', |
'discussvote' => 'misc', |
'examcode' => 'high_level_randomization', |
'examcode' => 'high_level_randomization', |
); |
); |
} |
} |
|
|
# Adds the given parameter name to an array of arrays listing all parameters for each category. |
# Adds the given parameter name to an array of arrays listing all parameters for each category. |
Line 2022 sub parmboxes {
|
Line 2211 sub parmboxes {
|
$r->print('<div class="LC_Box LC_400Box">' |
$r->print('<div class="LC_Box LC_400Box">' |
.'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n"); |
.'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n"); |
foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
|
next if ($tempkey eq ''); |
$r->print('<span class="LC_nobreak">' |
$r->print('<span class="LC_nobreak">' |
.'<label><input type="checkbox" name="pscat" ' |
.'<label><input type="checkbox" name="pscat" ' |
.'value="'.$tempkey.'" '); |
.'value="'.$tempkey.'" '); |
Line 2038 sub parmboxes {
|
Line 2228 sub parmboxes {
|
} |
} |
|
|
# Prints HTML with shortcuts to select groups of parameters in one click, or deselect all. |
# Prints HTML with shortcuts to select groups of parameters in one click, or deselect all. |
# FIXME: remove unused parameters |
|
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {hash reference} $allparms - hash parameter name -> parameter title (unused) |
|
# @param {array reference} $pscat - list of selected parameter names (unused) |
|
# @param {hash reference} $keyorder - hash parameter key -> appearance rank (unused) |
|
sub shortCuts { |
sub shortCuts { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r)=@_; |
|
|
# Parameter Selection |
# Parameter Selection |
$r->print( |
$r->print( |
Line 2135 sub usermenu {
|
Line 2321 sub usermenu {
|
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
%grouphash = &Apache::longroup::coursegroups(); |
%grouphash = &Apache::longroup::coursegroups(); |
} elsif ($env{'request.course.groups'} ne '') { |
} elsif ($env{'request.course.groups'} ne '') { |
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
} |
} |
|
|
my $g_s_header=''; |
my $g_s_header=''; |
Line 2238 function group_or_section(caller) {
|
Line 2424 function group_or_section(caller) {
|
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {hash reference} $allparms - hash parameter name -> parameter title |
# @param {hash reference} $allparms - hash parameter name -> parameter title |
# @param {array reference} $pscat - list of selected parameter names |
# @param {array reference} $pscat - list of selected parameter names |
# @param {array reference} $psprt - list of selected parameter parts (unused) |
|
# @param {hash reference} $keyorder - hash parameter key -> appearance rank |
# @param {hash reference} $keyorder - hash parameter key -> appearance rank |
# @param {string} [$divid] - name used to give an id to the HTML element for the scroll box |
# @param {string} [$divid] - name used to give an id to the HTML element for the scroll box |
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_; |
my ($r,$allparms,$pscat,$keyorder,$divid)=@_; |
|
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
|
|
&parmmenu($r,$allparms,$pscat,$keyorder); # only $allparms is used by parmmenu |
&parmmenu($r); |
$r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); |
$r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::loncommon::end_scrollbox()); |
$r->print(&Apache::loncommon::end_scrollbox()); |
Line 2480 sub groupmenu {
|
Line 2665 sub groupmenu {
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
%grouphash = &Apache::longroup::coursegroups(); |
%grouphash = &Apache::longroup::coursegroups(); |
} elsif ($env{'request.course.groups'} ne '') { |
} elsif ($env{'request.course.groups'} ne '') { |
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
} |
} |
return '' if (!%grouphash); |
return '' if (!%grouphash); |
|
|
Line 2630 sub standardkeyorder {
|
Line 2815 sub standardkeyorder {
|
# url - used only with command 'set', the resource url |
# url - used only with command 'set', the resource url |
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
|
# @param $parm_permission - ref to hash of permissions |
|
# if $parm_permission->{'edit'} is true, editing is allowed. |
sub assessparms { |
sub assessparms { |
|
|
my $r=shift; |
my ($r,$parm_permission) = @_; |
|
|
|
|
# -------------------------------------------------------- Variable declaration |
# -------------------------------------------------------- Variable declaration |
Line 2644 sub assessparms {
|
Line 2831 sub assessparms {
|
my %uris=(); # hash resource/map id -> resource src |
my %uris=(); # hash resource/map id -> resource src |
my %maptitles=(); # hash map pc or src -> map title |
my %maptitles=(); # hash map pc or src -> map title |
my %allmaps=(); # hash map pc -> map src |
my %allmaps=(); # hash map pc -> map src |
|
my %allmaps_inverted=(); # hash map src -> map pc |
my %alllevs=(); # hash English level title -> value |
my %alllevs=(); # hash English level title -> value |
|
|
my $uname; # selected user name |
my $uname; # selected user name |
Line 2652 sub assessparms {
|
Line 2840 sub assessparms {
|
my $csec; # selected section name |
my $csec; # selected section name |
my $cgroup; # selected group name |
my $cgroup; # selected group name |
my @usersgroups = (); # list of the user groups |
my @usersgroups = (); # list of the user groups |
|
my $numreclinks = 0; |
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
Line 2685 sub assessparms {
|
Line 2874 sub assessparms {
|
if ($cgroup ne '') { |
if ($cgroup ne '') { |
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (($env{'request.course.groups'} eq '') || |
if (($env{'request.course.groups'} eq '') || |
(!grep(/^\Q$cgroup\E$/,split(/,/,$env{'request.course.groups'})))) { |
(!grep(/^\Q$cgroup\E$/,split(/:/,$env{'request.course.groups'})))) { |
$noeditgrp = 1; |
$noeditgrp = 1; |
} |
} |
} |
} |
Line 2799 sub assessparms {
|
Line 2988 sub assessparms {
|
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder); |
\%keyorder); |
|
|
|
%allmaps_inverted = reverse(%allmaps); |
|
|
$mapp{'0.0'} = ''; |
$mapp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
|
|
# ---------------------------------------------------------- Anything to store? |
# ---------------------------------------------------------- Anything to store? |
if ($env{'form.pres_marker'}) { |
if ($env{'form.pres_marker'} && $parm_permission->{'edit'}) { |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
Line 2963 sub assessparms {
|
Line 3154 sub assessparms {
|
.'</p>'; |
.'</p>'; |
} |
} |
} |
} |
|
|
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") { |
if ($pscat[0] eq "all") { |
@pscat = (keys(%allparms)); |
@pscat = (keys(%allparms)); |
Line 3029 ENDPARMSELSCRIPT
|
Line 3221 ENDPARMSELSCRIPT
|
|
|
# Step 2 |
# Step 2 |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
&displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll'); |
&displaymenu($r,\%allparms,\@pscat,\%keyorder,'parmmenuscroll'); |
|
|
# Step 3 |
# Step 3 |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); |
Line 3096 ENDPARMSELSCRIPT
|
Line 3288 ENDPARMSELSCRIPT
|
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my $csuname=$env{'user.name'}; |
my $csuname=$env{'user.name'}; |
my $csudom=$env{'user.domain'}; |
my $csudom=$env{'user.domain'}; |
|
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
# |
# |
# This produces the cascading table output of parameters |
# This produces the cascading table output of parameters |
# |
# |
my $coursespan=$csec?10:6; |
my $coursespan=$csec?8:5; |
my $userspan=4; |
my $userspan=3; |
if ($cgroup ne '') { |
if ($cgroup ne '') { |
$coursespan += 4; |
$coursespan += 3; |
} |
} |
|
|
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
Line 3134 ENDPARMSELSCRIPT
|
Line 3330 ENDPARMSELSCRIPT
|
'femof' => 'from Enclosing Map or Folder', |
'femof' => 'from Enclosing Map or Folder', |
'gen' => 'general', |
'gen' => 'general', |
'foremf' => 'for Enclosing Map or Folder', |
'foremf' => 'for Enclosing Map or Folder', |
'formfr' => 'for Map or Folder (recursive)', |
|
'fr' => 'for Resource' |
'fr' => 'for Resource' |
); |
); |
$r->print(<<ENDTABLETWO); |
$r->print(<<ENDTABLETWO); |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname:$csudom)</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname:$csudom)</th> |
</tr><tr><td colspan="5"></td><th colspan="3">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
<th colspan="1">$lt{'ic'}</th> |
<th colspan="1">$lt{'ic'}</th> |
|
|
ENDTABLETWO |
ENDTABLETWO |
if ($csec) { |
if ($csec) { |
$r->print('<th colspan="4">'. |
$r->print('<th colspan="3">'. |
&mt("in Section")." $csec</th>"); |
&mt("in Section")." $csec</th>"); |
} |
} |
if ($cgroup) { |
if ($cgroup) { |
$r->print('<th colspan="4">'. |
$r->print('<th colspan="3">'. |
&mt("in Group")." $cgroup</th>"); |
&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> |
<th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th> |
<th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th> |
<th>$lt{'gen'}</th><th>$lt{'formfr'}</th><th>$lt{'foremf'}</th> |
<th>$lt{'gen'}</th><th>$lt{'foremf'}</th> |
<th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th> |
<th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th> |
ENDTABLEHEADFOUR |
ENDTABLEHEADFOUR |
|
|
if ($csec) { |
if ($csec) { |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>'); |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>'); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.&mt('foremf').'</th><th>'.$lt{'fr'}.'</th>'); |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>'); |
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if (@usersgroups > 1) { |
if (@usersgroups > 1) { |
$r->print('<th>'.&mt('Control by other group?').'</th>'); |
$r->print('<th>'.&mt('Control by other group?').'</th>'); |
} |
} |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>'); |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>'); |
} |
} |
|
|
$r->print('</tr>'); |
$r->print('</tr>'); |
Line 3185 ENDTABLEHEADFOUR
|
Line 3380 ENDTABLEHEADFOUR
|
foreach my $rid (@ids) { |
foreach my $rid (@ids) { |
|
|
my ($inmapid)=($rid=~/\.(\d+)$/); |
my ($inmapid)=($rid=~/\.(\d+)$/); |
|
|
if ((!$pssymb && |
if ((!$pssymb && |
(($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}))) |
(($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}))) |
|| |
|| |
Line 3215 ENDTABLEHEADFOUR
|
Line 3409 ENDTABLEHEADFOUR
|
my %type= (); |
my %type= (); |
my %default=(); |
my %default=(); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
my $toolsymb; |
|
if ($uri =~ /ext\.tool$/) { |
|
$toolsymb = $symbp{$rid}; |
|
} |
|
|
my $filter=$env{'form.filter'}; |
my $filter=$env{'form.filter'}; |
foreach my $tempkeyp (&keysplit($keyp{$rid})) { |
foreach my $tempkeyp (&keysplit($keyp{$rid})) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name'); |
my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name',$toolsymb); |
# We may only want certain parameters listed |
# We may only want certain parameters listed |
if ($filter) { |
if ($filter) { |
unless ($filter=~/\Q$parmname\E/) { next; } |
unless ($filter=~/\Q$parmname\E/) { next; } |
} |
} |
$name{$tempkeyp}=$parmname; |
$name{$tempkeyp}=$parmname; |
$part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part'); |
$part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part',$toolsymb); |
|
|
my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display',$toolsymb); |
if ($allparms{$name{$tempkeyp}} ne '') { |
if ($allparms{$name{$tempkeyp}} ne '') { |
my $identifier; |
my $identifier; |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
Line 3239 ENDTABLEHEADFOUR
|
Line 3437 ENDTABLEHEADFOUR
|
} |
} |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp,$toolsymb); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type',$toolsymb); |
$thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title'); |
$thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title',$toolsymb); |
} |
} |
} |
} |
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($symbp{$rid}); |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my @recurseup; |
|
if (ref($navmap) && $mapp{$rid}) { |
|
@recurseup = $navmap->recurseup_maps($mapp{$rid}); |
|
} |
$r->print('<tr><td style="background-color:'.$defbgone.';"'. |
$r->print('<tr><td style="background-color:'.$defbgone.';"'. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'><tt><font size="-1">'. |
'><tt><font size="-1">'. |
Line 3279 ENDTABLEHEADFOUR
|
Line 3482 ENDTABLEHEADFOUR
|
&print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default, |
&print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$cgroup,\@usersgroups,$noeditgrp); |
$cgroup,\@usersgroups,$noeditgrp,$readonly, |
|
\@recurseup,\%maptitles,\%allmaps_inverted, |
|
\$numreclinks); |
} |
} |
} |
} |
} |
} |
Line 3325 ENDTABLEHEADFOUR
|
Line 3530 ENDTABLEHEADFOUR
|
|
|
if ($map eq $mapid) { |
if ($map eq $mapid) { |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
my $toolsymb; |
|
if ($uri =~ /ext\.tool$/) { |
|
$toolsymb = $symbp{$rid}; |
|
} |
|
|
# $r->print("Keys: $keyp{$rid} <br />\n"); |
# $r->print("Keys: $keyp{$rid} <br />\n"); |
|
|
#-------------------------------------------------------------------- |
#-------------------------------------------------------------------- |
Line 3340 ENDTABLEHEADFOUR
|
Line 3550 ENDTABLEHEADFOUR
|
|
|
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb); |
if ($allparms{$name{$tempkeyp}} ne '') { |
if ($allparms{$name{$tempkeyp}} ne '') { |
my $identifier; |
my $identifier; |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
Line 3354 ENDTABLEHEADFOUR
|
Line 3564 ENDTABLEHEADFOUR
|
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb); |
} |
} |
} # end loop through keys |
} # end loop through keys |
} |
} |
Line 3392 ENDTABLEHEADFOUR
|
Line 3602 ENDTABLEHEADFOUR
|
$r->print('<p>'.&Apache::loncommon::start_data_table() |
$r->print('<p>'.&Apache::loncommon::start_data_table() |
.&Apache::loncommon::start_data_table_header_row() |
.&Apache::loncommon::start_data_table_header_row() |
.'<th>'.&mt('Parameter Name').'</th>' |
.'<th>'.&mt('Parameter Name').'</th>' |
.'<th>'.&mt('Recursive Value').'</th>' |
.'<th>'.&mt('Value').'</th>' |
.'<th>'.&mt('Non-Recursive Value').'</th>' |
|
.'<th>'.&mt('Parameter in Effect').'</th>' |
.'<th>'.&mt('Parameter in Effect').'</th>' |
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
); |
); |
|
|
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my @recurseup; |
|
if (ref($navmap)) { |
|
my $mapres = $navmap->getByMapPc($mapid); |
|
if (ref($mapres)) { |
|
@recurseup = $navmap->recurseup_maps($mapres->src()); |
|
} |
|
} |
|
|
|
|
foreach my $item (&keysinorder(\%name,\%keyorder)) { |
foreach my $item (&keysinorder(\%name,\%keyorder)) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, |
|
$readonly,\@recurseup,\%maptitles,\%allmaps_inverted, |
|
\$numreclinks); |
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
.'</div>' |
.'</div>' |
Line 3429 ENDTABLEHEADFOUR
|
Line 3650 ENDTABLEHEADFOUR
|
my $rid = $id; |
my $rid = $id; |
|
|
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
my $toolsymb; |
|
if ($uri =~ /ext\.tool$/) { |
|
$toolsymb = $symbp{$rid}; |
|
} |
|
|
#-------------------------------------------------------------------- |
#-------------------------------------------------------------------- |
# @catmarker contains list of all possible parameters including part #s |
# @catmarker contains list of all possible parameters including part #s |
Line 3442 ENDTABLEHEADFOUR
|
Line 3667 ENDTABLEHEADFOUR
|
$tempkeyp =~ s/_\w+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb); |
if ($allparms{$name{$tempkeyp}} ne '') { |
if ($allparms{$name{$tempkeyp}} ne '') { |
my $identifier; |
my $identifier; |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
Line 3456 ENDTABLEHEADFOUR
|
Line 3681 ENDTABLEHEADFOUR
|
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb); |
} |
} |
} # end loop through keys |
} # end loop through keys |
} # end loop through ids |
} # end loop through ids |
Line 3491 ENDMAPONE
|
Line 3716 ENDMAPONE
|
foreach my $item (&keysinorder(\%name,\%keyorder)) { |
foreach my $item (&keysinorder(\%name,\%keyorder)) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, |
|
$readonly); |
} |
} |
$r->print(&Apache::loncommon::end_data_table() |
$r->print(&Apache::loncommon::end_data_table() |
.'</p>' |
.'</p>' |
Line 3501 ENDMAPONE
|
Line 3727 ENDMAPONE
|
} # end of $parmlev eq general |
} # end of $parmlev eq general |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
|
if ($numreclinks) { |
|
$r->print(<<"END"); |
|
<form name="recurseform" action="/adm/parmset?action=settable" method="post"> |
|
<input type="hidden" name="pschp" /> |
|
<input type="hidden" name="pscat" /> |
|
<input type="hidden" name="psprt" /> |
|
<input type="hidden" name="hideparmsel" value="hidden" /> |
|
</form> |
|
<script type="text/javascript"> |
|
function pjumprec(rid,name,part) { |
|
document.forms.recurseform.pschp.value = rid; |
|
document.forms.recurseform.pscat.value = name; |
|
document.forms.recurseform.psprt.value = part; |
|
document.forms.recurseform.submit(); |
|
return false; |
|
} |
|
</script> |
|
END |
|
} |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
Line 3517 my $tableopen; # boolean, true if HTML t
|
Line 3762 my $tableopen; # boolean, true if HTML t
|
# @param {boolean} $readonly - true if values cannot be edited (otherwise more columns are added) |
# @param {boolean} $readonly - true if values cannot be edited (otherwise more columns are added) |
# @returns {string} |
# @returns {string} |
sub tablestart { |
sub tablestart { |
my ($readonly) = @_; |
my ($readonly,$is_map) = @_; |
if ($tableopen) { |
if ($tableopen) { |
return ''; |
return ''; |
} else { |
} else { |
Line 3526 sub tablestart {
|
Line 3771 sub tablestart {
|
if ($readonly) { |
if ($readonly) { |
$output .= '<th>'.&mt('Current value').'</th>'; |
$output .= '<th>'.&mt('Current value').'</th>'; |
} else { |
} else { |
$output .= '<th>'.&mt('Delete').'</th><th>'.&mt('Set to ...').'</th>'; |
$output .= '<th>'.&mt('Delete').'</th>'. |
|
'<th>'.&mt('Set to ...').'</th>'; |
|
if ($is_map) { |
|
$output .= '<th>'.&mt('Recursive?').'</th>'; |
|
} |
} |
} |
$output .= '</tr>'; |
$output .= '</tr>'; |
return $output; |
return $output; |
Line 3605 sub storedata {
|
Line 3854 sub storedata {
|
my %newdata=(); |
my %newdata=(); |
undef %newdata; |
undef %newdata; |
my @deldata=(); |
my @deldata=(); |
|
my @delrec=(); |
|
my @delnonrec=(); |
undef @deldata; |
undef @deldata; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my $now = time; |
my $now = time; |
Line 3612 sub storedata {
|
Line 3863 sub storedata {
|
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
next if ($cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny'); |
my ($altkey,$recursive,$tkey,$tkeyrec,$tkeynonrec); |
|
next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny'); |
|
if ((($cmd eq 'set') || ($cmd eq 'datepointer') || ($cmd eq 'dateinterval') || ($cmd eq 'del')) && |
|
($thiskey =~ /(?:sequence|page)\Q___(all)\E/)) { |
|
unless ($thiskey =~ /(encrypturl|hiddenresource)$/) { |
|
$altkey = $thiskey; |
|
$altkey =~ s/\Q___(all)\E/___(rec)/; |
|
if ($env{'form.rec_'.$thiskey}) { |
|
$recursive = 1; |
|
} |
|
} |
|
} |
my ($tuname,$tudom)=&extractuser($thiskey); |
my ($tuname,$tudom)=&extractuser($thiskey); |
my $tkey=$thiskey; |
|
if ($tuname) { |
if ($tuname) { |
|
$tkey=$thiskey; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
|
if ($altkey) { |
|
$tkeynonrec = $tkey; |
|
$tkeyrec = $altkey; |
|
$tkeyrec=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
|
} |
} |
} |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my ($data, $typeof, $text, $name, $valchk, $valmatch, $namematch); |
my ($data, $typeof, $text, $name, $valchk, $valmatch, $namematch); |
Line 3700 sub storedata {
|
Line 3967 sub storedata {
|
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified date for'); |
$text = &mt('Saved modified date for'); |
} |
} |
if ($thiskey =~ m{\.(?:sequence|page)___\(rec\)}) { |
if ($recursive) { |
$namematch = 'maplevelrecurse'; |
$namematch = 'maplevelrecurse'; |
} |
} |
if (($name ne '') || ($namematch ne '')) { |
if (($name ne '') || ($namematch ne '')) { |
Line 3747 sub storedata {
|
Line 4014 sub storedata {
|
next; |
next; |
} |
} |
} |
} |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
my ($reconlychg,$haschange,$storekey); |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
my $ustorekey; |
$tkey.'.type' => $typeof}, |
if ($altkey) { |
$tudom,$tuname) eq 'ok') { |
if ($recursive) { |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
if (exists($$olddata{$thiskey})) { |
$r->print('<br />'.$text.' '. |
if ($$olddata{$thiskey} eq $data) { |
&Apache::loncommon::plainname($tuname,$tudom)); |
$reconlychg = 1; |
|
} |
|
&Apache::lonnet::del('resourcedata',[$tkeynonrec,$tkeynonrec.'.type'],$tudom,$tuname); |
|
} |
|
if (exists($$olddata{$altkey})) { |
|
if (defined($data) && $$olddata{$altkey} ne $data) { |
|
$haschange = 1; |
|
} |
|
} elsif ((!$reconlychg) && ($data ne '')) { |
|
$haschange = 1; |
|
} |
|
$ustorekey = $tkeyrec; |
|
} else { |
|
if (exists($$olddata{$altkey})) { |
|
if ($$olddata{$altkey} eq $data) { |
|
$reconlychg = 1; |
|
} |
|
&Apache::lonnet::del('resourcedata',[$tkeyrec,$tkeyrec.'.type'],$tudom,$tuname); |
|
} |
|
if (exists($$olddata{$thiskey})) { |
|
if (defined($data) && $$olddata{$thiskey} ne $data) { |
|
$haschange = 1; |
|
} |
|
} elsif ((!$reconlychg) && ($data ne '')) { |
|
$haschange = 1; |
|
} |
|
$ustorekey = $tkeynonrec; |
|
} |
|
} else { |
|
if (exists($$olddata{$tkey})) { |
|
if (defined($data) && $$olddata{$tkey} ne $data) { |
|
$haschange = 1; |
|
} |
|
$ustorekey = $tkey; |
|
} |
|
} |
|
if ($haschange || $reconlychg) { |
|
unless ($env{'form.del_'.$thiskey}) { |
|
if (&Apache::lonnet::put('resourcedata',{$ustorekey=>$data, |
|
$ustorekey.'.type' => $typeof}, |
|
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$ustorekey=>$data,$ustorekey.'.type' => $typeof},0,$tuname,$tudom); |
|
$r->print('<br />'.$text.' '. |
|
&Apache::loncommon::plainname($tuname,$tudom)); |
|
} else { |
|
$r->print('<div class="LC_error">'. |
|
&mt('Error saving parameters').'</div>'); |
|
} |
|
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
|
} |
|
} |
|
} else { |
|
if ($altkey) { |
|
if ($recursive) { |
|
if (exists($$olddata{$thiskey})) { |
|
if ($$olddata{$thiskey} eq $data) { |
|
$reconlychg = 1; |
|
} |
|
push(@delnonrec,($thiskey,$thiskey.'.type')); |
|
} |
|
if (exists($$olddata{$altkey})) { |
|
if (defined($data) && $$olddata{$altkey} ne $data) { |
|
$haschange = 1; |
|
} |
|
} elsif (($data ne '') && (!$reconlychg)) { |
|
$haschange = 1; |
|
} |
|
$storekey = $altkey; |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
if (exists($$olddata{$altkey})) { |
&mt('Error saving parameters').'</div>'); |
if ($$olddata{$altkey} eq $data) { |
|
$reconlychg = 1; |
|
} |
|
push(@delrec,($altkey,$altkey.'.type')); |
|
} |
|
if (exists($$olddata{$thiskey})) { |
|
if (defined($data) && $$olddata{$thiskey} ne $data) { |
|
$haschange = 1; |
|
} |
|
} elsif (($data ne '') && (!$reconlychg)) { |
|
$haschange = 1; |
|
} |
|
$storekey = $thiskey; |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
|
} else { |
} else { |
$newdata{$thiskey}=$data; |
if (defined($data) && $$olddata{$thiskey} ne $data) { |
$newdata{$thiskey.'.type'}=$typeof; |
$haschange = 1; |
|
$storekey = $thiskey; |
|
} |
|
} |
|
} |
|
if ($reconlychg || $haschange) { |
|
unless ($env{'form.del_'.$thiskey}) { |
|
$newdata{$storekey}=$data; |
|
$newdata{$storekey.'.type'}=$typeof; |
} |
} |
} |
} |
} elsif ($cmd eq 'del') { |
} elsif ($cmd eq 'del') { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
my $error; |
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
if ($altkey) { |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
if (exists($$olddata{$altkey})) { |
|
if (&Apache::lonnet::del('resourcedata',[$tkeyrec,$tkeyrec.'.type'],$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkeyrec=>''},1,$tuname,$tudom); |
|
if ($recursive) { |
|
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
|
} |
|
} elsif ($recursive) { |
|
$error = 1; |
|
} |
|
} |
|
if (exists($$olddata{$thiskey})) { |
|
if (&Apache::lonnet::del('resourcedata',[$tkeynonrec,$tkeynonrec.'.type'],$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkeynonrec=>''},1,$tuname,$tudom); |
|
unless ($recursive) { |
|
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
|
} |
|
} elsif (!$recursive) { |
|
$error = 1; |
|
} |
|
} |
} else { |
} else { |
|
if (exists($$olddata{$thiskey})) { |
|
if (&Apache::lonnet::del('resourcedata',[$tkey,$tkey.'.type'],$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
|
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
|
} else { |
|
$error = 1; |
|
} |
|
} |
|
} |
|
if ($error) { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</div>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
push (@deldata,$thiskey,$thiskey.'.type'); |
if ($altkey) { |
|
if (exists($$olddata{$altkey})) { |
|
unless (grep(/^\Q$altkey\E$/,@delrec)) { |
|
push(@deldata,($altkey,$altkey.'.type')); |
|
} |
|
} |
|
if (exists($$olddata{$thiskey})) { |
|
unless (grep(/^\Q$thiskey\E$/,@delnonrec)) { |
|
push(@deldata,($thiskey,$thiskey.'.type')); |
|
} |
|
} |
|
} elsif (exists($$olddata{$thiskey})) { |
|
push(@deldata,($thiskey,$thiskey.'.type')); |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
# Store all course level |
# Store all course level |
my $delentries=$#deldata+1; |
my $delentries=$#deldata+1; |
|
my @alldels; |
|
if (@delrec) { |
|
push(@alldels,@delrec); |
|
} |
|
if (@delnonrec) { |
|
push(@alldels,@delnonrec); |
|
} |
|
if (@deldata) { |
|
push(@alldels,@deldata); |
|
} |
my @newdatakeys=keys(%newdata); |
my @newdatakeys=keys(%newdata); |
my $putentries=$#newdatakeys+1; |
my $putentries=$#newdatakeys+1; |
if ($delentries) { |
my ($delresult,$devalidate); |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (@alldels) { |
my %loghash=map { $_ => '' } @deldata; |
if (&Apache::lonnet::del('resourcedata',\@alldels,$dom,$crs) eq 'ok') { |
|
my %loghash=map { $_ => '' } @alldels; |
&log_parmset(\%loghash,1); |
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</h2>'); |
if ($delentries) { |
} else { |
$r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</h2>'); |
|
} |
|
} elsif ($delentries) { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</div>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
$devalidate = 1; |
} |
} |
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
Line 3804 sub storedata {
|
Line 4212 sub storedata {
|
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error saving parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
} |
} |
|
$devalidate = 1; |
|
} |
|
if ($devalidate) { |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
} |
} |
Line 3850 sub parse_listdata_key {
|
Line 4261 sub parse_listdata_key {
|
# @param {string} $sortorder - realmstudent|studentrealm |
# @param {string} $sortorder - realmstudent|studentrealm |
# @param {string} $caller - name of the calling sub (overview|newoverview) |
# @param {string} $caller - name of the calling sub (overview|newoverview) |
# @param {hash reference} $classlist - from loncoursedata::get_classlist |
# @param {hash reference} $classlist - from loncoursedata::get_classlist |
|
# @param {boolean} $readonly - true if editing not allowed |
# @returns{integer} - number of $listdata parameters processed |
# @returns{integer} - number of $listdata parameters processed |
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist)=@_; |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; |
|
|
# Start list output |
# Start list output |
|
|
Line 3870 sub listdata {
|
Line 4282 sub listdata {
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
%grouphash = &Apache::longroup::coursegroups(); |
%grouphash = &Apache::longroup::coursegroups(); |
} elsif ($env{'request.course.groups'} ne '') { |
} elsif ($env{'request.course.groups'} ne '') { |
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
} |
} |
} |
} |
|
|
foreach my $thiskey (sort { |
foreach my $key (sort { |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
|
|
Line 3914 sub listdata {
|
Line 4326 sub listdata {
|
|
|
$result; |
$result; |
|
|
} keys(%{$listdata})) { # foreach my $thiskey |
} keys(%{$listdata})) { # foreach my $key |
|
my $thiskey = $key; |
my $readonly; |
|
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'}) { |
$thistype=$$resourcedata{$thiskey.'.type'}; |
$thistype=$$resourcedata{$thiskey.'.type'}; |
} |
} |
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/); |
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
|
my $showval = $$resourcedata{$thiskey}; |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
my $issection=$1; |
my $issection=$1; |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
Line 3957 sub listdata {
|
Line 4369 sub listdata {
|
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
if ($middle=~/^(.+)\_\_\_\((all|rec)\)$/) { |
my ($is_map,$is_recursive,$mapurl,$maplevel); |
my $mapurl = $1; |
if ($caller eq 'overview') { |
my $maplevel = $2; |
if ($middle=~/^(.+)\_\_\_\((all|rec)\)$/) { |
|
$mapurl = $1; |
|
$maplevel = $2; |
|
$is_map = 1; |
|
} |
|
} elsif ($caller eq 'newoverview') { |
|
if ($middle=~/^(.+)\_\_\_\((all)\)$/) { |
|
$mapurl = $1; |
|
$maplevel = $2; |
|
$is_map = 1; |
|
} |
|
} |
|
if ($is_map) { |
my $leveltitle = &mt('Folder/Map'); |
my $leveltitle = &mt('Folder/Map'); |
if ($maplevel eq 'rec') { |
unless (($name eq 'hiddenresource') || ($name eq 'encrypturl')) { |
$leveltitle = &mt('Recursive'); |
if ($caller eq 'newoverview') { |
|
my $altkey = $thiskey; |
|
$altkey =~ s/\Q___(all)\E/___(rec)/; |
|
if ((exists($$resourcedata{$altkey})) & (!exists($$resourcedata{$thiskey}))) { |
|
$is_recursive = 1; |
|
if ($$resourcedata{$altkey.'.type'}) { |
|
$thistype=$$resourcedata{$altkey.'.type'}; |
|
} |
|
$showval = $$resourcedata{$altkey}; |
|
} |
|
} elsif (($caller eq 'overview') && ($maplevel eq 'rec')) { |
|
$thiskey =~ s/\Q___(rec)\E/___(all)/; |
|
$is_recursive = 1; |
|
} |
} |
} |
$realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' <br /><span class="LC_parm_folder">('.$mapurl.')</span></span>'; |
$realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' <br /><span class="LC_parm_folder">('.$mapurl.')</span></span>'; |
} elsif ($middle) { |
} elsif ($middle) { |
Line 4004 sub listdata {
|
Line 4441 sub listdata {
|
# Ready to print |
# Ready to print |
# |
# |
my $parmitem = &standard_parameter_names($name); |
my $parmitem = &standard_parameter_names($name); |
$r->print(&tablestart($readonly). |
$r->print(&tablestart($readonly,$is_map). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&mt($parmitem). |
'<td><b>'.&mt($parmitem). |
'</b></td>'); |
'</b></td>'); |
Line 4024 sub listdata {
|
Line 4461 sub listdata {
|
$r->print( |
$r->print( |
&Apache::lonhtmlcommon::date_setter('parmform', |
&Apache::lonhtmlcommon::date_setter('parmform', |
$jskey, |
$jskey, |
$$resourcedata{$thiskey}, |
$showval, |
'',1,$state)); |
'',1,$state)); |
unless ($readonly) { |
unless ($readonly) { |
$r->print( |
$r->print( |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
(($showval!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$showval.'">'. |
&mt('Shift all dates based on this date').'</a></span>':''). |
&mt('Shift all dates based on this date').'</a></span>':''). |
&date_sanity_info($$resourcedata{$thiskey}) |
&date_sanity_info($showval) |
); |
); |
} |
} |
} elsif ($thistype eq 'date_interval') { |
} elsif ($thistype eq 'date_interval') { |
$r->print(&date_interval_selector($thiskey,$name, |
$r->print(&date_interval_selector($thiskey,$name, |
$$resourcedata{$thiskey},$readonly)); |
$showval,$readonly)); |
} elsif ($thistype =~ m/^string/) { |
} elsif ($thistype =~ m/^string/) { |
$r->print(&string_selector($thistype,$thiskey, |
$r->print(&string_selector($thistype,$thiskey, |
$$resourcedata{$thiskey},$name,$readonly)); |
$showval,$name,$readonly)); |
} else { |
} else { |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly)); |
$r->print(&default_selector($thiskey,$showval,$readonly)); |
} |
} |
unless ($readonly) { |
unless ($readonly) { |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'" />'); |
$thistype.'" />'); |
} |
} |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('</td>'); |
|
if ($is_map) { |
|
if (($name eq 'encrypturl') || ($name eq 'hiddenresource')) { |
|
$r->print('<td><table><tr><td>'.&mt('Yes').'</td></tr></table></td>'); |
|
} else { |
|
my ($disabled,$recon,$recoff); |
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
if ($is_recursive) { |
|
$recon = ' checked="checked"'; |
|
} else { |
|
$recoff = ' checked="checked"'; |
|
} |
|
$r->print('<td><table><tr><td><label><input type="radio" name="rec_'.$thiskey.'" value="1"'.$recon.$disabled.' />'.&mt('Yes').'</label>'. |
|
'</td><td><label><input type="radio" name="rec_'.$thiskey.'" value="0"'.$recoff.$disabled.' />'.&mt('No').'</label></td></tr></table></td>'); |
|
} |
|
} |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
return $foundkeys; |
return $foundkeys; |
Line 4140 sub string_ip_selector {
|
Line 4595 sub string_ip_selector {
|
@{$access{'deny'}} = (''); |
@{$access{'deny'}} = (''); |
} |
} |
my ($disabled,$addmore); |
my ($disabled,$addmore); |
if ($disabled) { |
if ($readonly) { |
$disabled=' disabled="disabled"'; |
$disabled=' disabled="disabled"'; |
} else { |
} else { |
$addmore = "\n".'<button class="LC_add_ipacc_button">'.&mt('Add more').'</button>'; |
$addmore = "\n".'<button class="LC_add_ipacc_button">'.&mt('Add more').'</button>'; |
Line 4561 sub date_interval_selector {
|
Line 5016 sub date_interval_selector {
|
$currprocdisplay = 'text'; |
$currprocdisplay = 'text'; |
} |
} |
my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"'; |
my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"'; |
|
my $disabled; |
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
$result .= '<br /><span class="LC_nobreak">'.&mt('Include "done" button'). |
$result .= '<br /><span class="LC_nobreak">'.&mt('Include "done" button'). |
'<label><input type="radio" value="" name="done_'.$thiskey.'"'.$checkedoff.$onclick.' />'. |
'<label><input type="radio" value="" name="done_'.$thiskey.'"'.$checkedoff.$onclick.$disabled.' />'. |
&mt('No').'</label>'.(' 'x2). |
&mt('No').'</label>'.(' 'x2). |
'<label><input type="radio" value="_done" name="done_'.$thiskey.'"'.$checkedon.$onclick.' />'. |
'<label><input type="radio" value="_done" name="done_'.$thiskey.'"'.$checkedon.$onclick.$disabled.' />'. |
&mt('Yes').'</label>'.(' 'x2). |
&mt('Yes').'</label>'.(' 'x2). |
'<label><input type="radio" value="_done_proctor" name="done_'.$thiskey.'"'.$checkedproc.$onclick.' />'. |
'<label><input type="radio" value="_done_proctor" name="done_'.$thiskey.'"'.$checkedproc.$onclick.$disabled.' />'. |
&mt('Yes, with proctor key').'</label>'. |
&mt('Yes, with proctor key').'</label>'. |
'<input type="'.$currprocdisplay.'" id="done_'.$thiskey.'_proctorkey" '. |
'<input type="'.$currprocdisplay.'" id="done_'.$thiskey.'_proctorkey" '. |
'name="done_'.$thiskey.'_proctorkey" value="'.&HTML::Entities::encode($currproctorkey,'"<>&').'" /></span><br />'. |
'name="done_'.$thiskey.'_proctorkey" value="'.&HTML::Entities::encode($currproctorkey,'"<>&').'"'.$disabled.' /></span><br />'. |
'<span class="LC_nobreak">'.&mt('Button text').': '. |
'<span class="LC_nobreak">'.&mt('Button text').': '. |
'<input type="text" name="done_'.$thiskey.'_buttontext" value="'.&HTML::Entities::encode($currdonetext,'"<>&').'" /></span>'; |
'<input type="text" name="done_'.$thiskey.'_buttontext" value="'.&HTML::Entities::encode($currdonetext,'"<>&').'"'.$disabled.' /></span>'; |
} |
} |
} |
} |
unless ($readonly) { |
unless ($readonly) { |
Line 4705 sub dateshift {
|
Line 5164 sub dateshift {
|
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
sub newoverview { |
sub newoverview { |
my ($r) = @_; |
my ($r,$parm_permission) = @_; |
|
|
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 $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
|
|
Line 4812 ENDOVER
|
Line 5275 ENDOVER
|
|
|
$r->print('<div class="LC_Box">'); |
$r->print('<div class="LC_Box">'); |
$r->print('<div>'); |
$r->print('<div>'); |
&displaymenu($r,\%allparms,\@pscat,\%keyorder); # FIXME: wrong parameters, could make keysindisplayorderCategory crash because $keyorder is undefined |
&displaymenu($r,\%allparms,\@pscat,\%keyorder); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
my $sectionselector = §ionmenu(\@selected_sections); |
my $sectionselector = §ionmenu(\@selected_sections); |
Line 4868 ENDOVER
|
Line 5331 ENDOVER
|
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview'); |
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly); |
} |
} |
$r->print(&tableend(). |
$r->print(&tableend()); |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
unless ($readonly) { |
'</form>'); |
$r->print( ((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':'') ); |
|
} |
|
$r->print('</form>'); |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
Line 4911 sub secgroup_lister {
|
Line 5376 sub secgroup_lister {
|
my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat; |
my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat; |
$$listdata{$newparmkey}=1; |
$$listdata{$newparmkey}=1; |
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
$newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(rec).'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
|
} |
} |
} else { |
} else { |
# resource-level parameter |
# resource-level parameter |
Line 4934 sub secgroup_lister {
|
Line 5396 sub secgroup_lister {
|
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
sub overview { |
sub overview { |
my ($r) = @_; |
my ($r,$parm_permission) = @_; |
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 $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
&toggleparmtextbox_js()."\n". |
&toggleparmtextbox_js()."\n". |
Line 4960 sub overview {
|
Line 5426 sub overview {
|
|
|
# Store modified |
# Store modified |
|
|
&storedata($r,$crs,$dom); |
unless ($readonly) { |
|
&storedata($r,$crs,$dom); |
|
} |
|
|
# Read modified data |
# Read modified data |
|
|
Line 4971 sub overview {
|
Line 5439 sub overview {
|
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder); |
|
|
|
my $submitbutton = '<input type="submit" value="'.&mt('Save').'" />'; |
|
|
|
if ($readonly) { |
|
$r->print('<p>'.$submitbutton.'</p>'); |
|
} |
|
|
# List data |
# List data |
|
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder,'overview',$classlist); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder,'overview',$classlist,$readonly); |
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'); |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':'<span class="LC_info">'.&mt('There are no parameters.').'</span>').'</p></form>'. |
if ($foundkeys) { |
&Apache::loncommon::end_page()); |
unless ($readonly) { |
|
$r->print('<p>'.$submitbutton.'</p>'); |
|
} |
|
} else { |
|
$r->print('<p class="LC_info">'.&mt('There are no parameters.').'</p>'); |
|
} |
|
$r->print('</form>'.&Apache::loncommon::end_page()); |
} |
} |
|
|
# Unused sub. |
# Unused sub. |
Line 5041 ENDOVER
|
Line 5521 ENDOVER
|
$r->print(&mt('All users')); |
$r->print(&mt('All users')); |
} elsif ($data{'scope_type'} eq 'user') { |
} elsif ($data{'scope_type'} eq 'user') { |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
} elsif ($data{'scope_type'} eq 'section') { |
} elsif ($data{'scope_type'} eq 'secgroup') { |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
$r->print(&mt('Group/Section: [_1]',$data{'scope'})); |
} elsif ($data{'scope_type'} eq 'group') { |
|
$r->print(&mt('Group: [_1]',$data{'scope'})); |
|
} |
} |
$r->print('<br />'); |
$r->print('<br />'); |
if ($data{'realm_type'} eq 'all') { |
if ($data{'realm_type'} eq 'all') { |
Line 5143 sub parse_key {
|
Line 5621 sub parse_key {
|
my ($key) = @_; |
my ($key) = @_; |
my %data; |
my %data; |
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/); |
$data{'scope_type'} = 'all'; |
$data{'scope_type'} = 'all'; |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
$data{'scope'} = $1; |
$data{'scope'} = $1; |
Line 5151 sub parse_key {
|
Line 5629 sub parse_key {
|
$data{'scope_type'} = 'user'; |
$data{'scope_type'} = 'user'; |
$data{'scope'} = [$1,$2]; |
$data{'scope'} = [$1,$2]; |
} else { |
} else { |
#FIXME check for group scope |
$data{'scope_type'} = 'secgroup'; |
$data{'scope_type'} = 'section'; |
|
} |
} |
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
Line 5213 ENDMAINFORMHEAD
|
Line 5690 ENDMAINFORMHEAD
|
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
my $dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}); |
my $dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}); |
|
my $vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}); |
|
my $vpa = &Apache::lonnet::allowed('vpa',$env{'request.course.id'}); |
if ((!$dcm) && ($env{'request.course.sec'} ne '')) { |
if ((!$dcm) && ($env{'request.course.sec'} ne '')) { |
$dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
$dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
'/'.$env{'request.course.sec'}); |
'/'.$env{'request.course.sec'}); |
} |
} |
|
if ((!$vcb) && ($env{'request.course.sec'} ne '')) { |
|
$vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'}); |
|
} |
|
my (%linktext,%linktitle,%url); |
|
if ($parm_permission->{'edit'}) { |
|
%linktext = ( |
|
newoverview => 'Edit Resource Parameters - Overview Mode', |
|
settable => 'Edit Resource Parameters - Table Mode', |
|
setoverview => 'Modify Resource Parameters - Overview Mode', |
|
); |
|
%linktitle = ( |
|
newoverview => 'Set/Modify resource parameters in overview mode.', |
|
settable => 'Set/Modify resource parameters in table mode.', |
|
setoverview => 'Set/Modify existing resource parameters in overview mode.', |
|
); |
|
} else { |
|
%linktext = ( |
|
newoverview => 'View Resource Parameters - Overview Mode', |
|
settable => 'View Resource Parameters - Table Mode', |
|
setoverview => 'View Resource Parameters - Overview Mode', |
|
); |
|
%linktitle = ( |
|
newoverview => 'Display resource parameters in overview mode.', |
|
settable => 'Display resource parameters in table mode.', |
|
setoverview => 'Display existing resource parameters in overview mode.', |
|
); |
|
} |
|
if ($mgr) { |
|
$linktext{'resettimes'} = 'Reset Student Access Times'; |
|
$linktitle{'resettimes'} = "Reset access times for folders/maps, resources or the $lc_crstype."; |
|
$url{'resettimes'} = '/adm/helper/resettimes.helper'; |
|
} elsif ($vgr) { |
|
$linktext{'resettimes'} = 'Display Student Access Times', |
|
$linktitle{'resettimes'} = "Display access times for folders/maps, resources or the $lc_crstype.", |
|
$url{'resettimes'} = '/adm/accesstimes'; |
|
} |
my @menu = |
my @menu = |
( { categorytitle=>"Content Settings for this $crstype", |
( { categorytitle=>"Content Settings for this $crstype", |
items => [ |
items => [ |
{ linktext => 'Portfolio Metadata', |
{ linktext => 'Portfolio Metadata', |
url => '/adm/parmset?action=setrestrictmeta', |
url => '/adm/parmset?action=setrestrictmeta', |
permission => $parm_permission, |
permission => $parm_permission->{'setrestrictmeta'}, |
linktitle => "Restrict metadata for this $lc_crstype." , |
linktitle => "Restrict metadata for this $lc_crstype." , |
icon =>'contact-new.png' , |
icon =>'contact-new.png' , |
}, |
}, |
{ linktext => 'Reset Student Access Times', |
{ linktext => $linktext{'resettimes'}, |
url => '/adm/helper/resettimes.helper', |
url => $url{'resettimes'}, |
permission => $mgr, |
permission => ($vgr || $mgr), |
linktitle => "Reset access times for folders/maps, resources or the $lc_crstype." , |
linktitle => $linktitle{'resettimes'}, |
icon => 'start-here.png' , |
icon => 'start-here.png', |
}, |
}, |
{ linktext => 'Blocking Communication/Resource Access', |
{ linktext => 'Blocking Communication/Resource Access', |
url => '/adm/setblock', |
url => '/adm/setblock', |
permission => $dcm, |
permission => ($vcb || $dcm), |
linktitle => 'Configure blocking of communication/collaboration and access to resources during an exam', |
linktitle => 'Configure blocking of communication/collaboration and access to resources during an exam', |
icon => 'comblock.png', |
icon => 'comblock.png', |
}, |
}, |
{ linktext => 'Set Parameter Setting Default Actions', |
{ linktext => 'Set Parameter Setting Default Actions', |
url => '/adm/parmset?action=setdefaults', |
url => '/adm/parmset?action=setdefaults', |
permission => $parm_permission, |
permission => $parm_permission->{'setdefaults'}, |
linktitle =>'Set default actions for parameters.' , |
linktitle =>'Set default actions for parameters.' , |
icon => 'folder-new.png' , |
icon => 'folder-new.png' , |
}]}, |
}]}, |
Line 5249 ENDMAINFORMHEAD
|
Line 5764 ENDMAINFORMHEAD
|
items => [ |
items => [ |
{ linktext => 'Edit Resource Parameters - Helper Mode', |
{ linktext => 'Edit Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission->{'helper'}, |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
icon => 'dialog-information.png' , |
icon => 'dialog-information.png' , |
#help => 'Parameter_Helper', |
#help => 'Parameter_Helper', |
}, |
}, |
{ linktext => 'Edit Resource Parameters - Overview Mode', |
{ linktext => $linktext{'newoverview'}, |
url => '/adm/parmset?action=newoverview', |
url => '/adm/parmset?action=newoverview', |
permission => $parm_permission, |
permission => $parm_permission->{'newoverview'}, |
linktitle =>'Set/Modify resource parameters in overview mode.' , |
linktitle => $linktitle{'newoverview'}, |
icon => 'edit-find.png' , |
icon => 'edit-find.png', |
#help => 'Parameter_Overview', |
#help => 'Parameter_Overview', |
}, |
}, |
{ linktext => 'Edit Resource Parameters - Table Mode', |
{ linktext => $linktext{'settable'}, |
url => '/adm/parmset?action=settable', |
url => '/adm/parmset?action=settable', |
permission => $parm_permission, |
permission => $parm_permission->{'settable'}, |
linktitle =>'Set/Modify resource parameters in table mode.' , |
linktitle => $linktitle{'settable'}, |
icon => 'edit-copy.png' , |
icon => 'edit-copy.png', |
#help => 'Table_Mode', |
#help => 'Table_Mode', |
}]}, |
}]}, |
{ categorytitle => 'Existing Parameter Settings for Resources', |
{ categorytitle => 'Existing Parameter Settings for Resources', |
items => [ |
items => [ |
{ linktext => 'Modify Resource Parameters - Overview Mode', |
{ linktext => $linktext{'setoverview'}, |
url => '/adm/parmset?action=setoverview', |
url => '/adm/parmset?action=setoverview', |
permission => $parm_permission, |
permission => $parm_permission->{'setoverview'}, |
linktitle =>'Set/Modify existing resource parameters in overview mode.' , |
linktitle => $linktitle{'setoverview'}, |
icon => 'preferences-desktop-wallpaper.png' , |
icon => 'preferences-desktop-wallpaper.png', |
#help => 'Parameter_Overview', |
#help => 'Parameter_Overview', |
}, |
}, |
{ linktext => 'Change Log', |
{ linktext => 'Change Log', |
url => '/adm/parmset?action=parameterchangelog', |
url => '/adm/parmset?action=parameterchangelog', |
permission => $parm_permission, |
permission => $parm_permission->{'parameterchangelog'}, |
linktitle =>"View parameter and $lc_crstype blog posting/user notification change log." , |
linktitle =>"View parameter and $lc_crstype blog posting/user notification change log." , |
icon => 'document-properties.png', |
icon => 'document-properties.png', |
}]} |
}]} |
Line 5508 sub addmetafield {
|
Line 6023 sub addmetafield {
|
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
foreach my $key(keys(%$fields)) { |
foreach my $key(keys(%$fields)) { |
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
$r->print('<label><input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'</label><br /'); |
} |
} |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); # FIXME: HTML error, input will not be displayed ! |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.'. |
|
'<form method="post" action="/adm/parmset?action=addmetadata">'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
|
$r->print('</form>'); |
} |
} |
$r->print('</form>'); |
|
&endSettingsScreen($r); |
&endSettingsScreen($r); |
} |
} |
|
|
Line 5840 ENDYESNO
|
Line 6356 ENDYESNO
|
# $issection - section or group name |
# $issection - section or group name |
# $realmdescription - title for the parameter level and resource (without using HTML) |
# $realmdescription - title for the parameter level and resource (without using HTML) |
# |
# |
# FIXME: remove unused fields. |
|
# |
|
# @param {string} $key - parameter log key |
# @param {string} $key - parameter log key |
# @param {string} $uname - user name |
# @param {string} $uname - user name |
# @param {string} $udom - user domain |
# @param {string} $udom - user domain |
# @param {string} $exeuser - unused |
|
# @param {string} $exedomain - unused |
|
# @param {boolean} $typeflag - .type log entry |
# @param {boolean} $typeflag - .type log entry |
# @returns {Array} |
# @returns {Array} |
sub components { |
sub components { |
my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; |
my ($key,$uname,$udom,$typeflag)=@_; |
|
|
if ($typeflag) { |
if ($typeflag) { |
$key=~s/\.type$//; |
$key=~s/\.type$//; |
} |
} |
|
|
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/); |
my $issection; |
my $issection; |
|
|
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
Line 5902 my %standard_parms_types; # hash paramet
|
Line 6414 my %standard_parms_types; # hash paramet
|
|
|
# Reads parameter info from packages.tab into %standard_parms. |
# Reads parameter info from packages.tab into %standard_parms. |
sub load_parameter_names { |
sub load_parameter_names { |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
open(my $config,"<","$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
while (my $configline=<$config>) { |
while (my $configline=<$config>) { |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
chomp($configline); |
chomp($configline); |
Line 5917 sub load_parameter_names {
|
Line 6429 sub load_parameter_names {
|
close($config); |
close($config); |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
|
$standard_parms{'scoreformat'} = 'Format for display of score'; |
} |
} |
|
|
# Returns a parameter title for standard parameters, the name for others. |
# Returns a parameter title for standard parameters, the name for others. |
Line 5972 sub standard_parameter_levels {
|
Line 6485 sub standard_parameter_levels {
|
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
sub parm_change_log { |
sub parm_change_log { |
my ($r)=@_; |
my ($r,$parm_permission)=@_; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'} |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Parameter Change Log"}); |
text=>"Parameter Change Log"}); |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
Line 6004 sub parm_change_log {
|
Line 6517 sub parm_change_log {
|
'<input type="submit" value="'.&mt('Display').'" />'. |
'<input type="submit" value="'.&mt('Display').'" />'. |
'</form></fieldset></div><br clear="all" />'); |
'</form></fieldset></div><br clear="all" />'); |
|
|
|
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th>'); |
&Apache::loncommon::end_data_table_header_row()); |
unless ($readonly) { |
|
$r->print('<th>'.&mt('Announce').'</th>'); |
|
} |
|
$r->print(&Apache::loncommon::end_data_table_header_row()); |
my $shown=0; |
my $shown=0; |
my $folder=''; |
my $folder=''; |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
Line 6040 sub parm_change_log {
|
Line 6560 sub parm_change_log {
|
$parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_udom'}); |
$parmlog{$id}{'exe_udom'}); |
my $send_msg_link=''; |
my $send_msg_link=''; |
if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
if ((!$readonly) && |
|
(($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
$send_msg_link ='<br />'. |
$send_msg_link ='<br />'. |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
Line 6056 sub parm_change_log {
|
Line 6577 sub parm_change_log {
|
my $typeflag = ($changed =~/\.type$/ && |
my $typeflag = ($changed =~/\.type$/ && |
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag); |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},$typeflag); |
if ($env{'request.course.sec'} ne '') { |
if ($env{'request.course.sec'} ne '') { |
next if (($issection ne '') && ($issection ne $env{'request.course.sec'})); |
next if (($issection ne '') && ($issection ne $env{'request.course.sec'})); |
if ($uname ne '') { |
if ($uname ne '') { |
Line 6092 sub parm_change_log {
|
Line 6613 sub parm_change_log {
|
$parmitem = &mt($parmitem); |
$parmitem = &mt($parmitem); |
$output .= &mt('Type: [_1]',$parmitem); |
$output .= &mt('Type: [_1]',$parmitem); |
} else { |
} else { |
|
my $toolsymb; |
|
if ($middle =~ /ext\.tool$/) { |
|
$toolsymb = $middle; |
|
} |
my ($level,@all)=&parmval_by_symb($what,$middle, |
my ($level,@all)=&parmval_by_symb($what,$middle, |
&Apache::lonnet::metadata($middle,$what), |
&Apache::lonnet::metadata($middle,$what,$toolsymb), |
$uname,$udom,$issection,$issection,$courseopt); |
$uname,$udom,$issection,$issection,$courseopt); |
my $showvalue = $value; |
my $showvalue = $value; |
if ($istype{$parmname} eq '') { |
if ($istype{$parmname} eq '') { |
Line 6117 sub parm_change_log {
|
Line 6642 sub parm_change_log {
|
} |
} |
} |
} |
} |
} |
$output .= '</td><td>'; |
$output .= '</td>'; |
|
|
if ($stillactive) { |
unless ($readonly) { |
my $parmitem = &standard_parameter_names($parmname); |
$output .= '<td>'; |
$parmitem = &mt($parmitem); |
if ($stillactive) { |
my $title=&mt('Changed [_1]',$parmitem); |
my $parmitem = &standard_parameter_names($parmname); |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
$parmitem = &mt($parmitem); |
$parmitem,$realmdescription, |
my $title=&mt('Changed [_1]',$parmitem); |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
if (($uname) && ($udom)) { |
$parmitem,$realmdescription, |
$output .= |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
&Apache::loncommon::messagewrapper('Notify User', |
if (($uname) && ($udom)) { |
$uname,$udom,$title, |
$output .= |
$description); |
&Apache::loncommon::messagewrapper('Notify User', |
} else { |
$uname,$udom,$title, |
$output .= |
$description); |
&Apache::lonrss::course_blog_link($id,$title, |
} else { |
$description); |
$output .= |
|
&Apache::lonrss::course_blog_link($id,$title, |
|
$description); |
|
} |
} |
} |
|
$output .= '</td>'; |
} |
} |
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
if ($env{'form.displayfilter'} eq 'containing') { |
if ($env{'form.displayfilter'} eq 'containing') { |
my $wholeentry=$about_me_link.':'. |
my $wholeentry=$about_me_link.':'. |
Line 6327 sub parameter_releasecheck {
|
Line 6856 sub parameter_releasecheck {
|
return $needsnewer; |
return $needsnewer; |
} |
} |
|
|
|
sub get_permission { |
|
my %permission; |
|
my $allowed = 0; |
|
return (\%permission,$allowed) unless ($env{'request.course.id'}); |
|
if ((&Apache::lonnet::allowed('opa',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'}))) { |
|
%permission= ( |
|
'edit' => 1, |
|
'set' => 1, |
|
'setoverview' => 1, |
|
'addmetadata' => 1, |
|
'ordermetadata' => 1, |
|
'setrestrictmeta' => 1, |
|
'newoverview' => 1, |
|
'setdefaults' => 1, |
|
'settable' => 1, |
|
'parameterchangelog' => 1, |
|
'cleanparameters' => 1, |
|
'dateshift1' => 1, |
|
'dateshift2' => 1, |
|
'helper' => 1, |
|
); |
|
} elsif ((&Apache::lonnet::allowed('vpa',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('vpa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'}))) { |
|
%permission = ( |
|
'set' => 1, |
|
'settable' => 1, |
|
'newoverview' => 1, |
|
'setoverview' => 1, |
|
'parameterchangelog' => 1, |
|
); |
|
} |
|
foreach my $perm (values(%permission)) { |
|
if ($perm) { $allowed=1; last; } |
|
} |
|
return (\%permission,$allowed); |
|
} |
|
|
################################################## |
################################################## |
# HANDLER |
# HANDLER |
################################################## |
################################################## |
Line 6375 sub handler {
|
Line 6944 sub handler {
|
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); |
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); |
|
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
my $parm_permission = |
my ($parm_permission,$allowed) = &get_permission(); |
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
|
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'})); |
|
my $exists = &check_for_course_info(); |
my $exists = &check_for_course_info(); |
|
|
if ($env{'request.course.id'} && $parm_permission && $exists) { |
if ($env{'request.course.id'} && $allowed && $exists) { |
# |
# |
# Main switch on form.action and form.state, as appropriate |
# Main switch on form.action and form.state, as appropriate |
# |
# |
# Check first if coming from someone else headed directly for |
# Check first if coming from someone else headed directly for |
# the table mode |
# the table mode |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if (($parm_permission->{'set'}) && |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&assessparms($r); |
&& (!$env{'form.dis'})) || ($env{'form.symb'}))) { |
|
&assessparms($r,$parm_permission); |
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
|
} elsif (!$parm_permission->{$env{'form.action'}}) { |
|
&print_main_menu($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'setoverview') { |
} elsif ($env{'form.action'} eq 'setoverview') { |
&overview($r); |
&overview($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'addmetadata') { |
} elsif ($env{'form.action'} eq 'addmetadata') { |
&addmetafield($r); |
&addmetafield($r); |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
Line 6401 sub handler {
|
Line 6970 sub handler {
|
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
&setrestrictmeta($r); |
&setrestrictmeta($r); |
} elsif ($env{'form.action'} eq 'newoverview') { |
} elsif ($env{'form.action'} eq 'newoverview') { |
&newoverview($r); |
&newoverview($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'setdefaults') { |
} elsif ($env{'form.action'} eq 'setdefaults') { |
&defaultsetter($r); |
&defaultsetter($r); |
} elsif ($env{'form.action'} eq 'settable') { |
} elsif ($env{'form.action'} eq 'settable') { |
&assessparms($r); |
&assessparms($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
&parm_change_log($r); |
&parm_change_log($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
&clean_parameters($r); |
&clean_parameters($r); |
} elsif ($env{'form.action'} eq 'dateshift1') { |
} elsif ($env{'form.action'} eq 'dateshift1') { |