'.
''.
@@ -413,8 +429,13 @@ LISTJAVASCRIPT
'onClick="javascript:checkSelect(this.form.stuinfo);" '.
'value="'.$viewgrade.'" />'."\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/;
}
@@ -453,96 +474,182 @@ sub sub_page_js {
my $request = shift;
$request->print(<
- function updateRadio(radioButton,formtextbox,formsel,scores,weight) {
- var pts = formtextbox.value;
- var resetbox =false;
- if (isNaN(pts) || pts < 0) {
- alert("A number equal or greater than 0 is expected. Entered value = "+pts);
- for (var i=0; i weight) {
+ var resp = confirm("You entered a value ("+pts+
+ ") greater than the weight for the part. Accept?");
+ if (resp == false) {
+ gradeBox.value = "";
+ return;
+ }
}
- return;
- }
- if (pts > weight) {
- var resp = confirm("You entered a value ("+pts+
- ") greater than the weight for the part. Accept?");
- if (resp == false) {
- formtextbox.value = "";
- return;
- }
+ for (var i=0; i
+SUBJAVASCRIPT
+}
- }
- document.SCORE.submit();
- }
+#--- javascript for essay type problem --
+sub sub_page_kw_js {
+ my $request = shift;
+ my $iconpath = $request->dir_config('lonIconsURL');
+ $request->print(<
//===================== Show list of keywords ====================
function keywords(keyform) {
- var keywds = keyform.value;
- var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keywds);
+ var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keyform.value);
if (nret==null) return;
keyform.value = nret;
@@ -584,6 +691,12 @@ sub sub_page_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);
@@ -611,91 +724,102 @@ sub sub_page_js {
return;
}
+// var pWin = null;
function savedMsgHeader(Nmsg,usrctr,fullname) {
- var height = 30*Nmsg+250;
+ var height = 70*Nmsg+250;
var scrollbar = "no";
if (height > 600) {
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.document.write("");
- pWin.document.write("Message Central ");
-
- pWin.document.write("
SUBJAVASCRIPT
}
+#--- displays the grading box, used in essay type problem and grading by page/sequence
+sub gradeBox {
+ my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
+
+ my $checkIcon = ' ';
+
+ my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
+ my $wgtmsg = ($wgt > 0 ? '(problem weight)' :
+ 'problem weight assigned by computer ');
+ $wgt = ($wgt > 0 ? $wgt : '1');
+ my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ?
+ '' : $$record{'resource.'.$partid.'.awarded'}*$wgt);
+ my $result=' '."\n";
+
+ $result.=''."\n";
+ return $result;
+}
sub show_problem {
- my ($request,$symb,$uname,$udom,$removeform) = @_;
+ my ($request,$symb,$uname,$udom,$removeform,$viewon) = @_;
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
$ENV{'request.course.id'});
if ($removeform) {
@@ -813,13 +997,14 @@ sub show_problem {
$rendered=~s|name="submit"|name="would_have_been_submit"|g;
}
my $result.='';
- $result.='';
- $result.=' View of the problem - '.$ENV{'form.fullname'}.
- ' '.$rendered.' ';
+ $result.='';
+ $result.=' View of the problem - '.$ENV{'form.fullname'}.
+ ' ' if ($viewon);
+ $result.=''.$rendered.' ';
$result.='Correct answer: '.$companswer;
$result.='
';
$result.='
';
- $request->print($result);
+ return $result;
}
# --------------------------- show submissions of a student, option to grade
@@ -827,27 +1012,28 @@ sub submission {
my ($request,$counter,$total) = @_;
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
-# if ($ENV{'form.student'} eq '') { &moreinfo($request,'Need student login id'); return ''; }
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 '';
-# if ($uname eq '') { &moreinfo($request,'Unable to find student'); return ''; }
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
-# $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes';
# header info
if ($counter == 0) {
&sub_page_js($request);
+ &sub_page_kw_js($request);
+ $ENV{'form.probTitle'} = $ENV{'form.probTitle'} eq '' ?
+ &Apache::lonnet::gettitle($symb) : $ENV{'form.probTitle'};
+
$request->print(' Submission Record '."\n".
- ' Resource: '.$url.' '."\n");
+ ' Problem: '.$ENV{'form.probTitle'}.' '."\n");
# option to display problem, only once else it cause problems
# with the form later since the problem has a form.
- if ($ENV{'form.vProb'} eq 'yes') {
- &show_problem($request,$symb,$uname,$udom,0);
+ if ($ENV{'form.vProb'} eq 'yes' or !$ENV{'form.vProb'}) {
+ $request->print(&show_problem($request,$symb,$uname,$udom,0,1));
}
# kwclr is the only variable that is guaranteed to be non blank
@@ -864,13 +1050,15 @@ sub submission {
$ENV{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0';
$ENV{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
$ENV{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ?
- $keyhash{$symb.'_subject'} : &Apache::lonnet::metadata($url,'title');
+ $keyhash{$symb.'_subject'} : $ENV{'form.probTitle'};
$ENV{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0';
}
$request->print('
'."\n");
+ $request->print(&show_grading_menu_form($symb,$url))
+ if (($ENV{'form.command'} eq 'submission') ||
+ ($ENV{'form.command'} eq 'processGroup' && $counter == $total));
return;
}
@@ -1057,10 +1270,13 @@ KEYWORDS
my $lastone = pop @col_fullnames;
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.';
}
+ $msgfor =~ s/\'/\\'/g; #' stupid emacs
$result.=''."\n".
' '.
- 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').' '.
+ 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').' '.
+ ' '."\n".
' (Message will be sent when you click on Save & Next below.)'."\n"
if ($ENV{'form.handgrade'} eq 'yes');
$request->print($result);
@@ -1073,54 +1289,8 @@ KEYWORDS
$seen{$partid}++;
next if ($$handgrade{$_} =~ /:no$/);
push @partlist,$partid;
- my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
- my $wgtmsg = ($wgt > 0 ? '(problem weight)' :
- 'problem weight assigned by computer ');
- $wgt = ($wgt > 0 ? $wgt : '1');
- my $score = ($record{'resource.'.$partid.'.awarded'} eq '' ?
- '' : $record{'resource.'.$partid.'.awarded'}*$wgt);
- $result=' ';
- $result.=''."\n";
- $request->print($result);
+ $request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
}
$result=' '."\n";
@@ -1138,7 +1308,7 @@ KEYWORDS
' '."\n";
if ($ENV{'form.handgrade'} eq 'yes') {
$endform.=' '."\n";
my $ntstu =''.
'1 2 '.
@@ -1151,9 +1321,9 @@ KEYWORDS
$endform.=' '."\n";
}
$endform.=' '."\n".
+ 'onClick="javascript:checksubmit(this.form,\'Next\');" TARGET=_self> '."\n".
' ';
+ 'onClick="javascript:checksubmit(this.form,\'Previous\');" TARGET=_self> ';
$endform.='(Next and Previous do not save the scores.)'."\n"
if ($ENV{'form.handgrade'} eq 'yes');
$endform.='
';
@@ -1173,9 +1343,7 @@ sub get_last_submission {
for ($version=1;$version<=$returnhash{'version'};$version++) {
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) {
$lasthash{$_}=$returnhash{$version.':'.$_};
-# if ($returnhash{$version.':'.$_} =~ /(SUBMITTED|DRAFT)$/) {
$timestamp = scalar(localtime($returnhash{$version.':timestamp'}));
-# }
}
}
foreach ((keys %lasthash)) {
@@ -1222,8 +1390,11 @@ sub processHandGrade {
my $ctr = 0;
while ($ctr < $ngrade) {
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr});
- my ($errorflag) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr);
-
+ my ($errorflag,$pts,$wgt) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr);
+ if ($errorflag eq 'no_score') {
+ $ctr++;
+ next;
+ }
my $includemsg = $ENV{'form.includemsg'.$ctr};
my ($subject,$message,$msgstatus) = ('','','');
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {
@@ -1232,7 +1403,11 @@ sub processHandGrade {
foreach (@msgnum) {
$message.=$ENV{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne '');
}
- $message =~ s/\s+/ /g;
+ $message =&Apache::lonfeedback::clear_out_html($message);
+ $message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt;
+ $message.=" for $ENV{'form.probTitle'} ";
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom,
$ENV{'form.msgsub'},$message);
}
@@ -1293,12 +1468,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 '';
@@ -1314,7 +1497,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) {
@@ -1354,8 +1536,6 @@ sub processHandGrade {
$ENV{'form.student'} = $uname;
$ENV{'form.userdom'} = $udom;
$ENV{'form.fullname'} = $$fullname{$_};
-# $ENV{'form.'.$_.':submitted_by'} = $submitter;
-# print "submitter=$ENV{'form.'.$_.':submitted_by'}= $submitter: ";
&submission($request,$ctr,$total);
$ctr++;
}
@@ -1372,8 +1552,9 @@ sub processHandGrade {
#---- Save the score and award for each student, if changed
sub saveHandGrade {
my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_;
- my %record=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
- my %newrecord;
+ my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
+ my %newrecord = ();
+ my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') {
if ($record{'resource.'.$_.'.solved'} ne 'excused') {
@@ -1383,10 +1564,11 @@ sub saveHandGrade {
}
}
} else {
- my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
- $ENV{'form.GD_BOX'.$newflg.'_'.$_} :
- $ENV{'form.RADVAL'.$newflg.'_'.$_});
- my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 :
+ $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
+ $ENV{'form.GD_BOX'.$newflg.'_'.$_} :
+ $ENV{'form.RADVAL'.$newflg.'_'.$_});
+ return 'no_score' if ($pts eq '' && $ENV{'form.GD_SEL'.$newflg.'_'.$_} eq '');
+ $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 :
$ENV{'form.WGT'.$newflg.'_'.$_};
my $partial= $pts/$wgt;
$newrecord{'resource.'.$_.'.awarded'} = $partial
@@ -1401,15 +1583,15 @@ sub saveHandGrade {
}
$newrecord{'resource.'.$_.'.submitted_by'} = $submitter
if ($submitter && ($record{'resource.'.$_.'.submitted_by'} ne $submitter));
+ $newrecord{'resource.'.$_.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
}
}
if (scalar(keys(%newrecord)) > 0) {
- $newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
&Apache::lonnet::cstore(\%newrecord,$symb,
$ENV{'request.course.id'},$domain,$stuname);
}
- return '';
+ return '',$pts,$wgt;
}
#--------------------------------------------------------------------------------------
@@ -1594,7 +1776,7 @@ sub viewgrades {
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'});
my $result='Manual Grading ';
- $result.='Resource: '.$ENV{'form.url'}.' '."\n";
+ $result.='Problem: '.$ENV{'form.probTitle'}.' '."\n";
#view individual student submission form - called using Javascript viewOneStudent
$result.=&jscriptNform($url,$symb);
@@ -1604,7 +1786,10 @@ sub viewgrades {
' '."\n".
' '."\n".
' '."\n".
- ' '."\n";
+ ' '."\n".
+ ' '."\n".
+ ' '."\n";
+
$result.='Assign Common Grade To ';
if ($ENV{'form.section'} eq 'all') {
$result.='Class ';
@@ -1615,12 +1800,6 @@ sub viewgrades {
}
$result.= ''."\n".
'';
-# $result.='To assign the same score for all the students use the radio buttons or '.
-# 'text box below. To assign scores individually fill in the score boxes for '.
-# 'each student in the table below. A part that has already '.
-# 'been graded does not get changed using the radio buttons or text box. '.
-# 'If needed, it has to be changed individually. ';
-# $result.=' ';
#radio buttons/text box for assigning points for a section or class.
#handles different parts of a problem
my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
@@ -1699,10 +1878,11 @@ sub viewgrades {
#get info for each student
#list all the students - with points and grade status
- my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
+ my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1');
my $ctr = 0;
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
- my ($uname,$udom) = split(/:/);
+ my $uname = $_;
+ $uname=~s/:/_/;
$result.=' '."\n";
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},
$_,$$fullname{$_},\@parts,\%weight);
@@ -1712,6 +1892,10 @@ sub viewgrades {
$result.=' '."\n";
$result.=' '."\n";
+ if (scalar(%$fullname) eq 0) {
+ my $colspan=3+scalar(@parts);
+ $result='There are no students in section "'.$ENV{'form.section'}.'" with enrollment status "'.$ENV{'form.status'}.'" to modify or grade. ';
+ }
$result.=&show_grading_menu_form($symb,$url);
return $result;
}
@@ -1720,30 +1904,31 @@ sub viewgrades {
sub viewstudentgrade {
my ($url,$symb,$courseid,$student,$fullname,$parts,$weight) = @_;
my ($uname,$udom) = split(/:/,$student);
+ $student=~s/:/_/;
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my $result=' '.
''.$fullname.' '.
' '.$uname.' '.$udom.' '."\n";
- foreach my $part (@$parts) {
- my ($part,$type) = &split_part_type($part);
+ foreach my $apart (@$parts) {
+ my ($part,$type) = &split_part_type($apart);
my $score=$record{"resource.$part.$type"};
if ($type eq 'awarded') {
my $pts = $score eq '' ? '' : $score*$$weight{$part};
$result.=' '."\n";
+ 'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n";
$result.=' '."\n";
} elsif ($type eq 'solved') {
my ($status,$foo)=split(/_/,$score,2);
$status = 'nothing' if ($status eq '');
- $result.=' '."\n";
$result.=''."\n";
+ 'GD_'.$student.'_'.$part.'_solved" '.
+ 'onChange="javascript:changeOneScore(\''.$part.'\',\''.$student.'\')" >'."\n";
my $optsel = ' excused '."\n";
$optsel = ' excused '."\n"
if ($status eq 'excused');
@@ -1751,10 +1936,10 @@ sub viewstudentgrade {
$result.=" \n";
} else {
$result.=' '.
+ 'GD_'.$student.'_'.$part.'_'.$type.'_s" value="'.$score.'" />'.
"\n";
$result.=' '."\n";
}
}
@@ -1770,12 +1955,11 @@ sub editgrades {
my $symb=$ENV{'form.symb'};
my $url =$ENV{'form.url'};
my $title='Current Grade Status ';
- $title.='Resource: '.$ENV{'form.url'}.' '."\n";
+ $title.='Problem: '.$ENV{'form.probTitle'}.' '."\n";
$title.='Section: '.$ENV{'form.section'}.' '."\n";
- $title.= &show_grading_menu_form ($symb,$url);
my $result= ''."\n";
$result.= ''.
- 'Username Fullname '."\n";
+ 'Username Domain Fullname '."\n";
my %scoreptr = (
'correct' =>'correct_by_override',
@@ -1823,16 +2007,19 @@ sub editgrades {
$result .= ' ';
$result .= $header;
$result .= ' '."\n";
-
+ my $noupdate;
for ($i=0; $i<$ENV{'form.total'}; $i++) {
+ my $line;
my $user = $ENV{'form.ctr'.$i};
+ my $usercolon = $user;
+ $usercolon =~s/_/:/;
+ my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- my @userdom = grep /^$user:/,keys %$classlist;
- my (undef,$udom) = split(/:/,$userdom[0]);
- $result .= ''.$user.' '.
- $$fullname{$userdom[0]}.' ';
+ $line .= ''.$uname.' '.
+ $udom.' '.
+ $$fullname{$usercolon}.' ';
foreach (@partid) {
my $old_aw = $ENV{'form.GD_'.$user.'_'.$_.'_awarded_s'};
my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1);
@@ -1852,7 +2039,7 @@ sub editgrades {
}
$score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_solved'} eq 'excused') &&
($score ne 'excused'));
- $result .= ''.$old_aw.' '.
+ $line .= ''.$old_aw.' '.
''.$awarded.
($score eq 'excused' ? $score : '').' ';
@@ -1872,21 +2059,28 @@ sub editgrades {
my $awarded = $ENV{'form.GD_'.$user.'_'.$part.'_'.$type};
if ($awarded ne '' && $awarded ne $old_aw) {
$newrecord{'resource.'.$part.'.'.$type}= $awarded;
+ $newrecord{'resource.'.$part.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
$updateflag=1;
}
- $result .= ''.$old_aw.' '.
+ $line .= ''.$old_aw.' '.
''.$awarded.' ';
}
}
- $result .= ' '."\n";
+ $line.=''."\n";
if ($updateflag) {
$count++;
- $newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
&Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},
- $udom,$user);
+ $udom,$uname);
+ $result.=$line;
+ } else {
+ $noupdate.=$line;
}
}
- $result .= '
'."\n";
+ if ($noupdate) {
+ $result .= 'No Changes Occured For the Students Below '.$noupdate;
+ }
+ $result .= '
'."\n".
+ &show_grading_menu_form ($symb,$url);
my $msg = 'Number of records updated = '.$rec_update.
' for '.$count.' student'.($count <= 1 ? '' : 's').'. '.
'Total number of students = '.$ENV{'form.total'}.' ';
@@ -1994,7 +2188,7 @@ sub csvuploadmap_header {
}
my $result='';
- $result.='Resource: '.$url.' ';
+ $result.='Problem: '.$ENV{'form.probTitle'}.' ';
my ($partlist,$handgrade) = &response_type($url);
my ($resptype,$hdgrade)=('','no');
for (sort keys(%$handgrade)) {
@@ -2025,6 +2219,8 @@ to this page if the data selected is ins
value="$ENV{'form.upfile_associate'}" />
+
+
+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);
if (!$symb) {return '';}
+
my $datatoken;
if (!$ENV{'form.datatoken'}) {
$datatoken=&Apache::loncommon::upfile_store($request);
@@ -2093,6 +2332,8 @@ sub csvuploadmap {
}
}
&csvuploadmap_footer($request,$i,$keyfields);
+ $request->print(&show_grading_menu_form($symb,$url));
+
return '';
}
@@ -2117,7 +2358,7 @@ sub csvuploadassign {
}
$request->print('Assigning Grades ');
my $courseid=$ENV{'request.course.id'};
- my ($classlist) = &getclasslist('all','1');
+ my ($classlist) = &getclasslist('all',0);
my @skipped;
my $countdone=0;
foreach my $grade (@gradedata) {
@@ -2149,13 +2390,773 @@ sub csvuploadassign {
$request->print('Skipped Students ');
foreach my $student (@skipped) { $request->print(" $student"); }
}
- $request->print(&view_edit_entire_class_form($symb,$url));
$request->print(&show_grading_menu_form($symb,$url));
return '';
}
#------------- end of section for handling csv file upload ---------
#
#-------------------------------------------------------------------
+#
+#-------------- Next few routines handles grading by page/sequence
+#
+#--- Select a page/sequence and a student to grade
+sub pickStudentPage {
+ my ($request) = shift;
+
+ $request->print(<
+
+function checkPickOne(formname) {
+ if (radioSelection(formname.student) == null) {
+ alert("Please select the student you wish to grade.");
+ return;
+ }
+ var ptr = pullDownSelection(formname.selectpage);
+ formname.page.value = eval("formname.page"+ptr+".value");
+ formname.title.value = eval("formname.title"+ptr+".value");
+ formname.submit();
+}
+
+function radioSelection(radioButton) {
+ var selection=null;
+ if (radioButton.length > 1) {
+ for (var i=0; i 1) {
+ for (var i=0; i
+LISTJAVASCRIPT
+
+ my ($symb,$url) = &get_symb_and_url($request);
+ my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"};
+ my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"};
+ my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};
+
+ my $result=' '.
+ 'Manual Grading by Page or Sequence ';
+
+ $result.=''."\n";
+
+ $studentTable.=&show_grading_menu_form($symb,$url);
+ $request->print($studentTable);
+
+ return '';
+}
+
+sub getSymbMap {
+ my ($request) = @_;
+ my $navmap = Apache::lonnavmaps::navmap-> new($ENV{'request.course.fn'}.'.db',
+ $ENV{'request.course.fn'}.'_parms.db',1, 1);
+
+ my $res = $navmap->firstResource(); # temp resource to access constants
+ $navmap->init();
+
+ # End navmap using boilerplate
+
+ my $iterator = $navmap->getIterator(undef, undef, undef, 1);
+ my $depth = 1;
+ $iterator->next(); # ignore first BEGIN_MAP
+ my $curRes = $iterator->next();
+
+ my %symbx = ();
+ my @titles = ();
+ my $minder=0;
+ while ($depth > 0) {
+ if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
+ if ($curRes == $iterator->END_MAP()) { $depth--; }
+
+ if (ref($curRes) && $curRes->is_map()) {
+ my ($mapUrl, $id, $resUrl) = split(/___/, $curRes->symb()); # check map contains at least one problem
+ my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
+
+ my $mapiterator = $navmap->getIterator($map->map_start(),
+ $map->map_finish());
+
+ my $mapdepth = 1;
+ my $countProblems = 0;
+ $mapiterator->next(); # skip the first BEGIN_MAP
+ my $mapcurRes = $mapiterator->next(); # for "current resource"
+ while ($mapdepth > 0) {
+ if($mapcurRes == $mapiterator->BEGIN_MAP) { $mapdepth++; }
+ if($mapcurRes == $mapiterator->END_MAP) { $mapdepth--; }
+
+ if (ref($mapcurRes) && $mapcurRes->is_problem() && !$mapcurRes->randomout) {
+ $countProblems++;
+ }
+ $mapcurRes = $mapiterator->next();
+ }
+ if ($countProblems > 0) {
+ my $title = $curRes->compTitle();
+ push @titles,$minder.'.'.$title; # minder, just in case two titles are identical
+ $symbx{$minder.'.'.$title} = $curRes->symb();
+ $minder++;
+ }
+ }
+ $curRes = $iterator->next();
+ }
+
+ $navmap->untieHashes();
+ return \@titles,\%symbx;
+}
+
+#
+#--- Displays a page/sequence w/wo problems, w/wo submissions
+sub displayPage {
+ my ($request) = shift;
+
+ my ($symb,$url) = &get_symb_and_url($request);
+ my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"};
+ my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"};
+ my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};
+ my $pageTitle = $ENV{'form.page'};
+ my (undef,undef,$fullname) = &getclasslist($getsec,'1');
+ my ($uname,$udom) = split(/:/,$ENV{'form.student'});
+
+ my $result=' '.$ENV{'form.title'}.' ';
+ $result.=' Student: '.$$fullname{$ENV{'form.student'}}.
+ ' ('.$uname.($udom eq $cdom ? '':':'.$udom).') '."\n";
+
+ &sub_page_js($request);
+ $request->print($result);
+
+ my $navmap = Apache::lonnavmaps::navmap-> new($ENV{'request.course.fn'}.'.db',
+ $ENV{'request.course.fn'}.'_parms.db',1, 1);
+ my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'});
+ my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
+
+ my $iterator = $navmap->getIterator($map->map_start(),
+ $map->map_finish());
+
+ my $studentTable='