');
+ $stdid='';
+ }
+ $r->print('\n"); }
+ &endGradeScreen($r);
+ return OK;
- # Keep this hash in sync with %statusIconMap in lonnavmaps; they
- # should match color/icon
- my $res = $navmap->firstResource(); # temp resource to access constants
-
- # Header
- my $title = $showPoints ? "Quick Points Display" : "Quick Completed Problems Display";
- $r->print(&Apache::loncommon::bodytag($title, '', ''));
-
- if (!$showPoints) {
- $r->print(<This screen shows how many problems (or problem parts) you have completed, and
-how many you have not yet done. You can also look at a detailed
-score sheet.
-HEADER
+}
+
+sub startGradeScreen {
+ my ($r,$mode)=@_;
+
+ my $showPoints =
+ $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard';
+ my $notshowSPRSlink =
+ (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external')
+ || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals')
+ || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'));
+ my $notshowTotals=
+ $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals';
+ my $showCategories=
+ $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';
+
+ my $allowed_to_view = &Apache::lonnet::allowed('vgr',$env{'request.course.id'});
+ my $allowed_to_edit = &Apache::lonnet::allowed('mgr',$env{'request.course.id'});
+
+ if ($allowed_to_view) {
+ my @notes;
+ push(@notes,&mt('Students do not see total points.')) if ($notshowTotals);
+ 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, &Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'),'grading'));
+ $r->print(&Apache::loncommon::head_subbox(join(' ',@notes)));
}
- $r->print("This may take a few moments to display.");
- $r->rflush();
+ $r->print("\n".'
'
+ .&Apache::loncommon::end_data_table_row());
+ }
}
}
@@ -237,32 +405,616 @@ HEADER
# If there were any problems at the top level, print an extra "catchall"
if ($topLevelParts > 0) {
my $ratio = $topLevelRight / $topLevelParts;
- my $color = mixColors(\@start, \@end, $ratio);
- $r->print("
");
- $r->print("Problems Not Contained In A Folder
');
+ $r->print(&mt("Problems Not Contained In A Folder")."
");
+ $r->print("$topLevelRight / $topLevelParts
"
+ .&Apache::loncommon::end_data_table_row());
+ }
+
+#
+# show totals (if applicable), close table
+#
+ if ($showPoints) {
+ my $maxHelpLink = &Apache::loncommon::help_open_topic("Quick_Grades_Possibly_Correct");
+
+ $title = $showPoints ? "Points" : "Parts Done";
+ my $totaltitle = $showPoints ? &mt("Awarded Total Points") : &mt("Total Parts Done");
+ $r->print(&Apache::loncommon::start_data_table_row()
+ .'
'.$totaltitle.': '.$totalRight.' ');
+ $r->print(&mt('Max Possible To Date')." $maxHelpLink: $totalPossible ");
+ $title = $showPoints ? "Points" : "Parts";
+ $r->print(&mt("Total $title In Course").': '.$totalParts.'
'
+ .&Apache::loncommon::end_data_table_row());
}
- my $maxHelpLink = Apache::loncommon::help_open_topic("Quick_Grades_Possibly_Correct");
+ $r->print(&Apache::loncommon::end_data_table());
+}
+
+#
+# === Outputting category-based grades.
+#
+# $category{'order'}: output order of categories by id
+# $category{'all'}: complete list of all categories
+# $category{$id.'_name'}: display-name of category
+#
- $title = $showPoints ? "Points" : "Parts Done";
+sub outputCategories {
- $r->print("
Total $title: $totalRight ");
- $r->print("Max Possible To Date $maxHelpLink: $totalPossible ");
- $title = $showPoints ? "Points" : "Parts";
- $r->print("Total $title In Course: $totalParts
\n\n");
+ my ($r,$showPoints,$notshowTotals,
+ $navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted)=@_;
+# Take care of storing and retrieving categories
+
+ my $cangrade=&Apache::lonnet::allowed('mgr');
+
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my %categories=();
+# Loading old categories
+ %categories=&Apache::lonnet::dump('grading_categories',$cdom,$cnum);
+# Storing
+ if (($cangrade) && (($env{'form.storechanges'}) || ($env{'form.storemove'} ne '') || ($env{'form.cmd'} ne ''))) {
+# Process the changes
+ %categories=&process_category_edits($r,$cangrade,%categories);
+# Actually store
+ &Apache::lonnet::put('grading_categories',\%categories,$cdom,$cnum);
+ }
+# new categories loaded now
+ &output_category_table($r,$cangrade,$navmap,%categories);
+#
+ if ($cangrade) {
+ $r->print(&Apache::loncommon::resourcebrowser_javascript().
+ ''.
+ ''.
+ ''.
+ ''.
+ '');
+ }
+#
+# Debug
+#
+# my %data=&dumpdata($navmap);
+# foreach (keys(%data)) {
+# $r->print("\n ".$_.'='.$data{$_});
+# }
+}
+#
+# Get data for all symbs
+#
- $r->print("