--- loncom/interface/lonparmset.pm 2000/11/27 16:08:55 1.15 +++ loncom/interface/lonparmset.pm 2000/11/28 02:53:40 1.16 @@ -17,7 +17,6 @@ use strict; use Apache::lonnet; use Apache::Constants qw(:common :http REDIRECT); use GDBM_File; -use Apache::lonmeta; my %courseopt; @@ -31,6 +30,9 @@ my @ids; my %symbp; my %mapp; my %typep; +my %keyp; + +my %allkeys; my $uname; my $udom; @@ -127,7 +129,7 @@ sub bycat { if ($fcat eq '') { $a<=>$b; } else { - &parmval('0.'.$fcat,$a)<=>&parmval('0.'.$fcat,$b); + &parmval($fcat,$a)<=>&parmval($fcat,$b); } } @@ -229,19 +231,42 @@ sub handler { $ENV{'request.course.fn'}.'_parms.db',&GDBM_READER,0640))) { # --------------------------------------------------------- Get all assessments + %allkeys=(); + map { if ($_=~/^src\_(\d+)\.(\d+)$/) { my $mapid=$1; my $resid=$2; my $id=$mapid.'.'.$resid; - if ($bighash{$_}=~/\.(problem|exam|quiz|assess|survey|form)$/) { + my $srcf=$bighash{$_}; + if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) { $ids[$#ids+1]=$id; $typep{$id}=$1; + $keyp{$id}=''; + map { + if ($_=~/^parameter\_(.*)/) { + my $key=$_; + my $allkey=$1; + my $display= + &Apache::lonnet::metadata($srcf,$key.'.display'); + unless ($display) { + $display= + &Apache::lonnet::metadata($srcf,$key.'.name'); + } + $allkeys{$allkey}=$display; + if ($keyp{$id}) { + $keyp{$id}.=','.$key; + } else { + $keyp{$id}=$key; + } + } + } split(/\,/, + &Apache::lonnet::metadata($srcf,'keys')); $mapp{$id}= &Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); $symbp{$id}=$mapp{$id}. '___'.$resid.'___'. - &Apache::lonnet::declutter($bighash{$_}); + &Apache::lonnet::declutter($srcf); } } } keys %bighash; @@ -392,13 +417,12 @@ ENDHEAD $r->print($message.'

Sort list by '); $r->print(''); # ----------------------------------------------------------------- Start Table my $coursespan=$csec?8:5; @@ -436,34 +460,28 @@ ENDTABLEHEADFOUR @outpar=(); my $rid=$_; my $thistitle=''; - my %name= ('0_deadline' => 'deadline'); - my %part= ('0_deadline' => '0'); - my %display=('0_deadline' => 'Deadline'); - my %type= ('0_deadline' => 'date_end'); - my %default=('0_deadline' => time); - my %metadata=&Apache::lonmeta::unpackagemeta( -&Apache::lonnet::getfile('/home/httpd/html/'.$bighash{'src_'.$rid}.'.meta'),1); + my %name= (); + my %part= (); + my %display=(); + my %type= (); + my %default=(); + my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); + map { - if ($_=~/^parameter\_(\d+)\_(\w+)$/) { - my $hashid=$1.'_'.$2; - $part{$hashid}=$1; - $name{$hashid}=$2; - my $tdef; - ($tdef,$display{$hashid})= - split(/\_\_dis\_\_/,$metadata{$_}); - ($type{$hashid},$default{$hashid})=split(/\:/,$tdef); - unless ($display{$hashid}) { - $display{$hashid}=$name{$hashid}; - } - } - if ($_ eq 'title') { - $thistitle=$metadata{$_}; - } - } keys %metadata; + $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); + $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); + $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display'); + unless ($display{$_}) { $display{$_}=''; } + $display{$_}.=' ('.$name{$_}.')'; + $default{$_}=&Apache::lonnet::metadata($uri,$_.'.default'); + $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); + $thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); + } split(/\,/,$keyp{$rid}); + my $totalparms=scalar keys %name; $r->print(''. - join(' / ',split(/\//,&Apache::lonnet::declutter($bighash{'src_'.$rid}))). - '

'. + join(' / ',split(/\//,$uri)). + '

'. $bighash{'title_'.$rid}); if ($thistitle) { $r->print(' ('.$thistitle.')'); @@ -476,8 +494,10 @@ ENDTABLEHEADFOUR my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_}); - $r->print("$part{$_}$display{$_}"); - my $mprefix=$rid.'&'.$_.'&'; + $r->print("$part{$_}$display{$_}"); + my $thismarker=$_; + $thismarker=~s/^parameter\_//; + my $mprefix=$rid.'&'.$thismarker.'&'; $r->print(''. &valout($outpar[11],$type{$_}).'');