Diff for /loncom/interface/lonpickcode.pm between versions 1.7 and 1.14

version 1.7, 2005/08/12 22:14:12 version 1.14, 2007/11/13 01:14:11
Line 43  sub get_code_freq { Line 43  sub get_code_freq {
     $r->rflush();      $r->rflush();
     my ($scanlines,$scan_data)=&Apache::grades::scantron_getfile();      my ($scanlines,$scan_data)=&Apache::grades::scantron_getfile();
     for (my $i=0;$i<=$scanlines->{'count'};$i++) {      for (my $i=0;$i<=$scanlines->{'count'};$i++) {
  my $line=&Apache::grades::scantron_get_line($scanlines,$i);   my $line=&Apache::grades::scantron_get_line($scanlines,$scan_data,$i);
  if ($line=~/^[\s\cz]*$/) { next; }   if ($line=~/^[\s\cz]*$/) { next; }
  my $scan_record=   my $scan_record=
     &Apache::grades::scantron_parse_scanline($line,$i,      &Apache::grades::scantron_parse_scanline($line,$i,
Line 60  sub handler { Line 60  sub handler {
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDDOCUMENT);  
 $html  
   <head>  
     <title>The LearningOnline Network with CAPA</title>  
   </head>  
 ENDDOCUMENT  
   
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
     ['curCODE','scantron_selectfile',      ['curCODE','scantron_selectfile',
Line 75  ENDDOCUMENT Line 68  ENDDOCUMENT
   
     if  (!($env{'request.course.id'}) &&       if  (!($env{'request.course.id'}) && 
  (&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {   (&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) {
  $r->print('<body>Access not allowed.</body>');   $r->print(&Apache::loncommon::start_page().
     &mt('Access not allowed.').
     &Apache::loncommon::end_page());
         return OK;          return OK;
     }      }
     if      ($env{'form.command'} eq 'codelist') {      if      ($env{'form.command'} eq 'codelist') {
  &code_list($r);   &code_list($r);
           $r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'},
         $env{'form.url'}));
     } elsif ($env{'form.command'} eq 'showcodes') {      } elsif ($env{'form.command'} eq 'showcodes') {
  &show_codes($r);   &show_codes($r);
     } else {      } else {
  &picking_a_code($r);   &picking_a_code($r);
     }      }
     $r->print('</body></html>');      $r->print(&Apache::loncommon::end_page());
     return OK;      return OK;
 }  }
   
 sub code_list {  sub code_list {
     my ($r,$secondview)=@_;      my ($r,$context)=@_;
     if (!$secondview) {      # $context = 0 Print page header and enclosing table
  $r->print(&Apache::loncommon::bodytag("View CODEs"));      # $context = 1 No page header, print enclosing table
  $r->print("<p>".&mt('Select a set of saved CODEs to view.')."</p>");      # $context = 2 No page header, no enclosing table
     } else {      my $table_head;
  $r->print("<p>".&mt('Select another set of saved CODEs to view.')."</p>");      my $enc_table_start;
     }      my $enc_table_close;
     $r->print("<form method='POST' action='/adm/pickcode' name='pickcode'>");      
       if (!$context) {
    $r->print(&Apache::loncommon::start_page("View CODEs",undef,
    {'no_nav_bar' => 1}));
    $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("<input type='submit' name='submit' value='".&mt("View:")."' /> ");
     $r->print(&Apache::grades::scantron_CODElist());      $r->print(&Apache::grades::scantron_CODElist());
       $r->print('</td></tr>');
       $r->print('</table>');
       $r->print($enc_table_close); # conditional
     $r->print("<input type='hidden' name='command' value='showcodes' />");      $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='symb' value='".$env{'form.symb'}."' />");
     $r->print("<input type='hidden' name='url' value='".$env{'form.url'}."' />");      $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("</form>");
     $r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'},      
       $env{'form.url'}));  
 }  }
   
 sub show_codes {  sub show_codes {
     my ($r)=@_;      my ($r)=@_;
     $r->print(&Apache::loncommon::bodytag("View CODEs"));      $r->print(&Apache::loncommon::start_page("View CODEs",undef,
        {'no_nav_bar' => 1}));
     my %codes=&Apache::grades::get_codes();      my %codes=&Apache::grades::get_codes();
     $r->print("<h2>".$env{'form.scantron_CODElist'}."</h2>");      $r->print("<h2>".$env{'form.scantron_CODElist'}."</h2>");
     $r->print('<pre>');      $r->print('<pre>');
Line 119  sub show_codes { Line 137  sub show_codes {
     }      }
     $r->print('</pre>');      $r->print('</pre>');
     &code_list($r,1);      &code_list($r,1);
       $r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'},
         $env{'form.url'}));
 }  }
   
 sub picking_a_code {  sub picking_a_code {
     my ($r)=@_;      my ($r)=@_;
     $r->print(&Apache::loncommon::bodytag("Selecting a CODE"));      $r->print(&Apache::loncommon::start_page("Selecting a CODE",undef,
        {'no_nav_bar' => 1}));
     $r->print(<<ENDSCRIPT);      $r->print(<<ENDSCRIPT);
 <script>  <script>
 function gochoose(newcode) {  function gochoose(newcode) {
Line 145  ENDSCRIPT Line 166  ENDSCRIPT
     my %code_freq=&get_code_freq($r);      my %code_freq=&get_code_freq($r);
     my $num_matches=length($env{'form.curCODE'});      my $num_matches=length($env{'form.curCODE'});
     for (my $i=$num_matches;$i>=0;$i--) {      for (my $i=$num_matches;$i>=0;$i--) {
  my $to_print="<p> CODEs with $i matches</p>";   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>';   $to_print.='<table border="1"><tr><td></td><td>CODE</td><td>exams using this CODE</td>';
  my $print;   my $print;
  foreach my $code (sort(keys(%codes))) {   foreach my $code (sort(keys(%codes))) {

Removed from v.1.7  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>