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

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


This is a MIME encoded message

--www1269036006
Content-Type: text/plain

www		Fri Mar 19 22:00:06 2010 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Just saving my work
  
  
--www1269036006
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20100319220006.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.599 loncom/homework/grades.pm:1.600
--- loncom/homework/grades.pm:1.599	Fri Mar 19 21:22:34 2010
+++ loncom/homework/grades.pm	Fri Mar 19 22:00:06 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.599 2010/03/19 21:22:34 www Exp $
+# $Id: grades.pm,v 1.600 2010/03/19 22:00:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8582,7 +8582,7 @@
                                 icon => 'edit-find-replace.png',
                                 linktitle => 'Grade current resource for all students.'
                         },
-                        {       linktext => 'Grade complete page/sequence/folder for one student.',
+                        {       linktext => 'Grade complete page/sequence/folder for one student',
                                 url => $url1d,
                                 permission => 'F',
                                 icon => 'edit-find-replace.png',
@@ -8675,69 +8675,90 @@
     return $Str;    
 }
 
-sub individual {
-    my ($request)=@_;
-    &submit_options($request);
-}
 
 sub ungraded {
     my ($request)=@_;
     &submit_options($request);
 }
 
-sub table {
-    my ($request)=@_;
-    &submit_options($request);
-}
-
-sub all_for_one {
-    my ($request)=@_;
-    &submit_options($request);
-}
-
 sub submit_options_sequence {
     my ($request) = @_;
     my ($symb)=&get_symb($request);
     if (!$symb) {return '';}
-    my $probTitle = &Apache::lonnet::gettitle($symb);
+    &commonJSfunctions($request);
+    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'});
 
-    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();
+    # Preselect sections
+    my $selsec="";
+    if (ref($sections)) {
+        foreach my $section (sort(@$sections)) {
+            $selsec.='<option value="'.$section.'" '.
+                ($saveSec eq $section ? 'selected="selected"':'').'>'.$section.'</option>'."\n";
         }
-        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
+    $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="saveState"   value="" />'."\n".
+        '<input type="hidden" name="gradingMenu" value="1" />'."\n".
+        '<input type="hidden" name="showgrading" value="yes" />'."\n";
+
+    $result.='
+<h2>
+  '.&mt('Grade complete page/sequence/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;
+}
+
+sub submit_options_table {
+    my ($request) = @_;
+    my ($symb)=&get_symb($request);
+    if (!$symb) {return '';}
     &commonJSfunctions($request);
-#    my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
     my $result;
     my (undef,$sections) = &getclasslist('all','0');
     my $savedState = &savedState();
@@ -8757,14 +8778,13 @@
 
     $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').'
+  '.&mt('Grading table').'
 </h2>
 
 <div class="LC_columnSection">
@@ -8797,7 +8817,7 @@
 
 <br />
 
-            <input type="hidden" name="command" value="pickStudentPage" />
+            <input type="hidden" name="command" value="viewgrades" />
             <div>
               <input type="submit" value="'.&mt('Next').' &rarr;" />
             </div>
@@ -8807,6 +8827,8 @@
     return $result;
 }
 
+
+
 #--- Displays the submissions first page -------
 sub submit_options {
     my ($request) = @_;
@@ -8814,43 +8836,7 @@
     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();
@@ -8870,16 +8856,14 @@
 
     $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.'" />'."\n".
-	'<input type="hidden" name="command"     value="" />'."\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 Current Resource').'
+  '.&mt('Select individual students to grade').'
 </h2>
 
 <div class="LC_columnSection">
@@ -8924,23 +8908,8 @@
 </div>
 
 <br />
-          <div>
-            <div>
-              <label>
-                <input type="radio" name="radioChoice" value="submission" '.
-                  ($saveCmd eq 'submission' ? 'checked="checked"' : '').' /> '.
-             &mt('Select individual students to grade and view submissions.').'
-	      </label> 
-            </div>
-            <div>
-	      <label>
-                <input type="radio" name="radioChoice" value="viewgrades" '.
-                  ($saveCmd eq 'viewgrades' ? 'checked="checked"' : '').' /> '.
-                    &mt('Grade all selected students in a grading table.').'
-              </label>
-            </div>
-            <div>
-	      <input type="button" onclick="javascript:checkChoice(this.form,\'2\');" value="'.&mt('Next').' &rarr;" />
+                <input type="hidden" name="command" value="submission" /> 
+	      <input type="submit" value="'.&mt('Next').' &rarr;" />
             </div>
           </div>
 
@@ -9561,11 +9530,11 @@
 	} elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {
 	    $request->print(&grading_menu($request));
 	} elsif ($command eq 'individual' && $perm{'vgr'}) {
-	    $request->print(&individual($request));
+	    $request->print(&submit_options($request));
         } elsif ($command eq 'ungraded' && $perm{'vgr'}) {
             $request->print(&submit_options($request));
         } elsif ($command eq 'table' && $perm{'vgr'}) {
-            $request->print(&submit_options($request));
+            $request->print(&submit_options_table($request));
         } elsif ($command eq 'all_for_one' && $perm{'vgr'}) {
             $request->print(&submit_options_sequence($request));
 	} elsif ($command eq 'viewgrades' && $perm{'vgr'}) {

--www1269036006--