version 1.248, 2005/02/18 23:36:12
|
version 1.253, 2005/04/02 02:22:10
|
Line 96 sub get_symb_and_url {
|
Line 96 sub get_symb_and_url {
|
sub nameUserString { |
sub nameUserString { |
my ($type,$fullname,$uname,$udom) = @_; |
my ($type,$fullname,$uname,$udom) = @_; |
if ($type eq 'header') { |
if ($type eq 'header') { |
return '<b> Fullname </b><font color="#999999">(Username)</font> '; |
return '<b> Fullname </b><font color="#999999">(Username)</font>'; |
} else { |
} else { |
return ' '.$fullname.'<font color="#999999"> ('.$uname. |
return ' '.$fullname.'<font color="#999999"> ('.$uname. |
($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').')</font>'; |
($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').')</font>'; |
Line 664 LISTJAVASCRIPT
|
Line 664 LISTJAVASCRIPT
|
$gradeTable.='To '.lc($viewgrade).' a submission or a group of submissions, click on the check box(es) '. |
$gradeTable.='To '.lc($viewgrade).' a submission or a group of submissions, click on the check box(es) '. |
'next to the student\'s name(s). Then click on the Next button.<br />'."\n". |
'next to the student\'s name(s). Then click on the Next button.<br />'."\n". |
'<input type="hidden" name="command" value="processGroup" />'."\n"; |
'<input type="hidden" name="command" value="processGroup" />'."\n"; |
|
|
|
# checkall buttons |
|
$gradeTable.=&check_script('gradesub', 'stuinfo'); |
$gradeTable.='<input type="button" '."\n". |
$gradeTable.='<input type="button" '."\n". |
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
'value="Next->" />'."\n"; |
'value="Next->" /> <br />'."\n"; |
|
$gradeTable.=&check_buttons(); |
$gradeTable.='<input type="checkbox" name="checkPlag" checked="on">Check For Plagiarism</input>'; |
$gradeTable.='<input type="checkbox" name="checkPlag" checked="on">Check For Plagiarism</input>'; |
my (undef, undef, $fullname) = &getclasslist($getsec,'1'); |
my ($classlist, undef, $fullname) = &getclasslist($getsec,'1'); |
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'. |
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr bgcolor="#e6ffff">'; |
'<table border="0"><tr bgcolor="#e6ffff">'; |
my $loop = 0; |
my $loop = 0; |
while ($loop < 2) { |
while ($loop < 2) { |
$gradeTable.='<td><b> No.</b> </td><td><b> Select </b></td>'. |
$gradeTable.='<td><b> No.</b> </td><td><b> Select </b></td>'. |
'<td>'.&nameUserString('header').'</td>'; |
'<td>'.&nameUserString('header').' Section/Group</td>'; |
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { |
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { |
foreach (sort(@$partlist)) { |
foreach (sort(@$partlist)) { |
my $display_part=&get_display_part((split(/_/))[0],$url,$symb); |
my $display_part=&get_display_part((split(/_/))[0],$url,$symb); |
Line 719 LISTJAVASCRIPT
|
Line 723 LISTJAVASCRIPT
|
} |
} |
|
|
$ctr++; |
$ctr++; |
|
my $section = $classlist->{$student}->[&Apache::loncoursedata::CL_SECTION()]; |
|
|
if ( $perm{'vgr'} eq 'F' ) { |
if ( $perm{'vgr'} eq 'F' ) { |
$gradeTable.='<tr bgcolor="#ffffe6">' if ($ctr%2 ==1); |
$gradeTable.='<tr bgcolor="#ffffe6">' if ($ctr%2 ==1); |
$gradeTable.='<td align="right">'.$ctr.' </td>'. |
$gradeTable.='<td align="right">'.$ctr.' </td>'. |
'<td align="center"><input type=checkbox name="stuinfo" value="'. |
'<td align="center"><label><input type=checkbox name="stuinfo" value="'. |
$student.':'.$$fullname{$student}.' " /></td>'."\n". |
$student.':'.$$fullname{$student}.':::SECTION'.$section. |
'<td>'.&nameUserString(undef,$$fullname{$student},$uname,$udom).'</td>'."\n"; |
') " /> </label></td>'."\n".'<td>'. |
|
&nameUserString(undef,$$fullname{$student},$uname,$udom). |
|
' '.$section.'</td>'."\n"; |
|
|
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { |
if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { |
foreach (sort keys(%status)) { |
foreach (sort keys(%status)) { |
Line 746 LISTJAVASCRIPT
|
Line 754 LISTJAVASCRIPT
|
$gradeTable.='</tr>'; |
$gradeTable.='</tr>'; |
} |
} |
|
|
$gradeTable.='</table></td></tr></table>'. |
$gradeTable.='</table></td></tr></table>'."\n". |
'<input type="button" '. |
'<input type="button" '. |
'onClick="javascript:checkSelect(this.form.stuinfo);" '. |
'onClick="javascript:checkSelect(this.form.stuinfo);" '. |
'value="Next->" /></form>'."\n"; |
'value="Next->" /></form>'."\n"; |
Line 771 LISTJAVASCRIPT
|
Line 779 LISTJAVASCRIPT
|
} |
} |
|
|
#---- Called from the listStudents routine |
#---- Called from the listStudents routine |
|
|
|
sub check_script { |
|
my ($form, $type)=@_; |
|
my $chkallscript='<script type="text/javascript"> |
|
function checkall() { |
|
for (i=0; i<document.forms.'.$form.'.elements.length; i++) { |
|
ele = document.forms.'.$form.'.elements[i]; |
|
if (ele.name == "'.$type.'") { |
|
document.forms.'.$form.'.elements[i].checked=true; |
|
} |
|
} |
|
} |
|
|
|
function checksec() { |
|
for (i=0; i<document.forms.'.$form.'.elements.length; i++) { |
|
ele = document.forms.'.$form.'.elements[i]; |
|
string = document.forms.'.$form.'.chksec.value; |
|
if |
|
(ele.value.indexOf(":::SECTION"+string)>0) { |
|
document.forms.'.$form.'.elements[i].checked=true; |
|
} |
|
} |
|
} |
|
|
|
|
|
function uncheckall() { |
|
for (i=0; i<document.forms.'.$form.'.elements.length; i++) { |
|
ele = document.forms.'.$form.'.elements[i]; |
|
if (ele.name == "'.$type.'") { |
|
document.forms.'.$form.'.elements[i].checked=false; |
|
} |
|
} |
|
} |
|
|
|
</script>'."\n"; |
|
return $chkallscript; |
|
} |
|
|
|
sub check_buttons { |
|
my $buttons.='<input type="button" onclick="checkall()" value="Check All" />'; |
|
$buttons.='<input type="button" onclick="uncheckall()" value="Uncheck All" /> '; |
|
$buttons.='<input type="button" onclick="checksec()" value="Check Section/Group" />'; |
|
$buttons.='<input type="text" size="5" name="chksec" /> '; |
|
return $buttons; |
|
} |
|
|
# Displays the submissions for one student or a group of students |
# Displays the submissions for one student or a group of students |
sub processGroup { |
sub processGroup { |
my ($request) = shift; |
my ($request) = shift; |
Line 2059 sub saveHandGrade {
|
Line 2113 sub saveHandGrade {
|
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
if (!&canmodify($usec)) { return('not_allowed'); } |
if (!&canmodify($usec)) { return('not_allowed'); } |
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname); |
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname); |
|
my @parts_graded; |
my %newrecord = (); |
my %newrecord = (); |
my ($pts,$wgt) = ('',''); |
my ($pts,$wgt) = ('',''); |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
Line 2093 sub saveHandGrade {
|
Line 2148 sub saveHandGrade {
|
if ($partial eq $record{'resource.'.$_.'.awarded'}) { |
if ($partial eq $record{'resource.'.$_.'.awarded'}) { |
#do not update score for part if not changed. |
#do not update score for part if not changed. |
next; |
next; |
|
} else { |
|
push @parts_graded, $_; |
} |
} |
if ($record{'resource.'.$_.'.awarded'} ne $partial) { |
if ($record{'resource.'.$_.'.awarded'} ne $partial) { |
$newrecord{'resource.'.$_.'.awarded'} = $partial; |
$newrecord{'resource.'.$_.'.awarded'} = $partial; |
Line 2116 sub saveHandGrade {
|
Line 2173 sub saveHandGrade {
|
} |
} |
} |
} |
if (scalar(keys(%newrecord)) > 0) { |
if (scalar(keys(%newrecord)) > 0) { |
|
&version_portfiles(\%record, \@parts_graded, $ENV{'request.course.id'}, $symb, $domain, $stuname); |
&Apache::lonnet::cstore(\%newrecord,$symb, |
&Apache::lonnet::cstore(\%newrecord,$symb, |
$ENV{'request.course.id'},$domain,$stuname); |
$ENV{'request.course.id'},$domain,$stuname); |
} |
} |
return '',$pts,$wgt; |
return '',$pts,$wgt; |
} |
} |
|
|
|
# ----------- Handles creating versions for portfolio files as answers |
|
sub version_portfiles { |
|
my ($record, $parts_graded, $courseid, $symb, $domain, $stuname) = @_; |
|
my $parts = join '|', @$parts_graded; |
|
my $portfolio_root = &Apache::loncommon::propath($domain, |
|
$stuname). |
|
'/userfiles/portfolio'; |
|
foreach my $key (keys %$record) { |
|
if ($key =~ /^resource\.($parts)\./ && $key =~ /\.portfiles$/) { |
|
my @portfiles = split /,/,$$record{$key}; |
|
foreach my $file (@portfiles) { |
|
$file =~ /^(.*?)([^\/]*$)/; |
|
my $directory = $1; |
|
my $version = 0; |
|
my $answer_file = $2; |
|
my @answer_file_parts = split /\./, $answer_file; |
|
my @dir_list = &Apache::lonnet::dirlist($directory,$domain,$stuname,$portfolio_root); |
|
my @file_names; |
|
my @file_name_parts; |
|
foreach my $row (@dir_list) { |
|
@file_names = split (/\&/,$row,2); |
|
@file_name_parts = split (/\./, $file_names[0]); |
|
# ($file_name_parts[scalar @file_name_parts] eq $answer_file_parts[scalar @answer_file_parts]) |
|
if (($file_name_parts[0] eq $answer_file_parts[0]) && |
|
($file_name_parts[-1] eq $answer_file_parts[-1])) { |
|
# gets here if filename and extension match, regardless of version |
|
if (scalar @file_name_parts == 3) { # a versioned file is found |
|
# so save it for later |
|
if ($file_name_parts[1] > $version) {$version = $file_name_parts[1]}; |
|
} |
|
} |
|
} |
|
$version += 1; |
|
&Apache::lonnet::logthis('answer file is '.$answer_file. |
|
' becomes '.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[(scalar @answer_file_parts)-1]); |
|
&Apache::lonnet::logthis('from dir list is '.$file_names[0].' has '.@file_name_parts.' parts'); |
|
} |
|
&Apache::lonnet::logthis('found key portfiles '.$key); |
|
&Apache::lonnet::logthis('found value portfiles '.$$record{$key}); |
|
} |
|
} |
|
|
|
|
|
} |
|
|
#-------------------------------------------------------------------------------------- |
#-------------------------------------------------------------------------------------- |
# |
# |
#-------------------------- Next few routines handles grading by section or whole class |
#-------------------------- Next few routines handles grading by section or whole class |