[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 15 Jun 2007 22:10:15 -0000
albertel Fri Jun 15 18:10:15 2007 EDT
Modified files:
/loncom/homework grades.pm
Log:
- style police
- mt police
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.406 loncom/homework/grades.pm:1.407
--- loncom/homework/grades.pm:1.406 Fri Jun 15 18:00:42 2007
+++ loncom/homework/grades.pm Fri Jun 15 18:10:15 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.406 2007/06/15 22:00:42 www Exp $
+# $Id: grades.pm,v 1.407 2007/06/15 22:10:15 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,7 +41,6 @@
use Apache::lonlocal;
use Apache::lonenc;
use String::Similarity;
-use lib '/home/httpd/lib/perl';
use LONCAPA;
use POSIX qw(floor);
@@ -6130,34 +6129,34 @@
}
sub gather_clicker_ids {
- my %clickerids=();
+ my %clicker_ids=();
my $classlist = &Apache::loncoursedata::get_classlist();
# Set up a couple variables.
- my $usernameidx = &Apache::loncoursedata::CL_SNAME();
- my $domainidx = &Apache::loncoursedata::CL_SDOM();
+ my $username_idx = &Apache::loncoursedata::CL_SNAME();
+ my $domain_idx = &Apache::loncoursedata::CL_SDOM();
- foreach my $student (keys %$classlist) {
+ foreach my $student (keys(%$classlist)) {
- my $username = $classlist->{$student}->[$usernameidx];
- my $domain = $classlist->{$student}->[$domainidx];
+ my $username = $classlist->{$student}->[$username_idx];
+ my $domain = $classlist->{$student}->[$domain_idx];
my $clickers =
(&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1];
foreach my $id (split(/\,/,$clickers)) {
$id=~s/^0+//;
- if (exists($clickerids{$id})) {
- $clickerids{$id}.=','.$username.':'.$domain;
+ if (exists($clicker_ids{$id})) {
+ $clicker_ids{$id}.=','.$username.':'.$domain;
} else {
- $clickerids{$id}=$username.':'.$domain;
+ $clicker_ids{$id}=$username.':'.$domain;
}
}
}
- return %clickerids;
+ return %clicker_ids;
}
sub gather_adv_clicker_ids {
- my %clickerids=();
+ 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);
@@ -6168,15 +6167,15 @@
(&Apache::lonnet::userenvironment($pudom,$puname,'clickers'))[1];
foreach my $id (split(/\,/,$clickers)) {
$id=~s/^0+//;
- if (exists($clickerids{$id})) {
- $clickerids{$id}.=','.$puname.':'.$pudom;
+ if (exists($clicker_ids{$id})) {
+ $clicker_ids{$id}.=','.$puname.':'.$pudom;
} else {
- $clickerids{$id}=$puname.':'.$pudom;
+ $clicker_ids{$id}=$puname.':'.$pudom;
}
}
}
}
- return %clickerids;
+ return %clicker_ids;
}
sub process_clicker {
@@ -6274,29 +6273,29 @@
$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 %correctids=();
+ my %clicker_ids=&gather_clicker_ids();
+ my %correct_ids=();
if ($env{'form.gradingmechanism'} eq 'personnel') {
- %correctids=&gather_adv_clicker_ids();
+ %correct_ids=&gather_adv_clicker_ids();
}
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';
+ 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');
} else {
my $number=0;
$result.='<h3>'.&mt('Correctness determined by the following IDs').'</h3>';
- foreach my $id (sort(keys(%correctids))) {
+ foreach my $id (sort(keys(%correct_ids))) {
$result.='<tt>'.$id.'</tt> - ';
- if ($correctids{$id} eq 'specified') {
+ if ($correct_ids{$id} eq 'specified') {
$result.=&mt('specified');
} else {
- my ($uname,$udom)=split(/\:/,$correctids{$id});
+ my ($uname,$udom)=split(/\:/,$correct_ids{$id});
$result.=&Apache::loncommon::plainname($uname,$udom);
}
$result.='<br />';
@@ -6308,7 +6307,10 @@
}
}
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.";
+ $result.=&mt('[_1] Error: [_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.',
+ '<span class="LC_error">',
+ '</span>',
+ '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>');
return $result.&show_grading_menu_form($symb);
}
my %responses=();