[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 15 Jun 2007 22:12:50 -0000
This is a MIME encoded message
--albertel1181945570
Content-Type: text/plain
albertel Fri Jun 15 18:12:50 2007 EDT
Modified files:
/loncom/homework grades.pm
Log:
- tabination police
--albertel1181945570
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070615181250.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.407 loncom/homework/grades.pm:1.408
--- loncom/homework/grades.pm:1.407 Fri Jun 15 18:10:15 2007
+++ loncom/homework/grades.pm Fri Jun 15 18:12:49 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.407 2007/06/15 22:10:15 albertel Exp $
+# $Id: grades.pm,v 1.408 2007/06/15 22:12:49 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6129,7 +6129,7 @@
}
sub gather_clicker_ids {
- my %clicker_ids=();
+ my %clicker_ids;
my $classlist = &Apache::loncoursedata::get_classlist();
@@ -6142,13 +6142,13 @@
my $username = $classlist->{$student}->[$username_idx];
my $domain = $classlist->{$student}->[$domain_idx];
my $clickers =
- (&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1];
+ (&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1];
foreach my $id (split(/\,/,$clickers)) {
$id=~s/^0+//;
if (exists($clicker_ids{$id})) {
- $clicker_ids{$id}.=','.$username.':'.$domain;
+ $clicker_ids{$id}.=','.$username.':'.$domain;
} else {
- $clicker_ids{$id}=$username.':'.$domain;
+ $clicker_ids{$id}=$username.':'.$domain;
}
}
}
@@ -6156,7 +6156,7 @@
}
sub gather_adv_clicker_ids {
- my %clicker_ids=();
+ my %clicker_ids;
my $cnum=$env{'course.'.$env{'request.course.id'}.'.num'};
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'};
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
@@ -6164,14 +6164,14 @@
foreach my $person (split(/\,/,$coursepersonnel{$element})) {
my ($puname,$pudom)=split(/\:/,$person);
my $clickers =
- (&Apache::lonnet::userenvironment($pudom,$puname,'clickers'))[1];
+ (&Apache::lonnet::userenvironment($pudom,$puname,'clickers'))[1];
foreach my $id (split(/\,/,$clickers)) {
- $id=~s/^0+//;
- if (exists($clicker_ids{$id})) {
- $clicker_ids{$id}.=','.$puname.':'.$pudom;
- } else {
- $clicker_ids{$id}=$puname.':'.$pudom;
- }
+ $id=~s/^0+//;
+ if (exists($clicker_ids{$id})) {
+ $clicker_ids{$id}.=','.$puname.':'.$pudom;
+ } else {
+ $clicker_ids{$id}=$puname.':'.$pudom;
+ }
}
}
}
@@ -6199,7 +6199,7 @@
my $pcorrect=&mt("Percentage points for correct solution");
my $pincorrect=&mt("Percentage points for incorrect solution");
my $selectform=&Apache::loncommon::select_form('iclicker','upfiletype',
- ('iclicker' => 'i>clicker'));
+ ('iclicker' => 'i>clicker'));
$result.=<<ENDUPFORM;
<script type="text/javascript">
@@ -6270,41 +6270,41 @@
if (!$symb) {return '';}
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
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);
+ $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 %clicker_ids=&gather_clicker_ids();
- my %correct_ids=();
+ my %correct_ids;
if ($env{'form.gradingmechanism'} eq 'personnel') {
- %correct_ids=&gather_adv_clicker_ids();
+ %correct_ids=&gather_adv_clicker_ids();
}
if ($env{'form.gradingmechanism'} eq 'specific') {
- my $correct_id=$env{'form.specificid'};
- $correct_id=~tr/a-z/A-Z/;
- $correct_id=~s/\s//gs;
- $correct_id=~s/^0+//;
- $correct_ids{$correct_id}='specified';
+ my $correct_id=$env{'form.specificid'};
+ $correct_id=~tr/a-z/A-Z/;
+ $correct_id=~s/\s//gs;
+ $correct_id=~s/^0+//;
+ $correct_ids{$correct_id}='specified';
}
if ($env{'form.gradingmechanism'} eq 'attendance') {
- $result.=&mt('Score based on attendance only');
+ $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(%correct_ids))) {
- $result.='<tt>'.$id.'</tt> - ';
- if ($correct_ids{$id} eq 'specified') {
- $result.=&mt('specified');
- } else {
- my ($uname,$udom)=split(/\:/,$correct_ids{$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);
- }
+ my $number=0;
+ $result.='<h3>'.&mt('Correctness determined by the following IDs').'</h3>';
+ foreach my $id (sort(keys(%correct_ids))) {
+ $result.='<tt>'.$id.'</tt> - ';
+ if ($correct_ids{$id} eq 'specified') {
+ $result.=&mt('specified');
+ } else {
+ my ($uname,$udom)=split(/\:/,$correct_ids{$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.=&mt('[_1] Error: [_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.',
@@ -6313,16 +6313,16 @@
'<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>');
return $result.&show_grading_menu_form($symb);
}
- my %responses=();
- my @questiontitles=();
+ my %responses;
+ my @questiontitles;
my $errormsg='';
my $number=0;
if ($env{'form.upfiletype'} eq 'iclicker') {
- ($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses);
+ ($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses);
}
$result.='<br />'.&mt('Found [_1] questions',$number).'<br />';
foreach my $id (keys %responses) {
- $result.='<br />'.$id.' - '.$responses{$id};
+ $result.='<br />'.$id.' - '.$responses{$id};
}
return $result.&show_grading_menu_form($symb);
}
@@ -6332,30 +6332,30 @@
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) {
- $$questiontitles[$number]=$entries[$i];
- $number++;
- }
- }
- if ($entries[0]=~/^\#/) {
- my $id=$entries[0];
- my @idresponses=();
- $id=~s/^[\#0]+//;
- for (my $i=0;$i<$number;$i++) {
- my $idx=3+$i*6;
- push(@idresponses,$entries[$idx]);
- }
- $$responses{$id}=join(',',@idresponses);
- }
+ 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) {
+ $$questiontitles[$number]=$entries[$i];
+ $number++;
+ }
+ }
+ if ($entries[0]=~/^\#/) {
+ my $id=$entries[0];
+ my @idresponses;
+ $id=~s/^[\#0]+//;
+ for (my $i=0;$i<$number;$i++) {
+ my $idx=3+$i*6;
+ push(@idresponses,$entries[$idx]);
+ }
+ $$responses{$id}=join(',',@idresponses);
+ }
}
return ($errormsg,$number);
}
--albertel1181945570--