--- loncom/interface/lonparmset.pm 2015/05/10 01:02:35 1.551 +++ loncom/interface/lonparmset.pm 2016/01/31 21:25:38 1.555 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.551 2015/05/10 01:02:35 raeburn Exp $ +# $Id: lonparmset.pm,v 1.555 2016/01/31 21:25:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -777,7 +777,7 @@ sub storeparm_by_symb_inner { sub valout { - my ($value,$type,$editable)=@_; + my ($value,$type,$name,$editable)=@_; my $result = ''; # Values of zero are valid. if (! $value && $value ne '0') { @@ -791,7 +791,8 @@ sub valout { } } else { if ($type eq 'date_interval') { - my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); + my ($totalsecs,$donebutton) = split(/_/,$value); + my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($totalsecs); my @timer; $year=$year-70; $mday--; @@ -824,6 +825,9 @@ sub valout { push(@timer,&mt('[quant,_1,sec]',0)); } $result.=join(", ",@timer); + if ($donebutton eq 'done') { + $result .= ' '.&mt('+ "done"'); + } } elsif (&isdateparm($type)) { $result = &Apache::lonlocal::locallocaltime($value). &date_sanity_info($value); @@ -850,7 +854,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,1); + my $valout = &valout($value,$type,$parmname,1); my $unencmarker = $marker; foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, \$hour, \$min, \$sec) { @@ -1138,10 +1142,11 @@ ENDHEAD sub print_row { 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 $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); + # get the values for the parameter in cascading order # empty levels will remain empty my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which}, @@ -1177,14 +1182,14 @@ sub print_row { my $thismarker=$which; $thismarker=~s/^parameter\_//; 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); if ($parmlev eq 'general') { if ($uname) { &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); } elsif ($cgroup) { - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); } elsif ($csec) { &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); } else { @@ -1195,7 +1200,7 @@ sub print_row { if ($uname) { &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); } elsif ($cgroup) { - &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); } elsif ($csec) { &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); } else { @@ -1232,9 +1237,9 @@ sub print_row { } if ($cgroup) { - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$which,\@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); + &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); } if ($uname) { @@ -1255,7 +1260,7 @@ sub print_row { my $sessionvaltype=$typeoutpar[$result]; if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } $r->print(''. - &valout($sessionval,$sessionvaltype).' '. + &valout($sessionval,$sessionvaltype,$$name{$which}).' '. ''); } $r->print(''); @@ -1263,12 +1268,18 @@ sub print_row { } 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(''); my $nolink = 0; 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; @@ -1279,7 +1290,7 @@ sub print_td { } } if ($nolink) { - $r->print(&valout($$outpar[$which],$$typeoutpar[$which])); + $r->print(&valout($$outpar[$which],$$typeoutpar[$which],$mprefix)); } else { $r->print(&plink($$typeoutpar[$which], $$display{$value},$$outpar[$which], @@ -1304,9 +1315,9 @@ sub print_usergroups { if (($coursereply) && ($cgroup ne $resultgroup)) { if ($result > 3) { $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 = ''; if ($resultgroup && $resultlevel) { $output .= ''.$resultgroup.' ('.$resultlevel.'): '.$grp_parm; @@ -1754,7 +1765,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(); @@ -1763,12 +1774,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:').' print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section'))); $r->print($sections.$groups); $r->print(&Apache::lonhtmlcommon::row_closure()); + } else { + $r->print($sections); } $r->print(&Apache::lonhtmlcommon::row_title(&mt('User'))); @@ -2040,44 +2064,52 @@ sub levelmenu { sub sectionmenu { - my ($r,$selectedsections)=@_; + my ($selectedsections)=@_; my %sectionhash = &Apache::loncommon::get_sections(); - return if (!%sectionhash); + return '' if (!%sectionhash); - $r->print(''; + foreach my $s (@possibles) { + $output .= ' \n"); + $output .= '>'."$s\n"; } - $r->print("\n"); + $output .= "\n"; + return $output; } sub groupmenu { - my ($r,$selectedgroups)=@_; - my %grouphash = &Apache::longroup::coursegroups(); - return if (!%grouphash); + my ($selectedgroups)=@_; + my %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(''; foreach my $group (sort(keys(%grouphash))) { - $r->print(' \n"); + $output .= '>'."$group\n"; } - $r->print("\n"); + $output .= "\n"; + return $output; } - sub keysplit { my $keyp=shift; return (split(/\,/,$keyp)); @@ -2197,7 +2229,21 @@ sub assessparms { my $message=''; $csec=$env{'form.csec'}; + if ($env{'request.course.sec'} ne '') { + $csec = $env{'request.course.sec'}; + } + +# Check group privs. $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'}) { } elsif ($udom=$env{'request.role.domain'}) { @@ -2245,7 +2291,7 @@ sub assessparms { my $id=$env{'form.id'}; if (($id) && ($udom)) { - $uname=(&Apache::lonnet::idget($udom,$id))[1]; + $uname=(&Apache::lonnet::idget($udom,[$id],'ids'))[1]; if ($uname) { $id=''; } else { @@ -2323,6 +2369,12 @@ sub assessparms { my $now = time; for (my $i=0;$i<=$#markers;$i++) { my ($needsrelease,$needsnewer,$name); + if (($env{'request.course.sec'} ne '') && ($markers[$i] =~ /\&(7|8|9)$/)) { + next if ($csec ne $env{'request.course.sec'}); + } + if ($markers[$i] =~ /\&(6|5|4)$/) { + next if ($noeditgrp); + } if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { my (@ok_slots,@fail_slots,@del_slots); my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); @@ -2353,7 +2405,7 @@ sub assessparms { } } } - } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate|acc)\&\d+$/) { + } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate|acc|interval)\&\d+$/) { $name = $1; my $val = $values[$i]; my $valmatch = ''; @@ -2390,6 +2442,23 @@ sub assessparms { } } } + } 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 = $Apache::lonnet::needsrelease{"parameter:$name:$val:$valmatch"}; @@ -2486,7 +2555,7 @@ ENDPARMSELSCRIPT # Step 3 $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); $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::end_pick_box()); @@ -2518,7 +2587,7 @@ ENDPARMSELSCRIPT '
'); $r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); $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::end_pick_box()); $r->print('

