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

banghart lon-capa-cvs-allow@mail.lon-capa.org
Fri, 12 Oct 2007 20:08:38 -0000


banghart		Fri Oct 12 16:08:38 2007 EDT

  Modified files:              
    /loncom/interface	lonpickcode.pm 
  Log:
  	Display code_list in a table.
  
  
Index: loncom/interface/lonpickcode.pm
diff -u loncom/interface/lonpickcode.pm:1.12 loncom/interface/lonpickcode.pm:1.13
--- loncom/interface/lonpickcode.pm:1.12	Thu Jan 25 15:34:29 2007
+++ loncom/interface/lonpickcode.pm	Fri Oct 12 16:08:38 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a CODE from the list of possible CODEs
 #
-# $Id: lonpickcode.pm,v 1.12 2007/01/25 20:34:29 albertel Exp $
+# $Id: lonpickcode.pm,v 1.13 2007/10/12 20:08:38 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -75,6 +75,8 @@
     }
     if      ($env{'form.command'} eq 'codelist') {
 	&code_list($r);
+        $r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'},
+						      $env{'form.url'}));	
     } elsif ($env{'form.command'} eq 'showcodes') {
 	&show_codes($r);
     } else {
@@ -85,23 +87,44 @@
 }
 
 sub code_list {
-    my ($r,$secondview)=@_;
-    if (!$secondview) {
+    my ($r,$context)=@_;
+    # $context = 0 Print page header and enclosing table
+    # $context = 1 No page header, print enclosing table
+    # $context = 2 No page header, no enclosing table
+    my $table_head;
+    my $enc_table_start;
+    my $enc_table_close;
+    
+    if (!$context) {
 	$r->print(&Apache::loncommon::start_page("View CODEs",undef,
 						 {'no_nav_bar' => 1}));
-	$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>");
+	$table_head = ('<b>'.&mt('Select a set of saved CODEs to view.')."</b>");
+    } elsif ($context eq 1) {
+	$table_head = ('<b>'.&mt('Select another set of saved CODEs to view.')."</b>");
+	$enc_table_start = '<table width="100%"><tr><td bgcolor="#777777">';
+	$enc_table_close = '</tr></td></table>';
+    } elsif ($context eq 2) {
+        $table_head = ('<b>'.&mt('Select a set of saved CODEs to view.')."</b>");
     }
     $r->print("<form method='POST' action='/adm/pickcode' name='pickcode'>");
+    $r->print($enc_table_start);
+    $r->print('<table width="100%">');
+    $r->print('<tr><td bgcolor="#e6ffff">');
+    $r->print($table_head);
+    $r->print('</td></tr>');
+    $r->print('<tr><td bgcolor="#ffffe6">');
     $r->print(&Apache::grades::scantron_CODElist());
+    $r->print('</td></tr>');
     $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('<tr><td bgcolor="#ffffe6">');
     $r->print("<input type='submit' name='submit' value='".&mt("View")."' />");
+    $r->print('</td></tr>');
+    $r->print('</table>');
+    $r->print($enc_table_close); # conditional
     $r->print("</form>");
-    $r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'},
-						      $env{'form.url'}));
+    
 }
 
 sub show_codes {
@@ -116,6 +139,8 @@
     }
     $r->print('</pre>');
     &code_list($r,1);
+    $r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'},
+						      $env{'form.url'}));
 }
 
 sub picking_a_code {