--- loncom/homework/grades.pm 2007/05/02 01:17:37 1.398
+++ loncom/homework/grades.pm 2007/06/13 15:22:38 1.402
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.398 2007/05/02 01:17:37 albertel Exp $
+# $Id: grades.pm,v 1.402 2007/06/13 15:22:38 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -180,7 +180,7 @@ sub showResourceInfo {
if (exists($partsseen{$partID})) {
$result.="
";
} else {
- $result.="
";
+ $result.="
";
}
$partsseen{$partID}=1;
}
@@ -708,16 +708,16 @@ LISTJAVASCRIPT
&commonJSfunctions($request);
$request->print($result);
- my $checkhdgrade = ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked' : '';
- my $checklastsub = $checkhdgrade eq '' ? 'checked' : '';
+ my $checkhdgrade = ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked="checked"' : '';
+ my $checklastsub = $checkhdgrade eq '' ? 'checked="checked"' : '';
my $gradeTable=''."\n";
return $result;
}
@@ -6125,6 +6129,153 @@ sub init_perm {
}
}
+sub gather_clicker_ids {
+ my %clickerids=();
+
+ my $classlist = &Apache::loncoursedata::get_classlist();
+
+ # Set up a couple variables.
+ my $usernameidx = &Apache::loncoursedata::CL_SNAME();
+ my $domainidx = &Apache::loncoursedata::CL_SDOM();
+
+ foreach my $student (keys %$classlist) {
+
+ my $username = $classlist->{$student}->[$usernameidx];
+ my $domain = $classlist->{$student}->[$domainidx];
+ my $clickers =
+ (&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1];
+ foreach my $id (split(/\,/,$clickers)) {
+ if (exists($clickerids{$id})) {
+ $clickerids{$id}.=','.$username.':'.$domain;
+ } else {
+ $clickerids{$id}=$username.':'.$domain;
+ }
+ }
+ }
+ return %clickerids;
+}
+
+sub gather_adv_clicker_ids {
+ my %clickerids=();
+ 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);
+ foreach my $element (sort keys %coursepersonnel) {
+ foreach my $person (split(/\,/,$coursepersonnel{$element})) {
+ my ($puname,$pudom)=split(/\:/,$person);
+ my $clickers =
+ (&Apache::lonnet::userenvironment($pudom,$puname,'clickers'))[1];
+ foreach my $id (split(/\,/,$clickers)) {
+ if (exists($clickerids{$id})) {
+ $clickerids{$id}.=','.$puname.':'.$pudom;
+ } else {
+ $clickerids{$id}=$puname.':'.$pudom;
+ }
+ }
+ }
+ }
+ return %clickerids;
+}
+
+sub process_clicker {
+ my ($r)=@_;
+ my ($symb)=&get_symb($r);
+ if (!$symb) {return '';}
+ my $result=&checkforfile_js();
+ $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
+ my ($table) = &showResourceInfo($symb,$env{'form.probTitle'});
+ $result.=$table;
+ $result.='
'."\n";
+ $result.='
'."\n";
+ $result.=' '.&mt('Specify a file containing the clicker information for this resource').
+ '.
'."\n";
+ $result.='
'."\n";
+ my $upload=&mt("Upload File");
+ my $type=&mt("Type");
+ my $attendance=&mt("Award points just for participation");
+ my $personnel=&mt("Correctness determined from response by course personnel");
+ my $specific=&mt("Correctness determind from response with clicker ID");
+ 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' => 'iClicker'));
+
+ $result.=<
+function sanitycheck() {
+// Accept only integer percentages
+ document.forms.gradesupload.pcorrect.value=Math.round(document.forms.gradesupload.pcorrect.value);
+ document.forms.gradesupload.pincorrect.value=Math.round(document.forms.gradesupload.pincorrect.value);
+// Find out grading choice
+ for (i=0; i
+
+ENDUPFORM
+ $result.='