' @@ -2730,7 +2799,7 @@ ENDTABLEHEADFOUR &print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default, \%type,\%display,$defbgone,$defbgtwo, $defbgthree,$parmlev,$uname,$udom,$csec, - $cgroup,\@usersgroups); + $cgroup,\@usersgroups,$noeditgrp); } } } @@ -2852,7 +2921,7 @@ ENDTABLEHEADFOUR $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, - $parmlev,$uname,$udom,$csec,$cgroup); + $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); } $r->print(&Apache::loncommon::end_data_table().'

' .'' @@ -2942,7 +3011,7 @@ ENDMAPONE $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, - $parmlev,$uname,$udom,$csec,$cgroup); + $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); } $r->print(&Apache::loncommon::end_data_table() .'

' @@ -2961,12 +3030,19 @@ ENDMAPONE my $tableopen; sub tablestart { + my ($readonly) = @_; if ($tableopen) { - return ''; + return ''; } else { - $tableopen=1; - return &Apache::loncommon::start_data_table().''.&mt('Parameter').''. - &mt('Delete').''.&mt('Set to ...').''; + $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; } } @@ -2999,7 +3075,11 @@ sub readdata { } } } - return $resourcedata; + if (wantarray) { + return ($resourcedata,$classlist); + } else { + return $resourcedata; + } } @@ -3086,6 +3166,25 @@ sub storedata { } } 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'); } @@ -3195,7 +3294,8 @@ sub parse_listdata_key { } sub listdata { - my ($r,$resourcedata,$listdata,$sortorder)=@_; + my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist)=@_; + # Start list output my $oldsection=''; @@ -3206,6 +3306,16 @@ sub listdata { my $foundkeys=0; 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 { my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); @@ -3247,22 +3357,43 @@ sub listdata { $result; } keys(%{$listdata})) { + my $readonly; 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'); if ($middle=~/^\[(.*)\]/) { - 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/^\[(.*)\]//; + 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($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/^\.+//; @@ -3305,64 +3436,55 @@ sub listdata { # Ready to print # my $parmitem = &standard_parameter_names($name); - $r->print(&tablestart(). + $r->print(&tablestart($readonly). &Apache::loncommon::start_data_table_row(). ''.&mt($parmitem). - ''); + ''); + unless ($readonly) { + $r->print(''); + } + $r->print(''); $foundkeys++; if (&isdateparm($thistype)) { - my $jskey='key_'.$pointer; - $pointer++; - $r->print( - &Apache::lonhtmlcommon::date_setter('parmform', - $jskey, - $$resourcedata{$thiskey}, - '',1,'',''). + 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( ''. (($$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, - $$resourcedata{$thiskey})); + $r->print(&date_interval_selector($thiskey,$name, + $$resourcedata{$thiskey},$readonly)); } elsif ($thistype =~ m/^string/) { - $r->print(&string_selector($thistype,$thiskey, - $$resourcedata{$thiskey},$name)); + $r->print(&string_selector($thistype,$thiskey, + $$resourcedata{$thiskey},$name,$readonly)); } else { - $r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); + $r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly)); + } + unless ($readonly) { + $r->print(''); } - $r->print(''); $r->print(''.&Apache::loncommon::end_data_table_row()); } } 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 .= ''; - return $result; - -} - sub get_date_interval_from_form { my ($key) = @_; my $seconds = 0; @@ -3375,17 +3497,24 @@ sub get_date_interval_from_form { $seconds += $env{'form.'.$name.'_'.$key} * $factor; } } + if (($key =~ /\.interval$/) && ($env{'form.done_'.$key} eq '_done')) { + $seconds .= $env{'form.done_'.$key}; + } return $seconds; } sub default_selector { - my ($thiskey, $showval) = @_; - return ''; + my ($thiskey, $showval, $readonly) = @_; + my $disabled; + if ($readonly) { + $disabled = ' disabled="disabled"'; + } + return ''; } sub string_ip_selector { - my ($thiskey, $showval) = @_; + my ($thiskey, $showval, $readonly) = @_; my %access = ( allow => [], deny => [], @@ -3411,6 +3540,12 @@ sub string_ip_selector { if (!@{$access{'deny'}}) { @{$access{'deny'}} = (''); } + my ($disabled,$addmore); + if ($disabled) { + $disabled=' disabled="disabled"'; + } else { + $addmore = "\n".''; + } my $output = ' '; foreach my $acctype ('allow','deny') { @@ -3420,7 +3555,7 @@ sub string_ip_selector {
'."\n"; my $num = 0; foreach my $curr (@{$access{$acctype}}) { - $output .= '
'; + $output .= '
'; if ($num > 0) { $output .= ''.&mt('Remove').''; } @@ -3428,8 +3563,7 @@ sub string_ip_selector { $num ++; } $output .= ' -
- +
'.$addmore.'
'; } @@ -3515,10 +3649,10 @@ sub get_stringtype { } sub string_selector { - my ($thistype, $thiskey, $showval, $name) = @_; + my ($thistype, $thiskey, $showval, $name, $readonly) = @_; if (!exists($strings{$thistype})) { - return &default_selector($thiskey,$showval); + return &default_selector($thiskey,$showval,$readonly); } my %skiptype; @@ -3563,10 +3697,14 @@ sub string_selector { } if ($thistype eq 'string_ip') { - return &string_ip_selector($thiskey,$showval); + return &string_ip_selector($thiskey,$showval,$readonly); } - my $result; + my ($result,$disabled); + + if ($readonly) { + $disabled = ' disabled="disabled"'; + } my $numinrow = 3; if ($thistype eq 'string_problemstatus') { $numinrow = 2; @@ -3631,7 +3769,7 @@ sub string_selector { foreach my $reltype ('corrchkd','corrunchkd','incorrchkd','incorrunchkd') { $add .= ''."\n". ''; } $add .= '
'.&mt('Allow from').''.&mt('Deny from').'
 '.$relatives{$reltype}.''. + ' value="'.$textval{$reltype}.'" size="3"'.$disabled.' />'. '
'."\n"; @@ -3642,7 +3780,7 @@ sub string_selector { $result .= ''. '