[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface/statistics lonproblemstatistics.pm

raeburn raeburn at source.lon-capa.org
Mon Mar 3 15:45:05 EST 2014


raeburn		Mon Mar  3 20:45:05 2014 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface/statistics	lonproblemstatistics.pm 
  Log:
  - For 2.11
    - Backport 1.125, 1.126.
  
  
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.122.2.2 loncom/interface/statistics/lonproblemstatistics.pm:1.122.2.3
--- loncom/interface/statistics/lonproblemstatistics.pm:1.122.2.2	Mon Dec 30 14:05:21 2013
+++ loncom/interface/statistics/lonproblemstatistics.pm	Mon Mar  3 20:45:05 2014
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemstatistics.pm,v 1.122.2.2 2013/12/30 14:05:21 raeburn Exp $
+# $Id: lonproblemstatistics.pm,v 1.122.2.3 2014/03/03 20:45:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -182,7 +182,7 @@
              format => '%d',
              sortable  => 'yes',
              graphable => 'yes',
-             long_title => 'Minumum Number of Tries',
+             long_title => 'Minimum Number of Tries',
              selectable => 'yes',
              defaultselected => 'yes',
            },
@@ -438,7 +438,7 @@
              format => '%4.2f',
              sortable  => 'no',
              graphable => 'no',
-             long_title => 'Minumum Sequence Score',
+             long_title => 'Minimum Sequence Score',
              selectable => 'yes',
              defaultselected => 'no',
            },
@@ -493,7 +493,7 @@
              format => '%4.2f',
              sortable  => 'no',
              graphable => 'no',
-             long_title => 'Minumum Number of Correct Problems',
+             long_title => 'Minimum Number of Correct Problems',
              selectable => 'yes',
              defaultselected => 'no',
            },
@@ -586,14 +586,14 @@
 
 sub field_selection_input {
     my $Str = '<select name="fieldselections" multiple="multiple" size="5">'."\n";
-    $Str .= '<option value="all">all</option>'."\n";
+    $Str .= '<option value="all">'.&mt('all').'</option>'."\n";
     foreach my $field (@Fields) {
         next if ($field->{'selectable'} ne 'yes');
-        $Str .= '    <option value="'.$field->{'name'}.'" ';
+        $Str .= '    <option value="'.$field->{'name'}.'"';
         if ($field->{'selected'} eq 'yes') {
-            $Str .= 'selected ';
+            $Str .= ' selected="selected"';
         }
-        $Str .= '>'.$field->{'title'}.'</option>'."\n";
+        $Str .= '>'.&mt($field->{'title'}).'</option>'."\n";
     }
     $Str .= "</select>\n";
 }
@@ -618,7 +618,6 @@
     &parse_field_selection();
     #
     my $Str = '';
-    $Str .= '<p>';
     $Str .= &Apache::loncommon::start_data_table();
     $Str .= &Apache::loncommon::start_data_table_header_row();
     $Str .= '<th>'.&mt('Sections').'</th>';
@@ -644,14 +643,13 @@
     $Str .= &field_selection_input();
     $Str .= '</td><td align="center" valign="top">';
     $Str .= &plot_dropdown();
-    $Str .= '</td>'."\n";
+    $Str .= "\n";
     $Str .= '</td><td align="center" valign="top">';
     $Str .= &Apache::lonstathelpers::limit_by_time_form();
     $Str .= '</td>'."\n";
     $Str .=  &Apache::loncommon::end_data_table_row();
     $Str .= &Apache::loncommon::end_data_table();
     #
-    $Str .= '</p>';
     $Str .= '<input type="submit" name="GenerateStatistics" value="'.
         &mt('Generate Statistics').'" />';
     $Str .= (' 'x10);
@@ -801,9 +799,8 @@
     $r->print('<h2>'.&mt('Sequence Statistics').
 	      &Apache::loncommon::help_open_topic('Statistics_Sequence').
 	      '</h2>');
-    $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row());
+    $r->print(&Apache::loncommon::start_data_table());
     $r->print(&sequence_html_header());
