--- loncom/homework/grades.pm 2007/06/16 14:09:52 1.412 +++ loncom/homework/grades.pm 2007/06/16 14:38:45 1.413 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.412 2007/06/16 14:09:52 www Exp $ +# $Id: grades.pm,v 1.413 2007/06/16 14:38:45 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -6178,6 +6178,14 @@ sub gather_adv_clicker_ids { return %clicker_ids; } +sub clicker_grading_parameters { + return ('gradingmechanism' => 'scalar', + 'upfiletype' => 'scalar', + 'specificid' => 'scalar', + 'pcorrect' => 'scalar', + 'pincorrect' => 'scalar'); +} + sub process_clicker { my ($r)=@_; my ($symb)=&get_symb($r); @@ -6191,6 +6199,22 @@ sub process_clicker { $result.=' '.&mt('Specify a file containing the clicker information for this resource'). '.'."\n"; $result.=''."\n"; +# Attempt to restore parameters from last session, set defaults if not present + my %Saveable_Parameters=&clicker_grading_parameters(); + &Apache::loncommon::restore_course_settings('grades_clicker', + \%Saveable_Parameters); + if (!$env{'form.pcorrect'}) { $env{'form.pcorrect'}=100; } + if (!$env{'form.pincorrect'}) { $env{'form.pincorrect'}=100; } + if (!$env{'form.gradingmechanism'}) { $env{'form.gradingmechanism'}='attendance'; } + if (!$env{'form.upfiletype'}) { $env{'form.upfiletype'}='iclicker'; } + + my %checked; + foreach my $gradingmechanism ('attendance','personnel','specific') { + if ($env{'form.gradingmechanism'} eq $gradingmechanism) { + $checked{$gradingmechanism}="checked='checked'"; + } + } + my $upload=&mt("Upload File"); my $type=&mt("Type"); my $attendance=&mt("Award points just for participation"); @@ -6198,7 +6222,7 @@ sub process_clicker { my $specific=&mt("Correctness determined from response with clicker ID"); my $pcorrect=&mt("Percentage points for correct solution"); my $pincorrect=&mt("Percentage points for incorrect solution"); - my $selectform=&Apache::loncommon::select_form('iclicker','upfiletype', + my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype', ('iclicker' => 'i>clicker')); $result.=<
-
-
-
- - -
-
+
+
+
+ + +
+

ENDUPFORM @@ -6268,6 +6292,11 @@ sub process_clicker_file { my ($r)=@_; my ($symb)=&get_symb($r); if (!$symb) {return '';} + + my %Saveable_Parameters=&clicker_grading_parameters(); + &Apache::loncommon::store_course_settings('grades_clicker', + \%Saveable_Parameters); + my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) { $result.=''.&mt('You need to specify a clicker ID for the correct answer').'';