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

raeburn raeburn at source.lon-capa.org
Mon Aug 31 23:35:54 EDT 2020


raeburn		Tue Sep  1 03:35:54 2020 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm 
  Log:
  - Current user's shown in username textbox for Individual Points Overview
    if no student selected.
  - Eliminate unused assignment of $notshowSPRSlink in &real_handler(), it's
    set in &startGradeScreen() now.
  - If no navmap object available display error message.
  - Course personnel see: 'Students will see link to spreadsheet." note in
    page header, if course configured to use spreadsheet.
  
  
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.117 loncom/interface/lonquickgrades.pm:1.118
--- loncom/interface/lonquickgrades.pm:1.117	Mon Aug 10 19:28:21 2020
+++ loncom/interface/lonquickgrades.pm	Tue Sep  1 03:35:54 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.117 2020/08/10 19:28:21 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.118 2020/09/01 03:35:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -222,6 +222,10 @@
             $r->print('<p><span class="LC_warning">'.&mt("Unknown Student/Employee ID: [_1]",$stdid).'</span></p>');
             $stdid='';
         }
+        if (($uname eq '') && ($udom eq '')) {
+            $uname = $env{'user.name'};
+            $udom = $env{'user.domain'};
+        }
         $r->print('<form method="post" name="quickform" action="/adm/quickgrades">');
         my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
            &Apache::loncommon::selectstudent_link('quickform','uname','udom');
@@ -237,9 +241,6 @@
     }
     $r->rflush();
 
-    my $notshowSPRSlink =
-        (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external')
-      || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals'));
     my $notshowTotals=
         $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals';
     my $showCategories=
@@ -248,12 +249,19 @@
     my ($navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted)=
        &getData($showPoints,$uname,$udom);
 
-    if ($showCategories) {
-       &outputCategories($r,$showPoints,$notshowTotals,
-                 $navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted);
+    if (ref($navmap)) {
+        if ($showCategories) {
+            &outputCategories($r,$showPoints,$notshowTotals,
+                $navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted);
+        } else {
+            &outputTable($r,$showPoints,$notshowTotals,
+                $navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted);
+        }
     } else {
-       &outputTable($r,$showPoints,$notshowTotals,
-                 $navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted);
+        if ($cangrade) { $r->print("\n</form>\n"); }
+        my $requrl = $r->uri;
+        $env{'user.error.msg'} = "$requrl:bre:0:0:Navmap initialization failed.";
+        return HTTP_NOT_ACCEPTABLE;
     }
     if ($cangrade) { $r->print("\n</form>\n"); }
     &endGradeScreen($r);
@@ -332,6 +340,8 @@
       || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'));
     my $notshowTotals=
         $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals';
+    my $showSPRSlink =
+        $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'spreadsheet';
     my $showCategories=
         $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';
  
@@ -353,6 +363,7 @@
        push(@notes,&mt('Students do not see link to spreadsheet.')) if ($notshowSPRSlink);
        push(@notes,&mt('Students will see points based on problem weights.')) if ($showPoints);
        push(@notes,&mt('Students will see points based on categories.')) if ($showCategories);
+       push(@notes,&mt('Students will see link to spreadsheet.')) if ($showSPRSlink);
        push(@notes, &Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'),'grading'));
        $r->print(&Apache::loncommon::head_subbox(join('  ', at notes)));
     }
@@ -393,6 +404,7 @@
 sub endGradeScreen {
    my ($r)=@_;
    $r->print('</div></div></div>'.&Apache::loncommon::end_page());
+   return;
 }
 
 # -----------
@@ -465,6 +477,10 @@
     # Create the nav map
     my $navmap = Apache::lonnavmaps::navmap->new($uname,$udom);
 
+    if (!defined($navmap)) {
+        return ();
+    }
+
     my $res = $navmap->firstResource(); # temp resource to access constants
 
     my $iterator = $navmap->getIterator(undef, undef, undef, 1);
@@ -693,6 +709,7 @@
     }
 
     $r->print(&Apache::loncommon::end_data_table());
+    return;
 }
 
 #




More information about the LON-CAPA-cvs mailing list