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

www www@source.lon-capa.org
Tue, 27 Apr 2010 00:06:35 -0000


This is a MIME encoded message

--www1272326795
Content-Type: text/plain

www		Tue Apr 27 00:06:35 2010 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Standard tables
  Standardize page headers
  Internationalization
  Detect double data on clickers (after assignment of unknown clickers)
  
  
--www1272326795
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20100427000635.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.631 loncom/homework/grades.pm:1.632
--- loncom/homework/grades.pm:1.631	Sun Apr 25 13:18:32 2010
+++ loncom/homework/grades.pm	Tue Apr 27 00:06:34 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.631 2010/04/25 13:18:32 www Exp $
+# $Id: grades.pm,v 1.632 2010/04/27 00:06:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -820,9 +820,7 @@
        $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'};
     }
 
-    my $result='<h3><span class="LC_info">&nbsp;'
-	.&mt("View/Grade/Regrade Submissions for a Student or a Group of Students")
-	.'</span></h3>';
+    my $result='';
     my $res_error;
     my ($partlist,$handgrade,$responseType) = &response_type($symb,\$res_error);
 
@@ -1913,7 +1911,6 @@
     if ($counter == 0) {
 	&sub_page_js($request);
 	&sub_page_kw_js($request);
-	$request->print('<h3>&nbsp;<span class="LC_info">'.&mt('Submission Record').'</span></h3>');
 
 	# option to display problem, only once else it cause problems 
         # with the form later since the problem has a form.
@@ -2693,9 +2690,7 @@
 	$ctr++;
     }
     if ($total < 0) {
-	my $the_end = '<h3><span class="LC_info">'.&mt('LON-CAPA User Message').'</span></h3><br />'."\n";
-	$the_end.=&mt('<b>Message: </b> No more students for this section or class.').'<br /><br />'."\n";
-	$the_end.=&mt('Click on the button below to return to the grading menu.').'<br /><br />'."\n";
+	my $the_end.=&mt('<b>Message: </b> No more students for this section or class.').'<br /><br />'."\n";
 	$request->print($the_end);
     }
     return '';
@@ -3824,18 +3819,14 @@
 	$javascript=&csvupload_javascript_forward_associate();
     }
 
-    my $result='';
     $symb = &Apache::lonenc::check_encrypt($symb);
+    $request->print('<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">'.
+                    &mt('Total number of records found in file: [_1]',$distotal).'<hr />'.
+                    &mt('Associate entries from the uploaded file with as many fields as you can.'));
+    my $reverse=&mt("Reverse Association");
     $request->print(<<ENDPICK);
-<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">
-<h3><span class="LC_info">Uploading Class Grades</span></h3>
-$result
-<hr />
-<h3>Identify fields</h3>
-Total number of records found in file: $distotal <hr />
-Enter as many fields as you can. The system will inform you and bring you back
-to this page if the data selected is insufficient to run your class.<hr />
-<input type="button" value="Reverse Association" onclick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" />
+<br />
+<input type="button" value="$reverse" onclick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" />
 <input type="hidden" name="associate"  value="" />
 <input type="hidden" name="phase"      value="three" />
 <input type="hidden" name="datatoken"  value="$datatoken" />
@@ -3908,11 +3899,11 @@
     my ($request,$symb) = @_;
     if (!$symb) {return '';}
     my $result=&checkforfile_js();
-    $result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n";
-    $result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n";
-    $result.='&nbsp;<b>'.&mt('Specify a file containing the class scores for current resource.').
-	'</b></td></tr>'."\n";
-    $result.='<tr bgcolor=#ffffe6><td>'."\n";
+    $result.=&Apache::loncommon::start_data_table().
+             &Apache::loncommon::start_data_table_header_row().
+             '<th>'.&mt('Specify a file containing the class scores for current resource.').'</th>'.
+             &Apache::loncommon::end_data_table_header_row().
+             &Apache::loncommon::start_data_table_row().'<td>';
     my $upload=&mt("Upload Scores");
     my $upfile_select=&Apache::loncommon::upfile_select_html();
     my $ignore=&mt('Ignore First Line');
@@ -3926,9 +3917,10 @@
 </form>
 ENDUPFORM
     $result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
