--- loncom/interface/lonparmset.pm 2019/03/02 16:25:45 1.522.2.23.2.3 +++ loncom/interface/lonparmset.pm 2018/09/03 20:23:37 1.522.2.24 @@ -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.24 2018/09/03 20:23:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -752,7 +752,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 +766,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 +799,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 +816,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 +825,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 +850,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 +905,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; iprint(''. - &valout($sessionval,$sessionvaltype,$$name{$which}).' '. + &valout($sessionval,$sessionvaltype).' '. ''); } $r->print(''); @@ -1205,6 +1091,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 +1108,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], @@ -1241,9 +1133,9 @@ sub print_usergroups { if (($coursereply) && ($cgroup ne $resultgroup)) { if ($result > 3) { $bgcolor = '#AAFFAA'; - $grp_parm = &valout($coursereply,$resulttype,$what); + $grp_parm = &valout($coursereply,$resulttype); } - $grp_parm = &valout($coursereply,$resulttype,$what); + $grp_parm = &valout($coursereply,$resulttype); $output = ''; if ($resultgroup && $resultlevel) { $output .= ''.$resultgroup.' ('.$resultlevel.'): '.$grp_parm; @@ -1387,14 +1279,6 @@ 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 @@ -1706,7 +1590,7 @@ sub partmenu { } 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').' '. &Apache::loncommon::selectstudent_link('parmform','uname','udom'); my $selscript=&Apache::loncommon::studentbrowser_javascript(); @@ -1715,12 +1599,23 @@ sub usermenu { my %sectionhash = &Apache::loncommon::get_sections(); 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_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:').'