--- loncom/homework/grades.pm 2010/03/19 21:22:34 1.599
+++ loncom/homework/grades.pm 2010/04/18 19:29:10 1.624
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.599 2010/03/19 21:22:34 www Exp $
+# $Id: grades.pm,v 1.624 2010/04/18 19:29:10 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,6 +43,7 @@ use Apache::lonmsg();
use Apache::Constants qw(:common);
use Apache::lonlocal;
use Apache::lonenc;
+use Apache::lonstathelpers;
use String::Similarity;
use LONCAPA;
@@ -123,25 +124,6 @@ sub getpartlist {
return @stores;
}
-# --- Get the symbolic name of a problem and the url
-# Generate an error message if symb could not be found unless silent flag is set
-# Takes $env{'form.symb'} by default; if not present, takes $env{'form.url'} and tries to get symb from that
-#
-
-sub get_symb {
- my ($request,$silent) = @_;
- (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
- my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url)));
- if ($symb eq '') {
- if (!$silent) {
- $request->print(&mt("Unable to handle ambiguous references: [_1].",$url));
- return ();
- }
- }
- &Apache::lonenc::check_decrypt(\$symb);
- return ($symb);
-}
-
#--- Format fullname, username:domain if different for display
#--- Use anywhere where the student names are listed
sub nameUserString {
@@ -156,6 +138,7 @@ sub nameUserString {
#--- Get the partlist and the response type for a given problem. ---
#--- Indicate if a response type is coded handgraded or not. ---
+#--- Sets response_error pointer to "1" if navmaps object broken ---
sub response_type {
my ($symb,$response_error) = @_;
@@ -214,55 +197,6 @@ sub get_display_part {
return $display;
}
-#--- Show resource title
-#--- and parts and response type
-#sub showResourceInfo {
-# my ($symb,$probTitle,$checkboxes,$res_error) = @_;
-# my $result = '
'.&mt('Current Resource').': '.$probTitle.'
'."\n";
-# my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);
-# if (ref($res_error)) {
-# if ($$res_error) {
-# return;
-# }
-# }
-# $result.=&Apache::loncommon::start_data_table()
-# .&Apache::loncommon::start_data_table_header_row();
-# if ($checkboxes) {
-# $result.='
';
-# }
-# $result.='
'.&mt('Problem Part').'
'
-# .'
'.&mt('Res. ID').'
'
-# .'
'.&mt('Type').'
'
-# .&Apache::loncommon::end_data_table_header_row();
-# my %resptype = ();
-# my $hdgrade='no';
-# my %partsseen;
-# foreach my $partID (sort(keys(%$responseType))) {
-# foreach my $resID (sort(keys(%{ $responseType->{$partID} }))) {
-# my $handgrade=$$handgrade{$partID.'_'.$resID};
-# my $responsetype = $responseType->{$partID}->{$resID};
-# $hdgrade = $handgrade if ($handgrade eq 'yes');
-# $result.=&Apache::loncommon::start_data_table_row();
-# if ($checkboxes) {
-# if (exists($partsseen{$partID})) {
-# $result.="
'."\n";
+ &mt('Verifying Receipt Number [_1]',$receipt).
+ ''."\n";
my ($string,$contents,$matches) = ('','',0);
my (undef,undef,$fullname) = &getclasslist('all','0');
@@ -861,7 +802,7 @@ sub verifyreceipt {
$contents.
&Apache::loncommon::end_data_table()."\n";
}
- return $string.&show_grading_menu_form($symb);
+ return $string;
}
#--- This is called by a number of programs.
@@ -869,26 +810,21 @@ sub verifyreceipt {
#--- Also called directly when one clicks on the subm button
# on the problem page.
sub listStudents {
- my ($request) = shift;
+ my ($request,$symb,$submitonly) = @_;
- my ($symb) = &get_symb($request);
my $cdom = $env{"course.$env{'request.course.id'}.domain"};
my $cnum = $env{"course.$env{'request.course.id'}.num"};
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'};
my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'};
- my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'};
- my $viewgrade = $env{'form.showgrading'} eq 'yes' ? 'View/Grade/Regrade' : 'View';
- $env{'form.probTitle'} = $env{'form.probTitle'} eq '' ?
- &Apache::lonnet::gettitle($symb) : $env{'form.probTitle'};
+ unless ($submitonly) {
+ $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'};
+ }
my $result='
'
- .&mt("$viewgrade Submissions for a Student or a Group of Students")
+ .&mt("View/Grade/Regrade Submissions for a Student or a Group of Students")
.'
';
-
-# my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($symb,$env{'form.probTitle'},($env{'form.showgrading'} eq 'yes'));
- my ($partlist,$handgrade,$responseType) = &response_type($symb
-#,$res_error
- );
+ my $res_error;
+ my ($partlist,$handgrade,$responseType) = &response_type($symb,\$res_error);
my %lt = &Apache::lonlocal::texthash (
'multiple' => 'Please select a student or group of students before clicking on the Next button.',
@@ -928,8 +864,6 @@ LISTJAVASCRIPT
&commonJSfunctions($request);
$request->print($result);
- my $checkhdgrade = ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked="checked"' : '';
- my $checklastsub = $checkhdgrade eq '' ? 'checked="checked"' : '';
my $gradeTable='';
+ return $result;
+}
-
-
-
-
-
-
-
-
-
+sub submit_options_download {
+ my ($request,$symb) = @_;
+ if (!$symb) {return '';}
-
+ &commonJSfunctions($request);
-
-
+ my $result='
'."\n".
+ ''."\n";
+ $result.='
+
+ '.&mt('Select Students for Which to Download Submissions').'
+
'.&selectfield(1).'
+
-
+
+
+
';
- $result .= &show_grading_menu_form($symb);
return $result;
}
#--- Displays the submissions first page -------
sub submit_options {
- my ($request) = @_;
- my ($symb)=&get_symb($request);
+ my ($request,$symb) = @_;
if (!$symb) {return '';}
- my $probTitle = &Apache::lonnet::gettitle($symb);
- my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
- $request->print(&Apache::lonhtmlcommon::scripttag(<'.$section.''."\n";
- }
- }
$result.='
';
return $result;
}
@@ -9034,18 +8706,14 @@ sub clicker_grading_parameters {
}
sub process_clicker {
- my ($r)=@_;
- my ($symb)=&get_symb($r);
+ my ($r,$symb)=@_;
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";
+ $result.='
'."\n";
# Attempt to restore parameters from last session, set defaults if not present
my %Saveable_Parameters=&clicker_grading_parameters();
&Apache::loncommon::restore_course_settings('grades_clicker',
@@ -9118,8 +8786,6 @@ ENDUPFORM
'."\n";
- $result.=&show_grading_menu_form($symb);
return $result;
}
sub process_clicker_file {
- my ($r)=@_;
- my ($symb)=&get_symb($r);
+ my ($r,$symb)=@_;
if (!$symb) {return '';}
my %Saveable_Parameters=&clicker_grading_parameters();
&Apache::loncommon::store_course_settings('grades_clicker',
\%Saveable_Parameters);
my $result='';
-# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) {
$result.=''.&mt('You need to specify a clicker ID for the correct answer').'';
- return $result.&show_grading_menu_form($symb);
+ return $result;
}
if (($env{'form.gradingmechanism'} eq 'given') && ($env{'form.givenanswer'}!~/\S/)) {
$result.=''.&mt('You need to specify the correct answer').'';
- return $result.&show_grading_menu_form($symb);
+ return $result;
}
my $foundgiven=0;
if ($env{'form.gradingmechanism'} eq 'given') {
@@ -9204,7 +8867,7 @@ sub process_clicker_file {
$result.="\n";
if ($number==0) {
$result.=''.&mt('No IDs found to determine correct answer').'';
- return $result.&show_grading_menu_form($symb);
+ return $result;
}
}
if (length($env{'form.upfile'}) < 2) {
@@ -9212,7 +8875,7 @@ sub process_clicker_file {
'',
'',
''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'');
- return $result.&show_grading_menu_form($symb);
+ return $result;
}
# Were able to get all the info needed, now analyze the file
@@ -9227,8 +8890,6 @@ sub process_clicker_file {
-
-
@@ -9253,7 +8914,7 @@ ENDHEADER
' ';
if (($env{'form.gradingmechanism'} eq 'given') && ($number!=$foundgiven)) {
$result.=''.&mt('Number of given answers does not agree with number of questions in file.').'';
- return $result.&show_grading_menu_form($symb);
+ return $result;
}
# Remember Question Titles
# FIXME: Possibly need delimiter other than ":"
@@ -9315,7 +8976,7 @@ ENDHEADER
}
$result.='
'."\n".
'
'."\n";
- return $result.&show_grading_menu_form($symb);
+ return $result;
}
sub iclicker_eval {
@@ -9377,8 +9038,7 @@ sub interwrite_eval {
}
sub assign_clicker_grades {
- my ($r)=@_;
- my ($symb)=&get_symb($r);
+ my ($r,$symb)=@_;
if (!$symb) {return '';}
# See which part we are saving to
my $res_error;
@@ -9390,7 +9050,6 @@ sub assign_clicker_grades {
my $part=$$partlist[0];
# Start screen output
my $result='';
-# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
my $heading=&mt('Assigning grades based on clicker file');
$result.=(<'.&mt('Successfully stored grades for [quant,_1,student].',$storecount).
''."\n".
'