-                           &mt("How do I create a CSV file from a spreadsheet"))
-    .'</td></tr></table>'."\n";
-    $result.='</td></tr></table><br /><br />'."\n";
+                           &mt("How do I create a CSV file from a spreadsheet")).
+             '</td>'.
+            &Apache::loncommon::end_data_table_row().
+            &Apache::loncommon::end_data_table();
     return $result;
 }
 
@@ -3980,29 +3972,21 @@
 
 sub csvuploadoptions {
     my ($request,$symb)= @_;
+    my $overwrite=&mt('Overwrite any existing score');
     $request->print(<<ENDPICK);
 <form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">
-<h3><span class="LC_info">Uploading Class Grade Options</span></h3>
 <input type="hidden" name="command"    value="csvuploadassign" />
-<!--
-<p>
-<label>
-   <input type="checkbox" name="show_full_results" />
-   Show a table of all changes
-</label>
-</p>
--->
 <p>
 <label>
    <input type="checkbox" name="overwite_scores" checked="checked" />
-   Overwrite any existing score
+   $overwrite
 </label>
 </p>
 ENDPICK
     my %fields=&get_fields();
     if (!defined($fields{'domain'})) {
 	my $domform = &Apache::loncommon::select_dom_form($env{'request.role.domain'},'default_domain');
-	$request->print("\n<p> Users are in domain: ".$domform."</p>\n");
+	$request->print("\n<p>".&mt('Users are in domain: [_1]',$domform)."</p>\n");
     }
     foreach my $key (sort(keys(%env))) {
 	if ($key !~ /^form\.(.*)$/) { next; }
@@ -4042,7 +4026,6 @@
     &Apache::loncommon::load_tmp_file($request);
     my @gradedata = &Apache::loncommon::upfile_record_sep();
     my %fields=&get_fields();
-    $request->print('<h3>Assigning Grades</h3>');
     my $courseid=$env{'request.course.id'};
     my ($classlist) = &getclasslist('all',0);
     my @notallowed;
@@ -8501,11 +8484,7 @@
 
     $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
         '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
-    $result.='
-<h2>
-  '.&mt('Grade page/folder for one student').'
-</h2>'.
-            &selectfield(0).
+    $result.=&selectfield(0).
             '<input type="hidden" name="command" value="pickStudentPage" />
             <div>
               <input type="submit" value="'.&mt('Next').' &rarr;" />
@@ -8524,11 +8503,7 @@
     $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
         '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
 
-    $result.='
-<h2>
-  '.&mt('Grading table').'
-</h2>'.
-            &selectfield(0).
+    $result.=&selectfield(0).
             '<input type="hidden" name="command" value="viewgrades" />
             <div>
               <input type="submit" value="'.&mt('Next').' &rarr;" />
@@ -8570,10 +8545,7 @@
 
     $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\n".
 	'<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n";
-    $result.='
-<h2>
-  '.&mt('Select individual students to grade').'
-</h2>'.&selectfield(1).'
+    $result.=&selectfield(1).'
                 <input type="hidden" name="command" value="submission" /> 
 	      <input type="submit" value="'.&mt('Next').' &rarr;" />
             </div>
@@ -8715,11 +8687,11 @@
     my ($r,$symb)=@_;
     if (!$symb) {return '';}
     my $result=&checkforfile_js();
-    $result.='<br /><table width="100%" border="0"><tr><td bgcolor="#777777">'."\n";
-    $result.='<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>'."\n";
-    $result.='&nbsp;<b>'.&mt('Specify a file containing the clicker information for this resource.').
-        '</b></td></tr>'."\n";
-    $result.='<tr bgcolor="#ffffe6"><td>'."\n";
+    $result.=&Apache::loncommon::start_data_table().
+             &Apache::loncommon::start_data_table_header_row().
+             '<th>'.&mt('Specify a file containing clicker information and set grading options.').'</th>'.
+             &Apache::loncommon::end_data_table_header_row().
+             &Apache::loncommon::start_data_table_row()."<td>\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',
@@ -8736,7 +8708,7 @@
        }
     }
 
