--- loncom/homework/grades.pm 2010/03/11 16:29:42 1.597
+++ loncom/homework/grades.pm 2010/04/01 00:58:43 1.604
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.597 2010/03/11 16:29:42 wenzelju Exp $
+# $Id: grades.pm,v 1.604 2010/04/01 00:58:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -96,6 +96,9 @@ sub ssi_print_error {
#
# --- Retrieve the parts from the metadata file.---
+# Returns an array of everything that the resources stores away
+#
+
sub getpartlist {
my ($symb,$errorref) = @_;
@@ -121,13 +124,17 @@ sub getpartlist {
}
# --- 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("Unable to handle ambiguous references:$url:.");
+ $request->print(&mt("Unable to handle ambiguous references: [_1].",$url));
return ();
}
}
@@ -207,55 +214,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.="
'
- .&Apache::loncommon::end_data_table_row();
- }
- }
- $result.=&Apache::loncommon::end_data_table();
- return $result,$responseType,$hdgrade,$partlist,$handgrade;
-}
-
sub reset_caches {
&reset_analyze_cache();
&reset_perm();
@@ -732,7 +690,7 @@ sub most_similar {
# ignore empty submissions (occuring when only files are sent)
- unless ($uessay=~/\w+/) { return ''; }
+ unless ($uessay=~/\w+/s) { return ''; }
# these will be returned. Do not care if not at least 50 percent similar
my $limit=0.6;
@@ -769,6 +727,19 @@ sub most_similar {
#------------------------------------ Receipt Verification Routines
#
+
+sub initialverifyreceipt {
+ my $request = shift;
+ &commonJSfunctions($request);
+ my ($symb) = &get_symb($request);
+ return '\n";
+}
+
#--- Check whether a receipt number is valid.---
sub verifyreceipt {
my $request = shift;
@@ -878,7 +849,9 @@ sub listStudents {
.&mt("$viewgrade 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 %lt = &Apache::lonlocal::texthash (
'multiple' => 'Please select a student or group of students before clicking on the Next button.',
@@ -921,7 +894,7 @@ LISTJAVASCRIPT
my $checkhdgrade = ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked="checked"' : '';
my $checklastsub = $checkhdgrade eq '' ? 'checked="checked"' : '';
my $gradeTable='