--- loncom/interface/lonparmset.pm 2003/09/04 22:36:47 1.123 +++ loncom/interface/lonparmset.pm 2003/09/05 03:47:47 1.124 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.123 2003/09/04 22:36:47 www Exp $ +# $Id: lonparmset.pm,v 1.124 2003/09/05 03:47:47 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1666,6 +1666,26 @@ ENDENV } ################################################## +my $tableopen; + +sub tablestart { + if ($tableopen) { + return ''; + } else { + $tableopen=1; + return ''; + } +} + +sub tableend { + if ($tableopen) { + $tableopen=0; + return '
ParameterDeleteSet to ...
'; + } else { + return''; + } +} + sub overview { my $r=shift; my $bodytag=&Apache::loncommon::bodytag( @@ -1681,12 +1701,37 @@ $bodytag
ENDOVER +# Setting + my %olddata=&Apache::lonnet::dump('resourcedata',$dom,$crs); + my %newdata=(); + undef %newdata; + my @deldata=(); + undef @deldata; + foreach (keys %ENV) { + if ($_=~/^form\.([a-z]+)\_(.+)$/) { + my $cmd=$1; + my $thiskey=$2; + if ($cmd eq 'set') { + my $data=$ENV{$_}; + if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } + } elsif ($cmd eq 'del') { + push (@deldata,$thiskey); + } elsif ($cmd eq 'datepointer') { + my $data=&Apache::lonhtmlcommon::get_date_from_form($ENV{$_}); + if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } + } + } + } +# Store + &Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs); + &Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs); # Read and display my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs); my $oldsection=''; my $oldrealm=''; my $oldpart=''; my $pointer=0; + $tableopen=0; foreach my $thiskey (sort keys %resourcedata) { if ($resourcedata{$thiskey.'.type'}) { my ($course,$middle,$part,$name)= @@ -1704,23 +1749,26 @@ ENDOVER $realm='Resource: '.&Apache::lonnet::gettitle($middle).''; } if ($section ne $oldsection) { - $r->print("\n

$section

"); + $r->print(&tableend()."\n

$section

"); $oldsection=$section; $oldrealm=''; } if ($realm ne $oldrealm) { - $r->print("\n

$realm

"); + $r->print(&tableend()."\n

$realm

"); $oldrealm=$realm; $oldpart=''; } if ($part ne $oldpart) { - $r->print("\n

Part: $part

"); + $r->print(&tableend(). + "\n

Part: $part

"); $oldpart=$part; } # # Ready to print # - $r->print('
'.$name.':'); + $r->print(&tablestart().''.$name. + ':'); if ($resourcedata{$thiskey.'.type'}=~/^date/) { my $jskey='key_'.$pointer; $pointer++; @@ -1735,9 +1783,12 @@ ENDOVER ''); } + $r->print(''); } } - $r->print('
'); + + $r->print(&tableend(). + '

'); } ##################################################