--- loncom/homework/grades.pm 2003/03/24 21:03:54 1.76
+++ loncom/homework/grades.pm 2003/06/20 17:25:48 1.102
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.76 2003/03/24 21:03:54 ng Exp $
+# $Id: grades.pm,v 1.102 2003/06/20 17:25:48 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,6 +46,9 @@ use Apache::lonhomework;
use Apache::loncoursedata;
use Apache::lonmsg qw(:user_normal_msg);
use Apache::Constants qw(:common);
+use String::Similarity;
+
+my %oldessays=();
# ----- These first few routines are general use routines.----
#
@@ -125,8 +128,8 @@ sub getclasslist {
my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
@{$classlist->{$_}};
# filter students according to status selected
- if ($filterlist && $ENV{'form.saveStatus'} ne 'Any') {
- if ($ENV{'form.saveStatus'} ne $status) {
+ if ($filterlist && $ENV{'form.status'} ne 'Any') {
+ if ($ENV{'form.status'} ne $status) {
delete ($classlist->{$_});
next;
}
@@ -144,43 +147,6 @@ sub getclasslist {
return ($classlist,\@sections,\%fullnames);
}
-#find user domain
-sub finduser {
- my ($name) = @_;
- my $domain = '';
- if ( $Apache::grades::viewgrades eq 'F' ) {
- my %classlist=&Apache::lonnet::dump('classlist',
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
- my (@fields) = grep /^$name:/, keys %classlist;
- ($name, $domain) = split(/:/,$fields[0]);
- return ($name,$domain);
- } else {
- return ($ENV{'user.name'},$ENV{'user.domain'});
- }
-}
-
-#--- Prompts a user to enter a username.
-sub moreinfo {
- my ($request,$reason) = @_;
- $request->print("Unable to process request: $reason");
- if ( $Apache::grades::viewgrades eq 'F' ) {
- $request->print('
');
- }
- return '';
-}
-
#--- Retrieve the grade status of a student for all the parts
sub student_gradeStatus {
my ($url,$symb,$udom,$uname,$partlist) = @_;
@@ -211,10 +177,7 @@ sub jscriptNform {
$jscript.= ''."\n";
if ($ctr == 0) {
- $gradeTable=' '.
- 'No submission found for this resource. ';
+ my $num_students=(scalar(keys(%$fullname)));
+ if ($num_students eq 0) {
+ $gradeTable=' There are no students currently enrolled.';
+ } else {
+ $gradeTable=' '.
+ 'No submissions found for this resource for any students. ('.$num_students.' checked for submissions ';
+ }
} elsif ($ctr == 1) {
$gradeTable =~ s/type=checkbox/type=checkbox checked/;
}
@@ -634,6 +643,7 @@ SUBJAVASCRIPT
#--- javascript for essay type problem --
sub sub_page_kw_js {
my $request = shift;
+ my $iconpath = $request->dir_config('lonIconsURL');
$request->print(<
@@ -681,6 +691,12 @@ sub sub_page_kw_js {
}
//====================== Script for composing message ==============
+ // preload images
+ img1 = new Image();
+ img1.src = "$iconpath/mailbkgrd.gif";
+ img2 = new Image();
+ img2.src = "$iconpath/mailto.gif";
+
function msgCenter(msgform,usrctr,fullname) {
var Nmsg = msgform.savemsgN.value;
savedMsgHeader(Nmsg,usrctr,fullname);
@@ -716,7 +732,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;
@@ -735,18 +751,23 @@ sub sub_page_kw_js {
pDoc.write(" if (document.msgcenter.subchk.checked) {");
pDoc.write(" msgchk = \\"msgsub,\\";");
pDoc.write(" }");
- pDoc.write( "for (var i=1; i<=nmsg; i++) {");
+ pDoc.write(" var includemsg = 0;");
+ pDoc.write(" for (var i=1; i<=nmsg; i++) {");
pDoc.write(" var opnmsg = eval(\\"opener.document.SCORE.savemsg\\"+i);");
pDoc.write(" var frmmsg = eval(\\"document.msgcenter.msg\\"+i);");
pDoc.write(" opnmsg.value = frmmsg.value;");
pDoc.write(" var chkbox = eval(\\"document.msgcenter.msgn\\"+i);");
pDoc.write(" if (chkbox.checked) {");
pDoc.write(" msgchk += \\"savemsg\\"+i+\\",\\";");
+ pDoc.write(" includemsg = 1;");
pDoc.write(" }");
pDoc.write(" }");
pDoc.write(" if (document.msgcenter.newmsgchk.checked) {");
pDoc.write(" msgchk += \\"newmsg\\"+usrctr;");
+ pDoc.write(" includemsg = 1;");
pDoc.write(" }");
+ pDoc.write(" imgformname = eval(\\"opener.document.SCORE.mailicon\\"+usrctr);");
+ 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;");
@@ -992,7 +1013,7 @@ sub submission {
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'});
- ($uname,$udom) = &finduser($uname) if $udom eq '';
+
$ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq '';
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
@@ -1036,10 +1057,7 @@ sub submission {
$request->print('