-    my $upload=&mt("Upload File");
+    my $upload=&mt("Evaluate File");
     my $type=&mt("Type");
     my $attendance=&mt("Award points just for participation");
     my $personnel=&mt("Correctness determined from response by course personnel");
@@ -8794,7 +8766,10 @@
 <input type="hidden" name="command" value="processclickerfile" />
 <input type="file" name="upfile" size="50" />
 <br /><label>$type: $selectform</label>
-<br /><label><input type="radio" name="gradingmechanism" value="attendance"$checked{'attendance'} onclick="sanitycheck()" />$attendance </label>
+ENDUPFORM
+    $result.='</td>'.&Apache::loncommon::end_data_table_row().
+                     &Apache::loncommon::start_data_table_row().'<td>'.(<<ENDGRADINGFORM);
+      <label><input type="radio" name="gradingmechanism" value="attendance"$checked{'attendance'} onclick="sanitycheck()" />$attendance </label>
 <br /><label><input type="radio" name="gradingmechanism" value="personnel"$checked{'personnel'} onclick="sanitycheck()" />$personnel</label>
 <br /><label><input type="radio" name="gradingmechanism" value="specific"$checked{'specific'} onclick="sanitycheck()" />$specific </label>
 <input type="text" name="specificid" value="$env{'form.specificid'}" size="20" />
@@ -8802,13 +8777,17 @@
 <br />&nbsp;&nbsp;&nbsp;
 <input type="text" name="givenanswer" size="50" />
 <input type="hidden" name="waschecked" value="$env{'form.gradingmechanism'}" />
-<br /><label>$pcorrect: <input type="text" name="pcorrect" size="4" value="$env{'form.pcorrect'}" onchange="sanitycheck()" /></label>
+ENDGRADINGFORM
+         $result.='</td>'.&Apache::loncommon::end_data_table_row().
+                     &Apache::loncommon::start_data_table_row().'<td>'.(<<ENDPERCFORM);
+      <label>$pcorrect: <input type="text" name="pcorrect" size="4" value="$env{'form.pcorrect'}" onchange="sanitycheck()" /></label>
 <br /><label>$pincorrect: <input type="text" name="pincorrect" size="4" value="$env{'form.pincorrect'}" onchange="sanitycheck()" /></label>
 <br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" />
 </form>'
-ENDUPFORM
-    $result.='</td></tr></table>'."\n".
-             '</td></tr></table><br /><br />'."\n";
+ENDPERCFORM
+    $result.='</td>'.
+             &Apache::loncommon::end_data_table_row().
+             &Apache::loncommon::end_data_table();
     return $result;
 }
 
@@ -8888,11 +8867,12 @@
 
     $result.=&Apache::loncommon::studentbrowser_javascript();
     $symb = &Apache::lonenc::check_encrypt($symb);
-    my $heading=&mt('Scanning clicker file');
-    $result.=(<<ENDHEADER);
-<br /><table width="100%" border="0"><tr><td bgcolor="#777777">
-<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>
-<b>$heading</b></td></tr><tr bgcolor=#ffffe6><td>
+    $result.=&Apache::loncommon::start_data_table().
+             &Apache::loncommon::start_data_table_header_row().
+             '<th>'.&mt('Evaluate clicker file').'</th>'.
+             &Apache::loncommon::end_data_table_header_row().
+             &Apache::loncommon::start_data_table_row().(<<ENDHEADER);
+<td>
 <form method="post" action="/adm/grades" name="clickeranalysis">
 <input type="hidden" name="symb" value="$symb" />
 <input type="hidden" name="command" value="assignclickergrades" />
