[LON-CAPA-cvs] cvs: loncom /homework grades.pm
ng
lon-capa-cvs@mail.lon-capa.org
Mon, 21 Jul 2003 13:32:49 -0000
ng Mon Jul 21 09:32:49 2003 EDT
Modified files:
/loncom/homework grades.pm
Log:
fix bug 763 - allow to go directly from submission page (displayed from chart button)
to grading page.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.120 loncom/homework/grades.pm:1.121
--- loncom/homework/grades.pm:1.120 Sat Jul 19 11:11:27 2003
+++ loncom/homework/grades.pm Mon Jul 21 09:32:49 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.120 2003/07/19 15:11:27 ng Exp $
+# $Id: grades.pm,v 1.121 2003/07/21 13:32:49 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -197,6 +197,7 @@
#--- section, ids and fullnames for each user.
sub getclasslist {
my ($getsec,$filterlist) = @_;
+ $getsec = $getsec eq '' ? 'all' : $getsec;
my $classlist=&Apache::loncoursedata::get_classlist();
# Bail out if we were unable to get the classlist
return if (! defined($classlist));
@@ -721,9 +722,9 @@
return;
}
-//=========== Check that a point is assigned for all the parts (essay grading only) ============
+//=========== Check that a point is assigned for all the parts ============
function checksubmit(formname,val,total,parttot) {
- document.SCORE.gradeOpt.value = val;
+ formname.gradeOpt.value = val;
if (val == "Save & Next") {
for (i=0;i<=total;i++) {
for (j=0;j<parttot;j++) {
@@ -745,14 +746,13 @@
}
}
- formname.submit();
- }
-
-//======= Process request to show the grading page from SUBM, CHART buttons
- function gradeStudent(formname,ptr) {
- formname.gradeOpt.value = 'Grade Student';
- formname.showgrading.value = "yes";
- formname.studentNo.value = ptr;
+ if (val == "Grade Student") {
+ formname.showgrading.value = "yes";
+ if (formname.Status.value == "") {
+ formname.Status.value = "Active";
+ }
+ formname.studentNo.value = total;
+ }
formname.submit();
}
@@ -1441,16 +1441,14 @@
'Apache::grades::keywords_highlight'));
}
- $result='<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n".
- '<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n".
- '<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'
- .$udom.'" />'."\n";
- $request->print($result);
+ $request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'
+ .$udom.'" />'."\n");
# return if view submission with no grading option
if ($ENV{'form.showgrading'} eq '' || (!&canmodify($usec))) {
my $toGrade.='<input type="button" value="Grade Student" '.
- 'onClick="javascript:gradeStudent(this.form,\''.$counter.'\');" TARGET=_self> '."\n";
+ 'onClick="javascript:checksubmit(this.form,\'Grade Student\',\''
+ .$counter.'\');" TARGET=_self> '."\n" if (&canmodify($usec));
$toGrade.='</td></tr></table></td></tr></table></form>'."\n";
$toGrade.=&show_grading_menu_form($symb,$url)
if (($ENV{'form.command'} eq 'submission') ||
@@ -1459,7 +1457,7 @@
return;
}
- # essay grading options
+ # essay grading message center
if ($ENV{'form.handgrade'} eq 'yes') {
my ($lastname,$givenn) = split(/,/,$ENV{'form.fullname'});
my $msgfor = $givenn.' '.$lastname;
@@ -1469,15 +1467,17 @@
}
$msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript
# $result.='<tr><td bgcolor="#ffffff">'."\n".
- $result=' <a href="javascript:msgCenter(document.SCORE,'.$counter.
+ $result='<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n".
+ '<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n";
+ $result.=' <a href="javascript:msgCenter(document.SCORE,'.$counter.
',\''.$msgfor.'\')"; TARGET=_self>'.
'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').'</a> '.
'<img src="'.$request->dir_config('lonIconsURL').
'/mailbkgrd.gif" width="14" height="10" name="mailicon'.$counter.'" />'."\n".
'<br /> (Message will be sent when you click on Save & Next below.)'."\n"
if ($ENV{'form.handgrade'} eq 'yes');
+ $request->print($result);
}
- $request->print($result);
my %seen = ();
my @partlist;
@@ -1503,7 +1503,6 @@
# print end of form
if ($counter == $total) {
my $endform='<table border="0"><tr><td>'."\n";
-# '<input type="hidden" name="gradeOpt" value="" />'."\n";
$endform.='<input type="button" value="Save & Next" '.
'onClick="javascript:checksubmit(this.form,\'Save & Next\','.
$total.','.scalar(@partlist).');" TARGET=_self> '."\n";
@@ -1666,7 +1665,6 @@
$ENV{'course.'.$ENV{'request.course.id'}.'.num'});
}
# Called by Save & Refresh from Highlight Attribute Window
-# my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1');
if ($ENV{'form.refresh'} eq 'on') {
my ($ctr,$total) = (0,0);
@@ -1686,8 +1684,9 @@
return '';
}
-# Go directly to grade student - from submission page
+# Go directly to grade student - from submission or link from chart page
if ($button eq 'Grade Student') {
+ (undef,undef,$ENV{'form.handgrade'},undef,undef) = &showResourceInfo($url);
my $processUser = $ENV{'form.unamedom'.$ENV{'form.studentNo'}};
($ENV{'form.student'},$ENV{'form.userdom'}) = split(/:/,$processUser);
$ENV{'form.fullname'} = $$fullname{$processUser};