[LON-CAPA-cvs] cvs: loncom /interface/statistics lonproblemanalysis.pm lonsubmissiontimeanalysis.pm doc/loncapafiles loncapafiles.lpml

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 19 Jan 2004 21:31:08 -0000


matthew		Mon Jan 19 16:31:08 2004 EDT

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/interface/statistics	lonsubmissiontimeanalysis.pm 
                                	lonproblemanalysis.pm 
  Log:
  Added entry for lonstathelpers.pm in loncapafiles.
  Modified lonsubmissiontimeanalysis and lonproblemanalysis to use 
  lonstathelpers.
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.325 doc/loncapafiles/loncapafiles.lpml:1.326
--- doc/loncapafiles/loncapafiles.lpml:1.325	Sat Jan 17 12:27:15 2004
+++ doc/loncapafiles/loncapafiles.lpml	Mon Jan 19 16:31:08 2004
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.325 2004/01/17 17:27:15 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.326 2004/01/19 21:31:08 matthew Exp $ -->
 
 <!--
 
@@ -2258,6 +2258,15 @@
 <categoryname>handler</categoryname>
 <description>
 Handler to show statistics on solving LON-CAPA problems.
+</description>
+<status>works/unverified</status>
+</file>
+<file>
+<source>loncom/interface/statistics/lonstathelpers.pm</source>
+<target dist='default'>home/httpd/lib/perl/Apache/lonstathelpers.pm</target>
+<categoryname>module</categoryname>
+<description>
+Utility module for statistics and data mining.
 </description>
 <status>works/unverified</status>
 </file>
Index: loncom/interface/statistics/lonsubmissiontimeanalysis.pm
diff -u loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.9 loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.10
--- loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.9	Thu Jan  8 14:20:12 2004
+++ loncom/interface/statistics/lonsubmissiontimeanalysis.pm	Mon Jan 19 16:31:08 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonsubmissiontimeanalysis.pm,v 1.9 2004/01/08 19:20:12 matthew Exp $
+# $Id: lonsubmissiontimeanalysis.pm,v 1.10 2004/01/19 21:31:08 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 use Apache::lonhtmlcommon();
 use Apache::loncoursedata();
 use Apache::lonstatistics;
+use Apache::lonstathelpers;
 use Apache::lonlocal;
 use HTML::Entities();
 use Time::Local();
@@ -50,23 +51,6 @@
                        text => 'Choose a different resource' },
                      );
 
-sub render_resource {
-    my ($resource) = @_;
-    ##
-    ## Render the problem
-    my $base;
-    ($base,undef) = ($resource->{'src'} =~ m|(.*/)[^/]*$|);
-    $base = "http://".$ENV{'SERVER_NAME'}.$base;
-    my $rendered_problem = 
-        &Apache::lonnet::ssi_body($resource->{'src'});
-    $rendered_problem =~ s/<\s*form\s*/<nop /g;
-    $rendered_problem =~ s|(<\s*/form\s*>)|<\/nop>|g;
-    return '<table bgcolor="ffffff"><tr><td>'.
-        '<base href="'.$base.'" />'.
-        $rendered_problem.
-        '</td></tr></table>';
-}
-
 sub BuildSubmissionTimePage {
     my ($r,$c)=@_;
     #
@@ -131,7 +115,7 @@
             $r->print('<h1>'.$resource->{'title'}.'</h1>');
             $r->print('<h3>'.$resource->{'src'}.'</h3>');
             $r->rflush();
-            $r->print(&render_resource($resource));
+            $r->print(&Apache::lonstathelpers::render_resource($resource));
             $r->rflush();
             $r->print(&analyze_times($r,$resource,\@Students,$part));
         }
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.59 loncom/interface/statistics/lonproblemanalysis.pm:1.60
--- loncom/interface/statistics/lonproblemanalysis.pm:1.59	Mon Jan 19 15:10:36 2004
+++ loncom/interface/statistics/lonproblemanalysis.pm	Mon Jan 19 16:31:08 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemanalysis.pm,v 1.59 2004/01/19 20:10:36 matthew Exp $
+# $Id: lonproblemanalysis.pm,v 1.60 2004/01/19 21:31:08 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 use Apache::loncoursedata();
 use Apache::lonstatistics;
 use Apache::lonlocal;
+use Apache::lonstathelpers;
 use HTML::Entities();
 use Time::Local();
 use Spreadsheet::WriteExcel();
@@ -58,22 +59,6 @@
                      { name => 'ExcelOutput',
                        text => 'Produce Excel Output' });
 
-sub render_resource {
-    my ($resource) = @_;
-    ##
-    ## Render the problem
-    my $base;
-    ($base,undef) = ($resource->{'src'} =~ m|(.*/)[^/]*$|);
-    $base = "http://".$ENV{'SERVER_NAME'}.$base;
-    my $rendered_problem = 
-        &Apache::lonnet::ssi_body($resource->{'src'});
-    $rendered_problem =~ s/<\s*form\s*/<nop /g;
-    $rendered_problem =~ s|(<\s*/form\s*>)|<\/nop>|g;
-    return '<table bgcolor="ffffff"><tr><td>'.
-        '<base href="'.$base.'" />'.
-        $rendered_problem.
-        '</td></tr></table>';
-}
 
 sub BuildProblemAnalysisPage {
     my ($r,$c)=@_;
@@ -152,7 +137,7 @@
             my $resource = $current_problem->{'resource'};
             $r->print('<h1>'.$resource->{'title'}.'</h1>');
             $r->print('<h3>'.$resource->{'src'}.'</h3>');
-            $r->print(&render_resource($resource));
+            $r->print(&Apache::lonstathelpers::render_resource($resource));
             $r->rflush();
             my %Data = &get_problem_data($resource->{'src'});
             my $ProblemData = $Data{$current_problem->{'part'}.