@@ -8940,7 +8920,9 @@
        } elsif ($clicker_ids{$id}) {
           if ($clicker_ids{$id}=~/\,/) {
 # More than one user with the same clicker!
-             $result.="\n<hr />".&mt('Clicker registered more than once').": <tt>".$id."</tt><br />";
+             $result.="</td>".&Apache::loncommon::end_data_table_row().
+                           &Apache::loncommon::start_data_table_row()."<td>".
+                       &mt('Clicker registered more than once').": <tt>".$id."</tt><br />";
              $result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'.
                            "<select name='multi".$id."'>";
              foreach my $reguser (sort(split(/\,/,$clicker_ids{$id}))) {
@@ -8954,7 +8936,9 @@
              $student_count++;
           }
        } else {
-          $result.="\n<hr />".&mt('Unregistered Clicker')." <tt>".$id."</tt><br />";
+          $result.="</td>".&Apache::loncommon::end_data_table_row().
+                           &Apache::loncommon::start_data_table_row()."<td>".
+                    &mt('Unregistered Clicker')." <tt>".$id."</tt><br />";
           $result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'.
                    "\n".&mt("Username").": <input type='text' name='uname".$id."' />&nbsp;".
                    "\n".&mt("Domain").": ".
@@ -8980,8 +8964,9 @@
     } else {
        $result.='<br /><input type="submit" name="finalize" value="'.&mt('Finalize Grading').'" />';
     }
-    $result.='</form></td></tr></table>'."\n".
-             '</td></tr></table><br /><br />'."\n";
+    $result.='</form></td>'.
+             &Apache::loncommon::end_data_table_row().
+             &Apache::loncommon::end_data_table();
     return $result;
 }
 
@@ -9055,14 +9040,11 @@
 # FIXME: This should probably look for the first handgradeable part
     my $part=$$partlist[0];
 # Start screen output
-    my $result='';
-
-    my $heading=&mt('Assigning grades based on clicker file');
-    $result.=(<<ENDHEADER);
-<br /><table width="100%" border="0"><tr><td bgcolor="#777777">
-<table width="100%" border="0"><tr bgcolor="#e6ffff"><td>
-<b>$heading</b></td></tr><tr bgcolor=#ffffe6><td>
-ENDHEADER
+    my $result=&Apache::loncommon::start_data_table().
+             &Apache::loncommon::start_data_table_header_row().
+             '<th>'.&mt('Assigning grades based on clicker file').'</th>'.
+             &Apache::loncommon::end_data_table_header_row().
+             &Apache::loncommon::start_data_table_row().'<td>';
 # Get correct result
 # FIXME: Possibly need delimiter other than ":"
     my @correct=();
@@ -9097,6 +9079,7 @@
     my $pcorrect=$env{'form.pcorrect'};
     my $pincorrect=$env{'form.pincorrect'};
     my $storecount=0;
+    my %users=();
     foreach my $key (keys(%env)) {
        my $user='';
        if ($key=~/^form\.student\:(.*)$/) {
@@ -9110,7 +9093,13 @@
              $user=$env{'form.multi'.$id};
           }
        }
-       if ($user) { 
+       if ($user) {
+          if ($users{$user}) {
+             $result.='<br /><span class="LC_warning">'.
+                      &mt("More than one entry found for <tt>[_1]</tt>!",$user).
+                      '</span><br />';
+          }
+          $users{$user}=1; 
           my @answer=split(/\,/,$env{$key});
           my $sum=0;
           my $realnumber=$number;
@@ -9150,8 +9139,9 @@
     }
 # We are done
     $result.='<br />'.&mt('Successfully stored grades for [quant,_1,student].',$storecount).
-             '</td></tr></table>'."\n".
-             '</td></tr></table><br /><br />'."\n";
+             '</td>'.
+             &Apache::loncommon::end_data_table_row().
+             &Apache::loncommon::end_data_table();
     return $result;
 }
 
@@ -9167,6 +9157,7 @@
     unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"});
     $r->print(&Apache::loncommon::start_page('Grading',undef,
                                           {'bread_crumbs' => $crumbs}));
+    $r->print('<h3>'.$$crumbs[-1]{'text'}.'</h3>');
     unless ($nodisplayflag) {
        $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag));
     }
@@ -9174,7 +9165,7 @@
 
 sub select_problem {
     my ($r)=@_;
-    $r->print('<h2>'.&mt('Select the problem or one of the problems you want to grade').'</h2><form action="/adm/grades">');
+    $r->print('<h3>'.&mt('Select the problem or one of the problems you want to grade').'</h3><form action="/adm/grades">');
     $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1));
     $r->print('<input type="hidden" name="command" value="gradingmenu" />');
     $r->print('<input type="submit" value="'.&mt('Next').' &rarr;" /></form>');

--www1272326795--