--- loncom/interface/lonparmset.pm 2012/05/01 15:54:49 1.505.2.1.2.2 +++ loncom/interface/lonparmset.pm 2011/01/13 17:44:30 1.506 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.505.2.1.2.2 2012/05/01 15:54:49 raeburn Exp $ +# $Id: lonparmset.pm,v 1.506 2011/01/13 17:44:30 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -302,6 +302,7 @@ use Apache::lonlocal; use Apache::lonnavmaps; use Apache::longroup; use Apache::lonrss; +use HTML::Entities; use LONCAPA qw(:DEFAULT :match); @@ -890,6 +891,8 @@ sub startpage { {'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(< + + ENDHEAD } @@ -930,7 +935,7 @@ sub print_row { if ($parmlev eq 'full') { $r->print('' - .$$part{$which}.''); + .($$part{$which} eq '0'?'0 ('.&mt('default').')':$$part{$which}).''); } else { $parm=~s|\[.*\]\s||g; } @@ -1265,7 +1270,6 @@ sub parmmenu { function checkdisset() { checkthis('discussend','pscat'); checkthis('discusshide','pscat'); - checkthis('discussvote','pscat'); } function checkcontdates() { @@ -1404,7 +1408,6 @@ sub lookUpTableParameter { 'acc' => 'misc', 'maxcollaborators' => 'misc', 'scoreformat' => 'misc', - 'discussvote' => 'misc', ); } @@ -1750,11 +1753,12 @@ sub mapmenu { # Info about selectable folders/maps $r->print( '
' - .&mt('You can only select maps and folders which have modifiable settings.') - .' '.&Apache::loncommon::help_open_topic('Parameter_Set_Folder') + .&mt('You can only select those maps and folders which can be currently parameterized.') + # .' '.&Apache::loncommon::help_open_topic('...') # Later: Add further help .'
' ); + $r->print(&Apache::loncommon::start_data_table()); # Display row: "All Maps or Folders" @@ -1960,9 +1964,8 @@ sub standardkeyorder { 'parameter_0_tol' => 16, 'parameter_0_sig' => 17, 'parameter_0_turnoffunit' => 18, - 'parameter_0_discussend' => 19, - 'parameter_0_discusshide' => 20, - 'parameter_0_discussvote' => 21); + 'parameter_0_discussend' => 19, + 'parameter_0_discusshide' => 20); } @@ -2022,8 +2025,11 @@ sub assessparms { my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); my $pschp=$env{'form.pschp'}; + + my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); if (!@psprt) { $psprt[0]='0'; } + if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; } my $pssymb=''; my $parmlev=''; @@ -2125,7 +2131,7 @@ sub assessparms { my ($got_chostname,$chostname,$cmajor,$cminor); my $totalstored = 0; for (my $i=0;$i<=$#markers;$i++) { - my ($needsrelease,$needsnewer,$name); + my ($needsrelease,$needsnewer); if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { my (@ok_slots,@fail_slots,@del_slots); my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); @@ -2156,23 +2162,22 @@ sub assessparms { } } } - } elsif ($markers[$i] =~ /_(type|discussvote)\&\d+$/) { - $name = $1; + } elsif ($markers[$i] =~ /_type\&\d+$/) { $needsrelease = - $Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"}; + $Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]}; if ($needsrelease) { unless ($got_chostname) { - ($chostname,$cmajor,$cminor) = ¶meter_release_vars(); + ($chostname,$cmajor,$cminor) = &questiontype_release_vars(); $got_chostname = 1; } - $needsnewer = ¶meter_releasecheck($name,$values[$i], - $needsrelease, - $chostname, - $cmajor,$cminor); + $needsnewer = &questiontype_releasecheck($values[$i], + $needsrelease, + $chostname, + $cmajor,$cminor); } } if ($needsnewer) { - $message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor, + $message .= &oldversion_warning($values[$i],$chostname,$cmajor, $cminor,$needsrelease); } else { $message.=&storeparm(split(/\&/,$markers[$i]), @@ -2334,6 +2339,9 @@ COURSECONTENTSCRIPT my $csudom=$env{'user.domain'}; if ($parmlev eq 'full') { +# +# This produces the cascading table output of parameters +# my $coursespan=$csec?8:5; my $userspan=3; if ($cgroup ne '') { @@ -2341,6 +2349,9 @@ COURSECONTENTSCRIPT } $r->print('

