Diff for /loncom/homework/grades.pm between versions 1.601 and 1.602

version 1.601, 2010/03/21 18:31:45 version 1.602, 2010/03/25 19:56:33
Line 214  sub get_display_part { Line 214  sub get_display_part {
     return $display;      return $display;
 }  }
   
 #--- Show resource title  
 #--- and parts and response type  
 #sub showResourceInfo {  
 #    my ($symb,$probTitle,$checkboxes,$res_error) = @_;  
 #    my $result = '<h3>'.&mt('Current Resource').': '.$probTitle.'</h3>'."\n";  
 #    my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);  
 #    if (ref($res_error)) {  
 #        if ($$res_error) {  
 #            return;  
 #        }  
 #    }  
 #    $result.=&Apache::loncommon::start_data_table()  
 #            .&Apache::loncommon::start_data_table_header_row();  
 #    if ($checkboxes) {  
 #        $result.='<th>&nbsp;</th>';  
 #    }  
 #    $result.='<th>'.&mt('Problem Part').'</th>'  
 #            .'<th>'.&mt('Res. ID').'</th>'  
 #            .'<th>'.&mt('Type').'</th>'  
 #            .&Apache::loncommon::end_data_table_header_row();  
 #    my %resptype = ();  
 #    my $hdgrade='no';  
 #    my %partsseen;  
 #    foreach my $partID (sort(keys(%$responseType))) {  
 #        foreach my $resID (sort(keys(%{ $responseType->{$partID} }))) {  
 #            my $handgrade=$$handgrade{$partID.'_'.$resID};  
 #            my $responsetype = $responseType->{$partID}->{$resID};  
 #            $hdgrade = $handgrade if ($handgrade eq 'yes');  
 #            $result.=&Apache::loncommon::start_data_table_row();  
 #            if ($checkboxes) {  
 #                if (exists($partsseen{$partID})) {  
 #                    $result.="<td>&nbsp;</td>";  
 #                } else {  
 #                    $result.="<td><input type='checkbox' name='vPart' value='$partID' checked='checked' /></td>";  
 #                }  
 #                $partsseen{$partID}=1;  
 #            }  
 #            my $display_part=&get_display_part($partID,$symb);  
 #            $result.='<td>'.$display_part.'</td>'  
 #                    .'<td>'.'<span class="LC_internal_info">'.$resID.'</span></td>'  
 #                    .'<td>'.&mt($responsetype).'</td>'  
 #                   .'<td>'.&mt('<b>Handgrade: </b>[_1]',$handgrade).'</td>'  
 #                    .&Apache::loncommon::end_data_table_row();  
 #       }  
 #    }  
 #    $result.=&Apache::loncommon::end_data_table();  
 #    return $result,$responseType,$hdgrade,$partlist,$handgrade;  
 #}  
   
 sub reset_caches {  sub reset_caches {
     &reset_analyze_cache();      &reset_analyze_cache();
     &reset_perm();      &reset_perm();
Line 776  sub most_similar { Line 727  sub most_similar {
   
 #------------------------------------ Receipt Verification Routines  #------------------------------------ Receipt Verification Routines
 #  #
   
   sub initialverifyreceipt {
      my $request = shift;
      &commonJSfunctions($request);
      $request->print('<form name="gradingMenu"><input type="submit" value="'.&mt('Verify Receipt No.').'" />'.
           &Apache::lonnet::recprefix($env{'request.course.id'}).
           '-<input type="text" name="receipt" size="4" />'.
           "</form>\n");
   }
   
 #--- Check whether a receipt number is valid.---  #--- Check whether a receipt number is valid.---
 sub verifyreceipt {  sub verifyreceipt {
     my $request  = shift;      my $request  = shift;
Line 885  sub listStudents { Line 846  sub listStudents {
  .&mt("$viewgrade Submissions for a Student or a Group of Students")   .&mt("$viewgrade Submissions for a Student or a Group of Students")
  .'</span></h3>';   .'</span></h3>';
   
 #    my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($symb,$env{'form.probTitle'},($env{'form.showgrading'} eq 'yes'));  
     my ($partlist,$handgrade,$responseType) = &response_type($symb      my ($partlist,$handgrade,$responseType) = &response_type($symb
 #,$res_error  #,$res_error
     );      );
Line 8521  sub grading_menu { Line 8481  sub grading_menu {
     if (!$symb) {return '';}      if (!$symb) {return '';}
     my $probTitle = &Apache::lonnet::gettitle($symb);      my $probTitle = &Apache::lonnet::gettitle($symb);
   
 #    $request->print($table);  
     my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb),      my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb),
                   'probTitle'=>$probTitle,                    'probTitle'=>$probTitle,
                   'command'=>'individual',                    'command'=>'individual',
Line 8547  sub grading_menu { Line 8506  sub grading_menu {
           
     $fields{'command'} = 'scantron_selectphase';      $fields{'command'} = 'scantron_selectphase';
     my $url4 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);      my $url4 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
   
       $fields{'command'} = 'initialverifyreceipt';
       my $url5 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
           
     my @menu = ({ categorytitle=>'Hand Grading',      my @menu = ({ categorytitle=>'Hand Grading',
             items =>[              items =>[
Line 8595  sub grading_menu { Line 8557  sub grading_menu {
                     permission => 'F',                      permission => 'F',
                     icon => 'stat.png',                      icon => 'stat.png',
                     linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.'                      linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.'
                    }                     },
                               {   linktext => 'Verify Receipt No.',
                                   url => $url5,
                                   permission => 'F',
                                   icon => 'edit-find-replace.png',
                                   linktitle => 'Verify a system-generated receipt number for correct problem solution.'
                               }
   
                     ]                      ]
             });              });
   
     #$fields{'command'} = 'verify';  
     #$url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);  
     #  
     # Create the menu      # Create the menu
     my $Str;      my $Str;
     # $Str .= '<h2>'.&mt('Please select a grading task').'</h2>';  
     $Str .= '<form method="post" action="" name="gradingMenu">';      $Str .= '<form method="post" action="" name="gradingMenu">';
     $Str .= '<input type="hidden" name="command" value="" />'.      $Str .= '<input type="hidden" name="command" value="" />'.
     '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".      '<input type="hidden" name="symb"        value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
 # '<input type="hidden" name="handgrade"   value="'.$hdgrade.'" />'."\n".  
  '<input type="hidden" name="probTitle"   value="'.$probTitle.'" />'."\n".   '<input type="hidden" name="probTitle"   value="'.$probTitle.'" />'."\n".
  '<input type="hidden" name="gradingMenu" value="1" />'."\n".   '<input type="hidden" name="gradingMenu" value="1" />'."\n".
  '<input type="hidden" name="showgrading" value="yes" />'."\n";   '<input type="hidden" name="showgrading" value="yes" />'."\n";
   
     $Str .= Apache::lonhtmlcommon::generate_menu(@menu);      $Str .= &Apache::lonhtmlcommon::generate_menu(@menu);
     #$menudata->{'jscript'}  
     $Str .='<hr /><input type="button" value="'.&mt('Verify Receipt No.').'" '.  
         ' onclick="javascript:checkChoice(document.forms.gradingMenu,\'5\',\'verify\')" '.  
         ' /> '.  
         &Apache::lonnet::recprefix($env{'request.course.id'}).  
         '-<input type="text" name="receipt" size="4" onchange="javascript:checkReceiptNo(this.form,\'OK\')" />';  
   
     $Str .="</form>\n";  
     my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");  
     $request->print(&Apache::lonhtmlcommon::scripttag(<<GRADINGMENUJS));  
     function checkChoice(formname,val,cmdx) {  
  if (val <= 2) {  
     var cmd = radioSelection(formname.radioChoice);  
     var cmdsave = cmd;  
  } else {  
     cmd = cmdx;  
     cmdsave = 'submission';  
  }  
  formname.command.value = cmd;  
  if (val < 5) formname.submit();  
  if (val == 5) {  
     if (!checkReceiptNo(formname,'notOK')) {   
         return false;  
     } else {  
         formname.submit();  
     }  
  }  
     }  
   
     function checkReceiptNo(formname,nospace) {  
  var receiptNo = formname.receipt.value;  
  var checkOpt = false;  
  if (nospace == "OK" && isNaN(receiptNo)) {checkOpt = true;}  
  if (nospace == "notOK" && (isNaN(receiptNo) || receiptNo == "")) {checkOpt = true;}  
  if (checkOpt) {  
     alert("$receiptalert");  
     formname.receipt.value = "";  
     formname.receipt.focus();  
     return false;  
  }  
  return true;  
     }  
 GRADINGMENUJS  
     &commonJSfunctions($request);  
     return $Str;          return $Str;    
 }  }
   
Line 9399  sub handler { Line 9319  sub handler {
     $request->print(&processHandGrade($request));      $request->print(&processHandGrade($request));
  } elsif ($command eq 'editgrades' && $perm{'mgr'}) {   } elsif ($command eq 'editgrades' && $perm{'mgr'}) {
     $request->print(&editgrades($request));      $request->print(&editgrades($request));
           } elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) {
               $request->print(&initialverifyreceipt($request));
  } elsif ($command eq 'verify' && $perm{'vgr'}) {   } elsif ($command eq 'verify' && $perm{'vgr'}) {
     $request->print(&verifyreceipt($request));      $request->print(&verifyreceipt($request));
         } elsif ($command eq 'processclicker' && $perm{'mgr'}) {          } elsif ($command eq 'processclicker' && $perm{'mgr'}) {

Removed from v.1.601  
changed lines
  Added in v.1.602


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>