--- loncom/interface/lonparmset.pm 2003/06/24 20:54:20 1.111 +++ 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.111 2003/06/24 20:54:20 sakharuk 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) { @@ -488,9 +494,15 @@ sub print_row { sub print_td { my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; $r->print(''. - &plink($$typeoutpar[$which],$$display{$value},$$outpar[$which], - $mprefix."$which",'parmform.pres','psub').''."\n"); + ' align="center">'); + if ($which<10) { + $r->print(&plink($$typeoutpar[$which], + $$display{$value},$$outpar[$which], + $mprefix."$which",'parmform.pres','psub')); + } else { + $r->print(&valout($$outpar[$which],$$typeoutpar[$which])); + } + $r->print(''."\n"); } sub get_env_multiple { @@ -641,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'; @@ -852,7 +864,7 @@ sub assessparms { $message.="Write Error: $1"; } # ---------------------------------------------------------------- Done storing - $message.='

Changes can take up to 10 minutes before being active for all students

'; + $message.='

Changes can take up to 10 minutes before being active for all students.'.&Apache::loncommon::help_open_topic('Caching').'

'; } # --------------------------------------------- Devalidate cache for this child &Apache::lonnet::devalidatecourseresdata( @@ -892,7 +904,11 @@ sub assessparms { &startpage($r,$id,$udom,$csec,$uname,$have_assesments); - if (!$have_assesments) { return ''; } + if (!$have_assesments) { + untie(%bighash); + untie(%parmhash); + return ''; + } # if ($ENV{'form.url'}) { # $r->print(''); @@ -907,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(''); @@ -1030,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(''); @@ -1136,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(). + '

'); +} ################################################## ################################################## @@ -1647,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; } @@ -1658,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
'. @@ -1144,7 +1162,7 @@ ENDTABLEHEADFOUR '

'. "$bighash{'title_'.$rid}"); + " TARGET=_self>$title"); if ($thistitle) { $r->print(' ('.$thistitle.')'); @@ -1470,6 +1488,10 @@ sub crsenv { 'description' => 'Course Description', 'courseid' => 'Course ID or number
'. '(internal, optional)', + 'grading' => 'Grading'. + '"standard" or any other value. '. + 'Default for new courses is "standard".', + 'default_xml_style' => 'Default XML Style File '. '
'Visibly Separate Items on Pages
'. '("yes" for visible separation, '. 'changes will not show until next login)', + + 'plc.roles.denied'=> 'Disallow live chatroom use for '. + 'Roles
"st": '. + 'student, "ta": '. + 'TA, "in": '. + 'instructor;
role,role,...) '. + Apache::loncommon::help_open_topic("Course_Disable_Discussion"), + 'plc.users.denied' => + 'Disallow live chatroom use for Users
'. + '(user:domain,user:domain,...)', + 'pch.roles.denied'=> 'Disallow Resource Discussion for '. 'Roles
"st": '. 'student, "ta": '. @@ -1517,9 +1550,9 @@ sub crsenv { => 'Randomization algorithm used
'. 'Modifying this will make problems '. 'have different numbers and answers', - 'problem_split' + 'problem_stream_switch' => 'Allow problems to be split over pages
'. - ' ("yes" if allowed, anything else if not)',, + ' ("yes" if allowed, anything else if not)', 'anonymous_quiz' => 'Anonimous quiz/exam
'. ' (yes to avoid print students names )', @@ -1527,16 +1560,21 @@ sub crsenv { 'when enrolling students
', 'default_enrollment_end_date' => 'Default ending date '. 'when enrolling students', - 'languages' => 'Languages used' + 'languages' => 'Languages used', + 'disable_receipt_display' + => 'Disable display of problem receipts
'. + ' ("yes" to disable, anything else if not)' ); - my @Display_Order = ('url','description','courseid', + my @Display_Order = ('url','description','courseid','grading', 'default_xml_style','pageseparators', 'question.email','comment.email','policy.email', + 'plc.roles.denied','plc.users.denied', 'pch.roles.denied','pch.users.denied', 'allow_limited_html_in_feedback', 'languages', 'rndseed', 'problem_stream_switch', + 'disable_receipt_display', 'spreadsheet_default_classcalc', 'spreadsheet_default_studentcalc', 'spreadsheet_default_assesscalc', @@ -1628,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('