--- loncom/homework/grades.pm 2007/05/10 16:06:09 1.399
+++ loncom/homework/grades.pm 2007/05/20 21:10:46 1.400
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.399 2007/05/10 16:06:09 albertel Exp $
+# $Id: grades.pm,v 1.400 2007/05/20 21:10:46 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6078,6 +6078,11 @@ GRADINGMENUJS
''.
' '.&mt('scores from file').' '."\n";
+# $result.='
'.
+# ''.
+# ' '.&mt('clicker file').' |
'."\n";
+
+
$result.=''.
' scantron forms |
'."\n";
@@ -6125,6 +6130,80 @@ 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 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".
+ ' |
'."\n";
+ $result.=&show_grading_menu_form($symb);
+ return $result;
+}
+
+sub process_clicker_file {
+ my ($r)=@_;
+ my ($symb)=&get_symb($r);
+ if (!$symb) {return '';}
+ my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
+ $result.=&show_grading_menu_form($symb);
+ my %clickerids=&gather_clicker_ids();
+ foreach my $key (keys %clickerids) {
+ $result.='
'.$key.' - '.$clickerids{$key};
+ }
+ return $result;
+}
+
sub handler {
my $request=$_[0];
@@ -6192,6 +6271,10 @@ sub handler {
$request->print(&editgrades($request));
} elsif ($command eq 'verify' && $perm{'vgr'}) {
$request->print(&verifyreceipt($request));
+ } elsif ($command eq 'processclicker' && $perm{'mgr'}) {
+ $request->print(&process_clicker($request));
+ } elsif ($command eq 'processclickerfile' && $perm{'mgr'}) {
+ $request->print(&process_clicker_file($request));
} elsif ($command eq 'csvform' && $perm{'mgr'}) {
$request->print(&upcsvScores_form($request));
} elsif ($command eq 'csvupload' && $perm{'mgr'}) {