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

banghart lon-capa-cvs-allow@mail.lon-capa.org
Mon, 08 Oct 2007 21:05:56 -0000


banghart		Mon Oct  8 17:05:56 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	Saving work in progress. Stuff works now, need to clean up
  	a couple of displays.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.444 loncom/homework/grades.pm:1.445
--- loncom/homework/grades.pm:1.444	Fri Oct  5 12:43:31 2007
+++ loncom/homework/grades.pm	Mon Oct  8 17:05:54 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.444 2007/10/05 16:43:31 banghart Exp $
+# $Id: grades.pm,v 1.445 2007/10/08 21:05:54 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6990,8 +6990,8 @@
             &mt('')});
     $fields{'command'} = 'verify';
     $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
-    push (@menu, { url => $url,
-                   jscript => ' onChange="javascript:checkReceiptNo(this.form,\'OK\')" ',
+    push (@menu, { url => "",
+                   jscript => ' onClick="javascript:checkChoice2(document.forms.gradingMenu,\'5\',\'verify\')" ',
                    name => &mt('Verify Receipt'),
                    short_description => 
             &mt('')});
@@ -7012,15 +7012,29 @@
     # Create the menu
     my $Str;
     # $Str .= '<h2>'.&mt('Please select a grading task').'</h2>';
-    $Str .= '<form method="post" action="adm/grades" name="gradingMenu">';
+    $Str .= '<form method="post" action="" name="gradingMenu">';
+    $Str .= '<input type="hidden" name="command" value="" />'.
+    	'<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";
+
     foreach my $menudata (@menu) {
-        $Str .='    <h3><a '.
-            $menudata->{'jscript'}.
-            ' href="'.
-            $menudata->{'url'}.'" >'.
-            $menudata->{'name'}."</a></h3>\n";
-        if ($menudata->{'name'} eq &mt('Verify Receipt')) {
-            $Str .= ' receipt: 156-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')" />';
+        if ($menudata->{'name'} ne &mt('Verify Receipt')) {
+            $Str .='    <h3><a '.
+                $menudata->{'jscript'}.
+                ' href="'.
+                $menudata->{'url'}.'" >'.
+                $menudata->{'name'}."</a></h3>\n";
+        } else {
+            $Str .='    <h3><a '.
+                $menudata->{'jscript'}.
+                ' nohref="nohref" >'.
+                $menudata->{'name'}."</a></h3>\n";
+            $Str .= ' receipt: '.&Apache::lonnet::recprefix($env{'request.course.id'}).
+                    '-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')" />';
         }
         $Str .= '    '.('&nbsp;'x8).$menudata->{'short_description'}.
             "\n";
@@ -7047,6 +7061,22 @@
 	}
 	if (val < 7) formname.submit();
     }
+    function checkChoice2(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;}
+	    formname.submit();
+	}
+	if (val < 7) formname.submit();
+    }
 
     function checkReceiptNo(formname,nospace) {
 	var receiptNo = formname.receipt.value;
@@ -7777,6 +7807,7 @@
     $request->send_http_header;
     return '' if $request->header_only;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
+    &Apache::lonnet::logthis("receipt is ".$env{'form.receipt'});
     my $symb=&get_symb($request,1);
     my @commands=&Apache::loncommon::get_env_multiple('form.command');
     my $command=$commands[0];