--- loncom/interface/lonparmset.pm 2002/09/07 17:30:31 1.66 +++ loncom/interface/lonparmset.pm 2002/10/28 14:00:18 1.74 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.66 2002/09/07 17:30:31 www Exp $ +# $Id: lonparmset.pm,v 1.74 2002/10/28 14:00:18 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -87,9 +87,23 @@ my $coursename; Figure out a cascading parameter. -Inputs: $what $id $def - -Returns: I am not entirely sure. +Inputs: $what - a parameter spec (incluse part info and name I.E. 0.weight) + $id - a bighash Id number + $def - the resource's default value 'stupid emacs + +Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 11 possible levels + +11- resource default +10- map default +9 - General Course +8 - Map level in course +7 - resource level in course +6 - General for section +5 - Map level for section +4 - resource level in section +3 - General for specific student +2 - Map level for specific student +1 - resource level for specific student =cut @@ -123,32 +137,32 @@ sub parmval { # --------------------------------------------------------- third, check course - if ($courseopt{$courselevel}) { + if (defined($courseopt{$courselevel})) { $outpar[9]=$courseopt{$courselevel}; $result=9; } - if ($courseopt{$courselevelm}) { + if (defined($courseopt{$courselevelm})) { $outpar[8]=$courseopt{$courselevelm}; $result=8; } - if ($courseopt{$courselevelr}) { + if (defined($courseopt{$courselevelr})) { $outpar[7]=$courseopt{$courselevelr}; $result=7; } - if ($csec) { - if ($courseopt{$seclevel}) { + if (defined($csec)) { + if (defined($courseopt{$seclevel})) { $outpar[6]=$courseopt{$seclevel}; $result=6; } - if ($courseopt{$seclevelm}) { + if (defined($courseopt{$seclevelm})) { $outpar[5]=$courseopt{$seclevelm}; $result=5; } - if ($courseopt{$seclevelr}) { + if (defined($courseopt{$seclevelr})) { $outpar[4]=$courseopt{$seclevelr}; $result=4; } @@ -156,23 +170,22 @@ sub parmval { # ---------------------------------------------------------- fourth, check user - if ($uname) { - if ($useropt{$courselevel}) { + if (defined($uname)) { + if (defined($useropt{$courselevel})) { $outpar[3]=$useropt{$courselevel}; $result=3; } - if ($useropt{$courselevelm}) { + if (defined($useropt{$courselevelm})) { $outpar[2]=$useropt{$courselevelm}; $result=2; } - if ($useropt{$courselevelr}) { + if (defined($useropt{$courselevelr})) { $outpar[1]=$useropt{$courselevelr}; $result=1; } } - return ($result,@outpar); } @@ -199,7 +212,7 @@ sub valout { my $result = ''; # Values of zero are valid. if (! $value && $value ne '0') { - $result = '  '; + $result = '  '; } else { if ($type eq 'date_interval') { my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); @@ -449,8 +462,12 @@ sub print_row { } my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. '.'.$$name{$which},$symbp{$rid}); - my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}. - '.'.$$name{$which}.'.type',$symbp{$rid}); +# this doesn't seem to work, and I don't think is correct +# my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}. +# '.'.$$name{$which}.'.type',$symbp{$rid}); +# this seems to work + my $sessionvaltype=$typeoutpar[$result]; + if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } $r->print(''. &valout($sessionval,$sessionvaltype).' '. ''); @@ -806,6 +823,10 @@ sub assessparms { } # ---------------------------------------------------------------- Done storing } +# --------------------------------------------- Devalidate cache for this child + &Apache::lonnet::devalidatecourseresdata( + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); # -------------------------------------------------------------- Get coursedata %courseopt = &Apache::lonnet::dump ('resourcedata', @@ -1175,7 +1196,7 @@ ENDTABLEHEADFOUR foreach (split(/\,/,$keyp{$rid})) { my $tempkeyp = $_; my $fullkeyp = $tempkeyp; - $tempkeyp =~ s/_[\d_]+_/_0_/; + $tempkeyp =~ s/_\w+_/_0_/; if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { $part{$tempkeyp}="0"; @@ -1183,7 +1204,7 @@ ENDTABLEHEADFOUR $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; - $display{$tempkeyp} =~ s/_[\d_]+_/_0_/; + $display{$tempkeyp} =~ s/_\w+_/_0_/; $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); } @@ -1257,14 +1278,14 @@ ENDMAPONE foreach (split(/\,/,$keyp{$rid})) { my $tempkeyp = $_; my $fullkeyp = $tempkeyp; - $tempkeyp =~ s/_[\d_]+_/_0_/; + $tempkeyp =~ s/_\w+_/_0_/; if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { $part{$tempkeyp}="0"; $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; - $display{$tempkeyp} =~ s/_[\d_]+_/_0_/; + $display{$tempkeyp} =~ s/_\w+_/_0_/; $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); } @@ -1382,13 +1403,13 @@ sub crsenv { 'Browse
", - 'question.email' => 'Feedback Addresses for Content '. + 'question.email' => 'Feedback Addresses for Resource Content '. 'Questions
(user:domain,'. - 'user:domain,...)', - 'comment.email' => 'Feedback Addresses for Comments
'. - '(user:domain,user:domain,...)', + 'user:domain(section;section;...;*;...),...)', + 'comment.email' => 'Feedback Addresses for Course Content Comments
'. + '(user:domain,user:domain(section;section;...;*;...),...)', 'policy.email' => 'Feedback Addresses for Course Policy'. - '
(user:domain,user:domain,...)', + '
(user:domain,user:domain(section;section;...;*;...),...)', 'hideemptyrows' => 'Hide Empty Rows in Spreadsheets
'. '("yes" for default hiding)', 'pageseparators' => 'Visibly Separate Items on Pages
'. @@ -1425,7 +1446,7 @@ sub crsenv { } foreach (sort keys %descriptions) { # onchange is javascript to automatically check the 'Set' button. - my $onchange = 'onchange="javascript:window.document.forms'. + my $onchange = 'onFocus="javascript:window.document.forms'. '[\'envform\'].elements[\''.$_.'_setparmval\']'. '.checked=true;"'; $output.=''.$descriptions{$_}.''. @@ -1434,7 +1455,7 @@ sub crsenv { ''. ''."\n"; } - my $onchange = 'onchange="javascript:window.document.forms'. + my $onchange = 'onFocus="javascript:window.document.forms'. '[\'envform\'].elements[\'newp_setparmval\']'. '.checked=true;"'; $output.='Create New Environment Variable
'.