--- loncom/interface/lonparmset.pm 2022/03/24 16:18:42 1.522.2.28.4.4 +++ loncom/interface/lonparmset.pm 2014/09/12 18:09:58 1.547 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.522.2.28.4.4 2022/03/24 16:18:42 raeburn Exp $ +# $Id: lonparmset.pm,v 1.547 2014/09/12 18:09:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,8 +36,7 @@ lonparmset - Handler to set parameters f =head1 SYNOPSIS -lonparmset provides an interface to setting content parameters in a -course. +lonparmset provides an interface to setting course parameters. =head1 DESCRIPTION @@ -130,7 +129,7 @@ javascript function 'pjump'. =item print_td() -=item check_other_groups() +=item print_usergroups() =item parm_control_group() @@ -150,7 +149,7 @@ Input: See list below =back -Outputs: See list below +Outputs: See list below: =over 4 @@ -324,6 +323,31 @@ use HTML::Entities; use LONCAPA qw(:DEFAULT :match); +sub startSettingsScreen { + my ($r,$mode,$crstype)=@_; + + my $tabtext = &mt('Course Settings'); + if ($crstype eq 'Community') { + $tabtext = &mt('Community Settings'); + } + $r->print("\n".''."\n"); + $r->print('
'); +} + +sub endSettingsScreen { + my ($r)=@_; + $r->print('
'); +} + + + sub parmval { my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, @@ -767,17 +791,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--; @@ -810,13 +824,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); @@ -831,15 +838,11 @@ sub valout { sub plink { - my ($type,$dis,$value,$marker,$return,$call,$extra)=@_; + 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]}; } @@ -850,13 +853,13 @@ sub plink { my $valout = &valout($value,$type,1); my $unencmarker = $marker; foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, - \$hour, \$min, \$sec, \$extra) { + \$hour, \$min, \$sec) { $$item = &HTML::Entities::encode($$item,'"<>&'); $$item =~ s/\'/\\\'/g; } return '
'. ''. + .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. $valout.'
'; } @@ -872,22 +875,20 @@ 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))) { - eval('document.parmform.recent_'+ - document.parmform.pres_type.value+ - '.value=document.parmform.pres_value.value;'); - } else { - eval('document.parmform.recent_'+typedef[0]+ - '.value=document.parmform.pres_value.value;'); - } + if (document.parmform.pres_type.value!='') { + if (typedef[0]=='date') { + eval('document.parmform.recent_'+ + document.parmform.pres_type.value+ + '.value=document.parmform.pres_value.value;'); + } else { + eval('document.parmform.recent_'+typedef[0]+ + '.value=document.parmform.pres_value.value;'); } + } document.parmform.submit(); } else { document.parmform.pres_value.value=''; @@ -902,7 +903,9 @@ sub page_js { var newWin = window.open(url, wdwName, options); newWin.focus(); } + // ]]> + $selscript ENDJS @@ -929,295 +932,8 @@ function showHide_courseContent() { COURSECONTENTSCRIPT } -sub validateparms_js { - return <<'ENDSCRIPT'; - -function validateParms() { - var textRegExp = /^settext_/; - var ipRegExp = /^setip/; - var ipallowRegExp = /^setipallow_/; - var ipdenyRegExp = /^setipdeny_/; - var deeplinkRegExp = /^deeplink_/; - var dlListScopeRegExp = /^deeplink_(state|others|listing|scope)_/; - var dlLinkProtectRegExp = /^deeplink_protect_/; - var dlLtidRegExp = /^deeplink_ltid_/; - var dlLticRegExp = /^deeplink_ltic_/; - var dlKeyRegExp = /^deeplink_key_/; - var dlMenusRegExp = /^deeplink_menus_/; - var dlCollsRegExp = /^deeplink_colls_/; - 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 0) { - var possdeeplink = document.parmform.elements[i].options[idx].value - possdeeplink = possdeeplink.replace(/^\s+|\s+$/g,''); - if (document.parmform.elements['set_'+identifier].value) { - possdeeplink = ','+possdeeplink; - } - document.parmform.elements['set_'+identifier].value += possdeeplink; - } - } else if (dlLinkProtectRegExp.test(name)) { - if (document.parmform.elements[i].checked) { - var identifier = name.replace(dlLinkProtectRegExp,''); - var posslinkurl = document.parmform.elements[i].value; - posslinkurl = posslinkurl.replace(/^\s+|\s+$/g,''); - if (document.parmform.elements['set_'+identifier].value) { - posslinkurl = ','+posslinkurl; - } - document.parmform.elements['set_'+identifier].value += posslinkurl; - } - } else if (dlLtidRegExp.test(name)) { - var identifier = name.replace(dlLtidRegExp,''); - if (isRadioSet('deeplink_protect_'+identifier,'ltid')) { - var possltid = document.parmform.elements[i].value; - possltid = possltid.replace(/\D+/g,''); - if (possltid.length) { - if (document.parmform.elements['set_'+identifier].value) { - possltid = ':'+possltid; - } - document.parmform.elements['set_'+identifier].value += possltid; - } else { - document.parmform.elements['set_'+identifier].value = ''; - alert("A link type of 'domain LTI launch' was selected but no domain LTI launcher was selected.\nPlease select one, or choose a different supported link type."); - return false; - } - } - } else if (dlLticRegExp.test(name)) { - var identifier = name.replace(dlLticRegExp,''); - if (isRadioSet('deeplink_protect_'+identifier,'ltic')) { - var possltic = document.parmform.elements[i].value; - possltic = possltic.replace(/\D+/g,''); - if (possltic.length) { - if (document.parmform.elements['set_'+identifier].value) { - possltic = ':'+possltic; - } - document.parmform.elements['set_'+identifier].value += possltic; - } else { - document.parmform.elements['set_'+identifier].value = ''; - alert("A link type of 'course LTI launch' was selected but no course LTI launcher was selected.\nPlease select one, or choose a different supported link type."); - return false; - } - } - } else if (dlKeyRegExp.test(name)) { - var identifier = name.replace(dlKeyRegExp,''); - if (isRadioSet('deeplink_protect_'+identifier,'key')) { - var posskey = document.parmform.elements[i].value; - posskey = posskey.replace(/^\s+|\s+$/g,''); - var origlength = posskey.length; - posskey = posskey.replace(/[^a-zA-Z\d_.!@#$%^&*()+=-]/g,''); - var newlength = posskey.length; - if (newlength > 0) { - var change = origlength - newlength; - if (change) { - alert(change+' disallowed character(s) removed from deeplink key'); - } - if (document.parmform.elements['set_'+identifier].value) { - posskey = ':'+posskey; - } - document.parmform.elements['set_'+identifier].value += posskey; - } else { - document.parmform.elements['set_'+identifier].value = ''; - if (newlength < origlength) { - alert("A link type of 'deep with key' was selected but the key value was blank, after removing disallowed characters.\nPlease enter a key using one or more of: a-zA-Z0-9_.!@#$%^&*()+=-"); - } else { - alert("A link type of 'deep with key' was selected but the key value was blank.\nPlease enter a key."); - } - return false; - } - } - } else if (dlMenusRegExp.test(name)) { - if (document.parmform.elements[i].checked) { - var identifier = name.replace(dlMenusRegExp,''); - var posslinkmenu = document.parmform.elements[i].value; - posslinkmenu = posslinkmenu.replace(/^\s+|\s+$/g,''); - if (posslinkmenu == 'std') { - posslinkmenu = '0'; - if (document.parmform.elements['set_'+identifier].value) { - posslinkmenu = ','+posslinkmenu; - } - document.parmform.elements['set_'+identifier].value += posslinkmenu; - } - } - } else if (dlCollsRegExp.test(name)) { - var identifier = name.replace(dlCollsRegExp,''); - if (isRadioSet('deeplink_menus_'+identifier,'colls')) { - var posslinkmenu = document.parmform.elements[i].value; - if (document.parmform.elements['set_'+identifier].value) { - posslinkmenu = ','+posslinkmenu; - } - document.parmform.elements['set_'+identifier].value += posslinkmenu; - } - } - } - } - } - } - return true; -} - -function isRadioSet(name,expected) { - var menuitems = document.getElementsByName(name); - var radioLength = menuitems.length; - result = false; - if (radioLength > 1) { - for (var j=0; j$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 "group_or_section('cgroup')", @@ -1244,13 +960,14 @@ sub startpage { '; my $start_page = - &Apache::loncommon::start_page('Set/Modify Course Parameters',$js, - {'add_entries' => \%loaditems,}); + &Apache::loncommon::start_page('Set/Modify Course Parameters',$js, + {'add_entries' => \%loaditems,}); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'}); my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); $r->print($start_page.$breadcrumbs); + &startSettingsScreen($r,'parmset',$crstype); $r->print(< @@ -1265,8 +982,7 @@ ENDHEAD sub print_row { my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, - $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp, - $readonly)=@_; + $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_; my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); @@ -1305,85 +1021,37 @@ sub print_row { my $thismarker=$which; $thismarker=~s/^parameter\_//; my $mprefix=$rid.'&'.$thismarker.'&'; - my ($parmname)=($thismarker=~/\_([^\_]+)$/); my $effective_parm = &valout($outpar[$result],$typeoutpar[$result]); - my ($othergrp,$grp_parm,$controlgrp,$extra); + my ($othergrp,$grp_parm,$controlgrp); - if ($parmname eq 'deeplink') { - my ($domltistr,$crsltistr); - my %lti = - &Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'}, - 'linkprot'); - if (keys(%lti)) { - foreach my $item (sort { $a <=> $b } (keys(%lti))) { - if (($item =~ /^\d+$/) && (ref($lti{$item}) eq 'HASH')) { - $domltistr .= $item.':'.&escape(&escape($lti{$item}{'name'})).','; - } - } - $domltistr =~ s/,$//; - if ($domltistr) { - $extra = 'ltid_'.$domltistr; - } - } - my %courselti = &Apache::lonnet::get_course_lti($cnum,$cdom); - if (keys(%courselti)) { - foreach my $item (sort { $a <=> $b } keys(%courselti)) { - if (($item =~ /^\d+$/) && (ref($courselti{$item}) eq 'HASH')) { - $crsltistr .= $item.':'.&escape(&escape($courselti{$item}{'name'})).','; - } - } - $crsltistr =~ s/,$//; - if ($crsltistr) { - if ($extra) { - $extra .= '&'; - } - $extra .= 'ltic_'.$crsltistr; - } - } - if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { - my @colls; - foreach my $item (split(/;/,$env{'course.'.$env{'request.course.id'}.'.menucollections'})) { - my ($num,$value) = split(/\%/,$item); - if ($num =~ /^\d+$/) { - push(@colls,$num); - } - } - if (@colls) { - if ($extra) { - $extra .= '&'; - } - $extra .= 'menus_'.join(',',@colls); - } - } - } if ($parmlev eq 'general') { if ($uname) { - &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } elsif ($cgroup) { - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra); + &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } elsif ($csec) { - &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } else { - &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } } elsif ($parmlev eq 'map') { if ($uname) { - &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } elsif ($cgroup) { - &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra); + &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } elsif ($csec) { - &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } else { - &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } } else { if ($uname) { if (@{$usersgroups} > 1) { my ($coursereply,$grp_parm,$controlgrp); ($coursereply,$othergrp,$grp_parm,$controlgrp) = - &check_other_groups($$part{$which}.'.'.$$name{$which}, + &print_usergroups($r,$$part{$which}.'.'.$$name{$which}, $rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); if ($coursereply && $result > 3) { if (defined($controlgrp)) { @@ -1396,32 +1064,32 @@ sub print_row { } } - &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); - &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); - &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); - &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); - &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); if ($csec) { - &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); - &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); - &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } if ($cgroup) { - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra); - &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra); - &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra); + &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } if ($uname) { if ($othergrp) { $r->print($othergrp); } - &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); - &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); - &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra); + &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } } # end of $parmlev if/else @@ -1441,27 +1109,19 @@ sub print_row { } sub print_td { - my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly,$extra)=@_; + my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; $r->print(''); my $nolink = 0; - if ($readonly) { + if ($which == 11 || $which == 12) { $nolink = 1; - } else { - if ($which == 11 || $which == 12) { + } elsif ($mprefix =~ /availablestudent\&$/) { + if ($which > 3) { $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\&$/) { + } + } elsif ($mprefix =~ /examcode\&$/) { + unless ($which == 2) { $nolink = 1; - } elsif ($mprefix =~ /examcode\&$/) { - unless ($which == 2) { - $nolink = 1; - } } } if ($nolink) { @@ -1469,13 +1129,13 @@ sub print_td { } else { $r->print(&plink($$typeoutpar[$which], $$display{$value},$$outpar[$which], - $mprefix."$which",'parmform.pres','psub',$extra)); + $mprefix."$which",'parmform.pres','psub')); } $r->print(''."\n"); } -sub check_other_groups { - my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; +sub print_usergroups { + my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; my $courseid = $env{'request.course.id'}; my $output; my $symb = &symbcache($rid); @@ -1490,6 +1150,7 @@ sub check_other_groups { if (($coursereply) && ($cgroup ne $resultgroup)) { if ($result > 3) { $bgcolor = '#AAFFAA'; + $grp_parm = &valout($coursereply,$resulttype); } $grp_parm = &valout($coursereply,$resulttype); $output = ''; @@ -1635,21 +1296,14 @@ 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)=@_; + my ($r,$allparms,$pscat,$keyorder)=@_; + my $tempkey; $r->print(< // print('
'); - &shortCuts($r); + &shortCuts($r,$allparms,$pscat,$keyorder); $r->print('
'); } # return a hash @@ -1777,7 +1431,6 @@ sub lookUpTableParameter { 'buttonshide' => 'hiding', 'turnoffeditor' => 'hiding', 'encrypturl' => 'hiding', - 'deeplink' => 'hiding', 'randomorder' => 'high_level_randomization', 'randompick' => 'high_level_randomization', 'available' => 'slots', @@ -1793,8 +1446,8 @@ sub lookUpTableParameter { 'lenient' => 'grading', 'retrypartial' => 'tries', 'discussvote' => 'misc', - 'examcode' => 'high_level_randomization', - ); + 'examcode' => 'high_level_randomization', + ); } sub whatIsMyCategory { @@ -1866,37 +1519,31 @@ sub parmboxes { &whatIsMyCategory($tempparameter, \%categoryList); } #part to print the parm-list - $r->print('
'."\n"); - - #Print parameters - for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { - next if(@{$categoryList{$key}} == 0); + foreach my $key (sort { $category_order{$a} <=> $category_order{$b} } keys(%categoryList)) { + next if (@{$categoryList{$key}} == 0); + next if ($key eq ''); $r->print('
' - .'

' - .&mt($categories{$key}) - .'

'."\n"); - foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { - next if ($tempkey eq ''); + .'

'.&mt($categories{$key}).'

'."\n"); + foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { $r->print('' .'
'."\n"); } - $r->print("
\n"); + $r->print('
'); } - - $r->print("\n"); + $r->print("\n"); } # # This function offers some links on the parameter section to get with one click a group a parameters # sub shortCuts { - my ($r)=@_; + my ($r,$allparms,$pscat,$keyorder)=@_; # Parameter Selection $r->print( @@ -1955,60 +1602,21 @@ sub partmenu { } sub usermenu { - my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_; + my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_; my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. - &Apache::loncommon::selectstudent_link('parmform','uname','udom','condition'). - &Apache::lonhtmlcommon::scripttag(<'. - $stuonly.'  '. - ''; my $sections=''; my %sectionhash = &Apache::loncommon::get_sections(); my $groups; - 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 %grouphash = &Apache::longroup::coursegroups(); my $g_s_header=''; my $g_s_footer=''; - my $currsec = $env{'request.course.sec'}; - if ($currsec) { - $sections=&mt('Section:').' '.$currsec; - if (%grouphash) { - $sections .= ';'.(' ' x2); - } - } elsif (%sectionhash && $currsec eq '') { + if (%sectionhash) { $sections=&mt('Section:').' '. - &mt('Show all parts'). - ''); - &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); + &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); $r->print('

' @@ -2928,11 +2377,6 @@ ENDPARMSELSCRIPT my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; my $csuname=$env{'user.name'}; my $csudom=$env{'user.domain'}; - my $readonly = 1; - if ($parm_permission->{'edit'}) { - undef($readonly); - } - $r->print('

'); if ($parmlev eq 'full') { # @@ -2955,7 +2399,7 @@ ENDPARMSELSCRIPT $userspan ++; } $r->print(''); - $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom"); + $r->print(&mt('User [_1] at Domain [_2]',"'".$uname."'","'".$udom."'").''); } my %lt=&Apache::lonlocal::texthash( 'pie' => "Parameter in Effect", @@ -3018,9 +2462,8 @@ ENDTABLEHEADFOUR my $defbgtwo=''; my $defbgthree = ''; - foreach (@ids) { + foreach my $rid (@ids) { - my $rid=$_; my ($inmapid)=($rid=~/\.(\d+)$/); if ((!$pssymb && @@ -3118,7 +2561,7 @@ ENDTABLEHEADFOUR &print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, \%type,\%display,$defbgone,$defbgtwo, $defbgthree,$parmlev,$uname,$udom,$csec, - $cgroup,\@usersgroups,$noeditgrp,$readonly); + $cgroup,\@usersgroups); } } } @@ -3241,8 +2684,7 @@ ENDTABLEHEADFOUR $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, - $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, - $readonly); + $parmlev,$uname,$udom,$csec,$cgroup); } $r->print(&Apache::loncommon::end_data_table().'

' .'
' @@ -3332,18 +2774,17 @@ ENDMAPONE foreach (&keysinorder(\%name,\%keyorder)) { $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, - \%type,\%display,$defbgone,$defbgtwo,$defbgthree, - $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, - $readonly); + \%type,\%display,$defbgone,$defbgtwo,$defbgthree, + $parmlev,$uname,$udom,$csec,$cgroup); } $r->print(&Apache::loncommon::end_data_table() .'

' .'' ); } # end of $parmlev eq general - $r->print(''); } $r->print(''); + &endSettingsScreen($r); $r->print(&Apache::loncommon::end_page()); } # end sub assessparms @@ -3353,19 +2794,12 @@ ENDMAPONE my $tableopen; sub tablestart { - my ($readonly) = @_; if ($tableopen) { - return ''; + return ''; } else { - $tableopen=1; - my $output = &Apache::loncommon::start_data_table().''.&mt('Parameter').''; - if ($readonly) { - $output .= ''.&mt('Current value').''; - } else { - $output .= ''.&mt('Delete').''.&mt('Set to ...').''; - } - $output .= ''; - return $output; + $tableopen=1; + return &Apache::loncommon::start_data_table().''.&mt('Parameter').''. + &mt('Delete').''.&mt('Set to ...').''; } } @@ -3398,11 +2832,7 @@ sub readdata { } } } - if (wantarray) { - return ($resourcedata,$classlist); - } else { - return $resourcedata; - } + return $resourcedata; } @@ -3423,39 +2853,20 @@ sub storedata { if ($key =~ /^form\.([a-z]+)\_(.+)$/) { my $cmd=$1; my $thiskey=$2; - next if ($cmd eq 'setipallow' || $cmd eq 'setipdeny' || $cmd eq 'setdeeplink'); my ($tuname,$tudom)=&extractuser($thiskey); my $tkey=$thiskey; if ($tuname) { $tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; } if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { - my ($data, $typeof, $text, $name, $valchk, $valmatch, $namematch); + my ($data, $typeof, $text, $name, $valchk); if ($cmd eq 'set') { $data=$env{$key}; - $valmatch = ''; $valchk = $data; $typeof=$env{'form.typeof_'.$thiskey}; $text = &mt('Saved modified parameter for'); if ($typeof eq 'string_questiontype') { $name = 'type'; - } elsif ($typeof eq 'string_deeplink') { - ($name) = ($typeof =~ /^string_(deeplink)$/); - 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_lenient') { $name = 'lenient'; } elsif ($typeof eq 'string_discussvote') { @@ -3600,7 +3011,7 @@ sub parse_listdata_key { } sub listdata { - my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; + my ($r,$resourcedata,$listdata,$sortorder)=@_; # Start list output my $oldsection=''; @@ -3610,17 +3021,6 @@ sub listdata { $tableopen=0; my $foundkeys=0; my %keyorder=&standardkeyorder(); - my $readonlyall = $readonly; - - 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 { my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); @@ -3664,50 +3064,25 @@ sub listdata { } keys %{$listdata}) { if ($$listdata{$thiskey.'.type'}) { - my $thistype=$$listdata{$thiskey.'.type'}; - if ($$resourcedata{$thiskey.'.type'}) { - $thistype=$$resourcedata{$thiskey.'.type'}; + my $thistype=$$listdata{$thiskey.'.type'}; + if ($$resourcedata{$thiskey.'.type'}) { + $thistype=$$resourcedata{$thiskey.'.type'}; } my ($middle,$part,$name)= ($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); my $section=&mt('All Students'); - $readonly = $readonlyall; - my $userscope; - my $showval = $$resourcedata{$thiskey}; if ($middle=~/^\[(.*)\]/) { - my $issection=$1; - if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { - my ($stuname,$studom) = ($1,$2); - if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { - if (ref($classlist) eq 'HASH') { - if (ref($classlist->{$stuname.':'.$studom}) eq 'ARRAY') { - next unless ($classlist->{$stuname.':'.$studom}->[$secidx] eq $env{'request.course.sec'}); - } - } - } - $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); - $userscope = 1; - } 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; + my $issection=$1; + if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { + $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); + } else { + $section=&mt('Group/Section').': '.$issection; + } + $middle=~s/^\[(.*)\]//; } $middle=~s/\.+$//; $middle=~s/^\.+//; my $realm=''.&mt('All Resources').''; - if ($middle=~/^(.+)\_\_\_\(all\)$/) { $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).'
('.$1.')
'; } elsif ($middle) { @@ -3746,57 +3121,36 @@ sub listdata { # Ready to print # my $parmitem = &standard_parameter_names($name); - $r->print(&tablestart($readonly). + $r->print(&tablestart(). &Apache::loncommon::start_data_table_row(). ''.&mt($parmitem). - ''); - unless ($readonly) { - my $disabled; - if (($name eq 'availablestudent') && - (($showval eq '') || ($userscope))) { - $disabled = ' disabled="disabled"'; - } - $r->print(''); - } - $r->print(''); + ''); $foundkeys++; if (&isdateparm($thistype)) { - my $jskey='key_'.$pointer; - my $state; - $pointer++; - if ($readonly) { - $state = 'disabled'; - } - $r->print( - &Apache::lonhtmlcommon::date_setter('parmform', - $jskey, - $$resourcedata{$thiskey}, - '',1,$state)); - unless ($readonly) { - $r->print( + my $jskey='key_'.$pointer; + $pointer++; + $r->print( + &Apache::lonhtmlcommon::date_setter('parmform', + $jskey, + $$resourcedata{$thiskey}, + '',1,'',''). ''. (($$resourcedata{$thiskey}!=0)?''. &mt('Shift all dates based on this date').'':''). &date_sanity_info($$resourcedata{$thiskey}) ); - } } elsif ($thistype eq 'date_interval') { - $r->print(&date_interval_selector($thiskey,$name, - $$resourcedata{$thiskey},$readonly)); + $r->print(&date_interval_selector($thiskey, + $$resourcedata{$thiskey})); } elsif ($thistype =~ m/^string/) { - if ($name eq 'availablestudent') { - $readonly = 1; - } - $r->print(&string_selector($thistype,$thiskey, - $$resourcedata{$thiskey},$name,$readonly)); + $r->print(&string_selector($thistype,$thiskey, + $$resourcedata{$thiskey},$name)); } else { - $r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly)); - } - unless ($readonly) { - $r->print(''); + $r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); } + $r->print(''); $r->print(''.&Apache::loncommon::end_data_table_row()); } } @@ -3805,9 +3159,8 @@ sub listdata { sub date_interval_selector { - my ($thiskey, $pname, $showval, $readonly) = @_; - my ($result,%skipval); - my $currval = $showval; + my ($thiskey, $showval) = @_; + my $result; foreach my $which (['days', 86400, 31], ['hours', 3600, 23], ['minutes', 60, 59], @@ -3818,57 +3171,10 @@ sub date_interval_selector { my %select = ((map {$_ => $_} (0..$max)), 'select_form_order' => [0..$max]); $result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, - \%select,'',$readonly); + \%select); $result .= ' '.&mt($name); } - if ($pname eq 'interval') { - unless ($skipval{'done'}) { - my $checkedon = ''; - my $checkedproc = ''; - my $currproctorkey = ''; - my $currprocdisplay = 'hidden'; - my $currdonetext = &mt('Done'); - my $checkedoff = ' checked="checked"'; - if ($currval =~ /^(?:\d+)_done$/) { - $checkedon = ' checked="checked"'; - $checkedoff = ''; - } elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:$/) { - $currdonetext = $1; - $checkedon = ' checked="checked"'; - $checkedoff = ''; - } elsif ($currval =~ /^(?:\d+)_done_proctor_(.+)$/) { - $currproctorkey = $1; - $checkedproc = ' checked="checked"'; - $checkedoff = ''; - $currprocdisplay = 'text'; - } elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:_proctor_(.+)$/) { - $currdonetext = $1; - $currproctorkey = $2; - $checkedproc = ' checked="checked"'; - $checkedoff = ''; - $currprocdisplay = 'text'; - } - my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"'; - my $disabled; - if ($readonly) { - $disabled = ' disabled="disabled"'; - } - $result .= '
'.&mt('Include "done" button'). - ''.(' 'x2). - ''.(' 'x2). - ''. - '&').'"'.$disabled.' />
'. - ''.&mt('Button text').': '. - '&').'"'.$disabled.' />'; - } - } - unless ($readonly) { - $result .= ''; - } + $result .= ''; return $result; } @@ -3890,285 +3196,10 @@ sub get_date_interval_from_form { sub default_selector { - my ($thiskey, $showval, $readonly) = @_; - my $disabled; - if ($readonly) { - $disabled = ' disabled="disabled"'; - } - return ''; -} - -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 ($readonly) { - $disabled=' disabled="disabled"'; - } else { - $addmore = "\n".''; - } - my $output = ' -'; - foreach my $acctype ('allow','deny') { - $output .= ' -'; - } - $output .= ' - -
'.&mt('Allow from').''.&mt('Deny from').'
-
-
'."\n"; - my $num = 0; - foreach my $curr (@{$access{$acctype}}) { - $output .= '
'; - if ($num > 0) { - $output .= ''.&mt('Remove').''; - } - $output .= '
'."\n"; - $num ++; - } - $output .= ' -
'.$addmore.' -
-
'."\n"; - return $output; -} - -sub string_deeplink_selector { - my ($thiskey, $showval, $readonly) = @_; - my (@components,%values,@current,%titles,%options,%optiontext,%defaults, - %selectnull,%domlti,%crslti,@possmenus); - @components = ('state','others','listing','scope','protect','menus'); - %titles = &Apache::lonlocal::texthash ( - state => 'Access status', - others => 'Hide other resources', - listing => 'In Contents and/or Gradebook', - scope => 'Access scope for link', - protect => 'Link protection', - menus => 'Menu Items Displayed', - ); - %options = ( - state => ['only','off','both'], - others => ['hide','unhide'], - listing => ['full','absent','grades','details','datestatus'], - scope => ['res','map','rec'], - protect => ['none','key','ltid','ltic'], - menus => ['std','colls'], - ); - %optiontext = &Apache::lonlocal::texthash ( - only => 'deep only', - off => 'deeplink off', - both => 'regular + deep', - hide => 'Hidden', - unhide => 'Unhidden', - full => 'Listed (linked) in both', - absent => 'Not listed', - grades => 'Listed in grades only', - details => 'Listed (unlinked) in both', - datestatus => 'Listed (unlinked) inc. status in both', - res => 'resource only', - map => 'enclosing map/folder', - rec => 'recursive map/folder', - none => 'not in use', - key => 'key access', - ltic => 'LTI access (course)', - ltid => 'LTI access (domain)' , - std => 'Standard (all menus)', - colls => 'Numbered collection', - ); - %selectnull = &Apache::lonlocal::texthash ( - ltic => 'Select Launcher', - ltid => 'Select Launcher', - colls => 'Select', - ); - if ($showval =~ /,/) { - %values=(); - @current = split(/,/,$showval); - ($values{'state'}) = ($current[0] =~ /^(only|off|both)$/); - ($values{'others'}) = ($current[1] =~ /^(hide|unhide)$/); - ($values{'listing'}) = ($current[2] =~ /^(full|absent|grades|details|datestatus)$/); - ($values{'scope'}) = ($current[3] =~ /^(res|map|rec)$/); - ($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/); - ($values{'menus'}) = ($current[5] =~ /^(\d+)$/); - } else { - $defaults{'state'} = 'off', - $defaults{'others'} = 'unhide', - $defaults{'listing'} = 'full'; - $defaults{'scope'} = 'res'; - $defaults{'protect'} = 'none'; - $defaults{'menus'} = '0'; - } - my $disabled; - if ($readonly) { - $disabled=' disabled="disabled"'; - } - my %courselti = - &Apache::lonnet::get_course_lti($env{'course.'.$env{'request.course.id'}.'.num'}, - $env{'course.'.$env{'request.course.id'}.'.domain'}); - foreach my $item (keys(%courselti)) { - if (ref($courselti{$item}) eq 'HASH') { - $crslti{$item} = $courselti{$item}{'name'}; - } - } - my %lti = - &Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'}, - 'linkprot'); - foreach my $item (keys(%lti)) { - if (($item =~ /^\d+$/) && (ref($lti{$item}) eq 'HASH')) { - $domlti{$item} = $lti{$item}{'name'}; - } - } - if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { - foreach my $item (split(/;/,$env{'course.'.$env{'request.course.id'}.'.menucollections'})) { - my ($num,$value) = split(/\%/,$item); - if ($num =~ /^\d+$/) { - push(@possmenus,$num); - } - } - } - - my $output = ''; - foreach my $item (@components) { - $output .= ''; - } - $output .= ''; - foreach my $item (@components) { - $output .= ''; - } - $output .= '
'.$titles{$item}.'
'; - if (($item eq 'protect') || ($item eq 'menus')) { - my $selected = $values{$item}; - foreach my $option (@{$options{$item}}) { - if ($item eq 'protect') { - if ($option eq 'ltid') { - next unless (keys(%domlti)); - } elsif ($option eq 'ltic') { - next unless (keys(%crslti)); - } - } elsif (($item eq 'menus') && ($option eq 'colls')) { - next unless (@possmenus); - } - my $checked; - if ($item eq 'menus') { - if (($selected =~ /^\d+$/) && (@possmenus) && - (grep(/^\Q$selected\E$/,@possmenus))) { - if ($option eq 'colls') { - $checked = ' checked="checked"'; - } - } elsif (($option eq 'std') && ($selected == 0) && ($selected ne '')) { - $checked = ' checked="checked"'; - } - } elsif ($selected =~ /^\Q$option\E/) { - $checked = ' checked="checked"'; - } - my $onclick; - unless ($readonly) { - my $esc_key = &js_escape($thiskey); - $onclick = ' onclick="toggleDeepLink(this.form,'."'$item','$esc_key'".');"'; - } - $output .= ''; - if (($item eq 'protect') && ($option eq 'key')) { - my $visibility="hidden"; - my $currkey; - if ($checked) { - $visibility = "text"; - $currkey = (split(/\:/,$values{$item}))[1]; - } - $output .= ' '. - ''; - } elsif (($option eq 'ltic') || ($option eq 'ltid') || ($option eq 'colls')) { - my $display="none"; - my ($current,$blankcheck,@possibles); - if ($checked) { - $display = 'inline-block'; - if (($option eq 'ltic') || ($option eq 'ltid')) { - $current = (split(/\:/,$selected))[1]; - } else { - $current = $selected; - } - } else { - $blankcheck = ' selected="selected"'; - } - if ($option eq 'ltid') { - @possibles = keys(%domlti); - } elsif ($option eq 'ltic') { - @possibles = keys(%crslti); - } else { - @possibles = @possmenus; - } - $output .= '
 