-    $r->print(&Apache::loncommon::end_data_table_header_row());
     foreach my $seq (@sequences) {
         last if ($c->aborted);
         &compute_sequence_statistics($seq);
@@ -825,7 +822,7 @@
 sub output_html_by_sequence {
     my ($r) = @_;
     my $c = $r->connection();
-    $r->print('<br>'.&html_preamble());
+    $r->print('<br />'.&html_preamble());
     #
     foreach my $seq (@sequences) {
         last if ($c->aborted);
@@ -929,14 +926,16 @@
         next if ($options =~ /no $field->{'name'}/);
         next if ($field->{'selected'} ne 'yes');
         $header_row .= '<th>';
+        my $header_row_text = &mt($field->{'title'});
         if (exists($field->{'sortable'}) && $field->{'sortable'} eq 'yes') {
-            $header_row .= '<a href="javascript:'.
+            $header_row .=
+                '<a href="javascript:'.
                 'document.Statistics.sortby.value='."'".$field->{'name'}."'".
-                    ';document.Statistics.submit();">';
-        }
-        $header_row .= &mt($field->{'title'});
-        if ($options =~ /sortable/) {
-            $header_row.= '</a>';
+                ';document.Statistics.submit();">'.
+                $header_row_text.
+                '</a>';
+        } else {
+            $header_row .= $header_row_text;
         }
         if ($options !~ /no plots/        && 
             exists($field->{'graphable'}) && 
@@ -953,13 +952,13 @@
 }
 
 sub sequence_html_header {
-    my $Str .= '<tr>';
+    my $Str .= &Apache::loncommon::start_data_table_header_row();
     foreach my $field (@SeqFields) {
 #        next if ($field->{'selected'} ne 'yes');
         $Str .= '<th bgcolor="'.$field->{'color'}.'"';
-        $Str .= '>'.$field->{'title'}.'</th>';
+        $Str .= '>'.&mt($field->{'title'}).'</th>';
     }
-    $Str .= '</tr>';
+    $Str .= &Apache::loncommon::end_data_table_header_row();
     return $Str;
 }
 
@@ -967,7 +966,7 @@
 sub sequence_html_output {
     my ($seq) = @_;
     my $data = $SeqStat{$seq->symb};
-    my $row = '<tr>';
+    my $row = &Apache::loncommon::start_data_table_row();
     foreach my $field (@SeqFields) {
         next if ($field->{'selected'} ne 'yes');
         $row .= '<td bgcolor="'.$field->{'color'}.'"';
@@ -982,7 +981,7 @@
         }
         $row .= '</td>';
     }
-    $row .= '</tr>'."\n";
+    $row .= &Apache::loncommon::end_data_table_row()."\n";
     return $row;
 }
 
@@ -1344,16 +1343,17 @@
     # Time restrictions
     my $time_string;
     if (defined($starttime)) {
-        # call localtime but not lonlocal:locallocaltime because excel probably
-        # cannot handle localized text.  Probably.
-        $time_string .= 'Data collected from '.localtime($time_string);
         if (defined($endtime)) {
-            $time_string .= ' to '.localtime($endtime);
+            $time_string .=  &mt('Data collected from [_1] to [_2]',
+                                 &Apache::lonlocal::locallocaltime($starttime),
+                                 &Apache::lonlocal::locallocaltime($endtime));
+        } else {
+            $time_string .=  &mt('Data collected from [_1]',
+                                 &Apache::lonlocal::locallocaltime($starttime));
         }
-        $time_string .= '.';
     } elsif (defined($endtime)) {
-        # See note above about lonlocal:locallocaltime
-        $time_string .= 'Data collected before '.localtime($endtime).'.';
+        $time_string .=  &mt('Data collected before [_1]',
+                             &Apache::lonlocal::locallocaltime($endtime));
     }
     if (defined($time_string)) {
         $excel_sheet->write($rows_output,$cols_output++,$time_string);
@@ -1362,7 +1362,7 @@
     #
     # Put the date in there too
     $excel_sheet->write($rows_output,$cols_output++,
-                        'Compiled on '.localtime(time));
+                        &mt('Compiled on [_1]',&Apache::lonlocal::locallocaltime(time)));
     #
     $rows_output++;
     $cols_output=0;




More information about the LON-CAPA-cvs mailing list