[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm /interface/statistics lonproblemanalysis.pm lonsubmissiontimeanalysis.pm

raeburn raeburn at source.lon-capa.org
Tue Nov 10 14:28:32 EST 2020


raeburn		Tue Nov 10 19:28:32 2020 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
    /loncom/interface/statistics	lonproblemanalysis.pm 
                                	lonsubmissiontimeanalysis.pm 
  Log:
  - Load CSS file(s) for resource when using (a) Student Submission Reports 
    (only one problem selected), or and (b)Detailed Problem Analysis when
    "Show problem" is checked, or when using Submission Time Plots.
  
  
-------------- next part --------------
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.164 loncom/interface/lonstatistics.pm:1.165
--- loncom/interface/lonstatistics.pm:1.164	Mon Dec 18 23:51:14 2017
+++ loncom/interface/lonstatistics.pm	Tue Nov 10 19:28:32 2020
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.164 2017/12/18 23:51:14 raeburn Exp $
+# $Id: lonstatistics.pm,v 1.165 2020/11/10 19:28:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -832,6 +832,8 @@
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['sort','reportSelected',
                                              'SelectedStudent']);
+    my $GoToPage = $env{'form.reportSelected'};
+ 
     #
     # Give the LON-CAPA page header
     my $style = <<ENDSTYLE;
@@ -842,9 +844,38 @@
     td.essay          { border: 1px solid gray; }
 </style>
 ENDSTYLE
-      
+
+    my $head_extra = $style;
+    if (($env{'form.reportSelected'} eq 'student_submission_reports') &&
+        ($env{'form.renderprob'})) {
+        my @Symbs = &Apache::lonstathelpers::get_selected_symbs('problemchoice');
+        if (scalar(@Symbs) == 1) {
+            $head_extra .= &Apache::loncommon::css_links($Symbs[0]);
+        }
+    } elsif ($env{'form.reportSelected'} eq 'submissiontime_analysis') {
+        my ($navmap,$current_problem) =
+            &Apache::lonsubmissiontimeanalysis::get_current_problem();
+        if (ref($current_problem) eq 'HASH') {
+            my $symb = $current_problem->{'symb'};
+            if ($symb) {
+                $head_extra .= &Apache::loncommon::css_links($symb);
+            }
+        }
+    } elsif (($env{'form.reportSelected'} eq 'problem_analysis') &&
+              ($env{'form.show_prob'})) {
+        my $problem_types = &Apache::lonproblemanalysis::analyzable_types();
+        my ($navmap,$current_problem) =
+            &Apache::lonproblemanalysis::get_current_problem($problem_types);
+        if (ref($current_problem) eq 'HASH') {
+            my $symb = $current_problem->{'symb'};
+            my $res = $current_problem->{'resource'};
+            if ($symb) {
+                $head_extra .= &Apache::loncommon::css_links($symb);
+            }
+        }
+    }
     $r->print(&Apache::loncommon::start_page('Course Statistics and Charts',
-					     $style));
+					     $head_extra));
     $r->rflush();
     # 
     # Either print out a menu for them or send them to a report
@@ -854,8 +885,7 @@
                                             text =>'Statistics',
                                             faq=>139,
                                             bug=>'Statistics and Charts'});
