--- loncom/homework/inputtags.pm 2014/11/28 18:23:04 1.328
+++ loncom/homework/inputtags.pm 2015/04/21 16:03:37 1.335
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.328 2014/11/28 18:23:04 raeburn Exp $
+# $Id: inputtags.pm,v 1.335 2015/04/21 16:03:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -464,12 +464,11 @@ sub start_textline {
$name = "none";
}
$result.= '';
+ . ' class="LC_textline spellchecked" size="'.$size.'"'.$maxlength.' />';
$result .= &spellcheck_onblur($itemid, $spellcheck);
}
@@ -641,7 +640,7 @@ sub file_selector {
my $current_files_display = ¤t_file_submissions($part,$id);
my $addfiles;
if ($current_files_display) {
- $result .= &Apache::lonhtmlcommon::row_title(&mt('Currently submitted files')).
+ $result .= &Apache::lonhtmlcommon::row_title(&mt('Files currently selected for submission')).
$current_files_display.
&Apache::lonhtmlcommon::row_closure();
$addfiles = &mt('Submit other file(s)');
@@ -699,6 +698,15 @@ sub current_file_submissions {
my $uploadedfile=$Apache::lonhomework::history{"resource.$part.$id.uploadedfile"};
my $portfiles=$Apache::lonhomework::history{"resource.$part.$id.portfiles"};
return if (($uploadedfile eq '') && ($portfiles !~/[^\s]/));
+ my @unversioned;
+ foreach my $file (split(/\s*,\s*/,&unescape($portfiles))) {
+ my ($path,$name) = ($file =~ m{^(.*/)([^/]+)$});
+ my ($origname,$version,$ext) = &Apache::lonnet::file_name_version_ext($name);
+ unless ($version) {
+ push(@unversioned,$file);
+ }
+ }
+ return if (!@unversioned);
my $header = &portpath_popup_js().
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row();
@@ -709,7 +717,7 @@ sub current_file_submissions {
'
'.&mt('Size (MB)').' | '.
''.&mt('Last Modified').' | '.
&Apache::loncommon::end_data_table_header_row();
- my (undef,$crsid,$udom,$uname)=&Apache::lonnet::whichuser();
+ my ($symb,$crsid,$udom,$uname)=&Apache::lonnet::whichuser();
my ($cdom,$cnum) = ($crsid =~ /^($LONCAPA::match_domain)_($LONCAPA::match_courseid)$/);
my ($result,$header_shown,%okfiles,%rows,%legacy,@bad_file_list);
if ($uploadedfile) {
@@ -728,9 +736,9 @@ sub current_file_submissions {
push(@bad_file_list,$error);
}
}
- if ($portfiles =~ /[^\s]/) {
+ if (@unversioned > 0) {
my $prefix = "/uploaded/$udom/$uname/portfolio";
- foreach my $file (split(/\s*,\s*/,&unescape($portfiles))) {
+ foreach my $file (@unversioned) {
my ($path,$name) = ($file =~ m{^(.*/)([^/]+)$});
my $url = $prefix.$path.$name;
my $uploadedfile = &HTML::Entities::encode($url,'<>&"');
@@ -898,7 +906,7 @@ sub valid_award {
{
my @awards = ('EXTRA_ANSWER', 'MISSING_ANSWER', 'ERROR', 'NO_RESPONSE',
- 'WRONG_NUMCHECKEDBOXES','TOO_LONG',
+ 'WRONG_NUMBOXESCHECKED','TOO_LONG',
'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT',
'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT',
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'NOT_FUNCTION',
@@ -988,6 +996,23 @@ sub finalizeawards {
$j++;
}
+ # if at least one response item is set to include lenient grading
+ # and that item is partially correct then overall award reflects
+ # that, unless an award for one of the other response items does
+ # not fall within the basic awards for correct or incorrect.
+ if ($Apache::inputtags::leniency) {
+ if (($$awardref[$which] eq 'INCORRECT')
+ && (grep { $_ eq 'EXACT_ANS' ||
+ $_ eq 'APPROX_ANS' ||
+ $_ eq 'ASSIGNED_SCORE' } (@$awardref))
+ && !((grep { $_ ne 'INCORRECT' &&
+ $_ ne 'EXACT_ANS' &&
+ $_ ne 'APPROX_ANS' &&
+ $_ ne 'ASSIGNED_SCORE' } (@$awardref)))) {
+ return ('ASSIGNED_SCORE');
+ }
+ }
+
if (defined($which)) {
if (ref($nameref)) {
return ($$awardref[$which],$$msgref[$which],$$nameref[$which]);
@@ -1503,7 +1528,8 @@ sub setgradedata {
$Apache::lonhomework::results{"resource.$id.type"} = $Apache::lonhomework::type;
$Apache::lonhomework::results{"resource.$id.duedate"} = &Apache::lonnet::EXT("resource.$id.duedate");
$Apache::lonhomework::results{"resource.$id.hinttries"} = &Apache::lonnet::EXT("resource.$id.hinttries");
- $Apache::lonhomework::results{"resourse.$id.version"} = &Apache::lonnet::usedversion();
+ $Apache::lonhomework::results{"resource.$id.version"} = &Apache::lonnet::usedversion();
+ $Apache::lonhomework::results{"resource.$id.maxtries"} = &Apache::lonnet::EXT("resource.$id.maxtries");
}
sub find_which_previous {
@@ -1730,15 +1756,15 @@ sub previous_tries {
my $count;
my %count_lookup;
- my $lastrndseed;
+ my ($lastrndseed,$lasttype);
my $numstamps = 0;
foreach my $i (1..$Apache::lonhomework::history{'version'}) {
my $prefix = $i.":resource.$id";
- my $is_anon;
+ my $is_anon;
+ my $curr_type = $Apache::lonhomework::history{"$prefix.type"};
if (defined($env{'form.grade_symb'})) {
- if (($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurvey') ||
- ($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurveycred')) {
+ if (($curr_type eq 'anonsurvey') || ($curr_type eq 'anonsurveycred')) {
$is_anon = 1;
}
}
@@ -1777,8 +1803,9 @@ sub previous_tries {
{$1 $txt_correct. $3}s;
}
my $trystr = "(".&mt('Try [_1]',$Apache::lonhomework::history{"$prefix.tries"}).")";
- if (($curr_rndseed || $lastrndseed) && ($i > 1)) {
- if ($curr_rndseed ne $lastrndseed) {
+ if (($curr_rndseed ne '') && ($lastrndseed ne '')) {
+ if (($curr_rndseed ne $lastrndseed) &&
+ (($curr_type eq 'randomizetry') || ($lasttype eq 'randomizetry'))) {
$trystr .= '
'.&mt('New problem variation this try.').'';
}
}
@@ -1819,6 +1846,7 @@ sub previous_tries {
}
$output.=&Apache::loncommon::end_data_table_row()."\n";
$lastrndseed = $curr_rndseed;
+ $lasttype = $curr_type;
}
return if ($output eq '');
my $headers = ''.