'); +# +# This produces the headers +# $r->print(''); $r->print(''); if ($uname) { @@ -2404,7 +2415,9 @@ ENDTABLEHEADFOUR } $r->print(''); - +# +# Done with the headers +# my $defbgone=''; my $defbgtwo=''; my $defbgthree = ''; @@ -2444,11 +2457,19 @@ ENDTABLEHEADFOUR my %default=(); my $uri=&Apache::lonnet::declutter($uris{$rid}); + my $filter=$env{'form.filter'}; + foreach (&keysplit($keyp{$rid})) { my $tempkeyp = $_; if (grep $_ eq $tempkeyp, @catmarker) { + my $parmname=&Apache::lonnet::metadata($uri,$_.'.name'); +# We may only want certain parameters listed + if ($filter) { + unless ($filter=~/\Q$parmname\E/) { next; } + } + $name{$_}=$parmname; $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); - $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); + my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); if ($allparms{$name{$_}} ne '') { my $identifier; @@ -2797,32 +2818,25 @@ sub storedata { $tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; } if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { - my ($data, $typeof, $text, $name); + my ($data, $typeof, $text); if ($cmd eq 'set') { $data=$env{$key}; $typeof=$env{'form.typeof_'.$thiskey}; $text = &mt('Saved modified parameter for'); if ($typeof eq 'string_questiontype') { - $name = 'type'; - } elsif ($typeof eq 'string_discussvote') { - $name = 'discussvote'; - } - if ($name ne '') { my ($needsrelease,$needsnewer); $needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data}; if ($needsrelease) { unless ($got_chostname) { - ($chostname,$cmajor,$cminor)=¶meter_release_vars(); + ($chostname,$cmajor,$cminor)=&questiontype_release_vars(); $got_chostname = 1; } - $needsnewer = ¶meter_releasecheck($name,$data, - $needsrelease, - $chostname,$cmajor, - $cminor); + $needsnewer = &questiontype_releasecheck($data,$needsrelease, + $chostname,$cmajor, + $cminor); } if ($needsnewer) { - $r->print('
'.&oldversion_warning($name,$data, - $chostname,$cmajor, + $r->print('
'.&oldversion_warning($data,$chostname,$cmajor, $cminor,$needsrelease)); next; } @@ -3057,7 +3071,7 @@ sub listdata { $$resourcedata{$thiskey})); } elsif ($thistype =~ m/^string/) { $r->print(&string_selector($thistype,$thiskey, - $$resourcedata{$thiskey},$name)); + $$resourcedata{$thiskey})); } else { $r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); } @@ -3131,10 +3145,6 @@ my %strings = [ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], [ 'practice', 'Practice'], [ 'surveycred', 'Survey (credit for submission)']], - 'string_discussvote' - => [['yes','Yes'], - ['notended','Yes, unless discussion ended'], - ['no','No']], ); sub standard_string_options { @@ -3146,30 +3156,29 @@ sub standard_string_options { } sub string_selector { - my ($thistype, $thiskey, $showval, $name) = @_; + my ($thistype, $thiskey, $showval) = @_; if (!exists($strings{$thistype})) { return &default_selector($thiskey,$showval); } my %skiptype; - if (($thistype eq 'string_questiontype') || - ($thistype eq 'string_discussvote')) { + if ($thistype eq 'string_questiontype') { my ($got_chostname,$chostname,$cmajor,$cminor); foreach my $possibilities (@{ $strings{$thistype} }) { next unless (ref($possibilities) eq 'ARRAY'); - my ($parmval, $description) = @{ $possibilities }; - my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"}; + my ($name, $description) = @{ $possibilities }; + my $needsrelease=$Apache::lonnet::needsrelease{'parameter:type:'.$name}; if ($needsrelease) { unless ($got_chostname) { - ($chostname,$cmajor,$cminor)=¶meter_release_vars(); + ($chostname,$cmajor,$cminor)=&questiontype_release_vars(); $got_chostname = 1; } - my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, - $chostname,$cmajor, - $cminor); + my $needsnewer=&questiontype_releasecheck($name,$needsrelease, + $chostname,$cmajor, + $cminor); if ($needsnewer) { - $skiptype{$parmval} = 1; + $skiptype{$name} = 1; } } } @@ -3296,6 +3305,7 @@ ENDOVER my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); my $pschp=$env{'form.pschp'}; + my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); if (!@psprt) { $psprt[0]='0'; } @@ -4571,7 +4581,7 @@ sub check_for_course_info { return 0; } -sub parameter_release_vars { +sub questiontype_release_vars { my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; my $chostname = &Apache::lonnet::hostname($chome); @@ -4580,42 +4590,35 @@ sub parameter_release_vars { return ($chostname,$cmajor,$cminor); } -sub parameter_releasecheck { - my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_; +sub questiontype_releasecheck { + my ($questiontype,$needsrelease,$chostname,$cmajor,$cminor) = @_; my $needsnewer; my ($needsmajor,$needsminor) = split(/\./,$needsrelease); if (($cmajor < $needsmajor) || ($cmajor == $needsmajor && $cminor < $needsminor)) { $needsnewer = 1; } else { - &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value}); + &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:type:'.$questiontype}); } return $needsnewer; } sub oldversion_warning { - my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; + my ($questiontype,$chostname,$cmajor,$cminor,$needsrelease) = @_; my $desc; - my %stringtypes = ( - type => 'string_questiontype', - 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; - } + if (ref($strings{'string_questiontype'}) eq 'ARRAY') { + foreach my $possibilities (@{ $strings{'string_questiontype'} }) { + next unless (ref($possibilities) eq 'ARRAY'); + my ($name, $description) = @{ $possibilities }; + if ($name eq $questiontype) { + $desc = $description; + last; } } } - my $standard_name = &standard_parameter_names($name); return '

'. - &mt('[_1] was [_2]not[_3] set to [_4].', - $standard_name,'','','"'.$desc.'"').'
'. + &mt('Question Type was [_1]not[_2] set to [_3].', + '','','"'.$desc.'"').'
'. &mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', $cmajor.'.'.$cminor,$chostname, $needsrelease). @@ -4636,6 +4639,7 @@ sub handler { 'pres_marker', 'pres_value', 'pres_type', + 'filter','part', 'udom','uname','symb','serial','timebase']);

'.&mt('Any User').'