-    if (! exists($env{'form.reportSelected'}) || 
-        $env{'form.reportSelected'} eq '') {
+    if ($GoToPage eq '') {
         $r->print(&Apache::lonhtmlcommon::breadcrumbs('Statistics Main Page'));
         &Apache::lonquickgrades::startGradeScreen($r,'statistics');
         $r->print(&CreateMainMenu());
@@ -884,8 +914,6 @@
             &Apache::loncoursedata::delete_caches($env{'request.course.id'});
         }
         #
-        my $GoToPage = $env{'form.reportSelected'};
-        #
         # Begin form output
         $r->print('<form name="Statistics" ');
         if ($GoToPage eq 'student_submission_reports') {
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.146 loncom/interface/statistics/lonproblemanalysis.pm:1.147
--- loncom/interface/statistics/lonproblemanalysis.pm:1.146	Wed Feb 26 17:46:19 2014
+++ loncom/interface/statistics/lonproblemanalysis.pm	Tue Nov 10 19:28:32 2020
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemanalysis.pm,v 1.146 2014/02/26 17:46:19 raeburn Exp $
+# $Id: lonproblemanalysis.pm,v 1.147 2020/11/10 19:28:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -92,7 +92,7 @@
         &Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status');
     $r->rflush();
     #
-    my $problem_types = '(option|radiobutton|numerical)';
+    my $problem_types = &analyzable_types();
     if (exists($env{'form.problemchoice'}) && 
         ! exists($env{'form.SelectAnother'})) {
         foreach my $button (@SubmitButtons) {
@@ -118,21 +118,9 @@
         $r->rflush();
         #
         # Determine which problem we are to analyze
-        my $current_problem = &Apache::lonstathelpers::get_target_from_id
-            ($env{'form.problemchoice'});
-        #
-        my ($navmap,$prev,$curr,$next) = 
-            &Apache::lonstathelpers::get_prev_curr_next($current_problem,
-                                                        $problem_types,
-                                                        'response',
-                                                        );
-        if (exists($env{'form.PrevProblemAnalysis'}) && defined($prev)) {
-            $current_problem = $prev;
-        } elsif (exists($env{'form.NextProblemAnalysis'}) && defined($next)) {
-            $current_problem = $next;
-        } else {
-            $current_problem = $curr;
-        }
+        my ($navmap,$current_problem) = &get_current_problem(); # need to retrieve $navmap
+                                                                # to support $resource->* calls
+                                                                # for src and compTitle (below)
         #
         # Store the current problem choice and send it out in the form
         $env{'form.problemchoice'} = 
@@ -193,6 +181,28 @@
     }
 }
 
+sub analyzable_types {
+    return '(option|radiobutton|numerical)';
+}
+
+sub get_current_problem {
+    my ($problem_types) = @_;
+    my $current_problem = &Apache::lonstathelpers::get_target_from_id
+        ($env{'form.problemchoice'});
+    my ($navmap,$prev,$curr,$next) =
+        &Apache::lonstathelpers::get_prev_curr_next($current_problem,
+                                                    $problem_types,
+                                                    'response');
+    if (exists($env{'form.PrevProblemAnalysis'}) && ($prev ne '')) {
+        $current_problem = $prev;
+    } elsif (exists($env{'form.NextProblemAnalysis'}) && ($next ne '')) {
+        $current_problem = $next;
+    } else {
+        $current_problem = $curr;
+    }
+    return ($navmap,$current_problem);
+}
+
 #########################################################
 #########################################################
 ##
Index: loncom/interface/statistics/lonsubmissiontimeanalysis.pm
diff -u loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.36 loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.37
--- loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.36	Mon Dec 17 02:20:13 2012
+++ loncom/interface/statistics/lonsubmissiontimeanalysis.pm	Tue Nov 10 19:28:32 2020
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonsubmissiontimeanalysis.pm,v 1.36 2012/12/17 02:20:13 raeburn Exp $
+# $Id: lonsubmissiontimeanalysis.pm,v 1.37 2020/11/10 19:28:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -105,20 +105,9 @@
         $r->rflush();
         #
         # Determine which problem we are to analyze
-        my $current_problem = &Apache::lonstathelpers::get_target_from_id
-            ($env{'form.problemchoice'});
-        #
-        my ($navmap,$prev,$curr,$next) = 
-            &Apache::lonstathelpers::get_prev_curr_next($current_problem,
-                                                        '.',
-                                                        'part');
-        if (exists($env{'form.PrevProblemAnalysis'}) && defined($prev)) {
-            $current_problem = $prev;
-        } elsif (exists($env{'form.NextProblemAnalysis'}) && defined($next)) {
-            $current_problem = $next;
-        } else {
-            $current_problem = $curr;
-        }
+        my ($navmap,$current_problem) = &get_current_problem(); # need to retrieve $navmap
+                                                                # to support $resource->* calls
+                                                                # for src and compTitle (below)
         #
         # Store the current problem choice and send it out in the form
         $env{'form.problemchoice'} = 
@@ -154,6 +143,23 @@
     }
 }
 
+sub get_current_problem {
+    my $current_problem = &Apache::lonstathelpers::get_target_from_id
+        ($env{'form.problemchoice'});
+    my ($navmap,$prev,$curr,$next) =
+        &Apache::lonstathelpers::get_prev_curr_next($current_problem,
+                                                    '.',
+                                                    'part');
+    if (exists($env{'form.PrevProblemAnalysis'}) && defined($prev)) {
+        $current_problem = $prev;
+    } elsif (exists($env{'form.NextProblemAnalysis'}) && defined($next)) {
+        $current_problem = $next;
+    } else {
+        $current_problem = $curr;
+    }
+    return ($navmap,$current_problem);
+}
+
 #########################################################
 #########################################################
 ##


More information about the LON-CAPA-cvs mailing list