version 1.531, 2013/04/08 23:21:15
|
version 1.558, 2016/03/15 14:25:26
|
Line 46 This module sets coursewide and assessme
|
Line 46 This module sets coursewide and assessme
|
|
|
=over |
=over |
|
|
=pod |
|
|
|
=item parmval() |
=item parmval() |
|
|
Figure out a cascading parameter. |
Figure out a cascading parameter. |
Line 56 Inputs: $what - a parameter spec (inclu
|
Line 54 Inputs: $what - a parameter spec (inclu
|
$id - a bighash Id number |
$id - a bighash Id number |
$def - the resource's default value 'stupid emacs |
$def - the resource's default value 'stupid emacs |
|
|
Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels |
Returns: A list, the first item is the index into the remaining list of items of parm values that is the active one, the list consists of parm values at the 18 possible levels |
|
|
14- General Course |
18 - General Course |
13- Map or Folder level in course |
17 - Map or Folder level in course (recursive) |
12- resource default |
16 - Map or Folder level in course (non-recursive) |
11- map default |
15 - resource default |
10- resource level in course |
14 - map default |
9 - General for section |
13 - resource level in course |
8 - Map or Folder level for section |
12 - General for section |
7 - resource level in section |
11 - Map or Folder level for section (recursive) |
6 - General for group |
10 - Map or Folder level for section (non-recursive) |
5 - Map or Folder level for group |
9 - resource level in section |
4 - resource level in group |
8 - General for group |
3 - General for specific student |
7 - Map or Folder level for group (recursive) |
2 - Map or Folder level for specific student |
6 - Map or Folder level for group (non-recursive) |
|
5 - resource level in group |
|
4 - General for specific student |
|
3 - Map or Folder level for specific student (recursive) |
|
2 - Map or Folder level for specific student (non-recursive) |
1 - resource level for specific student |
1 - resource level for specific student |
|
|
=item parmval_by_symb() |
=item parmval_by_symb() |
Line 139 javascript function 'pjump'.
|
Line 141 javascript function 'pjump'.
|
|
|
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes. |
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes. |
|
|
Input: See list below: |
Input: See list below |
|
|
|
=over 4 |
|
|
=item * B<env{'user.name'}> : Current username |
=item * B<env{'user.name'}> : Current username |
|
|
=item * B<env{'user.domain'}> : Domain of current user. |
=item * B<env{'user.domain'}> : Domain of current user. |
|
|
=item * b<env{"request.course.fn"} : Course |
=item * B<env{"request.course.fn"}> : Course |
|
|
|
=back |
|
|
Outputs: See list below: |
Outputs: See list below: |
|
|
|
=over 4 |
|
|
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
|
|
=item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
=item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
Line 173 Outputs: See list below:
|
Line 181 Outputs: See list below:
|
|
|
=item * B<defkeytype> |
=item * B<defkeytype> |
|
|
|
=back |
|
|
=item isdateparm() |
=item isdateparm() |
|
|
=item parmmenu() |
=item parmmenu() |
Line 210 Returns: nothing
|
Line 220 Returns: nothing
|
|
|
Variables used (guessed by Jeremy): |
Variables used (guessed by Jeremy): |
|
|
|
=over |
|
|
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
|
|
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
Line 222 Variables used (guessed by Jeremy):
|
Line 234 Variables used (guessed by Jeremy):
|
When storing information, store as part 0 |
When storing information, store as part 0 |
When requesting information, request from full part |
When requesting information, request from full part |
|
|
|
=back |
|
|
=item tablestart() |
=item tablestart() |
|
|
=item tableend() |
=item tableend() |
Line 288 Set portfolio metadata
|
Line 302 Set portfolio metadata
|
|
|
Main handler. Calls &assessparms subroutine. |
Main handler. Calls &assessparms subroutine. |
|
|
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 360 sub parmval_by_symb {
|
Line 373 sub parmval_by_symb {
|
$map = &Apache::lonnet::deversion($map); |
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$what; |
my $symbparm=$symb.'.'.$what; |
|
my $recurseparm=$map.'___(rec).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
|
|
my $grplevel=$env{'request.course.id'}.'.['.$cgroup.'].'.$what; |
my $grplevel=$env{'request.course.id'}.'.['.$cgroup.'].'.$what; |
my $grplevelr=$env{'request.course.id'}.'.['.$cgroup.'].'.$symbparm; |
my $grplevelr=$env{'request.course.id'}.'.['.$cgroup.'].'.$symbparm; |
|
my $grpleveli=$env{'request.course.id'}.'.['.$cgroup.'].'.$recurseparm; |
my $grplevelm=$env{'request.course.id'}.'.['.$cgroup.'].'.$mapparm; |
my $grplevelm=$env{'request.course.id'}.'.['.$cgroup.'].'.$mapparm; |
|
|
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what; |
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
|
my $secleveli=$env{'request.course.id'}.'.['.$csec.'].'.$recurseparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
|
|
my $courselevel=$env{'request.course.id'}.'.'.$what; |
my $courselevel=$env{'request.course.id'}.'.'.$what; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
|
my $courseleveli=$env{'request.course.id'}.'.'.$recurseparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
|
|
# --------------------------------------------------------- first, check course |
# --------------------------------------------------------- first, check course |
|
|
if (defined($$courseopt{$courselevel})) { |
if (defined($$courseopt{$courselevel})) { |
$outpar[14]=$$courseopt{$courselevel}; |
$outpar[18]=$$courseopt{$courselevel}; |
$result=14; |
$result=18; |
|
} |
|
|
|
if (defined($$courseopt{$courseleveli})) { |
|
$outpar[17]=$$courseopt{$courseleveli}; |
|
$result=17; |
} |
} |
|
|
if (defined($$courseopt{$courselevelm})) { |
if (defined($$courseopt{$courselevelm})) { |
$outpar[13]=$$courseopt{$courselevelm}; |
$outpar[16]=$$courseopt{$courselevelm}; |
$result=13; |
$result=16; |
} |
} |
|
|
# ------------------------------------------------------- second, check default |
# ------------------------------------------------------- second, check default |
|
|
if (defined($def)) { $outpar[12]=$def; $result=12; } |
if (defined($def)) { $outpar[15]=$def; $result=15; } |
|
|
# ------------------------------------------------------ third, check map parms |
# ------------------------------------------------------ third, check map parms |
|
|
|
|
my $thisparm=&parmhash($symbparm); |
my $thisparm=&parmhash($symbparm); |
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
if (defined($thisparm)) { $outpar[14]=$thisparm; $result=14; } |
|
|
if (defined($$courseopt{$courselevelr})) { |
if (defined($$courseopt{$courselevelr})) { |
$outpar[10]=$$courseopt{$courselevelr}; |
$outpar[13]=$$courseopt{$courselevelr}; |
$result=10; |
$result=13; |
} |
} |
|
|
# ------------------------------------------------------ fourth, back to course |
# ------------------------------------------------------ fourth, back to course |
if ($csec ne '') { |
if ($csec ne '') { |
if (defined($$courseopt{$seclevel})) { |
if (defined($$courseopt{$seclevel})) { |
$outpar[9]=$$courseopt{$seclevel}; |
$outpar[12]=$$courseopt{$seclevel}; |
$result=9; |
$result=12; |
} |
} |
|
if (defined($$courseopt{$secleveli})) { |
|
$outpar[11]=$$courseopt{$secleveli}; |
|
$result=11; |
|
} |
if (defined($$courseopt{$seclevelm})) { |
if (defined($$courseopt{$seclevelm})) { |
$outpar[8]=$$courseopt{$seclevelm}; |
$outpar[10]=$$courseopt{$seclevelm}; |
$result=8; |
$result=10; |
} |
} |
|
|
if (defined($$courseopt{$seclevelr})) { |
if (defined($$courseopt{$seclevelr})) { |
$outpar[7]=$$courseopt{$seclevelr}; |
$outpar[9]=$$courseopt{$seclevelr}; |
$result=7; |
$result=9; |
} |
} |
} |
} |
# ------------------------------------------------------ fifth, check course group |
# ------------------------------------------------------ fifth, check course group |
if ($cgroup ne '') { |
if ($cgroup ne '') { |
if (defined($$courseopt{$grplevel})) { |
if (defined($$courseopt{$grplevel})) { |
$outpar[6]=$$courseopt{$grplevel}; |
$outpar[8]=$$courseopt{$grplevel}; |
$result=6; |
$result=8; |
|
} |
|
if (defined($$courseopt{$grpleveli})) { |
|
$outpar[7]=$$courseopt{$grpleveli}; |
|
$result=7; |
} |
} |
if (defined($$courseopt{$grplevelm})) { |
if (defined($$courseopt{$grplevelm})) { |
$outpar[5]=$$courseopt{$grplevelm}; |
$outpar[6]=$$courseopt{$grplevelm}; |
$result=5; |
$result=6; |
} |
} |
if (defined($$courseopt{$grplevelr})) { |
if (defined($$courseopt{$grplevelr})) { |
$outpar[4]=$$courseopt{$grplevelr}; |
$outpar[5]=$$courseopt{$grplevelr}; |
$result=4; |
$result=5; |
} |
} |
} |
} |
|
|
# ---------------------------------------------------------- fifth, check user |
# ---------------------------------------------------------- sixth, check user |
|
|
if ($uname ne '') { |
if ($uname ne '') { |
if (defined($$useropt{$courselevel})) { |
if (defined($$useropt{$courselevel})) { |
$outpar[3]=$$useropt{$courselevel}; |
$outpar[4]=$$useropt{$courselevel}; |
|
$result=4; |
|
} |
|
|
|
if (defined($$useropt{$courseleveli})) { |
|
$outpar[3]=$$useropt{$courseleveli}; |
$result=3; |
$result=3; |
} |
} |
|
|
Line 677 sub storeparm_by_symb_inner {
|
Line 712 sub storeparm_by_symb_inner {
|
$map = &Apache::lonnet::deversion($map); |
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$spnam; |
my $symbparm=$symb.'.'.$spnam; |
|
my $recurseparm=$map.'___(rec).'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
|
|
my $grplevel=$env{'request.course.id'}.'.['.$cgroup.'].'.$spnam; |
my $grplevel=$env{'request.course.id'}.'.['.$cgroup.'].'.$spnam; |
my $grplevelr=$env{'request.course.id'}.'.['.$cgroup.'].'.$symbparm; |
my $grplevelr=$env{'request.course.id'}.'.['.$cgroup.'].'.$symbparm; |
|
my $grpleveli=$env{'request.course.id'}.'.['.$cgroup.'].'.$recurseparm; |
my $grplevelm=$env{'request.course.id'}.'.['.$cgroup.'].'.$mapparm; |
my $grplevelm=$env{'request.course.id'}.'.['.$cgroup.'].'.$mapparm; |
|
|
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
|
my $secleveli=$env{'request.course.id'}.'.['.$csec.'].'.$recurseparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
|
|
my $courselevel=$env{'request.course.id'}.'.'.$spnam; |
my $courselevel=$env{'request.course.id'}.'.'.$spnam; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
|
my $courseleveli=$env{'request.course.id'}.'.'.$recurseparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
my $storeunder=''; |
my $storeunder=''; |
if (($snum==14) || ($snum==3)) { $storeunder=$courselevel; } |
if (($snum==18) || ($snum==4)) { $storeunder=$courselevel; } |
if (($snum==13) || ($snum==2)) { $storeunder=$courselevelm; } |
if (($snum==17) || ($snum==3)) { $storeunder=$courseleveli; } |
if (($snum==10) || ($snum==1)) { $storeunder=$courselevelr; } |
if (($snum==16) || ($snum==2)) { $storeunder=$courselevelm; } |
if ($snum==9) { $storeunder=$seclevel; } |
if (($snum==13) || ($snum==1)) { $storeunder=$courselevelr; } |
if ($snum==8) { $storeunder=$seclevelm; } |
if ($snum==12) { $storeunder=$seclevel; } |
if ($snum==7) { $storeunder=$seclevelr; } |
if ($snum==11) { $storeunder=$secleveli; } |
if ($snum==6) { $storeunder=$grplevel; } |
if ($snum==10) { $storeunder=$seclevelm; } |
if ($snum==5) { $storeunder=$grplevelm; } |
if ($snum==9) { $storeunder=$seclevelr; } |
if ($snum==4) { $storeunder=$grplevelr; } |
if ($snum==8) { $storeunder=$grplevel; } |
|
if ($snum==7) { $storeunder=$grpleveli; } |
|
if ($snum==6) { $storeunder=$grplevelm; } |
|
if ($snum==5) { $storeunder=$grplevelr; } |
|
|
|
|
my $delete; |
my $delete; |
Line 708 sub storeparm_by_symb_inner {
|
Line 750 sub storeparm_by_symb_inner {
|
my %storecontent = ($storeunder => $nval, |
my %storecontent = ($storeunder => $nval, |
$storeunder.'.type' => $ntype); |
$storeunder.'.type' => $ntype); |
my $reply=''; |
my $reply=''; |
if ($snum>3) { |
if ($snum>4) { |
# ---------------------------------------------------------------- Store Course |
# ---------------------------------------------------------------- Store Course |
# |
# |
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'}; |
# Expire sheets |
# Expire sheets |
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','studentcalc'); |
if (($snum==10) || ($snum==7) || ($snum==4)) { |
if (($snum==13) || ($snum==9) || ($snum==5)) { |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
} elsif (($snum==11) || ($snum==8) || ($snum==5)) { |
} elsif (($snum==14) || ($snum==10) || ($snum==6)) { |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
} else { |
} else { |
&Apache::lonnet::expirespread('','','assesscalc'); |
&Apache::lonnet::expirespread('','','assesscalc'); |
Line 768 sub storeparm_by_symb_inner {
|
Line 810 sub storeparm_by_symb_inner {
|
|
|
|
|
sub valout { |
sub valout { |
my ($value,$type,$editable)=@_; |
my ($value,$type,$name,$editable)=@_; |
my $result = ''; |
my $result = ''; |
# Values of zero are valid. |
# Values of zero are valid. |
if (! $value && $value ne '0') { |
if (! $value && $value ne '0') { |
Line 776 sub valout {
|
Line 818 sub valout {
|
$result = |
$result = |
'<img src="/res/adm/pages/editmap.png"' |
'<img src="/res/adm/pages/editmap.png"' |
.' alt="'.&mt('Change').'"' |
.' alt="'.&mt('Change').'"' |
.' title="'.&mt('Change').'" />'; |
.' title="'.&mt('Change').'" style="border:0;" />'; |
} else { |
} else { |
$result=' '; |
$result=' '; |
} |
} |
} else { |
} else { |
if ($type eq 'date_interval') { |
if ($type eq 'date_interval') { |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
my ($totalsecs,$donebutton,$proctor,$secretkey) = split(/_/,$value); |
|
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($totalsecs); |
my @timer; |
my @timer; |
$year=$year-70; |
$year=$year-70; |
$mday--; |
$mday--; |
Line 815 sub valout {
|
Line 858 sub valout {
|
push(@timer,&mt('[quant,_1,sec]',0)); |
push(@timer,&mt('[quant,_1,sec]',0)); |
} |
} |
$result.=join(", ",@timer); |
$result.=join(", ",@timer); |
|
if ($donebutton eq 'done') { |
|
if ($secretkey) { |
|
$result .= ' '.&mt('+ "done" with proctor key: [_1]',$secretkey); |
|
} else { |
|
$result .= ' '.&mt('+ "done"'); |
|
} |
|
} |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = &Apache::lonlocal::locallocaltime($value). |
$result = &Apache::lonlocal::locallocaltime($value). |
&date_sanity_info($value); |
&date_sanity_info($value); |
Line 841 sub plink {
|
Line 891 sub plink {
|
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
unless (defined($winvalue)) { $winvalue=$val; } |
unless (defined($winvalue)) { $winvalue=$val; } |
my $valout = &valout($value,$type,1); |
my $valout = &valout($value,$type,$parmname,1); |
my $unencmarker = $marker; |
my $unencmarker = $marker; |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
\$hour, \$min, \$sec) { |
\$hour, \$min, \$sec) { |
Line 923 function showHide_courseContent() {
|
Line 973 function showHide_courseContent() {
|
COURSECONTENTSCRIPT |
COURSECONTENTSCRIPT |
} |
} |
|
|
|
sub toggleparmtextbox_js { |
|
return <<"ENDSCRIPT"; |
|
|
|
if (!document.getElementsByClassName) { |
|
function getElementsByClassName(node, classname) { |
|
var a = []; |
|
var re = new RegExp('(^| )'+classname+'( |$)'); |
|
var els = node.getElementsByTagName("*"); |
|
for(var i=0,j=els.length; i<j; i++) |
|
if(re.test(els[i].className))a.push(els[i]); |
|
return a; |
|
} |
|
} |
|
|
|
function showHideLenient() { |
|
var lenients; |
|
var setRegExp = /^set_/; |
|
if (document.getElementsByClassName) { |
|
lenients = document.getElementsByClassName('LC_lenient_radio'); |
|
} else { |
|
lenients = getElementsByClassName(document.body,'LC_lenient_radio'); |
|
} |
|
if (lenients != 'undefined') { |
|
for (var i=0; i<lenients.length; i++) { |
|
if (lenients[i].checked) { |
|
if (lenients[i].value == 'weighted') { |
|
if (setRegExp.test(lenients[i].name)) { |
|
var identifier = lenients[i].name.replace(setRegExp,''); |
|
toggleParmTextbox(document.parmform,identifier); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function toggleParmTextbox(form,key) { |
|
var divfortext = document.getElementById('LC_parmtext_'+key); |
|
if (divfortext) { |
|
var caller = form.elements['set_'+key]; |
|
if (caller.length) { |
|
for (i=0; i<caller.length; i++) { |
|
if (caller[i].checked) { |
|
if (caller[i].value == 'weighted') { |
|
divfortext.style.display = 'inline'; |
|
} else { |
|
divfortext.style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
sub validateparms_js { |
|
return <<'ENDSCRIPT'; |
|
|
|
function validateParms() { |
|
var textRegExp = /^settext_/; |
|
var tailLenient = /\.lenient$/; |
|
var patternRelWeight = /^\-?[\d.]+$/; |
|
var patternLenientStd = /^(yes|no|default)$/; |
|
var ipallowRegExp = /^setipallow_/; |
|
var ipdenyRegExp = /^setipdeny_/; |
|
var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/; |
|
if ((document.parmform.elements.length != 'undefined') && (document.parmform.elements.length) != 'null') { |
|
if (document.parmform.elements.length) { |
|
for (i=0; i<document.parmform.elements.length; i++) { |
|
var name=document.parmform.elements[i].name; |
|
if (textRegExp.test(name)) { |
|
var identifier = name.replace(textRegExp,''); |
|
if (tailLenient.test(identifier)) { |
|
if (document.parmform.elements['set_'+identifier].length) { |
|
for (var j=0; j<document.parmform.elements['set_'+identifier].length; j++) { |
|
if (document.parmform.elements['set_'+identifier][j].checked) { |
|
if (!(patternLenientStd.test(document.parmform.elements['set_'+identifier][j].value))) { |
|
var relweight = document.parmform.elements[i].value; |
|
relweight = relweight.replace(/^\s+|\s+$/g,''); |
|
if (!patternRelWeight.test(relweight)) { |
|
relweight = '0.0'; |
|
} |
|
if (document.parmform.elements['set_'+identifier][j].value == 'weighted') { |
|
document.parmform.elements['set_'+identifier][j].value = relweight; |
|
} else { |
|
document.parmform.elements['set_'+identifier][j].value += ','+relweight; |
|
} |
|
} |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
if (ipallowRegExp.test(name)) { |
|
var identifier = name.replace(ipallowRegExp,''); |
|
var possallow = document.parmform.elements[i].value; |
|
possallow = possallow.replace(/^\s+|\s+$/g,''); |
|
if (patternIP.test(possallow)) { |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
possallow = ','+possallow; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possallow; |
|
} |
|
} else { |
|
if (ipdenyRegExp.test(name)) { |
|
var identifier = name.replace(ipdenyRegExp,''); |
|
var possdeny = document.parmform.elements[i].value; |
|
possdeny = possdeny.replace(/^\s+|\s+$/g,''); |
|
if (patternIP.test(possdeny)) { |
|
possdeny = '!'+possdeny; |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
possdeny = ','+possdeny; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possdeny; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return true; |
|
} |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
sub ipacc_boxes_js { |
|
my $remove = &mt('Remove'); |
|
return <<"END"; |
|
\$(document).ready(function() { |
|
var wrapper = \$(".LC_string_ipacc_wrap"); |
|
var add_button = \$(".LC_add_ipacc_button"); |
|
var ipaccRegExp = /^LC_string_ipacc_/; |
|
|
|
\$(add_button).click(function(e){ |
|
e.preventDefault(); |
|
var identifier = \$(this).closest("div").attr("id"); |
|
identifier = identifier.replace(ipaccRegExp,''); |
|
\$(this).closest('div').find('.LC_string_ipacc_inner').append('<div><input type="text" name="setip'+identifier+'" /><a href="#" class="LC_remove_ipacc">$remove</a></div>'); |
|
}); |
|
|
|
\$(wrapper).delegate(".LC_remove_ipacc","click", function(e){ |
|
e.preventDefault(); \$(this).closest("div").remove(); |
|
}) |
|
}); |
|
|
|
|
|
END |
|
} |
|
|
|
sub done_proctor_js { |
|
return <<"END"; |
|
function toggleSecret(form,radio,key) { |
|
var radios = form[radio+key]; |
|
if (radios.length) { |
|
for (var i=0; i<radios.length; i++) { |
|
if (radios[i].checked) { |
|
if (radios[i].value == '_done_proctor') { |
|
if (document.getElementById('done_'+key+'_proctorkey')) { |
|
document.getElementById('done_'+key+'_proctorkey').type='text'; |
|
} |
|
} else { |
|
if (document.getElementById('done_'+key+'_proctorkey')) { |
|
document.getElementById('done_'+key+'_proctorkey').type='hidden'; |
|
document.getElementById('done_'+key+'_proctorkey').value=''; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
END |
|
|
|
} |
|
|
sub startpage { |
sub startpage { |
my ($r,$psymb,$crstype) = @_; |
my ($r,$psymb,$crstype) = @_; |
|
|
Line 973 ENDHEAD
|
Line 1204 ENDHEAD
|
|
|
sub print_row { |
sub print_row { |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_; |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp)=@_; |
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); |
|
|
# get the values for the parameter in cascading order |
# get the values for the parameter in cascading order |
# empty levels will remain empty |
# empty levels will remain empty |
my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which}, |
my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which}, |
Line 988 sub print_row {
|
Line 1220 sub print_row {
|
$$defaulttype{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
$$defaulttype{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
# cascade down manually |
# cascade down manually |
my $cascadetype=$$defaulttype{$which}; |
my $cascadetype=$$defaulttype{$which}; |
for (my $i=14;$i>0;$i--) { |
for (my $i=18;$i>0;$i--) { |
if ($typeoutpar[$i]) { |
if ($typeoutpar[$i]) { |
$cascadetype=$typeoutpar[$i]; |
$cascadetype=$typeoutpar[$i]; |
} else { |
} else { |
Line 1012 sub print_row {
|
Line 1244 sub print_row {
|
my $thismarker=$which; |
my $thismarker=$which; |
$thismarker=~s/^parameter\_//; |
$thismarker=~s/^parameter\_//; |
my $mprefix=$rid.'&'.$thismarker.'&'; |
my $mprefix=$rid.'&'.$thismarker.'&'; |
my $effective_parm = &valout($outpar[$result],$typeoutpar[$result]); |
my $effective_parm = &valout($outpar[$result],$typeoutpar[$result],$thismarker); |
my ($othergrp,$grp_parm,$controlgrp); |
my ($othergrp,$grp_parm,$controlgrp); |
|
|
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
|
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
} |
} else { |
} else { |
if ($uname) { |
if ($uname) { |
Line 1044 sub print_row {
|
Line 1278 sub print_row {
|
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
&print_usergroups($r,$$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 > 3) { |
if ($coursereply && $result > 4) { |
if (defined($controlgrp)) { |
if (defined($controlgrp)) { |
if ($cgroup ne $controlgrp) { |
if ($cgroup ne $controlgrp) { |
$effective_parm = $grp_parm; |
$effective_parm = $grp_parm; |
Line 1055 sub print_row {
|
Line 1289 sub print_row {
|
} |
} |
} |
} |
|
|
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
&print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); |
|
&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,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
&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>'); |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>'); |
Line 1092 sub print_row {
|
Line 1329 sub print_row {
|
my $sessionvaltype=$typeoutpar[$result]; |
my $sessionvaltype=$typeoutpar[$result]; |
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
$r->print('<td style="background-color:#999999;" align="center"><font color="#FFFFFF">'. |
$r->print('<td style="background-color:#999999;" align="center"><font color="#FFFFFF">'. |
&valout($sessionval,$sessionvaltype).' '. |
&valout($sessionval,$sessionvaltype,$$name{$which}).' '. |
'</font></td>'); |
'</font></td>'); |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
Line 1100 sub print_row {
|
Line 1337 sub print_row {
|
} |
} |
|
|
sub print_td { |
sub print_td { |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp)=@_; |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
';" align="center">'); |
';" align="center">'); |
my $nolink = 0; |
my $nolink = 0; |
if ($which == 11 || $which == 12) { |
if ($which == 14 || $which == 15) { |
$nolink = 1; |
$nolink = 1; |
|
} elsif (($env{'request.course.sec'} ne '') && ($which > 12)) { |
|
$nolink = 1; |
|
} elsif ($which == 5 || $which == 6 || $which == 7 || $which == 8) { |
|
if ($noeditgrp) { |
|
$nolink = 1; |
|
} |
} elsif ($mprefix =~ /availablestudent\&$/) { |
} elsif ($mprefix =~ /availablestudent\&$/) { |
if ($which > 3) { |
if ($which > 4) { |
|
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /examcode\&$/) { |
|
unless ($which == 2) { |
$nolink = 1; |
$nolink = 1; |
} |
} |
} |
} |
if ($nolink) { |
if ($nolink) { |
$r->print(&valout($$outpar[$which],$$typeoutpar[$which])); |
$r->print(&valout($$outpar[$which],$$typeoutpar[$which],$mprefix)); |
} else { |
} else { |
$r->print(&plink($$typeoutpar[$which], |
$r->print(&plink($$typeoutpar[$which], |
$$display{$value},$$outpar[$which], |
$$display{$value},$$outpar[$which], |
Line 1128 sub print_usergroups {
|
Line 1375 sub print_usergroups {
|
my $symb = &symbcache($rid); |
my $symb = &symbcache($rid); |
my $symbparm=$symb.'.'.$what; |
my $symbparm=$symb.'.'.$what; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
|
my $recurseparm=$map.'___(rec).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
my ($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype) = |
my ($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype) = |
&parm_control_group($courseid,$usersgroups,$symbparm,$mapparm,$what, |
&parm_control_group($courseid,$usersgroups,$symbparm,$mapparm, |
$courseopt); |
$recurseparm,$what,$courseopt); |
my $bgcolor = $defbg; |
my $bgcolor = $defbg; |
my $grp_parm; |
my $grp_parm; |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if ($result > 3) { |
if ($result > 3) { |
$bgcolor = '#AAFFAA'; |
$bgcolor = '#AAFFAA'; |
$grp_parm = &valout($coursereply,$resulttype); |
$grp_parm = &valout($coursereply,$resulttype,$what); |
} |
} |
$grp_parm = &valout($coursereply,$resulttype); |
$grp_parm = &valout($coursereply,$resulttype,$what); |
$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; |
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm; |
Line 1154 sub print_usergroups {
|
Line 1402 sub print_usergroups {
|
} |
} |
|
|
sub parm_control_group { |
sub parm_control_group { |
my ($courseid,$usersgroups,$symbparm,$mapparm,$what,$courseopt) = @_; |
my ($courseid,$usersgroups,$symbparm,$mapparm,$recurseparm,$what,$courseopt) = @_; |
my ($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); |
my ($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); |
my $grpfound = 0; |
my $grpfound = 0; |
my @levels = ($symbparm,$mapparm,$what); |
my @levels = ($symbparm,$mapparm,$recurseparm,$what); |
my @levelnames = ('resource','map/folder','general'); |
my @levelnames = ('resource','map/folder','recursive','general'); |
foreach my $group (@{$usersgroups}) { |
foreach my $group (@{$usersgroups}) { |
if ($grpfound) { last; } |
if ($grpfound) { last; } |
for (my $i=0; $i<@levels; $i++) { |
for (my $i=0; $i<@levels; $i++) { |
Line 1263 sub extractResourceInformation {
|
Line 1511 sub extractResourceInformation {
|
$$mapp{$mapid}=$$mapp{$id}; |
$$mapp{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
if ($mapid eq '1') { |
if ($mapid eq '1') { |
$$maptitles{$mapid}=&mt('Main Course Documents'); |
$$maptitles{$mapid}=&mt('Main Content'); |
} else { |
} else { |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
} |
} |
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; # Added in rev. 1.57, but seems not to be used. |
|
# Lines 1038 and 1114 which use $symbp{$mapid} |
|
# are commented out in rev. 1.57 |
} else { |
} else { |
$$mapp{$id} = $$mapp{$mapid}; |
$$mapp{$id} = $$mapp{$mapid}; |
} |
} |
Line 1397 sub lookUpTableParameter {
|
Line 1647 sub lookUpTableParameter {
|
'contentopen' => 'time_settings', |
'contentopen' => 'time_settings', |
'contentclose' => 'time_settings', |
'contentclose' => 'time_settings', |
'discussend' => 'time_settings', |
'discussend' => 'time_settings', |
'printopendate' => 'time_settings', |
'printstartdate' => 'time_settings', |
'printclosedate' => 'time_settings', |
'printenddate' => 'time_settings', |
'weight' => 'grading', |
'weight' => 'grading', |
'handgrade' => 'grading', |
'handgrade' => 'grading', |
'maxtries' => 'tries', |
'maxtries' => 'tries', |
Line 1433 sub lookUpTableParameter {
|
Line 1683 sub lookUpTableParameter {
|
'lenient' => 'grading', |
'lenient' => 'grading', |
'retrypartial' => 'tries', |
'retrypartial' => 'tries', |
'discussvote' => 'misc', |
'discussvote' => 'misc', |
|
'examcode' => 'high_level_randomization', |
); |
); |
} |
} |
|
|
Line 1485 sub category_order {
|
Line 1735 sub category_order {
|
|
|
sub parmboxes { |
sub parmboxes { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my %categories = &categories(); |
my $tempparameter; |
|
my %categories = &categories; |
|
my %category_order = &category_order(); |
my %category_order = &category_order(); |
my %categoryList = ( |
my %categoryList = ( |
'time_settings' => [], |
'time_settings' => [], |
Line 1502 sub parmboxes {
|
Line 1750 sub parmboxes {
|
'misc' => [], |
'misc' => [], |
); |
); |
|
|
foreach $tempparameter (keys %$allparms) { |
foreach my $tempparameter (keys(%$allparms)) { |
&whatIsMyCategory($tempparameter, \%categoryList); |
&whatIsMyCategory($tempparameter, \%categoryList); |
} |
} |
#part to print the parm-list |
#part to print the parm-list |
$r->print('<div class="LC_columnSection">'."\n"); |
foreach my $key (sort { $category_order{$a} <=> $category_order{$b} } keys(%categoryList)) { |
|
next if (@{$categoryList{$key}} == 0); |
#Print parameters |
next if ($key eq ''); |
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
$r->print('<div class="LC_Box LC_400Box">' |
if(@{$categoryList{$key}} == 0) { |
.'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n"); |
next; |
foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
} else { |
$r->print('<span class="LC_nobreak">' |
$r->print('<div class="LC_Box LC_400Box">' |
.'<label><input type="checkbox" name="pscat" ' |
.'<h4 class="LC_hcell">' |
.'value="'.$tempkey.'" '); |
.&mt($categories{$key}) |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
.'</h4>'."\n"); |
$r->print( ' checked="checked"'); |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
|
$r->print('<span class="LC_nobreak">' |
|
.'<label><input type="checkbox" name="pscat" '); |
|
$r->print('value="'.$tempkey.'" '); |
|
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></span><br />'."\n"); |
|
} |
} |
$r->print("</div>\n"); |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></span><br />'."\n"); |
} |
} |
|
$r->print('</div>'); |
} |
} |
|
$r->print("\n"); |
$r->print("</div>\n"); |
|
} |
} |
# |
# |
# This function offers some links on the parameter section to get with one click a group a parameters |
# This function offers some links on the parameter section to get with one click a group a parameters |
Line 1597 sub partmenu {
|
Line 1837 sub partmenu {
|
} |
} |
|
|
sub usermenu { |
sub usermenu { |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_; |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_; |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
Line 1606 sub usermenu {
|
Line 1846 sub usermenu {
|
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
|
|
my $groups; |
my $groups; |
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash; |
|
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
|
} |
|
|
my $g_s_header=''; |
my $g_s_header=''; |
my $g_s_footer=''; |
my $g_s_footer=''; |
|
|
if (%sectionhash) { |
my $currsec = $env{'request.course.sec'}; |
|
if ($currsec) { |
|
$sections=&mt('Section:').' '.$currsec; |
|
if (%grouphash) { |
|
$sections .= ';'.(' ' x2); |
|
} |
|
} elsif (%sectionhash && $currsec eq '') { |
$sections=&mt('Section:').' <select name="csec"'; |
$sections=&mt('Section:').' <select name="csec"'; |
if (%grouphash && $parmlev ne 'full') { |
if (%grouphash && $parmlev ne 'full') { |
$sections .= qq| onchange="group_or_section('csec')" |; |
$sections .= qq| onchange="group_or_section('csec')" |; |
} |
} |
$sections .= '>'; |
$sections .= '>'; |
foreach my $section ('',sort keys %sectionhash) { |
foreach my $section ('',sort(keys(%sectionhash))) { |
$sections.='<option value="'.$section.'" '. |
$sections.='<option value="'.$section.'" '. |
($section eq $csec?'selected="selected"':'').'>'.$section. |
($section eq $csec?'selected="selected"':'').'>'.$section. |
'</option>'; |
'</option>'; |
Line 1625 sub usermenu {
|
Line 1876 sub usermenu {
|
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
|
|
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
if (%sectionhash && %grouphash && $parmlev ne 'full' && $currsec eq '') { |
$sections .= ' '.&mt('or').' '; |
$sections .= ' '.&mt('or').' '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 1658 function group_or_section(caller) {
|
Line 1909 function group_or_section(caller) {
|
|
|
if (%grouphash) { |
if (%grouphash) { |
$groups=&mt('Group:').' <select name="cgroup"'; |
$groups=&mt('Group:').' <select name="cgroup"'; |
if (%sectionhash && $env{'form.action'} eq 'settable') { |
if (%sectionhash && $env{'form.action'} eq 'settable' && $currsec eq '') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
$groups .= '>'; |
$groups .= '>'; |
foreach my $grp ('',sort keys %grouphash) { |
foreach my $grp ('',sort(keys(%grouphash))) { |
$groups.='<option value="'.$grp.'" '; |
$groups.='<option value="'.$grp.'" '; |
if ($grp eq $cgroup) { |
if ($grp eq $cgroup) { |
unless ((defined($uname)) && ($grp eq '')) { |
unless ((defined($uname)) && ($grp eq '')) { |
Line 1684 function group_or_section(caller) {
|
Line 1935 function group_or_section(caller) {
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section'))); |
$r->print($sections.$groups); |
$r->print($sections.$groups); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
|
} else { |
|
$r->print($sections); |
} |
} |
|
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('User'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('User'))); |
Line 1697 function group_or_section(caller) {
|
Line 1950 function group_or_section(caller) {
|
# This function shows on table Mode the available Parameters for the selected Resources |
# This function shows on table Mode the available Parameters for the selected Resources |
# |
# |
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$pscat,$psprt,$keyorder)=@_; |
my ($r,$allparms,$pscat,$psprt,$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); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::loncommon::start_scrollbox()); |
$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 1777 sub mapmenu {
|
Line 2030 sub mapmenu {
|
.'</div>' |
.'</div>' |
); |
); |
|
|
$r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll')); |
$r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll')); |
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
|
|
# Display row: "All Maps or Folders" |
# Display row: "All Maps or Folders" |
Line 1796 sub mapmenu {
|
Line 2049 sub mapmenu {
|
.&Apache::loncommon::end_data_table_row() |
.&Apache::loncommon::end_data_table_row() |
); |
); |
|
|
# Display row: "Main Course Documents" |
# Display row: "Main Content" |
if (exists($$allmaps{1})) { |
if (exists($$allmaps{1})) { |
$r->print( |
$r->print( |
&Apache::loncommon::start_data_table_row() |
&Apache::loncommon::start_data_table_row() |
Line 1868 sub mapmenu {
|
Line 2121 sub mapmenu {
|
sub levelmenu { |
sub levelmenu { |
my ($r,$alllevs,$parmlev)=@_; |
my ($r,$alllevs,$parmlev)=@_; |
|
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').&Apache::loncommon::help_open_topic('Course_Parameter_Levels'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level'). |
|
&Apache::loncommon::help_open_topic('Course_Parameter_Levels'))); |
$r->print('<select id="parmlev" name="parmlev" onchange="showHide_courseContent()">'); |
$r->print('<select id="parmlev" name="parmlev" onchange="showHide_courseContent()">'); |
foreach (reverse sort keys %{$alllevs}) { |
foreach my $lev (reverse(sort(keys(%{$alllevs})))) { |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
$r->print('<option value="'.$$alllevs{$lev}.'"'); |
if ($parmlev eq $$alllevs{$_}) { |
if ($parmlev eq $$alllevs{$lev}) { |
$r->print(' selected="selected"'); |
$r->print(' selected="selected"'); |
} |
} |
$r->print('>'.&mt($_).'</option>'); |
$r->print('>'.&mt($lev).'</option>'); |
} |
} |
$r->print("</select>"); |
$r->print("</select>"); |
} |
} |
|
|
|
|
sub sectionmenu { |
sub sectionmenu { |
my ($r,$selectedsections)=@_; |
my ($selectedsections)=@_; |
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
return if (!%sectionhash); |
return '' if (!%sectionhash); |
|
|
$r->print('<select name="Section" multiple="multiple" size="8">'); |
my (@possibles,$disabled); |
foreach my $s ('all',sort keys %sectionhash) { |
if ($env{'request.course.sec'} ne '') { |
$r->print(' <option value="'.$s.'"'); |
@possibles = ($env{'request.course.sec'}); |
foreach (@{$selectedsections}) { |
$selectedsections = [$env{'request.course.sec'}]; |
if ($s eq $_) { |
$disabled = ' disabled="disabled"'; |
$r->print(' selected="selected"'); |
} else { |
last; |
@possibles = ('all',sort(keys(%sectionhash))); |
} |
|
} |
} |
$r->print('>'.$s."</option>\n"); |
my $output = '<select name="Section" multiple="multiple" size="8"'.$disabled.'>'; |
|
foreach my $s (@possibles) { |
|
$output .= ' <option value="'.$s.'"'; |
|
if ((@{$selectedsections}) && (grep(/^\Q$s\E$/,@{$selectedsections}))) { |
|
$output .= ' selected="selected"'; |
|
} |
|
$output .= '>'."$s</option>\n"; |
} |
} |
$r->print("</select>\n"); |
$output .= "</select>\n"; |
|
return $output; |
} |
} |
|
|
sub groupmenu { |
sub groupmenu { |
my ($r,$selectedgroups)=@_; |
my ($selectedgroups)=@_; |
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash; |
return if (!%grouphash); |
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
|
} |
|
return '' if (!%grouphash); |
|
|
$r->print('<select name="Group" multiple="multiple" size="8">'); |
my $output = '<select name="Group" multiple="multiple" size="8">'; |
foreach my $group (sort(keys(%grouphash))) { |
foreach my $group (sort(keys(%grouphash))) { |
$r->print(' <option value="'.$group.'"'); |
$output .= ' <option value="'.$group.'"'; |
foreach (@{$selectedgroups}) { |
if ((@{$selectedgroups}) && (grep(/^\Q$group\E$/,\@{$selectedgroups}))) { |
if ($group eq $_) { |
$output .= ' selected="selected"'; |
$r->print(' selected="selected"'); |
|
last; |
|
} |
} |
|
$output .= '>'."$group</option>\n"; |
} |
} |
$r->print('>'.$group."</option>\n"); |
$output .= "</select>\n"; |
} |
return $output; |
$r->print("</select>\n"); |
|
} |
} |
|
|
|
|
sub keysplit { |
sub keysplit { |
my $keyp=shift; |
my $keyp=shift; |
return (split(/\,/,$keyp)); |
return (split(/\,/,$keyp)); |
Line 1929 sub keysinorder {
|
Line 2191 sub keysinorder {
|
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
$$keyorder{$a} <=> $$keyorder{$b}; |
$$keyorder{$a} <=> $$keyorder{$b}; |
} (keys %{$name}); |
} (keys(%{$name})); |
} |
} |
|
|
sub keysinorder_bytype { |
sub keysinorder_bytype { |
Line 1941 sub keysinorder_bytype {
|
Line 2203 sub keysinorder_bytype {
|
return ($a cmp $b); |
return ($a cmp $b); |
} |
} |
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb}; |
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb}; |
} (keys %{$name}); |
} (keys(%{$name})); |
} |
} |
|
|
sub keysindisplayorder { |
sub keysindisplayorder { |
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
} (keys %{$name}); |
} (keys(%{$name})); |
} |
} |
|
|
sub sortmenu { |
sub sortmenu { |
Line 1988 sub standardkeyorder {
|
Line 2250 sub standardkeyorder {
|
'parameter_0_discussend' => 19, |
'parameter_0_discussend' => 19, |
'parameter_0_discusshide' => 20, |
'parameter_0_discusshide' => 20, |
'parameter_0_discussvote' => 21, |
'parameter_0_discussvote' => 21, |
'parameter_0_printopendate' => 22, |
'parameter_0_printstartdate' => 22, |
'parameter_0_printclosedate' => 23); |
'parameter_0_printenddate' => 23); |
} |
} |
|
|
|
|
Line 2039 sub assessparms {
|
Line 2301 sub assessparms {
|
my $message=''; |
my $message=''; |
|
|
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec = $env{'request.course.sec'}; |
|
} |
|
|
|
# Check group privs. |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
|
my $noeditgrp; |
|
if ($cgroup ne '') { |
|
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
if (($env{'request.course.groups'} eq '') || |
|
(!grep(/^\Q$cgroup\E$/,split(/,/,$env{'request.course.groups'})))) { |
|
$noeditgrp = 1; |
|
} |
|
} |
|
} |
|
|
if ($udom=$env{'form.udom'}) { |
if ($udom=$env{'form.udom'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
Line 2087 sub assessparms {
|
Line 2363 sub assessparms {
|
|
|
my $id=$env{'form.id'}; |
my $id=$env{'form.id'}; |
if (($id) && ($udom)) { |
if (($id) && ($udom)) { |
$uname=(&Apache::lonnet::idget($udom,$id))[1]; |
$uname=(&Apache::lonnet::idget($udom,[$id],'ids'))[1]; |
if ($uname) { |
if ($uname) { |
$id=''; |
$id=''; |
} else { |
} else { |
$message= |
$message= |
'<span class="LC_error">'.&mt("Unknown ID")." '$id' ". |
'<p class="LC_warning">'. |
&mt('at domain')." '$udom'</span>"; |
&mt('Unknown ID [_1] at domain [_2]', |
|
"'".$id."'","'".$udom."'"). |
|
'</p>'; |
} |
} |
} else { |
} else { |
$uname=$env{'form.uname'}; |
$uname=$env{'form.uname'}; |
Line 2104 sub assessparms {
|
Line 2382 sub assessparms {
|
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
$message= |
$message= |
'<span class="LC_error">'.&mt("Unknown user")." '$uname' ". |
'<p class="LC_warning">'. |
&mt("at domain")." '$udom'</span>"; |
&mt('Unknown user [_1] at domain [_2]', |
|
"'".$uname."'","'".$udom."'"). |
|
'</p>'; |
$uname=''; |
$uname=''; |
} else { |
} else { |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message='<span class="LC_error">'. |
$message= |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
'<p class="LC_warning">'. |
&mt("not in this course")."</span>"; |
&mt('User [_1] at domain [_2] not in this course', |
|
"'".$uname."'","'".$udom."'"). |
|
'</p>'; |
$uname=''; |
$uname=''; |
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
Line 2156 sub assessparms {
|
Line 2438 sub assessparms {
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my $totalstored = 0; |
my $totalstored = 0; |
|
my $now = time; |
|
|
for (my $i=0;$i<=$#markers;$i++) { |
for (my $i=0;$i<=$#markers;$i++) { |
my ($needsrelease,$needsnewer,$name); |
my ($needsrelease,$needsnewer,$name,$namematch); |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
if (($env{'request.course.sec'} ne '') && ($markers[$i] =~ /\&(9|10|11|12)$/)) { |
|
next if ($csec ne $env{'request.course.sec'}); |
|
} |
|
if ($markers[$i] =~ /\&(8|7|6|5)$/) { |
|
next if ($noeditgrp); |
|
} |
|
if ($markers[$i] =~ /\&(17|11|7|3)$/) { |
|
$namematch = 'maplevelrecurse'; |
|
} |
|
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3|4)$/) { |
my (@ok_slots,@fail_slots,@del_slots); |
my (@ok_slots,@fail_slots,@del_slots); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my ($level,@all) = |
my ($level,@all) = |
Line 2190 sub assessparms {
|
Line 2480 sub assessparms {
|
} |
} |
} |
} |
} |
} |
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote)\&\d+$/) { |
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate|acc|interval)\&\d+$/) { |
$name = $1; |
$name = $1; |
|
my $val = $values[$i]; |
|
my $valmatch = ''; |
|
if ($name eq 'examcode') { |
|
if (&Apache::lonnet::validCODE($values[$i])) { |
|
$val = 'valid'; |
|
} |
|
} elsif ($name eq 'printstartdate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val > $now) { |
|
$val = 'future'; |
|
} |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val < $now) { |
|
$val = 'past'; |
|
} |
|
} |
|
} elsif (($name eq 'lenient') || ($name eq 'acc')) { |
|
my $stringtype = &get_stringtype($name); |
|
my $stringmatch = &standard_string_matches($stringtype); |
|
if (ref($stringmatch) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatch}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($pattern ne '') { |
|
if ($val =~ /$pattern/) { |
|
$valmatch = $regexpname; |
|
$val = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} elsif ($name eq 'interval') { |
|
my $intervaltype = &get_intervaltype($name); |
|
my $intervalmatch = &standard_interval_matches($intervaltype); |
|
if (ref($intervalmatch) eq 'ARRAY') { |
|
foreach my $item (@{$intervalmatch}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($pattern ne '') { |
|
if ($val =~ /$pattern/) { |
|
$valmatch = $regexpname; |
|
$val = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
$needsrelease = |
$needsrelease = |
$Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"}; |
$Apache::lonnet::needsrelease{"parameter:$name:$val:$valmatch:"}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
$needsnewer = ¶meter_releasecheck($name,$values[$i], |
$needsnewer = ¶meter_releasecheck($name,$val,$valmatch,undef, |
$needsrelease, |
$needsrelease, |
$chostname, |
|
$cmajor,$cminor); |
$cmajor,$cminor); |
} |
} |
} |
} |
if ($needsnewer) { |
if ($needsnewer) { |
$message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor, |
undef($namematch); |
|
} else { |
|
my $currneeded; |
|
if ($needsrelease) { |
|
$currneeded = $needsrelease; |
|
} |
|
if ($namematch) { |
|
$needsrelease = |
|
$Apache::lonnet::needsrelease{"parameter::::$namematch"}; |
|
if (($needsrelease) && (($currneeded eq '') || ($needsrelease < $currneeded))) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = ¶meter_releasecheck(undef,undef,undef,$namematch, |
|
$needsrelease, |
|
$cmajor,$cminor); |
|
} else { |
|
undef($namematch); |
|
} |
|
} |
|
} |
|
if ($needsnewer) { |
|
$message .= &oldversion_warning($name,$namematch,$values[$i],$chostname,$cmajor, |
$cminor,$needsrelease); |
$cminor,$needsrelease); |
} else { |
} else { |
$message.=&storeparm(split(/\&/,$markers[$i]), |
$message.=&storeparm(split(/\&/,$markers[$i]), |
Line 2225 sub assessparms {
|
Line 2590 sub assessparms {
|
} |
} |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys(%allparms));} |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys(%allparts));} |
# ------------------------------------------------------------------ Start page |
# ------------------------------------------------------------------ Start page |
|
|
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
&startpage($r,$pssymb,$crstype); |
&startpage($r,$pssymb,$crstype); |
|
|
foreach ('tolerance','date_default','date_start','date_end', |
foreach my $item ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
&HTML::Entities::encode($env{'form.recent_'.$_},'"&<>'). |
&HTML::Entities::encode($env{'form.recent_'.$item},'"&<>'). |
'" name="recent_'.$_.'" />'); |
'" name="recent_'.$item.'" />'); |
} |
} |
|
|
# ----- Start Parameter Selection |
# ----- Start Parameter Selection |
Line 2283 ENDPARMSELSCRIPT
|
Line 2648 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); |
&displaymenu($r,\%allparms,\@pscat,\@psprt,\%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')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
|
Line 2320 ENDPARMSELSCRIPT
|
Line 2685 ENDPARMSELSCRIPT
|
'<br />'); |
'<br />'); |
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('<p>' |
$r->print('<p>' |
Line 2344 ENDPARMSELSCRIPT
|
Line 2709 ENDPARMSELSCRIPT
|
|
|
@pscat = @temp_pscat; |
@pscat = @temp_pscat; |
|
|
|
|
if (($env{'form.prevvisit'}) || ($pschp) || ($pssymb)) { |
if (($env{'form.prevvisit'}) || ($pschp) || ($pssymb)) { |
# ----------------------------------------------------------------- Start Table |
# ----------------------------------------------------------------- Start Table |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
Line 2354 ENDPARMSELSCRIPT
|
Line 2720 ENDPARMSELSCRIPT
|
# |
# |
# This produces the cascading table output of parameters |
# This produces the cascading table output of parameters |
# |
# |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?10:6; |
my $userspan=3; |
my $userspan=4; |
if ($cgroup ne '') { |
if ($cgroup ne '') { |
$coursespan += 3; |
$coursespan += 4; |
} |
} |
|
|
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
Line 2371 ENDPARMSELSCRIPT
|
Line 2737 ENDPARMSELSCRIPT
|
$userspan ++; |
$userspan ++; |
} |
} |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
$r->print(&mt('User [_1] at Domain [_2]',"'".$uname."'","'".$udom."'").'</th>'); |
} |
} |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'pie' => "Parameter in Effect", |
'pie' => "Parameter in Effect", |
Line 2387 ENDPARMSELSCRIPT
|
Line 2753 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="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
</tr><tr><td colspan="5"></td><th colspan="3">$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="3">'. |
$r->print('<th colspan="4">'. |
&mt("in Section")." $csec</th>"); |
&mt("in Section")." $csec</th>"); |
} |
} |
if ($cgroup) { |
if ($cgroup) { |
$r->print('<th colspan="3">'. |
$r->print('<th colspan="4">'. |
&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{'foremf'}</th> |
<th>$lt{'gen'}</th><th>$lt{'formfr'}</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>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>'); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.&mt('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>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
$r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>'); |
} |
} |
|
|
$r->print('</tr>'); |
$r->print('</tr>'); |
Line 2469 ENDTABLEHEADFOUR
|
Line 2836 ENDTABLEHEADFOUR
|
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
my $filter=$env{'form.filter'}; |
my $filter=$env{'form.filter'}; |
foreach (&keysplit($keyp{$rid})) { |
foreach my $tempkeyp (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
|
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
my $parmname=&Apache::lonnet::metadata($uri,$_.'.name'); |
my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name'); |
# 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{$_}=$parmname; |
$name{$tempkeyp}=$parmname; |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part'); |
|
|
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display'); |
if ($allparms{$name{$_}} ne '') { |
if ($allparms{$name{$tempkeyp}} ne '') { |
my $identifier; |
my $identifier; |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
$identifier = $1; |
$identifier = $1; |
} |
} |
$display{$_} = $allparms{$name{$_}}.$identifier; |
$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; |
} else { |
} else { |
$display{$_} = $parmdis; |
$display{$tempkeyp} = $parmdis; |
} |
} |
unless ($display{$_}) { $display{$_}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$_}.=' ('.$name{$_}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$default{$_}=&Apache::lonnet::metadata($uri,$_); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp); |
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
$thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title'); |
} |
} |
} |
} |
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}); |
Line 2523 ENDTABLEHEADFOUR
|
Line 2889 ENDTABLEHEADFOUR
|
$r->print('<td style="background-color:'.$defbgone.';"'. |
$r->print('<td style="background-color:'.$defbgone.';"'. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
foreach (&keysinorder_bytype(\%name,\%keyorder)) { |
foreach my $item (&keysinorder_bytype(\%name,\%keyorder)) { |
|
|
unless ($firstrow) { |
unless ($firstrow) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
} else { |
} else { |
undef $firstrow; |
undef $firstrow; |
} |
} |
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
&print_row($r,$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); |
$cgroup,\@usersgroups,$noeditgrp); |
} |
} |
} |
} |
} |
} |
Line 2557 ENDTABLEHEADFOUR
|
Line 2922 ENDTABLEHEADFOUR
|
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid; |
my $mapid; |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) { |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys(%maplist)) { |
my $maptitle = $maplist{$mapid}; |
my $maptitle = $maplist{$mapid}; |
|
|
#----------------------- loop through ids and get all parameter types for map |
#----------------------- loop through ids and get all parameter types for map |
Line 2571 ENDTABLEHEADFOUR
|
Line 2936 ENDTABLEHEADFOUR
|
|
|
# $r->print("Catmarker: @catmarker<br />\n"); |
# $r->print("Catmarker: @catmarker<br />\n"); |
|
|
foreach (@ids) { |
foreach my $id (@ids) { |
($map)=(/([\d]*?)\./); |
($map)=($id =~ /([\d]*?)\./); |
my $rid = $_; |
my $rid = $id; |
|
|
# $r->print("$mapid:$map: $rid <br /> \n"); |
# $r->print("$mapid:$map: $rid <br /> \n"); |
|
|
Line 2588 ENDTABLEHEADFOUR
|
Line 2953 ENDTABLEHEADFOUR
|
# When storing information, store as part 0 |
# When storing information, store as part 0 |
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (&keysplit($keyp{$rid})) { |
foreach my $fullkeyp (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $fullkeyp; |
my $fullkeyp = $tempkeyp; |
$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'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
Line 2647 ENDTABLEHEADFOUR
|
Line 3011 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('Default Value').'</th>' |
.'<th>'.&mt('Recursive 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() |
); |
); |
|
|
foreach (&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,$_,\%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); |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); |
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
.'</div>' |
.'</div>' |
Line 2679 ENDTABLEHEADFOUR
|
Line 3044 ENDTABLEHEADFOUR
|
my %type = (); |
my %type = (); |
my %default = (); |
my %default = (); |
|
|
foreach (@ids) { |
foreach $id (@ids) { |
my $rid = $_; |
my $rid = $id; |
|
|
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
Line 2691 ENDTABLEHEADFOUR
|
Line 3056 ENDTABLEHEADFOUR
|
# When storing information, store as part 0 |
# When storing information, store as part 0 |
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (&keysplit($keyp{$rid})) { |
foreach my $fullkeyp (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $fullkeyp; |
my $fullkeyp = $tempkeyp; |
$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'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
Line 2743 ENDMAPONE
|
Line 3107 ENDMAPONE
|
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
); |
); |
|
|
foreach (&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,$_,\%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); |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); |
} |
} |
$r->print(&Apache::loncommon::end_data_table() |
$r->print(&Apache::loncommon::end_data_table() |
.'</p>' |
.'</p>' |
Line 2766 ENDMAPONE
|
Line 3130 ENDMAPONE
|
my $tableopen; |
my $tableopen; |
|
|
sub tablestart { |
sub tablestart { |
|
my ($readonly) = @_; |
if ($tableopen) { |
if ($tableopen) { |
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
my $output = &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th>'; |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
if ($readonly) { |
|
$output .= '<th>'.&mt('Current value').'</th>'; |
|
} else { |
|
$output .= '<th>'.&mt('Delete').'</th><th>'.&mt('Set to ...').'</th>'; |
|
} |
|
$output .= '</tr>'; |
|
return $output; |
} |
} |
} |
} |
|
|
Line 2791 sub readdata {
|
Line 3162 sub readdata {
|
# Read userdata |
# Read userdata |
|
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
foreach (keys %$classlist) { |
foreach my $user (keys(%$classlist)) { |
if ($_=~/^($match_username)\:($match_domain)$/) { |
if ($user=~/^($match_username)\:($match_domain)$/) { |
my ($tuname,$tudom)=($1,$2); |
my ($tuname,$tudom)=($1,$2); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
foreach my $userkey (keys %{$useropt}) { |
foreach my $userkey (keys(%{$useropt})) { |
if ($userkey=~/^$env{'request.course.id'}/) { |
if ($userkey=~/^\Q$env{'request.course.id'}\E/) { |
my $newkey=$userkey; |
my $newkey=$userkey; |
$newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./; |
$newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./; |
$$resourcedata{$newkey}=$$useropt{$userkey}; |
$$resourcedata{$newkey}=$$useropt{$userkey}; |
} |
} |
|
} |
} |
} |
} |
} |
|
if (wantarray) { |
|
return ($resourcedata,$classlist); |
|
} else { |
|
return $resourcedata; |
} |
} |
return $resourcedata; |
|
} |
} |
|
|
|
|
Line 2820 sub storedata {
|
Line 3195 sub storedata {
|
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
my $now = time; |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
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 ($tuname,$tudom)=&extractuser($thiskey); |
my ($tuname,$tudom)=&extractuser($thiskey); |
my $tkey=$thiskey; |
my $tkey=$thiskey; |
if ($tuname) { |
if ($tuname) { |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~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); |
my ($data, $typeof, $text, $name, $valchk, $valmatch, $namematch); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$key}; |
$data=$env{$key}; |
|
$valmatch = ''; |
|
$valchk = $data; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified parameter for'); |
$text = &mt('Saved modified parameter for'); |
if ($typeof eq 'string_questiontype') { |
if ($typeof eq 'string_questiontype') { |
$name = 'type'; |
$name = 'type'; |
} elsif ($typeof eq 'string_lenient') { |
} elsif ($typeof eq 'string_lenient') { |
$name = 'lenient'; |
$name = 'lenient'; |
|
my $stringmatch = &standard_string_matches($typeof); |
|
if (ref($stringmatch) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatch}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($pattern ne '') { |
|
if ($data =~ /$pattern/) { |
|
$valmatch = $regexpname; |
|
$valchk = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
} elsif ($typeof eq 'string_discussvote') { |
} elsif ($typeof eq 'string_discussvote') { |
$name = 'discussvote'; |
$name = 'discussvote'; |
|
} elsif ($typeof eq 'string_examcode') { |
|
$name = 'examcode'; |
|
if (&Apache::lonnet::validCODE($data)) { |
|
$valchk = 'valid'; |
|
} |
} elsif ($typeof eq 'string_yesno') { |
} elsif ($typeof eq 'string_yesno') { |
if ($thiskey =~ /\.retrypartial$/) { |
if ($thiskey =~ /\.retrypartial$/) { |
$name = 'retrypartial'; |
$name = 'retrypartial'; |
} |
} |
} |
} |
|
} elsif ($cmd eq 'datepointer') { |
|
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
if ($typeof eq 'date_start') { |
|
if ($thiskey =~ /\.printstartdate$/) { |
|
$name = 'printstartdate'; |
|
if (($data) && ($data > $now)) { |
|
$valchk = 'future'; |
|
} |
|
} |
|
} elsif ($typeof eq 'date_end') { |
|
if ($thiskey =~ /\.printenddate$/) { |
|
$name = 'printenddate'; |
|
if (($data) && ($data < $now)) { |
|
$valchk = 'past'; |
|
} |
|
} |
|
} |
|
} elsif ($cmd eq 'dateinterval') { |
|
$data=&get_date_interval_from_form($thiskey); |
|
if ($thiskey =~ /\.interval$/) { |
|
$name = 'interval'; |
|
my $intervaltype = &get_intervaltype($name); |
|
my $intervalmatch = &standard_interval_matches($intervaltype); |
|
if (ref($intervalmatch) eq 'ARRAY') { |
|
foreach my $item (@{$intervalmatch}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($pattern ne '') { |
|
if ($data =~ /$pattern/) { |
|
$valmatch = $regexpname; |
|
$valchk = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
|
if ($thiskey =~ m{\.(?:sequence|page)___\(rec\)}) { |
|
$namematch = 'maplevelrecurse'; |
|
} |
|
if (($name ne '') || ($namematch ne '')) { |
|
my ($needsrelease,$needsnewer); |
if ($name ne '') { |
if ($name ne '') { |
my ($needsrelease,$needsnewer); |
$needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$valchk:$valmatch:"}; |
$needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$data"}; |
|
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
$needsnewer = ¶meter_releasecheck($name,$data, |
$needsnewer = ¶meter_releasecheck($name,$valchk,$valmatch,undef, |
$needsrelease, |
$needsrelease, |
$chostname,$cmajor, |
$cmajor,$cminor); |
$cminor); |
|
} |
} |
|
} |
|
if ($namematch ne '') { |
if ($needsnewer) { |
if ($needsnewer) { |
$r->print('<br />'.&oldversion_warning($name,$data, |
undef($namematch); |
$chostname,$cmajor, |
} else { |
$cminor,$needsrelease)); |
my $currneeded; |
next; |
if ($needsrelease) { |
|
$currneeded = $needsrelease; |
|
} |
|
$needsrelease = |
|
$Apache::lonnet::needsrelease{"parameter::::$namematch"}; |
|
if (($needsrelease) && (($currneeded eq '') || ($needsrelease < $currneeded))) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = ¶meter_releasecheck(undef,$valchk,$valmatch,$namematch, |
|
$needsrelease,$cmajor,$cminor); |
|
} else { |
|
undef($namematch); |
|
} |
} |
} |
} |
} |
} elsif ($cmd eq 'datepointer') { |
if ($needsnewer) { |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
$r->print('<br />'.&oldversion_warning($name,$namematch,$data, |
$typeof=$env{'form.typeof_'.$thiskey}; |
$chostname,$cmajor, |
$text = &mt('Saved modified date for'); |
$cminor,$needsrelease)); |
} elsif ($cmd eq 'dateinterval') { |
next; |
$data=&get_date_interval_from_form($thiskey); |
} |
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
} |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
Line 2911 sub storedata {
|
Line 3370 sub storedata {
|
} |
} |
# Store all course level |
# Store all course level |
my $delentries=$#deldata+1; |
my $delentries=$#deldata+1; |
my @newdatakeys=keys %newdata; |
my @newdatakeys=keys(%newdata); |
my $putentries=$#newdatakeys+1; |
my $putentries=$#newdatakeys+1; |
if ($delentries) { |
if ($delentries) { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
my %loghash=map { $_ => '' } @deldata; |
my %loghash=map { $_ => '' } @deldata; |
&log_parmset(\%loghash,1); |
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)',$delentries).'</h2>'); |
$r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</h2>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</div>'); |
&mt('Error deleting parameters').'</div>'); |
Line 2927 sub storedata {
|
Line 3386 sub storedata {
|
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
&log_parmset(\%newdata,0); |
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Saved [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Saved [quant,_1,parameter]',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error saving parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
Line 2962 sub parse_listdata_key {
|
Line 3421 sub parse_listdata_key {
|
} |
} |
|
|
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist)=@_; |
|
|
# Start list output |
# Start list output |
|
|
my $oldsection=''; |
my $oldsection=''; |
Line 2973 sub listdata {
|
Line 3433 sub listdata {
|
my $foundkeys=0; |
my $foundkeys=0; |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
|
|
|
my ($secidx,%grouphash); |
|
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
|
$secidx = &Apache::loncoursedata::CL_SECTION(); |
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
|
} |
|
} |
|
|
foreach my $thiskey (sort { |
foreach my $thiskey (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 3012 sub listdata {
|
Line 3482 sub listdata {
|
} |
} |
|
|
$result; |
$result; |
} keys %{$listdata}) { |
} keys(%{$listdata})) { |
|
|
|
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'); |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
my $issection=$1; |
my $issection=$1; |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
my ($stuname,$studom) = ($1,$2); |
} else { |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
$section=&mt('Group/Section').': '.$issection; |
if (ref($classlist) eq 'HASH') { |
} |
if (ref($classlist->{$stuname.':'.$studom}) eq 'ARRAY') { |
$middle=~s/^\[(.*)\]//; |
next unless ($classlist->{$stuname.':'.$studom}->[$secidx] eq $env{'request.course.sec'}); |
|
} |
|
} |
|
} |
|
$section=&mt('User').": ".&Apache::loncommon::plainname($stuname,$studom); |
|
} else { |
|
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
|
if (exists($grouphash{$issection})) { |
|
$section=&mt('Group').': '.$issection; |
|
} elsif ($issection eq $env{'request.course.sec'}) { |
|
$section = &mt('Section').': '.$issection; |
|
} else { |
|
next; |
|
} |
|
} else { |
|
$section=&mt('Group/Section').': '.$issection; |
|
} |
|
} |
|
$middle=~s/^\[(.*)\]//; |
|
} elsif (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
|
$readonly = 1; |
} |
} |
$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\)$/) { |
if ($middle=~/^(.+)\_\_\_\((all|rec)\)$/) { |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
my $mapurl = $1; |
|
my $maplevel = $2; |
|
my $leveltitle = &mt('Folder/Map'); |
|
if ($maplevel eq 'rec') { |
|
$leveltitle = &mt('Recursive'); |
|
} |
|
$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) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
Line 3072 sub listdata {
|
Line 3569 sub listdata {
|
# Ready to print |
# Ready to print |
# |
# |
my $parmitem = &standard_parameter_names($name); |
my $parmitem = &standard_parameter_names($name); |
$r->print(&tablestart(). |
$r->print(&tablestart($readonly). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&mt($parmitem). |
'<td><b>'.&mt($parmitem). |
'</b></td><td><input type="checkbox" name="del_'. |
'</b></td>'); |
$thiskey.'" /></td><td>'); |
unless ($readonly) { |
|
$r->print('<td><input type="checkbox" name="del_'. |
|
$thiskey.'" /></td>'); |
|
} |
|
$r->print('<td>'); |
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
my $jskey='key_'.$pointer; |
my $jskey='key_'.$pointer; |
$pointer++; |
my $state; |
$r->print( |
$pointer++; |
&Apache::lonhtmlcommon::date_setter('parmform', |
if ($readonly) { |
$jskey, |
$state = 'disabled'; |
$$resourcedata{$thiskey}, |
} |
'',1,'',''). |
$r->print( |
|
&Apache::lonhtmlcommon::date_setter('parmform', |
|
$jskey, |
|
$$resourcedata{$thiskey}, |
|
'',1,$state)); |
|
unless ($readonly) { |
|
$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}.'">'. |
(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
&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($$resourcedata{$thiskey}) |
); |
); |
|
} |
} elsif ($thistype eq 'date_interval') { |
} elsif ($thistype eq 'date_interval') { |
$r->print(&date_interval_selector($thiskey, |
$r->print(&date_interval_selector($thiskey,$name, |
$$resourcedata{$thiskey})); |
$$resourcedata{$thiskey},$readonly)); |
} elsif ($thistype =~ m/^string/) { |
} elsif ($thistype =~ m/^string/) { |
$r->print(&string_selector($thistype,$thiskey, |
$r->print(&string_selector($thistype,$thiskey, |
$$resourcedata{$thiskey},$name)); |
$$resourcedata{$thiskey},$name,$readonly)); |
} else { |
} else { |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly)); |
|
} |
|
unless ($readonly) { |
|
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
|
$thistype.'" />'); |
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
|
$thistype.'" />'); |
|
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
return $foundkeys; |
return $foundkeys; |
} |
} |
|
|
|
|
sub date_interval_selector { |
|
my ($thiskey, $showval) = @_; |
|
my $result; |
|
foreach my $which (['days', 86400, 31], |
|
['hours', 3600, 23], |
|
['minutes', 60, 59], |
|
['seconds', 1, 59]) { |
|
my ($name, $factor, $max) = @{ $which }; |
|
my $amount = int($showval/$factor); |
|
$showval %= $factor; |
|
my %select = ((map {$_ => $_} (0..$max)), |
|
'select_form_order' => [0..$max]); |
|
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
|
\%select); |
|
$result .= ' '.&mt($name); |
|
} |
|
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
|
return $result; |
|
|
|
} |
|
|
|
sub get_date_interval_from_form { |
sub get_date_interval_from_form { |
my ($key) = @_; |
my ($key) = @_; |
my $seconds = 0; |
my $seconds = 0; |
Line 3142 sub get_date_interval_from_form {
|
Line 3630 sub get_date_interval_from_form {
|
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
} |
} |
} |
} |
|
if (($key =~ /\.interval$/) && (($env{'form.done_'.$key} eq '_done') || ($env{'form.done_'.$key} eq '_done_proctor'))) { |
|
$seconds .= $env{'form.done_'.$key}; |
|
if ($env{'form.done_'.$key.'_proctorkey'}) { |
|
$seconds .= '_'.$env{'form.done_'.$key.'_proctorkey'}; |
|
} |
|
} |
return $seconds; |
return $seconds; |
} |
} |
|
|
|
|
sub default_selector { |
sub default_selector { |
my ($thiskey, $showval) = @_; |
my ($thiskey, $showval, $readonly) = @_; |
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
my $disabled; |
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'"'.$disabled.' />'; |
|
} |
|
|
|
sub string_ip_selector { |
|
my ($thiskey, $showval, $readonly) = @_; |
|
my %access = ( |
|
allow => [], |
|
deny => [], |
|
); |
|
if ($showval ne '') { |
|
my @current; |
|
if ($showval =~ /,/) { |
|
@current = split(/,/,$showval); |
|
} else { |
|
@current = ($showval); |
|
} |
|
foreach my $item (@current) { |
|
if ($item =~ /^\!([\[\]a-zA-Z\.\d\*\-]+)$/) { |
|
push(@{$access{'deny'}},$1); |
|
} elsif ($item =~ /^([\[\]a-zA-Z\.\d\*\-]+)$/) { |
|
push(@{$access{'allow'}},$item); |
|
} |
|
} |
|
} |
|
if (!@{$access{'allow'}}) { |
|
@{$access{'allow'}} = (''); |
|
} |
|
if (!@{$access{'deny'}}) { |
|
@{$access{'deny'}} = (''); |
|
} |
|
my ($disabled,$addmore); |
|
if ($disabled) { |
|
$disabled=' disabled="disabled"'; |
|
} else { |
|
$addmore = "\n".'<button class="LC_add_ipacc_button">'.&mt('Add more').'</button>'; |
|
} |
|
my $output = '<input type="hidden" name="set_'.$thiskey.'" /> |
|
<table><tr><th>'.&mt('Allow from').'</th><th>'.&mt('Deny from').'</th></tr><tr>'; |
|
foreach my $acctype ('allow','deny') { |
|
$output .= ' |
|
<td valign="top"> |
|
<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'.$acctype.'_'.$thiskey.'"> |
|
<div class="LC_string_ipacc_inner">'."\n"; |
|
my $num = 0; |
|
foreach my $curr (@{$access{$acctype}}) { |
|
$output .= '<div><input type="text" name="setip'.$acctype.'_'.$thiskey.'" value="'.$curr.'"'.$disabled.' />'; |
|
if ($num > 0) { |
|
$output .= '<a href="#" class="LC_remove_ipacc">'.&mt('Remove').'</a>'; |
|
} |
|
$output .= '</div>'."\n"; |
|
$num ++; |
|
} |
|
$output .= ' |
|
</div>'.$addmore.' |
|
</div> |
|
</td>'; |
|
} |
|
$output .= ' |
|
</tr> |
|
</table>'."\n"; |
|
return $output; |
} |
} |
|
|
|
{ |
my %strings = |
my %strings = |
( |
( |
'string_yesno' |
'string_yesno' |
Line 3173 my %strings =
|
Line 3732 my %strings =
|
'string_lenient' |
'string_lenient' |
=> [['yes', 'Yes' ], |
=> [['yes', 'Yes' ], |
[ 'no', 'No' ], |
[ 'no', 'No' ], |
[ 'default', 'Default - only bubblesheet grading is lenient' ]], |
[ 'default', 'Default - only bubblesheet grading is lenient' ], |
|
[ 'weighted', 'Yes, weighted (optionresponse in checkbox mode)' ]], |
'string_discussvote' |
'string_discussvote' |
=> [['yes','Yes'], |
=> [['yes','Yes'], |
['notended','Yes, unless discussion ended'], |
['notended','Yes, unless discussion ended'], |
['no','No']], |
['no','No']], |
|
'string_ip' |
|
=> [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'], |
|
['_denyfrom_',], 'Hostname(s) or IP(s) from which access is disallowed'], |
); |
); |
|
|
|
my %stringmatches = ( |
|
'string_lenient' |
|
=> [['weighted','^\-?[.\d]+,\-?[.\d]+,\-?[.\d]+,\-?[.\d]+$'],], |
|
'string_ip' |
|
=> [['_allowfrom_','[^\!]+'], |
|
['_denyfrom_','\!']], |
|
); |
|
|
|
my %stringtypes = ( |
|
type => 'string_questiontype', |
|
lenient => 'string_lenient', |
|
retrypartial => 'string_yesno', |
|
discussvote => 'string_discussvote', |
|
examcode => 'string_examcode', |
|
acc => 'string_ip', |
|
); |
|
|
sub standard_string_options { |
sub standard_string_options { |
my ($string_type) = @_; |
my ($string_type) = @_; |
if (ref($strings{$string_type}) eq 'ARRAY') { |
if (ref($strings{$string_type}) eq 'ARRAY') { |
Line 3188 sub standard_string_options {
|
Line 3768 sub standard_string_options {
|
return; |
return; |
} |
} |
|
|
|
sub standard_string_matches { |
|
my ($string_type) = @_; |
|
if (ref($stringmatches{$string_type}) eq 'ARRAY') { |
|
return $stringmatches{$string_type}; |
|
} |
|
return; |
|
} |
|
|
|
sub get_stringtype { |
|
my ($name) = @_; |
|
if (exists($stringtypes{$name})) { |
|
return $stringtypes{$name}; |
|
} |
|
return; |
|
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval, $name) = @_; |
my ($thistype, $thiskey, $showval, $name, $readonly) = @_; |
|
|
if (!exists($strings{$thistype})) { |
if (!exists($strings{$thistype})) { |
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval,$readonly); |
} |
} |
|
|
my %skiptype; |
my %skiptype; |
if (($thistype eq 'string_questiontype') || |
if (($thistype eq 'string_questiontype') || |
($thistype eq 'string_lenient') || |
($thistype eq 'string_lenient') || |
($thistype eq 'string_discussvote') || |
($thistype eq 'string_discussvote') || |
|
($thistype eq 'string_ip') || |
($name eq 'retrypartial')) { |
($name eq 'retrypartial')) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
foreach my $possibilities (@{ $strings{$thistype} }) { |
foreach my $possibilities (@{ $strings{$thistype} }) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($parmval, $description) = @{ $possibilities }; |
my ($parmval, $description) = @{ $possibilities }; |
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"}; |
my $parmmatch; |
|
if (ref($stringmatches{$thistype}) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatches{$thistype}}) { |
|
if (ref($item) eq 'ARRAY') { |
|
if ($parmval eq $item->[0]) { |
|
$parmmatch = $parmval; |
|
$parmval = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval:$parmmatch"}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, |
my $needsnewer=¶meter_releasecheck($name,$parmval,$parmmatch,undef, |
$chostname,$cmajor, |
$needsrelease,$cmajor,$cminor); |
$cminor); |
|
if ($needsnewer) { |
if ($needsnewer) { |
$skiptype{$parmval} = 1; |
if ($parmmatch ne '') { |
|
$skiptype{$parmmatch} = 1; |
|
} elsif ($parmval ne '') { |
|
$skiptype{$parmval} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
|
|
my $result; |
if ($thistype eq 'string_ip') { |
|
return &string_ip_selector($thiskey,$showval,$readonly); |
|
} |
|
|
|
my ($result,$disabled); |
|
|
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
my $numinrow = 3; |
my $numinrow = 3; |
if ($thistype eq 'string_problemstatus') { |
if ($thistype eq 'string_problemstatus') { |
$numinrow = 2; |
$numinrow = 2; |
Line 3236 sub string_selector {
|
Line 3855 sub string_selector {
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
foreach my $possibilities (@{ $strings{$thistype} }) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($name, $description) = @{ $possibilities }; |
my ($name, $description) = @{ $possibilities }; |
next if ($skiptype{$name}); |
next if ($skiptype{$name}); |
$rem = $i%($numinrow); |
$rem = $i%($numinrow); |
if ($rem == 0) { |
if ($rem == 0) { |
if ($i > 0) { |
if ($i > 0) { |
Line 3244 sub string_selector {
|
Line 3863 sub string_selector {
|
} |
} |
$result .= '<tr>'; |
$result .= '<tr>'; |
} |
} |
$result .= '<td class="LC_left_item">'. |
my $colspan; |
|
if ($i == @{ $strings{$thistype} }-1) { |
|
$rem = @{ $strings{$thistype} }%($numinrow); |
|
if ($rem) { |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft) { |
|
$colspan = $colsleft+1; |
|
$colspan = ' colspan="'.$colspan.'"'; |
|
} |
|
} |
|
} |
|
my ($add,$onchange,$css_class); |
|
if ($thistype eq 'string_lenient') { |
|
if ($name eq 'weighted') { |
|
my $display; |
|
my %relatives = &Apache::lonlocal::texthash( |
|
corrchkd => 'Correct (checked)', |
|
corrunchkd => 'Correct (unchecked)', |
|
incorrchkd => 'Incorrect (checked)', |
|
incorrunchkd => 'Incorrect (unchecked)', |
|
); |
|
my %textval = ( |
|
corrchkd => '1.0', |
|
corrunchkd => '1.0', |
|
incorrchkd => '0.0', |
|
incorrunchkd => '0.0', |
|
); |
|
if ($showval =~ /^([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)$/) { |
|
$textval{'corrchkd'} = $1; |
|
$textval{'corrunchkd'} = $2; |
|
$textval{'incorrchkd'} = $3; |
|
$textval{'incorrunchkd'} = $4; |
|
$display = 'inline'; |
|
$showval = $name; |
|
} else { |
|
$display = 'none'; |
|
} |
|
$add = ' <div id="LC_parmtext_'.$thiskey.'" style="display:'.$display.'"><table>'. |
|
'<tr><th colspan="2">'.&mt("Foil's submission status").'</th><th>'.&mt('Points').'</th></tr>'; |
|
foreach my $reltype ('corrchkd','corrunchkd','incorrchkd','incorrunchkd') { |
|
$add .= '<tr><td> </td><td>'.$relatives{$reltype}.'</td>'."\n". |
|
'<td><input type="text" name="settext_'.$thiskey.'"'. |
|
' value="'.$textval{$reltype}.'" size="3"'.$disabled.' />'. |
|
'</td></tr>'; |
|
} |
|
$add .= '</table></div>'."\n"; |
|
} |
|
$onchange = ' onclick="javascript:toggleParmTextbox(this.form,'."'$thiskey'".');"'; |
|
$css_class = ' class="LC_lenient_radio"'; |
|
} |
|
$result .= '<td class="LC_left_item"'.$colspan.'>'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="set_'.$thiskey. |
'<input type="radio" name="set_'.$thiskey. |
'" value="'.$name.'"'; |
'" value="'.$name.'"'.$onchange.$css_class.$disabled; |
if ($showval eq $name) { |
if ($showval eq $name) { |
$result .= ' checked="checked"'; |
$result .= ' checked="checked"'; |
} |
} |
$result .= ' />'.&mt($description).'</label></span></td>'; |
$result .= ' />'.&mt($description).'</label>'.$add.'</span></td>'; |
$i++; |
$i++; |
} |
} |
$rem = @{ $strings{$thistype} }%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$result .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$result .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$result .= '</tr>'; |
$result .= '</tr>'; |
} |
} |
if ($result) { |
if ($result) { |
Line 3270 sub string_selector {
|
Line 3931 sub string_selector {
|
return $result; |
return $result; |
} |
} |
|
|
|
my %intervals = |
|
( |
|
'date_interval' |
|
=> [[ 'done', 'Yes' ], |
|
[ 'done_proctor', 'Yes, with proctor key'], |
|
[ '', 'No' ]], |
|
); |
|
|
|
my %intervalmatches = ( |
|
'date_interval' |
|
=> [['done','\d+_done$'], |
|
['done_proctor','\d+_done_proctor_']], |
|
); |
|
|
|
my %intervaltypes = ( |
|
interval => 'date_interval', |
|
); |
|
|
|
sub standard_interval_matches { |
|
my ($interval_type) = @_; |
|
if (ref($intervalmatches{$interval_type}) eq 'ARRAY') { |
|
return $intervalmatches{$interval_type}; |
|
} |
|
return; |
|
} |
|
|
|
sub get_intervaltype { |
|
my ($name) = @_; |
|
if (exists($intervaltypes{$name})) { |
|
return $intervaltypes{$name}; |
|
} |
|
return; |
|
} |
|
|
|
sub standard_interval_options { |
|
my ($interval_type) = @_; |
|
if (ref($intervals{$interval_type}) eq 'ARRAY') { |
|
return $intervals{$interval_type}; |
|
} |
|
return; |
|
} |
|
|
|
sub date_interval_selector { |
|
my ($thiskey, $name, $showval, $readonly) = @_; |
|
my ($result,%skipval); |
|
if ($name eq 'interval') { |
|
my $intervaltype = &get_intervaltype($name); |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
foreach my $possibilities (@{ $intervals{$intervaltype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
my $parmmatch; |
|
if (ref($intervalmatches{$intervaltype}) eq 'ARRAY') { |
|
foreach my $item (@{$intervalmatches{$intervaltype}}) { |
|
if (ref($item) eq 'ARRAY') { |
|
if ($parmval eq $item->[0]) { |
|
$parmmatch = $parmval; |
|
$parmval = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval:$parmmatch"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
my $needsnewer=¶meter_releasecheck($name,$parmval,$parmmatch,undef, |
|
$needsrelease,$cmajor,$cminor); |
|
if ($needsnewer) { |
|
if ($parmmatch ne '') { |
|
$skipval{$parmmatch} = 1; |
|
} elsif ($parmval ne '') { |
|
$skipval{$parmval} = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
my $currval = $showval; |
|
foreach my $which (['days', 86400, 31], |
|
['hours', 3600, 23], |
|
['minutes', 60, 59], |
|
['seconds', 1, 59]) { |
|
my ($name, $factor, $max) = @{ $which }; |
|
my $amount = int($showval/$factor); |
|
$showval %= $factor; |
|
my %select = ((map {$_ => $_} (0..$max)), |
|
'select_form_order' => [0..$max]); |
|
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
|
\%select,'',$readonly); |
|
$result .= ' '.&mt($name); |
|
} |
|
if ($name eq 'interval') { |
|
unless ($skipval{'done'}) { |
|
my $checkedon = ''; |
|
my $checkedproc = ''; |
|
my $currproctorkey = ''; |
|
my $currprocdisplay = 'hidden'; |
|
my $checkedoff = ' checked="checked"'; |
|
if ($currval =~ /^(\d+)_done$/) { |
|
$checkedon = ' checked="checked"'; |
|
$checkedoff = ''; |
|
} elsif ($currval =~ /^(?:\d+)_done_proctor_(.+)$/) { |
|
$currproctorkey = $1; |
|
$checkedproc = ' checked="checked"'; |
|
$checkedoff = ''; |
|
$currprocdisplay = 'text'; |
|
} |
|
my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"'; |
|
$result .= '<br /><span class="LC_nobreak">'.&mt('Include "done" button'). |
|
'<label><input type="radio" value="" name="done_'.$thiskey.'"'.$checkedoff.$onclick.' />'. |
|
&mt('No').'</label>'.(' 'x2). |
|
'<label><input type="radio" value="_done" name="done_'.$thiskey.'"'.$checkedon.$onclick.' />'. |
|
&mt('Yes').'</label>'.(' 'x2). |
|
'<label><input type="radio" value="_done_proctor" name="done_'.$thiskey.'"'.$checkedproc.$onclick.' />'. |
|
&mt('Yes, with proctor key').'</label>'. |
|
'<input type="'.$currprocdisplay.'" id="done_'.$thiskey.'_proctorkey" '. |
|
'name="done_'.$thiskey.'_proctorkey" value="'.$currproctorkey.'" /></span>'; |
|
} |
|
} |
|
unless ($readonly) { |
|
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
|
} |
|
return $result; |
|
} |
|
|
|
sub oldversion_warning { |
|
my ($name,$namematch,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $standard_name = &standard_parameter_names($name); |
|
if ($namematch) { |
|
my $level = &standard_parameter_levels($namematch); |
|
my $msg = ''; |
|
if ($level) { |
|
$msg = &mt('[_1] was [_2]not[_3] set at the level of: [_4].', |
|
$standard_name,'<b>','</b>','"'.$level.'"'); |
|
} else { |
|
$msg = &mt('[_1] was [_2]not[_3] set.', |
|
$standard_name,'<b>','</b>'); |
|
} |
|
return '<p class="LC_warning">'.$msg.'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
|
my $desc; |
|
my $stringtype = &get_stringtype($name); |
|
if ($stringtype ne '') { |
|
if ($name eq 'examcode') { |
|
$desc = $value; |
|
} elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
my $parmmatch; |
|
if (ref($stringmatches{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatches{$stringtypes{$name}}}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($parmval eq $regexpname) { |
|
if ($value =~ /$pattern/) { |
|
$desc = $description; |
|
$parmmatch = 1; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
last if ($parmmatch); |
|
} elsif ($parmval eq $value) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
|
} elsif (($name eq 'printstartdate') || ($name eq 'printenddate')) { |
|
my $now = time; |
|
if ($value =~ /^\d+$/) { |
|
if ($name eq 'printstartdate') { |
|
if ($value > $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($value < $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} |
|
} |
|
} |
|
return '<p class="LC_warning">'. |
|
&mt('[_1] was [_2]not[_3] set to [_4].', |
|
$standard_name,'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
|
|
|
} |
|
|
# |
# |
# Shift all start and end dates by $shift |
# Shift all start and end dates by $shift |
# |
# |
Line 3280 sub dateshift {
|
Line 4145 sub dateshift {
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
# ugly retro fix for broken version of types |
# ugly retro fix for broken version of types |
foreach my $key (keys %data) { |
foreach my $key (keys(%data)) { |
if ($key=~/\wtype$/) { |
if ($key=~/\wtype$/) { |
my $newkey=$key; |
my $newkey=$key; |
$newkey=~s/type$/\.type/; |
$newkey=~s/type$/\.type/; |
Line 3290 sub dateshift {
|
Line 4155 sub dateshift {
|
} |
} |
my %storecontent=(); |
my %storecontent=(); |
# go through all parameters and look for dates |
# go through all parameters and look for dates |
foreach my $key (keys %data) { |
foreach my $key (keys(%data)) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
my $newdate=$data{$key}+$shift; |
my $newdate=$data{$key}+$shift; |
$storecontent{$key}=$newdate; |
$storecontent{$key}=$newdate; |
Line 3315 sub newoverview {
|
Line 4180 sub newoverview {
|
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
|
|
my %loaditems = ( |
my %loaditems = ( |
'onload' => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1');", |
'onload' => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1'); showHideLenient();", |
); |
); |
my $js = ' |
my $js = ' |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 3323 sub newoverview {
|
Line 4188 sub newoverview {
|
'. |
'. |
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n". |
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n". |
&showhide_js()."\n". |
&showhide_js()."\n". |
|
&toggleparmtextbox_js()."\n". |
|
&validateparms_js()."\n". |
|
&ipacc_boxes_js()."\n". |
|
&done_proctor_js()."\n". |
'// ]]> |
'// ]]> |
</script> |
</script> |
'; |
'; |
|
|
my $start_page = &Apache::loncommon::start_page('Set Parameters',$js, |
my $start_page = &Apache::loncommon::start_page('Set Parameters',$js, |
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset',$crstype); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform" onsubmit="return validateParms();"> |
ENDOVER |
ENDOVER |
my @ids=(); |
my @ids=(); |
my %typep=(); |
my %typep=(); |
Line 3369 ENDOVER
|
Line 4239 ENDOVER
|
@selected_sections = ('all'); |
@selected_sections = ('all'); |
} |
} |
} |
} |
|
if ($env{'request.course.sec'} ne '') { |
|
@selected_sections = ($env{'request.course.sec'}); |
|
} |
my @selected_groups = |
my @selected_groups = |
&Apache::loncommon::get_env_multiple('form.Group'); |
&Apache::loncommon::get_env_multiple('form.Group'); |
|
|
Line 3408 ENDOVER
|
Line 4281 ENDOVER
|
&displaymenu($r,\%allparms,\@pscat,\%keyorder); |
&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 $groupselector = &groupmenu(\@selected_groups); |
$r->print('<table>'. |
$r->print('<table>'. |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
'<tr><th>'.&mt('Parts').'</th>'); |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
if ($sectionselector) { |
|
$r->print('<th>'.&mt('Section(s)').'</th>'); |
|
} |
|
if ($groupselector) { |
|
$r->print('<th>'.&mt('Group(s)').'</th>'); |
|
} |
|
$r->print('</tr><tr><td>'); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
$r->print('</td><td>'); |
$r->print('</td>'); |
§ionmenu($r,\@selected_sections); |
if ($sectionselector) { |
$r->print('</td><td>'); |
$r->print('<td>'.$sectionselector.'</td>'); |
&groupmenu($r,\@selected_groups); |
} |
$r->print('</td></tr></table>'); |
if ($groupselector) { |
#$r->print('</td></tr></table>'); |
$r->print('<td>'.$groupselector.'</td>'); |
|
} |
|
$r->print('</tr></table>'); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
Line 3451 ENDOVER
|
Line 4334 ENDOVER
|
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata,$sortorder); |
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview'); |
} |
} |
$r->print(&tableend(). |
$r->print(&tableend(). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
Line 3475 sub secgroup_lister {
|
Line 4358 sub secgroup_lister {
|
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
# map-level parameter |
# map-level parameter |
foreach my $mapid (keys %{$allmaps}) { |
foreach my $mapid (keys(%{$allmaps})) { |
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; } |
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; } |
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 3500 sub overview {
|
Line 4386 sub overview {
|
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 $js = '<script type="text/javascript">'."\n". |
|
'// <![CDATA['."\n". |
|
&toggleparmtextbox_js()."\n". |
|
&validateparms_js()."\n". |
|
&ipacc_boxes_js()."\n". |
|
&done_proctor_js()."\n". |
|
'// ]]>'."\n". |
|
'</script>'."\n"; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my %loaditems = ( |
|
'onload' => "showHideLenient();", |
|
); |
|
|
|
my $start_page=&Apache::loncommon::start_page('Modify Parameters',$js,{'add_entries' => \%loaditems,}); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset',$crstype); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform">'); |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform" onsubmit="return validateParms();">'); |
|
|
# Store modified |
# Store modified |
|
|
Line 3515 sub overview {
|
Line 4412 sub overview {
|
|
|
# Read modified data |
# Read modified data |
|
|
my $resourcedata=&readdata($crs,$dom); |
my ($resourcedata,$classlist)=&readdata($crs,$dom); |
|
|
|
|
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
Line 3524 sub overview {
|
Line 4421 sub overview {
|
|
|
# List data |
# List data |
|
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder,'overview',$classlist); |
|
|
$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>'. |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':'<span class="LC_info">'.&mt('There are no parameters.').'</span>').'</p></form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
Line 3631 sub date_shift_one {
|
Line 4527 sub date_shift_one {
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset',$crstype); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print('<form name="shiftform" method="post">'. |
$r->print('<form name="shiftform" method="post" action="">'. |
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
&Apache::lonhtmlcommon::dshowerfuck.net |
&Apache::lonhtmlcommon::date_setter('shiftform', |
ate_setter('shiftform', |
|
'timeshifted', |
'timeshifted', |
$env{'form.timebase'},, |
$env{'form.timebase'},, |
''). |
''). |
Line 3660 sub date_shift_two {
|
Line 4555 sub date_shift_two {
|
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset',$crstype); |
&startSettingsScreen($r,'parmset',$crstype); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
$r->print(&mt('Shifting all dates such that [_1] becomes [_2]', |
$r->print('<h2>'.&mt('Shift Dates').'</h2>'. |
|
'<p>'.&mt('Shifting all dates such that [_1] becomes [_2]', |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
&Apache::lonlocal::locallocaltime($timeshifted))); |
&Apache::lonlocal::locallocaltime($timeshifted)).'</p>'); |
my $delta=$timeshifted-$env{'form.timebase'}; |
my $delta=$timeshifted-$env{'form.timebase'}; |
&dateshift($delta); |
&dateshift($delta); |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('Done')). |
|
'<br /><br />'. |
|
&Apache::lonhtmlcommon::actionbox( |
|
['<a href="/adm/parmset">'.&mt('Content and Problem Settings').'</a>'])); |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
Line 3806 ENDMAINFORMHEAD
|
Line 4707 ENDMAINFORMHEAD
|
}]} |
}]} |
); |
); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
|
$r->print('</form>'); |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
|
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
Line 3888 sub order_meta_fields {
|
Line 4791 sub order_meta_fields {
|
my $newpos = $env{'form.newpos'} - 1; |
my $newpos = $env{'form.newpos'} - 1; |
my $currentpos = $env{'form.currentpos'} - 1; |
my $currentpos = $env{'form.currentpos'} - 1; |
my @neworder = (); |
my @neworder = (); |
my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
my @oldorder = split(/,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}); |
my $i; |
my $i; |
if ($newpos > $currentpos) { |
if ($newpos > $currentpos) { |
# moving stuff up |
# moving stuff up |
Line 3922 sub order_meta_fields {
|
Line 4825 sub order_meta_fields {
|
} |
} |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $ordered_fields; |
my $ordered_fields; |
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
my @fields_in_order = split(/,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}); |
if (!@fields_in_order) { |
if (!@fields_in_order) { |
# no order found, pick sorted order then create metadata.addedorder key. |
# no order found, pick sorted order then create metadata.addedorder key. |
foreach my $key (sort keys %$fields) { |
foreach my $key (sort(keys(%$fields))) { |
push @fields_in_order, $key; |
push @fields_in_order, $key; |
$ordered_fields = join ",", @fields_in_order; |
$ordered_fields = join ",", @fields_in_order; |
} |
} |
Line 3937 sub order_meta_fields {
|
Line 4840 sub order_meta_fields {
|
foreach my $key (@fields_in_order) { |
foreach my $key (@fields_in_order) { |
$r->print('<tr><td>'); |
$r->print('<tr><td>'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
$r->print('<select name="newpos" onChange="this.form.submit()">'); |
$r->print('<select name="newpos" onchange="this.form.submit()">'); |
for (my $i = 1;$i le $num_fields;$i ++) { |
for (my $i = 1;$i le $num_fields;$i ++) { |
if ($i eq $idx) { |
if ($i eq $idx) { |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
Line 4206 sub defaultsetter {
|
Line 5109 sub defaultsetter {
|
} |
} |
} |
} |
} |
} |
foreach my $key (keys %allparms) { |
foreach my $key (keys(%allparms)) { |
$newrules{$key.'_triggers'}=$triggers{$key}; |
$newrules{$key.'_triggers'}=$triggers{$key}; |
} |
} |
&Apache::lonnet::put('parmdefactions',\%newrules,$cdom,$cnum); |
&Apache::lonnet::put('parmdefactions',\%newrules,$cdom,$cnum); |
Line 4328 sub components {
|
Line 5231 sub components {
|
} |
} |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realmdescription=&mt('all resources'); |
my $realmdescription=&mt('all resources'); |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\((all|rec)\)$/) { |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>'; |
my $mapurl = $1; |
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
my $maplevel = $2; |
|
my $leveltitle = &mt('Folder/Map'); |
|
if ($maplevel eq 'rec') { |
|
$leveltitle = &mt('Recursive'); |
|
} |
|
$realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' <span class="LC_parm_folder"><br />('.$mapurl.')</span></span>'; |
|
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($mapurl); |
} elsif ($middle) { |
} elsif ($middle) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
Line 4385 sub standard_parameter_types {
|
Line 5294 sub standard_parameter_types {
|
return; |
return; |
} |
} |
|
|
|
sub standard_parameter_levels { |
|
my ($name)=@_; |
|
my %levels = ( |
|
'resourcelevel' => 'a single resource', |
|
'maplevel' => 'the enclosing map/folder', |
|
'maplevelrecurse' => 'the enclosing map/folder (recursive into sub-folders)', |
|
'courselevel' => 'the general (course) level', |
|
); |
|
if ($levels{$name}) { |
|
return $levels{$name}; |
|
} |
|
return; |
|
} |
|
|
sub parm_change_log { |
sub parm_change_log { |
my ($r)=@_; |
my ($r)=@_; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 4472 sub parm_change_log {
|
Line 5395 sub parm_change_log {
|
!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'},undef,undef,$typeflag); |
|
if ($env{'request.course.sec'} ne '') { |
|
next if (($issection ne '') && ($issection ne $env{'request.course.sec'})); |
|
if ($uname ne '') { |
|
my $stusection = &Apache::lonnet::getsection($uname,$udom,$env{'request.course.id'}); |
|
next if (($stusection ne '-1') && ($stusection ne $env{'request.course.sec'})); |
|
} |
|
} |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($folder) { |
if ($folder) { |
if ($middle!~/^\Q$folder\E/) { next; } |
if ($middle!~/^\Q$folder\E/) { next; } |
Line 4673 sub parameter_release_vars {
|
Line 5603 sub parameter_release_vars {
|
} |
} |
|
|
sub parameter_releasecheck { |
sub parameter_releasecheck { |
my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_; |
my ($name,$value,$valmatch,$namematch,$needsrelease,$cmajor,$cminor) = @_; |
my $needsnewer; |
my $needsnewer; |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
if (($cmajor < $needsmajor) || |
if (($cmajor < $needsmajor) || |
($cmajor == $needsmajor && $cminor < $needsminor)) { |
($cmajor == $needsmajor && $cminor < $needsminor)) { |
$needsnewer = 1; |
$needsnewer = 1; |
} else { |
} elsif ($name) { |
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value}); |
if ($valmatch) { |
} |
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.'::'.$valmatch.':'}); |
return $needsnewer; |
} elsif ($value) { |
} |
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value.'::'}); |
|
|
sub oldversion_warning { |
|
my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $desc; |
|
my %stringtypes = ( |
|
type => 'string_questiontype', |
|
lenient => 'string_lenient', |
|
retrypartial => 'string_yesno', |
|
discussvote => 'string_discussvote', |
|
); |
|
if (exists($stringtypes{$name})) { |
|
if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
if ($parmval eq $value) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
} |
|
} elsif ($namematch) { |
|
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter::::'.$namematch}); |
} |
} |
my $standard_name = &standard_parameter_names($name); |
return $needsnewer; |
return '<p class="LC_warning">'. |
|
&mt('[_1] was [_2]not[_3] set to [_4].', |
|
$standard_name,'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
} |
|
|
sub handler { |
sub handler { |