version 1.391, 2007/03/13 18:59:56
|
version 1.397, 2007/04/26 22:29:50
|
Line 117 sub response_type {
|
Line 117 sub response_type {
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $res = $navmap->getBySymb($symb); |
my $res = $navmap->getBySymb($symb); |
my $partlist = $res->parts(); |
my $partlist = $res->parts(); |
|
my %vPart = |
|
map { $_ => 1 } (&Apache::loncommon::get_env_multiple('form.vPart')); |
my (%response_types,%handgrade); |
my (%response_types,%handgrade); |
foreach my $part (@{ $partlist }) { |
foreach my $part (@{ $partlist }) { |
|
next if (%vPart && !exists($vPart{$part})); |
|
|
my @types = $res->responseType($part); |
my @types = $res->responseType($part); |
my @ids = $res->responseIds($part); |
my @ids = $res->responseIds($part); |
for (my $i=0; $i < scalar(@ids); $i++) { |
for (my $i=0; $i < scalar(@ids); $i++) { |
Line 949 sub processGroup {
|
Line 953 sub processGroup {
|
my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo'); |
my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo'); |
my $total = scalar(@stuchecked)-1; |
my $total = scalar(@stuchecked)-1; |
|
|
foreach (@stuchecked) { |
foreach my $student (@stuchecked) { |
my ($uname,$udom,$fullname) = split(/:/); |
my ($uname,$udom,$fullname) = split(/:/,$student); |
$env{'form.student'} = $uname; |
$env{'form.student'} = $uname; |
$env{'form.userdom'} = $udom; |
$env{'form.userdom'} = $udom; |
$env{'form.fullname'} = $fullname; |
$env{'form.fullname'} = $fullname; |
Line 1623 sub show_problem {
|
Line 1627 sub show_problem {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub files_exist { |
|
my ($r, $symb) = @_; |
|
my @students = &Apache::loncommon::get_env_multiple('form.stuinfo'); |
|
|
|
foreach my $student (@students) { |
|
my ($uname,$udom,$fullname) = split(/:/,$student); |
|
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'}, |
|
$udom,$uname); |
|
my ($string,$timestamp)= &get_last_submission(\%record); |
|
foreach my $submission (@$string) { |
|
my ($partid,$respid) = |
|
($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/); |
|
my $files=&get_submitted_files($udom,$uname,$partid,$respid, |
|
\%record); |
|
return 1 if (@$files); |
|
} |
|
} |
|
return 0; |
|
} |
|
|
|
sub download_all_link { |
|
my ($r,$symb) = @_; |
|
my $all_students = |
|
join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo')); |
|
|
|
my $parts = |
|
join("\n",&Apache::loncommon::get_env_multiple('form.vPart')); |
|
|
|
my $identifier = &Apache::loncommon::get_cgi_id(); |
|
&Apache::lonnet::appenv('cgi.'.$identifier.'.students' => $all_students, |
|
'cgi.'.$identifier.'.symb' => $symb, |
|
'cgi.'.$identifier.'.parts' => $parts,); |
|
$r->print('<a href="/cgi-bin/multidownload.pl?'.$identifier.'">'. |
|
&mt('Download All Submitted Documents').'</a>'); |
|
return |
|
} |
|
|
# --------------------------- show submissions of a student, option to grade |
# --------------------------- show submissions of a student, option to grade |
sub submission { |
sub submission { |
my ($request,$counter,$total) = @_; |
my ($request,$counter,$total) = @_; |
Line 1657 sub submission {
|
Line 1698 sub submission {
|
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); |
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
|
if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) { |
|
&download_all_link($request, $symb); |
|
} |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
'<font size=+1> <b>Resource: </b>'.$env{'form.probTitle'}.'</font>'."\n"); |
'<font size=+1> <b>Resource: </b>'.$env{'form.probTitle'}.'</font>'."\n"); |
|
|
Line 1868 KEYWORDS
|
Line 1911 KEYWORDS
|
my %seenparts; |
my %seenparts; |
my @part_response_id = &flatten_responseType($responseType); |
my @part_response_id = &flatten_responseType($responseType); |
foreach my $part (@part_response_id) { |
foreach my $part (@part_response_id) { |
|
next if ($env{'form.lastSub'} eq 'hdgrade' |
|
&& $$handgrade{$$part[0].'_'.$$part[1]} ne 'yes'); |
|
|
my ($partid,$respid) = @{ $part }; |
my ($partid,$respid) = @{ $part }; |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
if ($env{"form.$uname:$udom:$partid:submitted_by"}) { |
if ($env{"form.$uname:$udom:$partid:submitted_by"}) { |
Line 1914 KEYWORDS
|
Line 1960 KEYWORDS
|
($env{'form.lastSub'} eq 'hdgrade' && |
($env{'form.lastSub'} eq 'hdgrade' && |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '. |
$lastsubonly.='<tr><td bgcolor="#ffffe6">Debug -'.'<b>Part:</b> '. |
$display_part.' <font color="#999999">( ID '.$respid. |
$display_part.' <font color="#999999">( hhhh ID '.$respid. |
' )</font> '; |
' )</font> '; |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
if (@$files) { |
if (@$files) { |
Line 2008 KEYWORDS
|
Line 2054 KEYWORDS
|
my $part_resp = join('_',@{ $part_response_id }); |
my $part_resp = join('_',@{ $part_response_id }); |
next if ($seen{$partid} > 0); |
next if ($seen{$partid} > 0); |
$seen{$partid}++; |
$seen{$partid}++; |
next if ($$handgrade{$part_resp} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/); |
next if ($$handgrade{$part_resp} ne 'yes' |
|
&& $env{'form.lastSub'} eq 'hdgrade'); |
push @partlist,$partid; |
push @partlist,$partid; |
push @gradePartRespid,$partid.'.'.$respid; |
push @gradePartRespid,$partid.'.'.$respid; |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
Line 2060 sub get_last_submission {
|
Line 2107 sub get_last_submission {
|
my %lasthash=(); |
my %lasthash=(); |
my ($version); |
my ($version); |
for ($version=1;$version<=$$returnhash{'version'};$version++) { |
for ($version=1;$version<=$$returnhash{'version'};$version++) { |
foreach (sort(split(/\:/,$$returnhash{$version.':keys'}))) { |
foreach my $key (sort(split(/\:/, |
$lasthash{$_}=$$returnhash{$version.':'.$_}; |
$$returnhash{$version.':keys'}))) { |
$timestamp = scalar(localtime($$returnhash{$version.':timestamp'})); |
$lasthash{$key}=$$returnhash{$version.':'.$key}; |
|
$timestamp = |
|
scalar(localtime($$returnhash{$version.':timestamp'})); |
} |
} |
} |
} |
foreach ((keys %lasthash)) { |
foreach my $key (keys(%lasthash)) { |
if ($_ =~ /\.submission$/) { |
next if ($key !~ /\.submission$/); |
my ($partid,$foo) = split(/submission$/,$_); |
|
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
my ($partid,$foo) = split(/submission$/,$key); |
'<font color="red">Draft Copy</font> ' : ''; |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
push @string, (join(':',$_,$draft.$lasthash{$_})); |
'<font color="red">Draft Copy</font> ' : ''; |
} |
push(@string, join(':', $key, $draft.$lasthash{$key})); |
} |
} |
} |
} |
@string = $string[0] eq '' ? '<font color="red">Nothing submitted - no attempts.</font>' : @string; |
if (!@string) { |
return \@string,\$timestamp; |
$string[0] = |
|
'<font color="red">Nothing submitted - no attempts.</font>'; |
|
} |
|
return (\@string,\$timestamp); |
} |
} |
|
|
#--- High light keywords, with style choosen by user. |
#--- High light keywords, with style choosen by user. |