'; - } - $output .= '
'; - } - } else { - my $selected = $values{$item}; - my $defsel; - if ($selected eq '') { - $defsel = ' selected="selected"'; - } - $output .= ''; - } - $output .= '
'."\n"; - return $output; + my ($thiskey, $showval) = @_; + return ''; } -{ - my %strings = ( 'string_yesno' @@ -4183,7 +3214,7 @@ my %strings = => [[ 'problem', 'Standard Problem'], [ 'survey', 'Survey'], [ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], - [ 'exam', 'Exam'], + [ 'exam', 'Bubblesheet Exam'], [ 'anonsurvey', 'Anonymous Survey'], [ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], [ 'practice', 'Practice'], @@ -4196,31 +3227,8 @@ my %strings = => [['yes','Yes'], ['notended','Yes, unless discussion ended'], ['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']], - 'string_deeplink' - => [['on','Set choices for link protection, resource listing, access scope, and shown menu items']], ); -my %stringmatches = ( - 'string_ip' - => [['_allowfrom_','[^\!]+'], - ['_denyfrom_','\!']], - 'string_deeplink' - => [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)$']], - ); - -my %stringtypes = ( - type => 'string_questiontype', - lenient => 'string_lenient', - retrypartial => 'string_yesno', - discussvote => 'string_discussvote', - examcode => 'string_examcode', - acc => 'string_ip', - deeplink => 'string_deeplink', - ); - sub standard_string_options { my ($string_type) = @_; if (ref($strings{$string_type}) eq 'ARRAY') { @@ -4229,19 +3237,11 @@ sub standard_string_options { return; } -sub standard_string_matches { - my ($string_type) = @_; - if (ref($stringmatches{$string_type}) eq 'ARRAY') { - return $stringmatches{$string_type}; - } - return; -} - sub string_selector { - my ($thistype, $thiskey, $showval, $name, $readonly) = @_; + my ($thistype, $thiskey, $showval, $name) = @_; if (!exists($strings{$thistype})) { - return &default_selector($thiskey,$showval,$readonly); + return &default_selector($thiskey,$showval); } my %skiptype; @@ -4267,18 +3267,9 @@ sub string_selector { } } } + - if ($thistype eq 'string_ip') { - return &string_ip_selector($thiskey,$showval,$readonly); - } elsif ($thistype eq 'string_deeplink') { - return &string_deeplink_selector($thiskey,$showval,$readonly); - } - - my ($result,$disabled); - - if ($readonly) { - $disabled = ' disabled="disabled"'; - } + my $result; my $numinrow = 3; if ($thistype eq 'string_problemstatus') { $numinrow = 2; @@ -4304,7 +3295,7 @@ sub string_selector { $result .= ''. '