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

www www@source.lon-capa.org
Fri, 19 Mar 2010 21:22:35 -0000


www		Fri Mar 19 21:22:35 2010 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Saving my pre-cleanup work
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.598 loncom/homework/grades.pm:1.599
--- loncom/homework/grades.pm:1.598	Mon Mar 15 07:54:04 2010
+++ loncom/homework/grades.pm	Fri Mar 19 21:22:34 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.598 2010/03/15 07:54:04 www Exp $
+# $Id: grades.pm,v 1.599 2010/03/19 21:22:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8695,6 +8695,117 @@
     &submit_options($request);
 }
 
+sub submit_options_sequence {
+    my ($request) = @_;
+    my ($symb)=&get_symb($request);
+    if (!$symb) {return '';}
+    my $probTitle = &Apache::lonnet::gettitle($symb);
+
+    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;
+        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("$receiptalert");
+            formname.receipt.value = "";
+            formname.receipt.focus();
+            return false;
+        }
+        return true;
+    }
+GRADINGMENUJS
+    &commonJSfunctions($request);
+#    my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
+    my $result;
+    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'});
+
+    # Preselect sections
+    my $selsec="";
+    if (ref($sections)) {
+        foreach my $section (sort(@$sections)) {
+            $selsec.='<option value="'.$section.'" '.
+                ($saveSec eq $section ? 'selected="selected"':'').'>'.$section.'</option>'."\n";
+        }
+    }
+
+    $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="probTitle"   value="'.$probTitle.'" />'."\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.='
+<h2>
+  '.&mt('Grade Complete Folder for One Student').'
+</h2>
+
+<div class="LC_columnSection">
+  
+    <fieldset>
+      <legend>
+       '.&mt('Sections').'
+      </legend>
+      <select name="section" multiple="multiple" size="5">'."\n";
+    $result.= $selsec;
+    $result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="selected"' : ''). '>all</option></select> &nbsp; ';
+    $result.='
+    </fieldset>
+  
+    <fieldset>
+      <legend>
+        '.&mt('Groups').'
+      </legend>
+      '.&Apache::lonstatistics::GroupSelect('group','multiple',5).'
+    </fieldset>
+  
+    <fieldset>
+      <legend>
+        '.&mt('Access Status').'
+      </legend>
+      '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').'
+    </fieldset>
+  
+</div>
+
+<br />
+
+            <input type="hidden" name="command" value="pickStudentPage" />
+            <div>
+              <input type="submit" value="'.&mt('Next').' &rarr;" />
+            </div>
+        </div>
+  </form>';
+    $result .= &show_grading_menu_form($symb);
+    return $result;
+}
 
 #--- Displays the submissions first page -------
 sub submit_options {
@@ -8834,21 +8945,6 @@
           </div>
 
 
-        <h2>
-         '.&mt('Grade Complete Folder for One Student').'
-        </h2>
-        <div>
-            <div>
-              <label>
-                <input type="radio" name="radioChoice" value="pickStudentPage" '.
-	  ($saveCmd eq 'pickStudentPage' ? 'checked="checked"' : '').' /> '.
-  &mt('The <b>complete</b> page/sequence/folder: For one student').'
-              </label>
-            </div>
-            <div>
-	      <input type="button" onclick="javascript:checkChoice(this.form,\'2\');" value="'.&mt('Next').' &rarr;" />
-            </div>
-        </div>
   </form>';
     $result .= &show_grading_menu_form($symb);
     return $result;
@@ -9471,7 +9567,7 @@
         } elsif ($command eq 'table' && $perm{'vgr'}) {
             $request->print(&submit_options($request));
         } elsif ($command eq 'all_for_one' && $perm{'vgr'}) {
-            $request->print(&submit_options($request));
+            $request->print(&submit_options_sequence($request));
 	} elsif ($command eq 'viewgrades' && $perm{'vgr'}) {
 	    $request->print(&viewgrades($request));
 	} elsif ($command eq 'handgrade' && $perm{'mgr'}) {