[LON-CAPA-cvs] cvs: loncom /homework grades.pm

www lon-capa-cvs-allow@mail.lon-capa.org
Thu, 14 Jun 2007 21:36:14 -0000


www		Thu Jun 14 17:36:14 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  More work on clickers - note: button not commented out, since apparently already backporting for 2.4.1
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.403 loncom/homework/grades.pm:1.404
--- loncom/homework/grades.pm:1.403	Wed Jun 13 13:18:48 2007
+++ loncom/homework/grades.pm	Thu Jun 14 17:36:12 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.403 2007/06/13 17:18:48 albertel Exp $
+# $Id: grades.pm,v 1.404 2007/06/14 21:36:12 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6078,9 +6078,9 @@
 	'<input type="button" onClick="javascript:checkChoice(this.form,\'3\',\'csvform\');" value="'.&mt('Upload').'" />'.
 	' '.&mt('scores from file').' </td></tr>'."\n";
 
-#    $result.='<tr bgcolor="#ffffe6"><td>'.
-#        '<input type="button" onClick="javascript:checkChoice(this.form,\'6\',\'processclicker\');" value="'.&mt('Process').'" />'.
-#        ' '.&mt('clicker file').' </td></tr>'."\n";
+    $result.='<tr bgcolor="#ffffe6"><td>'.
+        '<input type="button" onClick="javascript:checkChoice(this.form,\'6\',\'processclicker\');" value="'.&mt('Process').'" />'.
+        ' '.&mt('clicker file').' </td></tr>'."\n";
 
     $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
 	'<input type="button" onClick="javascript:checkChoice(this.form,\'4\',\'scantron_selectphase\');'.
@@ -6194,7 +6194,7 @@
     my $type=&mt("Type");
     my $attendance=&mt("Award points just for participation");
     my $personnel=&mt("Correctness determined from response by course personnel");
-    my $specific=&mt("Correctness determind from response with clicker ID"); 
+    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',
@@ -6268,12 +6268,43 @@
     my ($symb)=&get_symb($r);
     if (!$symb) {return '';}
     my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
-    $result.=&show_grading_menu_form($symb);
+    if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) {
+       $result.='<span class="LC_error">'.&mt('You need to specify a clicker ID for the correct answer').'</span>';
+       return $result.&show_grading_menu_form($symb);
+    }
     my %clickerids=&gather_clicker_ids();
-    foreach my $key (keys %clickerids) {
-       $result.='<br />'.$key.' - '.$clickerids{$key};
+    my %correctids=();
+    if ($env{'form.gradingmechanism'} eq 'personnel') {
+       %correctids=&gather_adv_clicker_ids();
+    }
+    if ($env{'form.gradingmechanism'} eq 'specific') {
+       my $correctid=$env{'form.specificid'};
+       $correctid=~tr/a-z/A-Z/;
+       $correctid=~s/\s//gs;
+       $correctids{$correctid}='specified';
     }
-    return $result;
+    if ($env{'form.gradingmechanism'} eq 'attendance') {
+       $result.=&mt('Score based on attendance only');
+    } else {
+       my $number=0;
+       $result.='<h3>'.&mt('Correctness determined by the following IDs').'</h3>';
+       foreach my $id (sort(keys(%correctids))) {
+          $result.='<tt>'.$id.'</tt> - ';
+          if ($correctids{$id} eq 'specified') {
+             $result.=&mt('specified');
+          } else {
+             my ($uname,$udom)=split(/\:/,$correctids{$id});
+             $result.=&Apache::loncommon::plainname($uname,$udom);
+          }
+          $result.='<br />';
+          $number++;
+       }
+       if ($number==0) {
+          $result.='<span class="LC_error">'.&mt('No IDs found to determine correct answer').'</span>';
+          return $result.&show_grading_menu_form($symb);
+       }
+    }
+    return $result.&show_grading_menu_form($symb);
 }
 
 sub handler {