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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 23 Sep 2004 14:35:54 -0000


matthew		Thu Sep 23 10:35:54 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentsubmissions.pm 
  Log:
  Use $res->compTitle insead of &get_title.
  
  
Index: loncom/interface/statistics/lonstudentsubmissions.pm
diff -u loncom/interface/statistics/lonstudentsubmissions.pm:1.22 loncom/interface/statistics/lonstudentsubmissions.pm:1.23
--- loncom/interface/statistics/lonstudentsubmissions.pm:1.22	Thu Sep 23 09:50:45 2004
+++ loncom/interface/statistics/lonstudentsubmissions.pm	Thu Sep 23 10:35:54 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentsubmissions.pm,v 1.22 2004/09/23 13:50:45 matthew Exp $
+# $Id: lonstudentsubmissions.pm,v 1.23 2004/09/23 14:35:54 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -228,7 +228,7 @@
             }
             $prob_span += $part_span;
         }
-        my $title = &get_title($prob->title,$prob->src);
+        my $title = $prob->compTitle;
         if ($prob_span > 0) {
             $headers{'problem'}.= qq{<th colspan="$prob_span">$title</th>};
         } elsif ($single_response) {
@@ -390,7 +390,7 @@
     }
     my $Str;
     if (! $single_response) {
-        my $id = &get_title($prob->title,$prob->src);
+        my $id = $prob->compTitle;
         if (defined($partid) && $partid ne '0') {
             $id .= ' '.$partid;
         }
@@ -506,7 +506,7 @@
         $r->print('<h1>'.&mt('Unable to complete request').'</h1>'.$/.
                   '<p>'.&mt('LON-CAPA is unable to produce your Excel spreadsheet because your selections will result in more than 255 columns.  Excel allows only 255 columns in a spreadsheet.').'</p>'.$/.
                   '<p>'.&mt('Consider selecting fewer problems to generate reports on, or reducing the number of items per problem.  Or use HTML or CSV output.').'</p>'.$/.
-                  '<p>'.&mt('The last problem that will fit in the current spreadsheet is [_1].',&get_title($lastprob->title,$lastprob->src)).'</p>');
+                  '<p>'.&mt('The last problem that will fit in the current spreadsheet is [_1].',$lastprob->compTitle).'</p>');
         $r->rflush();
         return;
     }
@@ -565,7 +565,7 @@
     }
     # Problem headers
     foreach my $prob (@$Problems) {
-        my $title = &get_title($prob->title,$prob->src);
+        my $title = $prob->compTitle;
         $worksheet->write($title_row,$cols_output,
                           $title,$format->{'h3'});
         foreach my $partid (@{$prob->parts}) {
@@ -698,16 +698,6 @@
     return $col;
 }
 
-sub get_title {
-    my ($title,$src) = @_;
-    if ($title eq '') {
-        ($title) = ($src =~ m|/([^/]+)$|);
-    } else {
-        $title =~ s/\&colon;/:/g;
-    }
-    return $title;
-}
-
 sub excel_format_response {
     my ($answer,$responsetype) = @_;
     if ($responsetype eq 'radiobutton') {
@@ -788,8 +778,7 @@
     # we put the headers into the %headers hash
     my $prob_start_idx = 0;
     foreach my $prob (@$problems) {
-        $headers{'problem'}->[$prob_start_idx] = 
-            &get_title($prob->title,$prob->src);
+        $headers{'problem'}->[$prob_start_idx] = $prob->compTitle;
         my $part_start_idx = $prob_start_idx;
         foreach my $partid (@{$prob->parts}) {
             $headers{'part'}->[$part_start_idx] = &mt('Part [_1]',$partid);