--- loncom/interface/lonparmset.pm 2002/08/17 20:04:18 1.62 +++ loncom/interface/lonparmset.pm 2002/08/19 23:01:27 1.63 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.62 2002/08/17 20:04:18 www Exp $ +# $Id: lonparmset.pm,v 1.63 2002/08/19 23:01:27 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -437,6 +437,102 @@ sub get_env_multiple { return(@values); } +=pod + +=item B: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. + +Input: See list below: + +=over 4 + +=item B: An array that will contain all of the ids in the course. + +=item B: hash, id->type, where "type" contains the extension of the file, thus, I. + +=item B: hash, id->key list, will contain a comma seperated list of the meta-data keys available for the given id + +=item B: hash, name of parameter->display value (what is the display value?) + +=item B: hash, part identification->text representation of part, where the text representation is "[Part $part]" + +=item B: hash, full key to part->display value (what's display value?) + +=item B: hash, ??? + +=item B: ??? + +=item B: hash, ??? + +=item B: ?? + +=item B: hash, id->full sym? + +=back + +=cut + +sub extractResourceInformation { + my $bighash = shift; + my $ids = shift; + my $typep = shift; + my $keyp = shift; + my $allparms = shift; + my $allparts = shift; + my $allkeys = shift; + my $allmaps = shift; + my $fcat = shift; + my $defp = shift; + my $mapp = shift; + my $symbp = shift; + + foreach (keys %$bighash) { + if ($_=~/^src\_(\d+)\.(\d+)$/) { + my $mapid=$1; + my $resid=$2; + my $id=$mapid.'.'.$resid; + my $srcf=$$bighash{$_}; + if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) { + $$ids[$#$ids+1]=$id; + $$typep{$id}=$1; + $$keyp{$id}=''; + foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'keys'))) { + if ($_=~/^parameter\_(.*)/) { + my $key=$_; + my $allkey=$1; + $allkey=~s/\_/\./g; + my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); + my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); + my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); + my $parmdis = $display; + $parmdis =~ s|(\[Part.*$)||g; + my $partkey = $part; + $partkey =~ tr|_|.|; + $$allparms{$name} = $parmdis; + $$allparts{$part} = "[Part $part]"; + $$allkeys{$allkey}=$display; + if ($allkey eq $fcat) { + $$defp{$id}= &Apache::lonnet::metadata($srcf,$key); + } + if ($$keyp{$id}) { + $$keyp{$id}.=','.$key; + } else { + $$keyp{$id}=$key; + } + } + } + $$mapp{$id}= + &Apache::lonnet::declutter($$bighash{'map_id_'.$mapid}); + $$mapp{$mapid}=$$mapp{$id}; + $$allmaps{$mapid}=$$mapp{$id}; + $$symbp{$id}=$$mapp{$id}. + '___'.$resid.'___'. + &Apache::lonnet::declutter($srcf); + $$symbp{$mapid}=$$mapp{$id}.'___(all)'; + } + } + } +} + ################################################## ################################################## @@ -451,6 +547,18 @@ Inputs: $r Returns: nothing +Variables used (guessed by Jeremy): + +=over 4 + +=item B: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. + +=item B: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? + +=item B: + +=back + =cut ################################################## @@ -580,53 +688,10 @@ sub assessparms { $r->print("Unable to access parameter data. (File $ENV{'request.course.fn'}_parms.db not tieable)"); return ; } + # --------------------------------------------------------- Get all assessments - foreach (keys %bighash) { - if ($_=~/^src\_(\d+)\.(\d+)$/) { - my $mapid=$1; - my $resid=$2; - my $id=$mapid.'.'.$resid; - my $srcf=$bighash{$_}; - if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) { - $ids[$#ids+1]=$id; - $typep{$id}=$1; - $keyp{$id}=''; - foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'keys'))) { - if ($_=~/^parameter\_(.*)/) { - my $key=$_; - my $allkey=$1; - $allkey=~s/\_/\./g; - my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); - my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); - my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); - my $parmdis = $display; - $parmdis =~ s|(\[Part.*$)||g; - my $partkey = $part; - $partkey =~ tr|_|.|; - $allparms{$name} = $parmdis; - $allparts{$part} = "[Part $part]"; - $allkeys{$allkey}=$display; - if ($allkey eq $fcat) { - $defp{$id}= &Apache::lonnet::metadata($srcf,$key); - } - if ($keyp{$id}) { - $keyp{$id}.=','.$key; - } else { - $keyp{$id}=$key; - } - } - } - $mapp{$id}= - &Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); - $mapp{$mapid}=$mapp{$id}; - $allmaps{$mapid}=$mapp{$id}; - $symbp{$id}=$mapp{$id}. - '___'.$resid.'___'. - &Apache::lonnet::declutter($srcf); - $symbp{$mapid}=$mapp{$id}.'___(all)'; - } - } - } + extractResourceInformation(\%bighash, \@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allkeys, \%allmaps, $fcat, \%defp, \%mapp, \%symbp); + $mapp{'0.0'} = ''; $symbp{'0.0'} = ''; # ---------------------------------------------------------- Anything to store? @@ -725,6 +790,7 @@ sub assessparms { if ($pscat[0] eq "all" || !@pscat) {@pscat = (keys %allparms);} if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} # ------------------------------------------------------------------ Start page + &startpage($r,$id,$udom,$csec,$uname); # if ($ENV{'form.url'}) { # $r->print('