--- loncom/interface/lonparmset.pm 2003/07/24 17:53:59 1.118 +++ loncom/interface/lonparmset.pm 2003/10/08 23:07:01 1.129 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.118 2003/07/24 17:53:59 matthew Exp $ +# $Id: lonparmset.pm,v 1.129 2003/10/08 23:07:01 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -287,7 +287,7 @@ sub plink { sub startpage { my ($r,$id,$udom,$csec,$uname,$have_assesments)=@_; - my $bodytag=&Apache::loncommon::bodytag('Set Course Parameters','', + my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', 'onUnload="pclose()"'); my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. &Apache::loncommon::selectstudent_link('parmform','uname','udom'); @@ -343,16 +343,22 @@ $selscript $bodytag
-

Course Environment

- +

Course Environment Parameters

+ +
+
+
+

Course Assessment Parameter - Helper Mode

+ +
+
+
+

Course Assessment Parameters - Overview Mode

+

-

Course Assessments

- -Use Assignment Parameter Helper, a -simpler interface to set open, due, or answer open dates for problems or -sequences.
 
+

Course Assessments Parameters - Table Mode

ENDHEAD if (!$have_assesments) { @@ -647,9 +653,9 @@ sub assessparms { my $r=shift; # -------------------------------------------------------- Variable declaration - my %allkeys; - my %allmaps; - my %alllevs; + my %allkeys=(); + my %allmaps=(); + my %alllevs=(); $alllevs{'Resource Level'}='full'; # $alllevs{'Resource Level [BRIEF]'}='brief'; @@ -917,7 +923,7 @@ sub assessparms { $r->print('

'.$message.'

'); - my $submitmessage; + my $submitmessage = 'Update Section or Specific User'; if (!$pssymb) { $r->print('\n"); $r->print(''); - - $r->print(''); - $r->print('\n"); + if ($parmlev ne 'general') { + $r->print(''); + $r->print('\n"); + } } else { - my ($map,$id,$resource)=split(/___/,$pssymb); + my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); $r->print(""); $r->print(''); $r->print(''); @@ -1040,7 +1047,7 @@ sub assessparms { if (($prevvisit) || ($pschp) || ($pssymb)) { $submitmessage = "Update Course Assessment Parameter Display"; } else { - $submitmessage = "Set Course Assessment Parameters"; + $submitmessage = "Set/Modify Course Assessment Parameters"; } $r->print(''); @@ -1146,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(''); + } + } + + $r->print(&tableend(). + '

'); +} ################################################## ################################################## @@ -1677,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; } @@ -1688,17 +1822,21 @@ 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'}; - unless (($ENV{'form.crsenv'}) || (!$ENV{'request.course.fn'})) { -# --------------------------------------------------------- Bring up assessment - &assessparms($r); + if (($ENV{'form.crsenv'}) || (!$ENV{'request.course.fn'})) { # ---------------------------------------------- This is for course environment - } else { +# -------------------------- also call if toplevel map coudl not be initialized &crsenv($r); + } elsif ($ENV{'form.overview'}) { +# --------------------------------------------------------------- Overview mode + &overview($r); + } else { +# --------------------------------------------------------- Bring up assessment + &assessparms($r); } } else { # ----------------------------- Not in a course, or not allowed to modify parms
Select Parameter Level'); $r->print('
Select Enclosing Map or Folder
Select Enclosing Map or Folder
Specific Resource$resource
'. @@ -1154,7 +1162,7 @@ ENDTABLEHEADFOUR '

'. "$bighash{'title_'.$rid}"); + " TARGET=_self>$title"); if ($thistitle) { $r->print(' ('.$thistitle.')'); @@ -1658,6 +1666,132 @@ $output 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( + 'Set/Modify Course Assessment Parameters'); + my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; + my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; + $r->print(< + +LON-CAPA Course Environment + +$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)= + ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); + my $section='All Students'; + if ($middle=~/^\[(.*)\]\./) { + $section='Group/Section: '.$1; + $middle=~s/^\[(.*)\]\.//; + } + $middle=~s/\.$//; + my $realm='All Resources'; + if ($middle=~/^(.+)\_\_\_\(all\)$/) { + $realm='Folder/Map: '.&Apache::lonnet::gettitle($1).''; + } elsif ($middle) { + $realm='Resource: '.&Apache::lonnet::gettitle($middle).''; + } + if ($section ne $oldsection) { + $r->print(&tableend()."\n


$section

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

$realm

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

Part: $part

"); + $oldpart=$part; + } +# +# Ready to print +# + $r->print(&tablestart().'
'.$name. + ':'); + if ($resourcedata{$thiskey.'.type'}=~/^date/) { + my $jskey='key_'.$pointer; + $pointer++; + $r->print( + &Apache::lonhtmlcommon::date_setter('overviewform', + $jskey, + $resourcedata{$thiskey}). +'' + ); + } else { + $r->print( + ''); + } + $r->print('