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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 10 Mar 2005 17:28:59 -0000


matthew		Thu Mar 10 12:28:59 2005 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentsubmissions.pm 
  Log:
  Modified to use loncommon::create_workbook and to call 
  lonstathelpers::render_resource with a navmaps resource object.
  
  
Index: loncom/interface/statistics/lonstudentsubmissions.pm
diff -u loncom/interface/statistics/lonstudentsubmissions.pm:1.35 loncom/interface/statistics/lonstudentsubmissions.pm:1.36
--- loncom/interface/statistics/lonstudentsubmissions.pm:1.35	Wed Feb 23 14:41:27 2005
+++ loncom/interface/statistics/lonstudentsubmissions.pm	Thu Mar 10 12:28:59 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentsubmissions.pm,v 1.35 2005/02/23 19:41:27 matthew Exp $
+# $Id: lonstudentsubmissions.pm,v 1.36 2005/03/10 17:28:59 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -118,9 +118,7 @@
                 $r->print('<h1>'.$resource->title.'</h1>');
                 $r->print('<h3>'.$resource->src.'</h3>');
                 if ($ENV{'form.renderprob'} eq 'true') {
-                    $r->print(
-                              &Apache::lonstathelpers::render_resource({src => $resource->src})
-                              );
+                    $r->print(&Apache::lonstathelpers::render_resource($resource));
                     $r->rflush();
                 }
             }
@@ -625,22 +623,9 @@
     $r->rflush();
     #
     # Create the excel spreadsheet
-    my $filename = '/prtspool/'.
-        $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
-        time.'_'.rand(1000000000).'.xls';
-    my $workbook  = Spreadsheet::WriteExcel->new('/home/httpd'.$filename);
-    if (! defined($workbook)) {
-        $r->log_error("Error creating excel spreadsheet $filename: $!");
-        $r->print('<p>'.&mt("Unable to create new Excel file.  ".
-                            "This error has been logged.  ".
-                            "Please alert your LON-CAPA administrator").
-                  '</p>');
-        return undef;
-    }
-    #
-    $workbook->set_tempdir('/home/httpd/perl/tmp');
-    #
-    my $format = &Apache::loncommon::define_excel_formats($workbook);
+    my ($workbook,$filename,$format) = 
+        &Apache::loncommon::create_workbook($r);
+    return if (! defined($workbook));
     my $worksheet  = $workbook->addworksheet('Student Submission Data');
     #
     # Add headers to the worksheet