'.
- ''.
- ' Select Fullname '.
- ' Username Domain ';
- foreach (sort(@$partlist)) {
- $gradeTable.=' Part '.(split(/_/))[0].' Status ';
+ '';
+ my $loop = 0;
+ while ($loop < 2) {
+ $gradeTable.=' Select Fullname '.
+ '(Username) ';
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ foreach (sort(@$partlist)) {
+ $gradeTable.=' Part '.(split(/_/))[0].' Status ';
+ }
+ }
+ $loop++;
}
$gradeTable.=' '."\n";
my $ctr = 0;
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
my ($uname,$udom) = split(/:/,$student);
- my (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
- my $statusflg = '';
- foreach (keys(%status)) {
- $statusflg = 1 if ($status{$_} ne 'nothing');
- my ($foo,$partid,$foo1) = split(/\./,$_);
- if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
- $statusflg = '';
- $gradeTable.=' ';
+ my %status = ();
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
+ my $statusflg = '';
+ foreach (keys(%status)) {
+ $statusflg = 1 if ($status{$_} ne 'nothing');
+ my ($foo,$partid,$foo1) = split(/\./,$_);
+ if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
+ $statusflg = '';
+ $gradeTable.=' ';
+ }
}
+ next if ($statusflg eq '' && $submitonly eq 'yes');
}
- next if ($statusflg eq '' && $submitonly eq 'yes');
$ctr++;
- if ( $Apache::grades::viewgrades eq 'F' ) {
- $gradeTable.=''.
- ' '."\n".
- ' '.$$fullname{$student}.' '."\n".
- ' '.$uname.' '."\n".
- ' '.$udom.' '."\n";
-
- foreach (sort keys(%status)) {
- next if (/^resource.*?submitted_by$/);
- $gradeTable.=' '.$status{$_}.' '."\n";
+ if ( $perm{'vgr'} eq 'F' ) {
+ $gradeTable.=' ' if ($ctr%2 ==1);
+ $gradeTable.=' '."\n".
+ ' '.$$fullname{$student}.' '."\n".
+ '('.$uname.') '."\n";
+
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ foreach (sort keys(%status)) {
+ next if (/^resource.*?submitted_by$/);
+ $gradeTable.=' '.$status{$_}.' '."\n";
+ }
}
- $gradeTable.=' '."\n";
+ $gradeTable.=''."\n" if ($ctr%2 ==0);
}
}
+ if ($ctr%2 ==1) {
+ $gradeTable.=' ';
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ foreach (@$partlist) {
+ $gradeTable.=' ';
+ }
+ }
+ $gradeTable.='';
+ }
+
$gradeTable.='
'.
' There are no students currently enrolled. ';
} else {
$gradeTable=' '.
- 'No submissions found for this resource for any students. ('.$num_students.' checked for submissions ';
+ 'No submissions found for this resource for any students. ('.$num_students.
+ ' checked for submissions ';
}
} elsif ($ctr == 1) {
$gradeTable =~ s/type=checkbox/type=checkbox checked/;
@@ -560,8 +708,8 @@ sub sub_page_js {
function checkSolved(formname,id) {
if (eval("formname.solved"+id+".value") == "correct_by_student") {
- alert("This problem has been graded correct by the computer. The score cannot be changed.");
- return "noupdate";
+ var reply = confirm("This problem has been graded correct by the computer. Do you want to change the score?");
+ if (!reply) {return "noupdate";}
}
return "update";
}
@@ -644,6 +792,7 @@ SUBJAVASCRIPT
sub sub_page_kw_js {
my $request = shift;
my $iconpath = $request->dir_config('lonIconsURL');
+ &commonJSfunctions($request);
$request->print(<
@@ -724,7 +873,6 @@ sub sub_page_kw_js {
return;
}
-// var pWin = null;
function savedMsgHeader(Nmsg,usrctr,fullname) {
var height = 70*Nmsg+250;
var scrollbar = "no";
@@ -733,7 +881,12 @@ sub sub_page_kw_js {
scrollbar = "yes";
}
// 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);
+ var xpos = (screen.width-600)/2;
+ xpos = (xpos < 0) ? '0' : xpos;
+ var ypos = (screen.height-height)/2-30;
+ ypos = (ypos < 0) ? '0' : ypos;
+
+ pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height);
pWin.focus();
pDoc = pWin.document;
pDoc.write("");
@@ -853,10 +1006,14 @@ sub sub_page_kw_js {
return;
}
-// var hwdWin = null;
function highlightCentral() {
// if (window.hwdWin) window.hwdWin.close();
- hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx=100,screeny=75');
+ var xpos = (screen.width-400)/2;
+ xpos = (xpos < 0) ? '0' : xpos;
+ var ypos = (screen.height-330)/2-30;
+ ypos = (ypos < 0) ? '0' : ypos;
+
+ hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos);
hwdWin.focus();
var hDoc = hwdWin.document;
hDoc.write("");
@@ -864,9 +1021,9 @@ sub sub_page_kw_js {
hDoc.write("
ENDPICK
-return '';
+ $request->print(&show_grading_menu_form($symb,$url));
+ return '';
}
@@ -2273,14 +2454,16 @@ sub upcsvScores_form {
CSVFORMJS
$ENV{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
+ my ($table) = &showResourceInfo($url,$ENV{'form.probTitle'});
+ $result.=$table;
$result.=''."\n";
$result.=''."\n";
- $result.=' Specify a file containing the class scores for problem - '.$ENV{'form.probTitle'}.
+ $result.=' Specify a file containing the class scores for current resource'.
'. '."\n";
$result.=''."\n";
my $upfile_select=&Apache::loncommon::upfile_select_html();
$result.=<
+
'."\n";
$result.='
'."\n";
$result.=&show_grading_menu_form($symb,$url);
-
return $result;
}
@@ -2359,6 +2541,7 @@ sub csvuploadassign {
$request->print('Assigning Grades ');
my $courseid=$ENV{'request.course.id'};
my ($classlist) = &getclasslist('all',0);
+ my @notallowed;
my @skipped;
my $countdone=0;
foreach my $grade (@gradedata) {
@@ -2369,6 +2552,11 @@ sub csvuploadassign {
push(@skipped,"$username:$domain");
next;
}
+ my $usec=$classlist->{"$username:$domain"}[5];
+ if (!&canmodify($usec)) {
+ push(@notallowed,"$username:$domain");
+ next;
+ }
my %grades;
foreach my $dest (keys(%fields)) {
if ($dest eq 'username' || $dest eq 'domain') { next; }
@@ -2387,9 +2575,14 @@ sub csvuploadassign {
}
$request->print(" Stored $countdone students\n");
if (@skipped) {
- $request->print('Skipped Students ');
- foreach my $student (@skipped) { $request->print(" $student"); }
+ $request->print('Skipped Students
');
+ foreach my $student (@skipped) { $request->print("$student \n"); }
}
+ if (@notallowed) {
+ $request->print('Students Not Allowed to Modify
');
+ foreach my $student (@notallowed) { $request->print("$student \n"); }
+ }
+ $request->print(" \n");
$request->print(&show_grading_menu_form($symb,$url));
return '';
}
@@ -2417,35 +2610,9 @@ function checkPickOne(formname) {
formname.submit();
}
-function radioSelection(radioButton) {
- var selection=null;
- if (radioButton.length > 1) {
- for (var i=0; i 1) {
- for (var i=0; i
LISTJAVASCRIPT
-
+ &commonJSfunctions($request);
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"};
@@ -2477,7 +2644,7 @@ LISTJAVASCRIPT
$result.=' '."\n".
' '."\n";
- $result.=' View Problems: no '."\n".
+ $result.=' View Problems Text: no '."\n".
' yes '." \n";
$result.=' Submission Details: '.
@@ -2486,6 +2653,7 @@ LISTJAVASCRIPT
' all details'."\n";
$result.=' '."\n".
+ ' '."\n".
' '."\n".
' '."\n".
' '."\n".
@@ -2530,53 +2698,22 @@ LISTJAVASCRIPT
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
+ $ENV{'request.course.fn'}.'_parms.db');
$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--; }
+ my $minder = 0;
- 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();
+ # Gather every sequence that has problems.
+ my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); }, 1);
+ for my $sequence ($navmap->getById('0.0'), @sequences) {
+ if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
+ my $title = $minder.'.'.$sequence->compTitle();
+ push @titles, $title; # minder in case two titles are identical
+ $symbx{$title} = $sequence->symb();
+ $minder++;
+ }
}
$navmap->untieHashes();
@@ -2593,9 +2730,14 @@ sub displayPage {
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 ($classlist,undef,$fullname) = &getclasslist($getsec,'1');
my ($uname,$udom) = split(/:/,$ENV{'form.student'});
-
+ my $usec=$classlist->{$ENV{'form.student'}}[5];
+ if (!&canview($usec)) {
+ $request->print('Unable to view requested student.('.$ENV{'form.student'}.') ');
+ $request->print(&show_grading_menu_form($symb,$url));
+ return;
+ }
my $result=' '.$ENV{'form.title'}.' ';
$result.=' Student: '.$$fullname{$ENV{'form.student'}}.
' ('.$uname.($udom eq $cdom ? '':':'.$udom).') '."\n";
@@ -2623,12 +2765,12 @@ sub displayPage {
my $checkIcon = ' ';
- $studentTable.=' Note: A problem graded correct ('.$checkIcon.
- ') by the computer cannot be changed.'."\n".
+ $studentTable.=' Note: Problems graded correct by the computer are marked with a '.$checkIcon.
+ ' symbol.'."\n".
''.
''.
- ' No '.
- ' '.($ENV{'form.vProb'} eq 'no' ? 'Title' : 'Problem View').'/Grade ';
+ ' Prob. '.
+ ' '.($ENV{'form.vProb'} eq 'no' ? 'Title' : 'Problem Text').'/Grade ';
my ($depth,$question) = (1,1);
$iterator->next(); # skip the first BEGIN_MAP
@@ -2647,59 +2789,27 @@ sub displayPage {
if ($ENV{'form.vProb'} eq 'yes') {
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1);
} else {
- my $companswer = &Apache::loncommon::get_student_answers(
- $symbx,$uname,$udom,$ENV{'request.course.id'});
+ my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$ENV{'request.course.id'});
$companswer =~ s|||g;
-
# while ($companswer =~ /()/s) { # \n");
# }
-# $companswer =~ s/ //g;
+# $companswer =~ s|||g;
$studentTable.=' '.$title.' Correct answer: '.$companswer;
}
my %record = &Apache::lonnet::restore($symbx,$ENV{'request.course.id'},$udom,$uname);
-
if ($ENV{'form.lastSub'} eq 'datesub') {
if ($record{'version'} eq '') {
$studentTable.=' No recorded submission for this problem ';
} else {
- $studentTable.=''.
- ''.
- 'Date/Time '.
- 'Submission '.
- 'Status ';
- my ($version);
- for ($version=1;$version<=$record{'version'};$version++) {
- my $timestamp = scalar(localtime($record{$version.':timestamp'}));
- $studentTable.=''.$timestamp.' ';
- my @versionKeys = split(/\:/,$record{$version.':keys'});
- my @displaySub = ();
- foreach my $partid (@{$parts}) {
- my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys;
- next if ($record{"$version:resource.$partid.solved"} eq '');
-# next if ($record{"$version:resource.$partid.award"} eq 'APPROX_ANS' &&
-# $record{"$version:resource.$partid.solved"} eq '');
- $displaySub[0].=(exists $record{$version.':'.$matchKey[0]}) ?
- 'Part '.$partid.' '.
- ($record{"$version:resource.$partid.tries"} eq '' ? 'Trial not counted' :
- 'Trial '.$record{"$version:resource.$partid.tries"}).' '.
- $record{$version.':'.$matchKey[0]}.' ' : '';
- $displaySub[1].=(exists $record{"$version:resource.$partid.award"}) ?
- 'Part '.$partid.' '.
- $record{"$version:resource.$partid.award"}.'/'.
- $record{"$version:resource.$partid.solved"}.' ' : '';
- $displaySub[2].=(exists $record{"$version:resource.$partid.regrader"}) ?
- $record{"$version:resource.$partid.regrader"}.' (Part: '.$partid.')' : '';
- }
- $displaySub[2].=(exists $record{"$version:resource.regrader"}) ?
- $record{"$version:resource.regrader"} : '';
- $studentTable.=''.$displaySub[0].' '.$displaySub[1].
- ($displaySub[2] eq '' ? '' : 'Manually graded by '.$displaySub[2]).' ';
+ my %responseType = ();
+ foreach my $partid (@{$parts}) {
+ $responseType{$partid} = $curRes->responseType($partid);
}
- $studentTable.='
';
+ $studentTable.= &displaySubByDates(\%record,$parts,\%responseType,$checkIcon);
}
} elsif ($ENV{'form.lastSub'} eq 'all') {
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
@@ -2708,15 +2818,16 @@ sub displayPage {
'','.submission');
}
-
- foreach my $partid (@{$parts}) {
- $studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record);
- $studentTable.=' '."\n";
- $question++;
+ if (&canmodify($usec)) {
+ foreach my $partid (@{$parts}) {
+ $studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record);
+ $studentTable.=' '."\n";
+ $question++;
+ }
}
$studentTable.='';
- }
+ }
$curRes = $iterator->next();
}
@@ -2732,6 +2843,46 @@ sub displayPage {
return '';
}
+sub displaySubByDates {
+ my ($record,$parts,$responseType,$checkIcon) = @_;
+ my $studentTable=''.
+ ''.
+ 'Date/Time '.
+ 'Submission '.
+ 'Status ';
+ my ($version);
+ my %mark;
+ $mark{'correct_by_student'} = $checkIcon;
+ for ($version=1;$version<=$$record{'version'};$version++) {
+ my $timestamp = scalar(localtime($$record{$version.':timestamp'}));
+ $studentTable.=''.$timestamp.' ';
+ my @versionKeys = split(/\:/,$$record{$version.':keys'});
+ my @displaySub = ();
+ foreach my $partid (@{$parts}) {
+ my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys;
+ next if ($$record{"$version:resource.$partid.solved"} eq '');
+ $displaySub[0].=(exists $$record{$version.':'.$matchKey[0]}) ?
+ 'Part '.$partid.' '.
+ ($$record{"$version:resource.$partid.tries"} eq '' ? 'Trial not counted' :
+ 'Trial '.$$record{"$version:resource.$partid.tries"}).' '.
+ &cleanRecord($$record{$version.':'.$matchKey[0]},$$responseType{$partid}).' ' : '';
+ $displaySub[1].=(exists $$record{"$version:resource.$partid.award"}) ?
+ 'Part '.$partid.' '.
+ lc($$record{"$version:resource.$partid.award"}).' '.
+ $mark{$$record{"$version:resource.$partid.solved"}}.' ' : '';
+# $$record{"$version:resource.$partid.solved"}.' ' : '';
+ $displaySub[2].=(exists $$record{"$version:resource.$partid.regrader"}) ?
+ $$record{"$version:resource.$partid.regrader"}.' (Part: '.$partid.')' : '';
+ }
+ $displaySub[2].=(exists $$record{"$version:resource.regrader"}) ?
+ $$record{"$version:resource.regrader"} : '';
+ $studentTable.=''.$displaySub[0].' '.$displaySub[1].
+ ($displaySub[2] eq '' ? '' : 'Manually graded by '.$displaySub[2]).' ';
+ }
+ $studentTable.='
';
+ return $studentTable;
+}
+
sub updateGradeByPage {
my ($request) = shift;
@@ -2739,9 +2890,14 @@ sub updateGradeByPage {
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 ($classlist,undef,$fullname) = &getclasslist($getsec,'1');
my ($uname,$udom) = split(/:/,$ENV{'form.student'});
-
+ my $usec=$classlist->{$ENV{'form.student'}}[5];
+ if (!&canmodify($usec)) {
+ $request->print('Unable to modify requested student.('.$ENV{'form.student'}.' ');
+ $request->print(&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'}));
+ return;
+ }
my $result=' '.$ENV{'form.title'}.' ';
$result.=' Student: '.$$fullname{$ENV{'form.student'}}.
' ('.$uname.($udom eq $cdom ? '':':'.$udom).') '."\n";
@@ -3194,12 +3350,19 @@ sub gradingmenu {
$request->print(<
- function checkChoice(formname) {
- var cmd = formname.command;
- formname.saveState.value = "saveCmd="+radioSelection(cmd)+":saveSec="+pullDownSelection(formname.section)+
- ":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.status);
- if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[3].checked || cmd[4].checked) formname.submit();
- if (cmd[5].checked) {
+ function checkChoice(formname,val,cmdx) {
+ if (val <= 2) {
+ var cmd = radioSelection(formname.radioChoice);
+ var cmdsave = cmd;
+ } else {
+ cmd = cmdx;
+ cmdsave = 'submission';
+ }
+ formname.command.value = cmd;
+ formname.saveState.value = "saveCmd="+cmdsave+":saveSec="+pullDownSelection(formname.section)+
+ ":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.Status);
+ if (val < 5) formname.submit();
+ if (val == 5) {
if (!checkReceiptNo(formname,'notOK')) { return false;}
formname.submit();
}
@@ -3216,60 +3379,19 @@ sub gradingmenu {
formname.receipt.focus();
return false;
}
- formname.command[5].checked = true;
return true;
}
-
- function radioSelection(radioButton) {
- var selection=null;
- if (radioButton.length > 1) {
- for (var i=0; i 1) {
- for (var i=0; i
GRADINGMENUJS
-
- my $result=' Manual Grading/View Submission '.
- ''.
- 'Problem: '.$probTitle.' '."\n";
- my ($partlist,$handgrade) = &response_type($url);
- my ($resptype,$hdgrade)=('','no');
- for (sort keys(%$handgrade)) {
- my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
- $resptype = $responsetype;
- $hdgrade = $handgrade if ($handgrade eq 'yes');
- $result.='Part '.(split(/_/))[0].' '.
- 'Type: '.$responsetype.' '.
- 'Handgrade: '.$handgrade.' ';
- }
- $result.='
'."\n";
-
+ &commonJSfunctions($request);
+ my $result=' Manual Grading/View Submission ';
+ my ($table,$resptype,$hdgrade) = &showResourceInfo($url,$probTitle);
+ $result.=$table;
my (undef,$sections) = &getclasslist('all','0');
my $savedState = &savedState();
- my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'pickStudentPage' : $$savedState{'saveCmd'});
+ my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'submission' : $$savedState{'saveCmd'});
my $saveSec = ($$savedState{'saveSec'} eq '' ? 'all' : $$savedState{'saveSec'});
- my $saveSub = ($$savedState{'saveSub'} eq '' ? 'yes' : $$savedState{'saveSub'});
+ my $saveSub = ($$savedState{'saveSub'} eq '' ? 'all' : $$savedState{'saveSub'});
my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'});
$result.='