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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 12 Aug 2005 22:14:15 -0000


albertel		Fri Aug 12 18:14:15 2005 EDT

  Modified files:              
    /loncom/interface	lonpickcode.pm 
    /loncom/homework	grades.pm 
  Log:
  - BUG#3966 web interface to see a set of printed CODES
  
  
Index: loncom/interface/lonpickcode.pm
diff -u loncom/interface/lonpickcode.pm:1.6 loncom/interface/lonpickcode.pm:1.7
--- loncom/interface/lonpickcode.pm:1.6	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lonpickcode.pm	Fri Aug 12 18:14:12 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a CODE from the list of possible CODEs
 #
-# $Id: lonpickcode.pm,v 1.6 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonpickcode.pm,v 1.7 2005/08/12 22:14:12 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,18 +68,61 @@
   </head>
 ENDDOCUMENT
 
-
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 					    ['curCODE','scantron_selectfile',
-					     'form','scantron_format',
-					     'scantron_CODElist']);
+					     'form','scantron_format','symb',
+					     'scantron_CODElist','command']);
 
     if  (!($env{'request.course.id'}) && 
 	 (&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {
 	$r->print('<body>Access not allowed.</body>');
         return OK;
     }
+    if      ($env{'form.command'} eq 'codelist') {
+	&code_list($r);
+    } elsif ($env{'form.command'} eq 'showcodes') {
+	&show_codes($r);
+    } else {
+	&picking_a_code($r);
+    }
+    $r->print('</body></html>');
+    return OK;
+}
+
+sub code_list {
+    my ($r,$secondview)=@_;
+    if (!$secondview) {
+	$r->print(&Apache::loncommon::bodytag("View CODEs"));
+	$r->print("<p>".&mt('Select a set of saved CODEs to view.')."</p>");
+    } else {
+	$r->print("<p>".&mt('Select another set of saved CODEs to view.')."</p>");
+    }
+    $r->print("<form method='POST' action='/adm/pickcode' name='pickcode'>");
+    $r->print(&Apache::grades::scantron_CODElist());
+    $r->print("<input type='hidden' name='command' value='showcodes' />");
+    $r->print("<input type='hidden' name='symb' value='".$env{'form.symb'}."' />");
+    $r->print("<input type='hidden' name='url' value='".$env{'form.url'}."' />");
+    $r->print("<input type='submit' name='submit' value='".&mt("View")."' />");
+    $r->print("</form>");
+    $r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'},
+						      $env{'form.url'}));
+}
+
+sub show_codes {
+    my ($r)=@_;
+    $r->print(&Apache::loncommon::bodytag("View CODEs"));
+    my %codes=&Apache::grades::get_codes();
+    $r->print("<h2>".$env{'form.scantron_CODElist'}."</h2>");
+    $r->print('<pre>');
+    foreach my $code (sort(keys(%codes))) {
+	$r->print($code."\n");
+    }
+    $r->print('</pre>');
+    &code_list($r,1);
+}
 
+sub picking_a_code {
+    my ($r)=@_;
     $r->print(&Apache::loncommon::bodytag("Selecting a CODE"));
     $r->print(<<ENDSCRIPT);
 <script>
@@ -125,8 +168,7 @@
 	$to_print.='</table>';
 	if ($print) { $r->print($to_print); }
     }
-    $r->print('</form></body></html>');
-    return OK;
+    $r->print('</form>');
 } 
 
 1;
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.278 loncom/homework/grades.pm:1.279
--- loncom/homework/grades.pm:1.278	Fri Aug 12 17:33:41 2005
+++ loncom/homework/grades.pm	Fri Aug 12 18:14:12 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.278 2005/08/12 21:33:41 albertel Exp $
+# $Id: grades.pm,v 1.279 2005/08/12 22:14:12 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5412,6 +5412,9 @@
     $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
 	'<input type="button" onClick="javascript:this.form.action=\'/adm/helper/resettimes.helper\';this.form.submit();'.
 	'" value="'.&mt('Manage').'" /> access times.</td></tr>'."\n";
+    $result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'.
+	'<input type="button" onClick="javascript:this.form.command.value=\'codelist\';this.form.action=\'/adm/pickcode\';this.form.submit();'.
+	'" value="'.&mt('View').'" /> saved CODEs.</td></tr>'."\n";
 
     $result.='</form></td></tr></table>'."\n".
 	'</td></tr></table>'."\n".