version 1.403, 2007/06/13 17:18:48
|
version 1.405, 2007/06/15 21:21:16
|
Line 6078 GRADINGMENUJS
|
Line 6078 GRADINGMENUJS
|
'<input type="button" onClick="javascript:checkChoice(this.form,\'3\',\'csvform\');" value="'.&mt('Upload').'" />'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'3\',\'csvform\');" value="'.&mt('Upload').'" />'. |
' '.&mt('scores from file').' </td></tr>'."\n"; |
' '.&mt('scores from file').' </td></tr>'."\n"; |
|
|
# $result.='<tr bgcolor="#ffffe6"><td>'. |
$result.='<tr bgcolor="#ffffe6"><td>'. |
# '<input type="button" onClick="javascript:checkChoice(this.form,\'6\',\'processclicker\');" value="'.&mt('Process').'" />'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'6\',\'processclicker\');" value="'.&mt('Process').'" />'. |
# ' '.&mt('clicker file').' </td></tr>'."\n"; |
' '.&mt('clicker file').' </td></tr>'."\n"; |
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td colspan="2">'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'4\',\'scantron_selectphase\');'. |
'<input type="button" onClick="javascript:checkChoice(this.form,\'4\',\'scantron_selectphase\');'. |
Line 6145 sub gather_clicker_ids {
|
Line 6145 sub gather_clicker_ids {
|
my $clickers = |
my $clickers = |
(&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1]; |
(&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1]; |
foreach my $id (split(/\,/,$clickers)) { |
foreach my $id (split(/\,/,$clickers)) { |
|
$id=~s/^0+//; |
if (exists($clickerids{$id})) { |
if (exists($clickerids{$id})) { |
$clickerids{$id}.=','.$username.':'.$domain; |
$clickerids{$id}.=','.$username.':'.$domain; |
} else { |
} else { |
Line 6165 sub gather_adv_clicker_ids {
|
Line 6166 sub gather_adv_clicker_ids {
|
my ($puname,$pudom)=split(/\:/,$person); |
my ($puname,$pudom)=split(/\:/,$person); |
my $clickers = |
my $clickers = |
(&Apache::lonnet::userenvironment($pudom,$puname,'clickers'))[1]; |
(&Apache::lonnet::userenvironment($pudom,$puname,'clickers'))[1]; |
foreach my $id (split(/\,/,$clickers)) { |
foreach my $id (split(/\,/,$clickers)) { |
|
$id=~s/^0+//; |
if (exists($clickerids{$id})) { |
if (exists($clickerids{$id})) { |
$clickerids{$id}.=','.$puname.':'.$pudom; |
$clickerids{$id}.=','.$puname.':'.$pudom; |
} else { |
} else { |
$clickerids{$id}=$puname.':'.$pudom; |
$clickerids{$id}=$puname.':'.$pudom; |
} |
} |
} |
} |
} |
} |
} |
} |
return %clickerids; |
return %clickerids; |
Line 6194 sub process_clicker {
|
Line 6196 sub process_clicker {
|
my $type=&mt("Type"); |
my $type=&mt("Type"); |
my $attendance=&mt("Award points just for participation"); |
my $attendance=&mt("Award points just for participation"); |
my $personnel=&mt("Correctness determined from response by course personnel"); |
my $personnel=&mt("Correctness determined from response by course personnel"); |
my $specific=&mt("Correctness determind from response with clicker ID"); |
my $specific=&mt("Correctness determined from response with clicker ID"); |
my $pcorrect=&mt("Percentage points for correct solution"); |
my $pcorrect=&mt("Percentage points for correct solution"); |
my $pincorrect=&mt("Percentage points for incorrect solution"); |
my $pincorrect=&mt("Percentage points for incorrect solution"); |
my $selectform=&Apache::loncommon::select_form('iclicker','upfiletype', |
my $selectform=&Apache::loncommon::select_form('iclicker','upfiletype', |
('iclicker' => 'iClicker')); |
('iclicker' => 'i>clicker')); |
|
|
$result.=<<ENDUPFORM; |
$result.=<<ENDUPFORM; |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 6268 sub process_clicker_file {
|
Line 6270 sub process_clicker_file {
|
my ($symb)=&get_symb($r); |
my ($symb)=&get_symb($r); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); |
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); |
$result.=&show_grading_menu_form($symb); |
if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) { |
|
$result.='<span class="LC_error">'.&mt('You need to specify a clicker ID for the correct answer').'</span>'; |
|
return $result.&show_grading_menu_form($symb); |
|
} |
my %clickerids=&gather_clicker_ids(); |
my %clickerids=&gather_clicker_ids(); |
foreach my $key (keys %clickerids) { |
my %correctids=(); |
$result.='<br />'.$key.' - '.$clickerids{$key}; |
if ($env{'form.gradingmechanism'} eq 'personnel') { |
|
%correctids=&gather_adv_clicker_ids(); |
} |
} |
return $result; |
if ($env{'form.gradingmechanism'} eq 'specific') { |
|
my $correctid=$env{'form.specificid'}; |
|
$correctid=~tr/a-z/A-Z/; |
|
$correctid=~s/\s//gs; |
|
$correctid=~s/^0+//; |
|
$correctids{$correctid}='specified'; |
|
} |
|
if ($env{'form.gradingmechanism'} eq 'attendance') { |
|
$result.=&mt('Score based on attendance only'); |
|
} else { |
|
my $number=0; |
|
$result.='<h3>'.&mt('Correctness determined by the following IDs').'</h3>'; |
|
foreach my $id (sort(keys(%correctids))) { |
|
$result.='<tt>'.$id.'</tt> - '; |
|
if ($correctids{$id} eq 'specified') { |
|
$result.=&mt('specified'); |
|
} else { |
|
my ($uname,$udom)=split(/\:/,$correctids{$id}); |
|
$result.=&Apache::loncommon::plainname($uname,$udom); |
|
} |
|
$result.='<br />'; |
|
$number++; |
|
} |
|
if ($number==0) { |
|
$result.='<span class="LC_error">'.&mt('No IDs found to determine correct answer').'</span>'; |
|
return $result.&show_grading_menu_form($symb); |
|
} |
|
} |
|
if (length($env{'form.upfile'}) < 2) { |
|
$result.="<span class=\"LC_error\">Error:</span> The file you attempted to upload, <tt>".&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."; |
|
return $result.&show_grading_menu_form($symb); |
|
} |
|
my %contents=(); |
|
my $errormsg=''; |
|
my $number=0; |
|
if ($env{'form.upfiletype'} eq 'iclicker') { |
|
($errormsg,$number,%contents)=&iclicker_eval(); |
|
$result.=$errormsg; |
|
} |
|
return $result.&show_grading_menu_form($symb); |
|
} |
|
|
|
sub iclicker_eval { |
|
my $number=0; |
|
my $errormsg=''; |
|
foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { |
|
chomp($line); |
|
foreach my $quoted ($line=~/\,\s*\"([^\"]*)\"\s*\,/g) { |
|
my $replace=$quoted; |
|
$replace=~s/\,//g; |
|
&Apache::lonnet::logthis($quoted.' - '.$replace.'<br />'); |
|
$line=~s/\,\s*\"\Q$quoted\E\"\s*\,/,$replace,/gs; |
|
} |
|
my @entries=split(/\,/,$line); |
|
if ($entries[0] eq 'Question') { |
|
for (my $i=3;$i<$#entries;$i+=6) { |
|
$number++; |
|
$errormsg.='<br />'.$entries[$i]; |
|
} |
|
} |
|
} |
|
return ($errormsg,$number); |
} |
} |
|
|
sub handler { |
sub handler { |