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

bisitz bisitz at source.lon-capa.org
Fri Feb 1 13:46:37 EST 2013


bisitz		Fri Feb  1 18:46:37 2013 EDT

  Modified files:              
    /loncom/interface	lonpickcode.pm 
  Log:
  Improvements and corrections related to "Selecting a CODE":
  - Internationalization - added missing &mt() calls
  - Standard layout: data_table; title in popup window; error style
  - XHTML
  
  
  
Index: loncom/interface/lonpickcode.pm
diff -u loncom/interface/lonpickcode.pm:1.15 loncom/interface/lonpickcode.pm:1.16
--- loncom/interface/lonpickcode.pm:1.15	Tue Nov 13 01:47:56 2007
+++ loncom/interface/lonpickcode.pm	Fri Feb  1 18:46:37 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a CODE from the list of possible CODEs
 #
-# $Id: lonpickcode.pm,v 1.15 2007/11/13 01:47:56 albertel Exp $
+# $Id: lonpickcode.pm,v 1.16 2013/02/01 18:46:37 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,7 +69,7 @@
     if  (!($env{'request.course.id'}) && 
 	 (&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {
 	$r->print(&Apache::loncommon::start_page().
-		  &mt('Access not allowed.').
+		  '<p class="LC_error">'.&mt('Access not allowed.').'</p>'.
 		  &Apache::loncommon::end_page());
         return OK;
     }
@@ -145,10 +145,12 @@
 
 sub picking_a_code {
     my ($r)=@_;
-    $r->print(&Apache::loncommon::start_page("Selecting a CODE",undef,
+    my $title = 'Selecting a CODE';
+    $r->print(&Apache::loncommon::start_page($title,undef,
 					     {'no_nav_bar' => 1}));
-    $r->print(<<ENDSCRIPT);
-<script>
+    $r->print('<h1>'.&mt($title).'</h1>');
+
+    $r->print(&Apache::lonhtmlcommon::scripttag("
 function gochoose(newcode) {
     opener.document.$env{'form.form'}.scantron_CODE_selectedvalue.value=newcode;
     var slct=opener.document.$env{'form.form'}.scantron_CODE_resolution;
@@ -158,18 +160,27 @@
     }
     self.close();
 }
-</script>
-ENDSCRIPT
-
+"));
 
-    $r->print("<p>The CODE on the paper is <tt><b>".$env{'form.curCODE'}.
-	      "</b></tt>. Please Select a new one.</p>\n".'<form>');
+    $r->print(
+        '<p>'
+       .&mt('The CODE on the paper is [_1]. Please select a new one.',
+                '<tt><b>'.$env{'form.curCODE'}.'</b></tt>')
+       ."</p>\n".'<form action="">'
+    );
     my %codes=&Apache::grades::get_codes();
     my %code_freq=&get_code_freq($r);
     my $num_matches=length($env{'form.curCODE'});
     for (my $i=$num_matches;$i>=0;$i--) {
-	my $to_print="<p>".&mt("CODEs with [_1] matching letters",$i)."</p>";
-	$to_print.='<table border="1"><tr><td></td><td>CODE</td><td>exams using this CODE</td>';
+	my $to_print =
+            '<p>'.&mt('CODEs with [_1] matching letters:',$i)."</p>\n"
+           .&Apache::loncommon::start_data_table()
+           .&Apache::loncommon::start_data_table_header_row()
+           .'<th> </th>'
+           .'<th>'.&mt('CODE').'</th>'
+           .'<th>'.&mt('Bubblesheet Exams using this CODE').'</th>'
+           .&Apache::loncommon::end_data_table_header_row();
+
 	my $print;
 	foreach my $code (sort(keys(%codes))) {
 	    if (&Apache::grades::num_matches($env{'form.curCODE'},$code) != $i) { next; }
@@ -181,15 +192,17 @@
 		$count=scalar(@{$code_freq{$code}});
 		$list=' - '.join(', ',@{$code_freq{$code}});
 	    }
-	    $to_print.='<tr><td>'.
-		      '<input type="button" value="'.&mt('Select').
-		      '" onClick="gochoose(\''.$code.'\')" /></td>'.
-		      '<td><tt>'.$code.'</tt></td><td>'.$count.
-		      $list.'</td></tr>';
-	    delete($codes{$code});
-	}
-	$to_print.='</table>';
-	if ($print) { $r->print($to_print); }
+        $to_print .=
+            &Apache::loncommon::start_data_table_row()
+           .'<td><input type="button" value="'.&mt('Select')
+           .'" onclick="gochoose(\''.$code.'\')" /></td>'
+           .'<td><tt>'.$code.'</tt></td>'
+           .'<td>'.$count.$list.'</td>'
+           .&Apache::loncommon::end_data_table_row();
+            delete($codes{$code});
+        }
+        $to_print .= &Apache::loncommon::end_data_table();
+        if ($print) { $r->print($to_print); }
     }
     $r->print('</form>');
 } 




More information about the LON-CAPA-cvs mailing list