version 1.428.2.2, 2007/09/05 00:22:20
|
version 1.430, 2007/08/21 18:41:27
|
Line 45 use LONCAPA;
|
Line 45 use LONCAPA;
|
|
|
use POSIX qw(floor); |
use POSIX qw(floor); |
|
|
my %perm; |
my %perm=(); |
|
|
# ----- These first few routines are general use routines.---- |
# ----- These first few routines are general use routines.---- |
# |
# |
Line 194 sub showResourceInfo {
|
Line 194 sub showResourceInfo {
|
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
} |
} |
|
|
sub reset_caches { |
|
&reset_analyze_cache(); |
|
&reset_perm(); |
|
} |
|
|
|
{ |
|
my %analyze_cache; |
|
|
|
sub reset_analyze_cache { |
|
undef(%analyze_cache); |
|
} |
|
|
|
sub get_analyze { |
sub get_order { |
my ($symb,$uname,$udom)=@_; |
my ($partid,$respid,$symb,$uname,$udom)=@_; |
my $key = "$symb\0$uname\0$udom"; |
my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
return $analyze_cache{$key} if (exists($analyze_cache{$key})); |
$url=&Apache::lonnet::clutter($url); |
|
my $subresult=&Apache::lonnet::ssi($url, |
my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
('grade_target' => 'analyze'), |
$url=&Apache::lonnet::clutter($url); |
('grade_domain' => $udom), |
my $subresult=&Apache::lonnet::ssi($url, |
('grade_symb' => $symb), |
('grade_target' => 'analyze'), |
('grade_courseid' => |
('grade_domain' => $udom), |
$env{'request.course.id'}), |
('grade_symb' => $symb), |
('grade_username' => $uname)); |
('grade_courseid' => |
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2); |
$env{'request.course.id'}), |
my %analyze=&Apache::lonnet::str2hash($subresult); |
('grade_username' => $uname)); |
return ($analyze{"$partid.$respid.shown"}); |
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2); |
|
my %analyze=&Apache::lonnet::str2hash($subresult); |
|
return $analyze_cache{$key} = \%analyze; |
|
} |
|
|
|
sub get_order { |
|
my ($partid,$respid,$symb,$uname,$udom)=@_; |
|
my $analyze = &get_analyze($symb,$uname,$udom); |
|
return $analyze->{"$partid.$respid.shown"}; |
|
} |
|
|
|
sub get_radiobutton_correct_foil { |
|
my ($partid,$respid,$symb,$uname,$udom)=@_; |
|
my $analyze = &get_analyze($symb,$uname,$udom); |
|
foreach my $foil (@{&get_order($partid,$respid,$symb,$uname,$udom)}) { |
|
if ($analyze->{"$partid.$respid.foil.value.$foil"} eq 'true') { |
|
return $foil; |
|
} |
|
} |
|
} |
|
} |
} |
|
|
#--- Clean response type for display |
#--- Clean response type for display |
#--- Currently filters option/rank/radiobutton/match/essay/Task |
#--- Currently filters option/rank/radiobutton/match/essay/Task |
# response types only. |
# response types only. |
Line 290 sub cleanRecord {
|
Line 258 sub cleanRecord {
|
} elsif ($response eq 'radiobutton') { |
} elsif ($response eq 'radiobutton') { |
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
my ($toprow,$bottomrow); |
my ($toprow,$bottomrow); |
my $correct = |
my $correct=($order->[0])+1; |
&get_radiobutton_correct_foil($partid,$respid,$symb,$uname,$udom); |
for (my $i=1;$i<=$#$order;$i++) { |
foreach my $foil (@$order) { |
my $foil=$order->[$i]; |
if (exists($answer{$foil})) { |
if (exists($answer{$foil})) { |
if ($foil eq $correct) { |
if ($i == $correct) { |
$toprow.='<td><b>true</b></td>'; |
$toprow.='<td><b>true</b></td>'; |
} else { |
} else { |
$toprow.='<td><i>true</i></td>'; |
$toprow.='<td><i>true</i></td>'; |
Line 3003 sub viewgrades {
|
Line 2971 sub viewgrades {
|
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n"; |
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n"; |
|
|
my $sectionClass; |
my $sectionClass; |
|
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
if ($env{'form.section'} eq 'all') { |
if ($env{'form.section'} eq 'all') { |
$sectionClass='Class </h3>'; |
$sectionClass='Class </h3>'; |
} elsif ($env{'form.section'} eq 'none') { |
} elsif ($env{'form.section'} eq 'none') { |
$sectionClass='Students in no Section </h3>'; |
$sectionClass='Students in no Section </h3>'; |
} else { |
} else { |
$sectionClass='Students in Section '.$env{'form.section'}.'</h3>'; |
$sectionClass='Students in Section(s) '.$section_display.'</h3>'; |
} |
} |
$result.='<h3>Assign Common Grade To '.$sectionClass; |
$result.='<h3>Assign Common Grade To '.$sectionClass; |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
Line 6964 GRADINGMENUJS
|
Line 6933 GRADINGMENUJS
|
|
|
$result.='<table width="100%" border="0">'; |
$result.='<table width="100%" border="0">'; |
$result.='<tr bgcolor="#ffffe6" valign="top"><td>'."\n". |
$result.='<tr bgcolor="#ffffe6" valign="top"><td>'."\n". |
' '.&mt('Select Section').': <select name="section">'."\n"; |
' '.&mt('Select Section').': <select name="section" multiple="multiple" size="3">'."\n"; |
if (ref($sections)) { |
if (ref($sections)) { |
foreach (sort (@$sections)) { |
foreach (sort (@$sections)) { |
$result.='<option value="'.$_.'" '. |
$result.='<option value="'.$_.'" '. |
Line 7072 sub gather_clicker_ids {
|
Line 7041 sub gather_clicker_ids {
|
# Set up a couple variables. |
# Set up a couple variables. |
my $username_idx = &Apache::loncoursedata::CL_SNAME(); |
my $username_idx = &Apache::loncoursedata::CL_SNAME(); |
my $domain_idx = &Apache::loncoursedata::CL_SDOM(); |
my $domain_idx = &Apache::loncoursedata::CL_SDOM(); |
my $status_idx = &Apache::loncoursedata::CL_STATUS(); |
|
|
|
foreach my $student (keys(%$classlist)) { |
foreach my $student (keys(%$classlist)) { |
if ($classlist->{$student}->[$status_idx] ne 'Active') { next; } |
|
my $username = $classlist->{$student}->[$username_idx]; |
my $username = $classlist->{$student}->[$username_idx]; |
my $domain = $classlist->{$student}->[$domain_idx]; |
my $domain = $classlist->{$student}->[$domain_idx]; |
my $clickers = |
my $clickers = |
Line 7336 ENDHEADER
|
Line 7304 ENDHEADER
|
$result.="\n".'<input type="hidden" name="correct:'.$correct_count.':'.$correct_ids{$id}.'" value="'.$responses{$id}.'" />'; |
$result.="\n".'<input type="hidden" name="correct:'.$correct_count.':'.$correct_ids{$id}.'" value="'.$responses{$id}.'" />'; |
$correct_count++; |
$correct_count++; |
} elsif ($clicker_ids{$id}) { |
} elsif ($clicker_ids{$id}) { |
if ($clicker_ids{$id}=~/\,/) { |
$result.="\n".'<input type="hidden" name="student:'.$clicker_ids{$id}.'" value="'.$responses{$id}.'" />'; |
# More than one user with the same clicker! |
$student_count++; |
$result.="\n<hr />".&mt('Clicker registered more than once').": <tt>".$id."</tt><br />"; |
|
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
|
"<select name='multi".$id."'>"; |
|
foreach my $reguser (sort(split(/\,/,$clicker_ids{$id}))) { |
|
$result.="<option value='".$reguser."'>".&Apache::loncommon::plainname(split(/\:/,$reguser)).' ('.$reguser.')</option>'; |
|
} |
|
$result.='</select>'; |
|
$unknown_count++; |
|
} else { |
|
# Good: found one and only one user with the right clicker |
|
$result.="\n".'<input type="hidden" name="student:'.$clicker_ids{$id}.'" value="'.$responses{$id}.'" />'; |
|
$student_count++; |
|
} |
|
} else { |
} else { |
$result.="\n<hr />".&mt('Unregistered Clicker')." <tt>".$id."</tt><br />"; |
$result.="\n<hr />".&mt('Unregistered Clicker')." <tt>".$id."</tt><br />"; |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
Line 7501 ENDHEADER
|
Line 7456 ENDHEADER
|
my $id=$1; |
my $id=$1; |
if (($env{'form.uname'.$id}) && ($env{'form.udom'.$id})) { |
if (($env{'form.uname'.$id}) && ($env{'form.udom'.$id})) { |
$user=$env{'form.uname'.$id}.':'.$env{'form.udom'.$id}; |
$user=$env{'form.uname'.$id}.':'.$env{'form.udom'.$id}; |
} elsif ($env{'form.multi'.$id}) { |
|
$user=$env{'form.multi'.$id}; |
|
} |
} |
} |
} |
if ($user) { |
if ($user) { |
Line 7548 ENDHEADER
|
Line 7501 ENDHEADER
|
sub handler { |
sub handler { |
my $request=$_[0]; |
my $request=$_[0]; |
|
|
&reset_caches(); |
&reset_perm(); |
if ($env{'browser.mathml'}) { |
if ($env{'browser.mathml'}) { |
&Apache::loncommon::content_type($request,'text/xml'); |
&Apache::loncommon::content_type($request,'text/xml'); |
} else { |
} else { |
Line 7592 sub handler {
|
Line 7545 sub handler {
|
} |
} |
} else { |
} else { |
&init_perm(); |
&init_perm(); |
|
# &Apache::lonnet::logthis("command is $command"); |
|
# foreach my $key (keys %perm) { |
|
# &Apache::lonnet::logthis("a key is $key"); |
|
# } |
if ($command eq 'submission' && $perm{'vgr'}) { |
if ($command eq 'submission' && $perm{'vgr'}) { |
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { |
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { |
Line 7661 sub handler {
|
Line 7618 sub handler {
|
} |
} |
} |
} |
$request->print(&Apache::loncommon::end_page()); |
$request->print(&Apache::loncommon::end_page()); |
&reset_caches(); |
|
return ''; |
return ''; |
} |
} |
|
|