--- loncom/homework/grades.pm 2003/03/28 20:49:55 1.80
+++ loncom/homework/grades.pm 2003/04/21 18:39:43 1.86
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.80 2003/03/28 20:49:55 ng Exp $
+# $Id: grades.pm,v 1.86 2003/04/21 18:39:43 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -717,7 +717,7 @@ sub sub_page_kw_js {
height = 600;
scrollbar = "yes";
}
-// if (window.pWin) window.pWin.close();
+// if (window.pWin) {window.pWin.close(); window.pWin=null}
pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height);
pWin.focus();
pDoc = pWin.document;
@@ -752,11 +752,7 @@ sub sub_page_kw_js {
pDoc.write(" includemsg = 1;");
pDoc.write(" }");
pDoc.write(" imgformname = eval(\\"opener.document.SCORE.mailicon\\"+usrctr);");
- pDoc.write(" if (includemsg) {");
- pDoc.write(" imgformname.src = \\"$iconpath/mailto.gif\\";");
- pDoc.write(" } else {");
- pDoc.write(" imgformname.src = \\"$iconpath/mailbkgrd.gif\\";");
- pDoc.write(" }");
+ pDoc.write(" imgformname.src = \\"$iconpath/\\"+((includemsg) ? \\"mailto.gif\\" : \\"mailbkgrd.gif\\");");
pDoc.write(" var includemsg = eval(\\"opener.document.SCORE.includemsg\\"+usrctr);");
pDoc.write(" includemsg.value = msgchk;");
@@ -1112,7 +1108,6 @@ KEYWORDS
my @col_fullnames;
my ($classlist,$fullname);
if ($ENV{'form.handgrade'} eq 'yes') {
- my @col_list;
($classlist,undef,$fullname) = &getclasslist('all','0');
for (keys (%$handgrade)) {
my $ncol = &Apache::lonnet::EXT('resource.'.$_.
@@ -1121,56 +1116,46 @@ KEYWORDS
next if ($ncol <= 0);
s/\_/\./g;
next if ($record{'resource.'.$_.'.collaborators'} eq '');
- my (@colList) = split(/,?\s+/,
- $record{'resource.'.$_.'.collaborators'});
- my @collaborators = ();
- foreach (@colList) { #pre-filter list - throw out submitter
+ my @goodcollaborators = ();
+ my @badcollaborators = ();
+ foreach (split(/,?\s+/,$record{'resource.'.$_.'.collaborators'})) {
+ $_ =~ s/[\$\^\(\)]//g;
+ next if ($_ eq '');
my ($co_name,$co_dom) = split /\@|:/,$_;
- $co_dom = $udom if (! defined($co_dom));
+ $co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i);
next if ($co_name eq $uname && $co_dom eq $udom);
- push @collaborators, $_;
+ # Doing this grep allows 'fuzzy' specification
+ my @Matches = grep /^$co_name:$co_dom$/i,keys %$classlist;
+ if (! scalar(@Matches)) {
+ push @badcollaborators,$_;
+ } else {
+ push @goodcollaborators, @Matches;
+ }
}
- my (@badcollaborators);
- if (scalar(@collaborators) != 0) {
+ if (scalar(@goodcollaborators) != 0) {
$result.='Collaborators: ';
- foreach my $collaborator (@collaborators) {
- my ($co_name,$co_dom) = split /\@|:/,$collaborator;
- $co_dom = $udom if (! defined($co_dom));
- # Doing this grep allows 'fuzzy' specification
- my @Matches = grep /^$co_name:$co_dom$/i,
- keys %$classlist;
- if (! scalar(@Matches)) {
- push @badcollaborators,':'.$collaborator.':';
- next;
- }
- push @col_list, @Matches;
- foreach (@Matches) {
- my ($lastname,$givenn) = split(/,/,$$fullname{$_});
- push @col_fullnames, $givenn.' '.$lastname;
- $result.=$$fullname{$_}.' ';
- }
- }
+ foreach (@goodcollaborators) {
+ my ($lastname,$givenn) = split(/,/,$$fullname{$_});
+ push @col_fullnames, $givenn.' '.$lastname;
+ $result.=$$fullname{$_}.' ';
+ }
$result.='
'."\n";
- if (scalar(@badcollaborators) > 0) {
- $result.='
';
- $result.='This student has submitted ';
- if (scalar(@badcollaborators) == 1) {
- $result .= 'an invalid collaborator';
- } else {
- $result .= 'invalid collaborators';
- }
- $result .= ': '.join(', ',@badcollaborators);
- $result .= ' |
';
- }
- if (scalar(@collaborators > $ncol)) {
- $result .= '';
- $result .= 'This student has submitted too many '.
- 'collaborators. Maximum is '.$ncol;
- $result .= ' |
';
- }
- $result.=''."\n";
- }
+ $result.=''."\n";
+ }
+ if (scalar(@badcollaborators) > 0) {
+ $result.='';
+ $result.='This student has submitted ';
+ $result.=(scalar(@badcollaborators) == 1) ? 'an invalid collaborator' : 'invalid collaborators';
+ $result .= ': '.join(', ',@badcollaborators);
+ $result .= ' |
';
+ }
+ if (scalar(@badcollaborators > $ncol)) {
+ $result .= '';
+ $result .= 'This student has submitted too many '.
+ 'collaborators. Maximum is '.$ncol.'.';
+ $result .= ' |
';
+ }
}
}
$request->print($result."\n");
@@ -1250,6 +1235,7 @@ KEYWORDS
my $lastone = pop @col_fullnames;
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.';
}
+ $msgfor =~ s/\'/\\'/g; #\'
$result.=''."\n".
' '.
@@ -1447,12 +1433,20 @@ sub processHandGrade {
$ENV{'course.'.$ENV{'request.course.id'}.'.num'});
# Called by Save & Refresh from Highlight Attribute Window
+ my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
if ($ENV{'form.refresh'} eq 'on') {
- my $ctr = 0;
- $ENV{'form.NTSTU'}=$ngrade;
+ my ($ctr,$total) = (0,0);
while ($ctr < $ngrade) {
- ($ENV{'form.student'},$ENV{'form.userdom'}) = split(/:/,$ENV{'form.unamedom'.$ctr});
- &submission($request,$ctr,$ngrade-1);
+ $total++ if $ENV{'form.unamedom'.$ctr} ne '';
+ $ctr++;
+ }
+ $ENV{'form.NTSTU'}=$ngrade;
+ $ctr = 0;
+ while ($ctr < $total) {
+ my $processUser = $ENV{'form.unamedom'.$ctr};
+ ($ENV{'form.student'},$ENV{'form.userdom'}) = split(/:/,$processUser);
+ $ENV{'form.fullname'} = $$fullname{$processUser};
+ &submission($request,$ctr,$total-1);
$ctr++;
}
return '';
@@ -1468,7 +1462,6 @@ sub processHandGrade {
$laststu = $firststu if ($ctr > $ngrade);
}
- my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
my (@parsedlist,@nextlist);
my ($nextflg) = 0;
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
@@ -2214,6 +2207,48 @@ sub csvuploadmap_footer {
ENDPICK
}
+sub upcsvScores_form {
+ my ($request) = shift;
+ my ($symb,$url)=&get_symb_and_url($request);
+ if (!$symb) {return '';}
+ my $result =<
+ function checkUpload(formname) {
+ if (formname.upfile.value == "") {
+ alert("Please use the browse button to select a file from your local directory.");
+ return false;
+ }
+ formname.submit();
+ }
+
+CSVFORMJS
+ $ENV{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
+ $result.='
'."\n";
+ $result.=''."\n";
+ $result.=' |
'."\n";
+ $result.=&show_grading_menu_form($symb,$url);
+
+ return $result;
+}
+
+
sub csvuploadmap {
my ($request)= @_;
my ($symb,$url)=&get_symb_and_url($request);
@@ -2779,6 +2814,15 @@ sub updateGradeByPage {
#
#------ start of section for handling grading by page/sequence ---------
+sub defaultFormData {
+ my ($symb,$url)=@_;
+ return '
+ '."\n".
+ ''."\n".
+ ''."\n".
+ ''."\n";
+}
+
sub getSequenceDropDown {
my ($request,$symb)=@_;
my $result=' |
'."\n".
''.
- ' '.
+ ' '.
'Upload scores from file |
'."\n";
$result.=''.
- ' '.
+ ' '.
'Grade scantron forms |
'."\n";
if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) {
@@ -3221,8 +3411,8 @@ sub handler {
}
} elsif ($command eq 'scantron_selectphase') {
$request->print(&scantron_selectphase($request));
- } elsif ($command eq 'scantron_configphase') {
- $request->print(&scantron_configphase($request));
+ } elsif ($command eq 'scantron_process') {
+ $request->print(&scantron_process_students($request));
} else {
$request->print("Unknown action: $command:");
}