--- loncom/interface/lonparmset.pm 2003/09/04 22:36:47 1.123 +++ loncom/interface/lonparmset.pm 2003/10/08 18:08:11 1.128 @@ -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.128 2003/10/08 18:08:11 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -937,18 +937,19 @@ sub assessparms { $r->print("\n"); $r->print(''); - - $r->print('Select Enclosing Map or Folder'); - $r->print('\n"); + if ($parmlev ne 'general') { + $r->print('Select Enclosing Map or Folder'); + $r->print('\n"); + } } else { - my ($map,$id,$resource)=split(/___/,$pssymb); + my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); $r->print("Specific Resource$resource"); $r->print(''); $r->print(''); @@ -1152,7 +1153,8 @@ ENDTABLEHEADFOUR my $totalparms=scalar keys %name; if ($totalparms>0) { my $firstrow=1; - + my $title=$bighash{'title_'.$rid}; + $title=~s/\:/:/g; $r->print(''. @@ -1160,7 +1162,7 @@ ENDTABLEHEADFOUR '

'. "$bighash{'title_'.$rid}"); + " TARGET=_self>$title"); if ($thistitle) { $r->print(' ('.$thistitle.')'); @@ -1666,6 +1668,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 +1703,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 +1751,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 +1785,12 @@ ENDOVER ''); } + $r->print(''); } } - $r->print(''); + + $r->print(&tableend(). + '

'); } ################################################## @@ -1758,7 +1811,7 @@ sub handler { my $r=shift; if ($r->header_only) { - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK; } @@ -1769,7 +1822,7 @@ sub handler { if (($ENV{'request.course.id'}) && (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) { - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};