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

banghart lon-capa-cvs-allow@mail.lon-capa.org
Thu, 04 Oct 2007 02:00:30 -0000


This is a MIME encoded message

--banghart1191463230
Content-Type: text/plain

banghart		Wed Oct  3 22:00:30 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	Saving work in progress. This really messes things up for the user.
  	You can still get to the previous PGRD initial screen by selecting
  	Manual Grade/View Submissions on the new menu.
  
  
--banghart1191463230
Content-Type: text/plain
Content-Disposition: attachment; filename="banghart-20071003220030.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.442 loncom/homework/grades.pm:1.443
--- loncom/homework/grades.pm:1.442	Mon Oct  1 15:41:51 2007
+++ loncom/homework/grades.pm	Wed Oct  3 22:00:29 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.442 2007/10/01 19:41:51 banghart Exp $
+# $Id: grades.pm,v 1.443 2007/10/04 02:00:29 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6945,8 +6945,159 @@
     return \%savedState;
 }
 
-#--- Displays the main menu page -------
-sub gradingmenu {
+sub grading_menu {
+    my ($request) = @_;
+    my ($symb)=&get_symb($request);
+    if (!$symb) {return '';}
+    my $probTitle = &Apache::lonnet::gettitle($symb);
+    my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
+
+    #
+    # Define menu data
+     
+    my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb),
+                  'handgrade'=>$hdgrade,
+                  'probTitle'=>$probTitle,
+                  'command'=>'submit_options',
+                  'saveState'=>"",
+                  'gradingMenu'=>1,
+                  'showgrading'=>"yes");
+    my $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+    my @menu = ({ url => $url,
+                     name => &mt('Manual Grading/View Submissions'),
+                     short_description => 
+    &mt('Start the process of hand grading submissions.'),
+                 });
+    $fields{'command'} = 'csvform';
+    $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+    push (@menu, { url => $url,
+                   name => &mt('Upload Scores'),
+                   short_description => 
+            &mt('Specify a file containing the class scores for current resource.')});
+    $fields{'command'} = 'processclicker';
+    $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+    push (@menu, { url => $url,
+                   name => &mt('Process Clicker'),
+                   short_description => 
+            &mt('Specify a file containing the clicker information for this resource.')});
+    $fields{'command'} = 'scantron_selectphase';
+    $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+    push (@menu, { url => $url,
+                   name => &mt('Grade Scantron Forms'),
+                   short_description => 
+            &mt('')});
+    $fields{'command'} = 'verify';
+    $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+    push (@menu, { url => $url,
+                   name => &mt('Verify Receipt'),
+                   short_description => 
+            &mt('')});
+    $fields{'command'} = 'manage';
+    $url = &Apache::lonhtmlcommon::build_url('/adm/helper/resettimes.helper',\%fields);
+    push (@menu, { url => $url,
+                   name => &mt('Manage Access Times'),
+                   short_description => 
+            &mt('')});
+    $fields{'command'} = 'view';
+    $url = &Apache::lonhtmlcommon::build_url('/adm/pickcode',\%fields);
+    push (@menu, { url => $url,
+                   name => &mt('View Saved CODEs'),
+                   short_description => 
+            &mt('')});
+
+    #
+    # Create the menu
+    my $Str;
+    $Str .= '<h2>'.&mt('Please select a grading task').'</h2>';
+    foreach my $menudata (@menu) {
+        $Str .='    <h3><a href="'.
+            $menudata->{'url'}.'" >'.
+            $menudata->{'name'}."</a></h3>\n";
+        $Str .= '    '.('&nbsp;'x8).$menudata->{'short_description'}.
+            "\n";
+    }
+    $Str .="</dl>\n";
+    
+    $request->print(<<GRADINGMENUJS);
+<script type="text/javascript" language="javascript">
+    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;
+	formname.saveState.value = "saveCmd="+cmdsave+":saveSec="+pullDownSelection(formname.section)+
+	    ":saveSub="+pullDownSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.Status);
+	if (val < 5) formname.submit();
+	if (val == 5) {
+	    if (!checkReceiptNo(formname,'notOK')) { return false;}
+	    formname.submit();
+	}
+	if (val < 7) 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("Please enter a receipt number given by a student in the receipt box.");
+	    formname.receipt.value = "";
+	    formname.receipt.focus();
+	    return false;
+	}
+	return true;
+    }
+</script>
+GRADINGMENUJS
+    &commonJSfunctions($request);
+    my $result='<h3>&nbsp;<span class="LC_info">Manual Grading/View Submission</span></h3>';
+    $result.=$table;
+    my (undef,$sections) = &getclasslist('all','0');
+    my $savedState = &savedState();
+    my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'submission' : $$savedState{'saveCmd'});
+    my $saveSec = ($$savedState{'saveSec'} eq '' ? 'all' : $$savedState{'saveSec'});
+    my $saveSub = ($$savedState{'saveSub'} eq '' ? 'all' : $$savedState{'saveSub'});
+    my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'});
+
+    $result.='<form action="/adm/grades" method="post" name="gradingMenu">'."\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.'" ue="" />'."\n".
+	'<input type="hidden" name="saveState"   value="" />'."\n".
+	'<input type="hidden" name="gradingMenu" value="1" />'."\n".
+	'<input type="hidden" name="showgrading" value="yes" />'."\n";
+
+    $result.='<table width="100%" border="0"><tr><td bgcolor=#777777>'."\n".
+	'<table width="100%" border="0"><tr bgcolor="#e6ffff"><td colspan="2">'."\n".
+	'&nbsp;<b>Select a Grading/Viewing Option</b></td></tr>'."\n".
+	'<tr bgcolor="#ffffe6" valign="top"><td>'."\n";
+
+    $result.='<table width="100%" border="0">';
+    $result.='<tr bgcolor="#ffffe6" valign="top">'."\n";
+    $result.='<td><b>'.&mt('Sections').'</b></td>';
+#    $result.='<td>Groups</td>';
+    $result.='<td><b>'.&mt('Access Status').'</td>'."\n";
+    $result.='</tr>';
+    $result.='<tr bgcolor="#ffffe6" valign="top"><td>'."\n".
+	'&nbsp;<select name="section" multiple="multiple" size="3">'."\n";
+    if (ref($sections)) {
+	foreach (sort (@$sections)) {
+	    $result.='<option value="'.$_.'" '.
+		($saveSec eq $_ ? 'selected="selected"':'').'>'.$_.'</option>'."\n";
+	}
+    }
+    $result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="selected"' : ''). '>all</option></select> &nbsp; ';
+    return $Str;    
+}
+
+
+#--- Displays the submissions first page -------
+sub submit_options {
     my ($request) = @_;
     my ($symb)=&get_symb($request);
     if (!$symb) {return '';}
@@ -7375,6 +7526,8 @@
     }
     $result.='<br />'.&mt('Found [_1] question(s)',$number).'<br />'.
              '<input type="hidden" name="number" value="'.$number.'" />'.
+             &mt('Awarding [_1] percent for corrion(s)',$number).'<br />'.
+             '<input type="hidden" name="number" value="'.$number.'" />'.
              &mt('Awarding [_1] percent for correct and [_2] percent for incorrect responses',
                  $env{'form.pcorrect'},$env{'form.pincorrect'}).
              '<br />';
@@ -7661,7 +7814,9 @@
 	} elsif ($command eq 'processGroup' && $perm{'vgr'}) {
 	    &processGroup($request);
 	} elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {
-	    $request->print(&gradingmenu($request));
+	    $request->print(&grading_menu($request));
+	} elsif ($command eq 'submit_options' && $perm{'vgr'}) {
+	    $request->print(&submit_options($request));
 	} elsif ($command eq 'viewgrades' && $perm{'vgr'}) {
 	    $request->print(&viewgrades($request));
 	} elsif ($command eq 'handgrade' && $perm{'mgr'}) {

--banghart1191463230--