--- loncom/interface/lonparmset.pm 2019/03/02 16:25:45 1.522.2.23.2.3 +++ loncom/interface/lonparmset.pm 2018/12/01 15:34:55 1.522.2.26 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.522.2.23.2.3 2019/03/02 16:25:45 raeburn Exp $ +# $Id: lonparmset.pm,v 1.522.2.26 2018/12/01 15:34:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,7 +36,8 @@ lonparmset - Handler to set parameters f =head1 SYNOPSIS -lonparmset provides an interface to setting course parameters. +lonparmset provides an interface to setting content parameters in a +course. =head1 DESCRIPTION @@ -129,7 +130,7 @@ javascript function 'pjump'. =item print_td() -=item print_usergroups() +=item check_other_groups() =item parm_control_group() @@ -752,7 +753,7 @@ sub storeparm_by_symb_inner { sub valout { - my ($value,$type,$name,$editable)=@_; + my ($value,$type,$editable)=@_; my $result = ''; # Values of zero are valid. if (! $value && $value ne '0') { @@ -766,17 +767,7 @@ sub valout { } } else { if ($type eq 'date_interval') { - my ($totalsecs,$donesuffix) = split(/_/,$value,2); - my ($usesdone,$donebuttontext,$proctor,$secretkey); - if ($donesuffix =~ /^done\:([^\:]+)\:(.*)$/) { - $donebuttontext = $1; - (undef,$proctor,$secretkey) = split(/_/,$2); - $usesdone = 'done'; - } elsif ($donesuffix =~ /^done(|_.+)$/) { - $donebuttontext = &mt('Done'); - ($usesdone,$proctor,$secretkey) = split(/_/,$donesuffix); - } - my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($totalsecs); + my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); my @timer; $year=$year-70; $mday--; @@ -809,13 +800,6 @@ sub valout { push(@timer,&mt('[quant,_1,sec]',0)); } $result.=join(", ",@timer); - if ($usesdone eq 'done') { - if ($secretkey) { - $result .= ' '.&mt('+ "[_1]" with proctor key: [_2]',$donebuttontext,$secretkey); - } else { - $result .= ' + "'.$donebuttontext.'"'; - } - } } elsif (&isdateparm($type)) { $result = &Apache::lonlocal::locallocaltime($value). &date_sanity_info($value); @@ -833,12 +817,8 @@ sub plink { my ($type,$dis,$value,$marker,$return,$call)=@_; my $winvalue=$value; unless ($winvalue) { - if ((&isdateparm($type)) || (&is_specialstring($type))) { + if (&isdateparm($type)) { $winvalue=$env{'form.recent_'.$type}; - } elsif ($type eq 'string_yesno') { - if ($env{'form.recent_string'} =~ /^(yes|no)$/i) { - $winvalue=$env{'form.recent_string'}; - } } else { $winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; } @@ -846,7 +826,7 @@ sub plink { my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); my ($hour,$min,$sec,$val)=&preset_defaults($parmname); unless (defined($winvalue)) { $winvalue=$val; } - my $valout = &valout($value,$type,$parmname,1); + my $valout = &valout($value,$type,1); my $unencmarker = $marker; foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, \$hour, \$min, \$sec) { @@ -871,14 +851,12 @@ sub page_js { $pjump_def function psub() { - var specstring = /^string_!(yesno|any)/i; if (document.parmform.pres_marker.value!='') { document.parmform.action+='#'+document.parmform.pres_marker.value; var typedef=new Array(); typedef=document.parmform.pres_type.value.split('_'); if (document.parmform.pres_type.value!='') { - if ((typedef[0]=='date') || - (specstring.test(document.parmform.pres_type.value))) { + if (typedef[0]=='date') { eval('document.parmform.recent_'+ document.parmform.pres_type.value+ '.value=document.parmform.pres_value.value;'); @@ -928,97 +906,6 @@ function showHide_courseContent() { COURSECONTENTSCRIPT } -sub validateparms_js { - return <<'ENDSCRIPT'; - -function validateParms() { - 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$remove'); - }); - - \$(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 1) { my ($coursereply,$grp_parm,$controlgrp); ($coursereply,$othergrp,$grp_parm,$controlgrp) = - &print_usergroups($r,$$part{$which}.'.'.$$name{$which}, + &check_other_groups($$part{$which}.'.'.$$name{$which}, $rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); if ($coursereply && $result > 3) { if (defined($controlgrp)) { @@ -1188,7 +1075,7 @@ sub print_row { my $sessionvaltype=$typeoutpar[$result]; if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } $r->print(''. - &valout($sessionval,$sessionvaltype,$$name{$which}).' '. + &valout($sessionval,$sessionvaltype).' '. ''); } $r->print(''); @@ -1205,6 +1092,12 @@ sub print_td { } else { if ($which == 11 || $which == 12) { $nolink = 1; + } elsif (($env{'request.course.sec'} ne '') && ($which > 9)) { + $nolink = 1; + } elsif ($which == 4 || $which == 5 || $which == 6) { + if ($noeditgrp) { + $nolink = 1; + } } elsif ($mprefix =~ /availablestudent\&$/) { if ($which > 3) { $nolink = 1; @@ -1216,7 +1109,7 @@ sub print_td { } } if ($nolink) { - $r->print(&valout($$outpar[$which],$$typeoutpar[$which],$mprefix)); + $r->print(&valout($$outpar[$which],$$typeoutpar[$which])); } else { $r->print(&plink($$typeoutpar[$which], $$display{$value},$$outpar[$which], @@ -1225,8 +1118,8 @@ sub print_td { $r->print(''."\n"); } -sub print_usergroups { - my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; +sub check_other_groups { + my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; my $courseid = $env{'request.course.id'}; my $output; my $symb = &symbcache($rid); @@ -1241,9 +1134,8 @@ sub print_usergroups { if (($coursereply) && ($cgroup ne $resultgroup)) { if ($result > 3) { $bgcolor = '#AAFFAA'; - $grp_parm = &valout($coursereply,$resulttype,$what); } - $grp_parm = &valout($coursereply,$resulttype,$what); + $grp_parm = &valout($coursereply,$resulttype); $output = ''; if ($resultgroup && $resultlevel) { $output .= ''.$resultgroup.' ('.$resultlevel.'): '.$grp_parm; @@ -1387,22 +1279,13 @@ sub isdateparm { return (($type=~/^date/) && (!($type eq 'date_interval'))); } -# Determine if parameter type is specialized string type (i.e., -# not just string or string_yesno. - -sub is_specialstring { - my $type=shift; - return (($type=~/^string_/) && (($type ne 'string_yesno'))); -} - # # parmmenu displays a list of the selected parameters. # It also offers a link to show/hide the complete parameter list # from which you can select all desired parameters. # sub parmmenu { - my ($r,$allparms,$pscat,$keyorder)=@_; - my $tempkey; + my ($r)=@_; $r->print(< // print('
'); - &shortCuts($r,$allparms,$pscat,$keyorder); + &shortCuts($r); $r->print('
'); } # return a hash @@ -1546,7 +1429,7 @@ sub lookUpTableParameter { 'retrypartial' => 'tries', 'discussvote' => 'misc', 'examcode' => 'high_level_randomization', - ); + ); } sub whatIsMyCategory { @@ -1628,6 +1511,7 @@ sub parmboxes { .&mt($categories{$key}) .''."\n"); foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { + next if ($tempkey eq ''); $r->print('' .'