[LON-CAPA-cvs] cvs: rat /client parameter.html loncom/interface lonparmset.pm loncom/publisher packages.tab
raeburn
raeburn at source.lon-capa.org
Sat Oct 8 15:03:11 EDT 2011
raeburn Sat Oct 8 19:03:11 2011 EDT
Modified files:
/loncom/interface lonparmset.pm
/loncom/publisher packages.tab
/rat/client parameter.html
Log:
- Bug 2802.
- checking for LON-CAPA version when setting "lenient" parameter
- &questiontype_releasecheck() renamed as ¶meter_releasecheck()
- &questiontype_release_vars() renamed as ¶meter_release_vars
- type set to "string_lenient" for the lenient parameter.
- allows default to be explicitly selected
- default: "Default - only bubblesheet grading is lenient"
- categorize "lenient" as belonging to "grading" parameters.
-------------- next part --------------
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.513 loncom/interface/lonparmset.pm:1.514
--- loncom/interface/lonparmset.pm:1.513 Mon May 23 09:29:27 2011
+++ loncom/interface/lonparmset.pm Sat Oct 8 19:02:49 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.513 2011/05/23 09:29:27 foxr Exp $
+# $Id: lonparmset.pm,v 1.514 2011/10/08 19:02:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1395,6 +1395,7 @@
'acc' => 'misc',
'maxcollaborators' => 'misc',
'scoreformat' => 'misc',
+ 'lenient' => 'grading',
);
}
@@ -2115,7 +2116,7 @@
for (my $i=0;$i<=$#markers;$i++) {
- my ($needsrelease,$needsnewer);
+ my ($needsrelease,$needsnewer,$name);
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {
my (@ok_slots, at fail_slots, at del_slots);
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
@@ -2146,22 +2147,23 @@
}
}
}
- } elsif ($markers[$i] =~ /_type\&\d+$/) {
+ } elsif ($markers[$i] =~ /_(type|lenient)\&\d+$/) {
+ $name = $1;
$needsrelease =
- $Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]};
+ $Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"};
if ($needsrelease) {
unless ($got_chostname) {
- ($chostname,$cmajor,$cminor) = &questiontype_release_vars();
+ ($chostname,$cmajor,$cminor) = ¶meter_release_vars();
$got_chostname = 1;
}
- $needsnewer = &questiontype_releasecheck($values[$i],
- $needsrelease,
- $chostname,
- $cmajor,$cminor);
+ $needsnewer = ¶meter_releasecheck($name,$values[$i],
+ $needsrelease,
+ $chostname,
+ $cmajor,$cminor);
}
}
if ($needsnewer) {
- $message .= &oldversion_warning($values[$i],$chostname,$cmajor,
+ $message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor,
$cminor,$needsrelease);
} else {
$message.=&storeparm(split(/\&/,$markers[$i]),
@@ -2803,25 +2805,32 @@
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./;
}
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') {
- my ($data, $typeof, $text);
+ my ($data, $typeof, $text, $name);
if ($cmd eq 'set') {
$data=$env{$key};
$typeof=$env{'form.typeof_'.$thiskey};
$text = &mt('Saved modified parameter for');
if ($typeof eq 'string_questiontype') {
+ $name = 'type';
+ } elsif ($typeof eq 'string_lenient') {
+ $name = 'lenient';
+ }
+ if ($name ne '') {
my ($needsrelease,$needsnewer);
- $needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data};
+ $needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$data"};
if ($needsrelease) {
unless ($got_chostname) {
- ($chostname,$cmajor,$cminor)=&questiontype_release_vars();
+ ($chostname,$cmajor,$cminor)=¶meter_release_vars();
$got_chostname = 1;
}
- $needsnewer = &questiontype_releasecheck($data,$needsrelease,
- $chostname,$cmajor,
- $cminor);
+ $needsnewer = ¶meter_releasecheck($name,$data,
+ $needsrelease,
+ $chostname,$cmajor,
+ $cminor);
}
if ($needsnewer) {
- $r->print('<br />'.&oldversion_warning($data,$chostname,$cmajor,
+ $r->print('<br />'.&oldversion_warning($name,$data,
+ $chostname,$cmajor,
$cminor,$needsrelease));
next;
}
@@ -3056,7 +3065,7 @@
$$resourcedata{$thiskey}));
} elsif ($thistype =~ m/^string/) {
$r->print(&string_selector($thistype,$thiskey,
- $$resourcedata{$thiskey}));
+ $$resourcedata{$thiskey},$name));
} else {
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey}));
}
@@ -3130,6 +3139,10 @@
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'],
[ 'practice', 'Practice'],
[ 'surveycred', 'Survey (credit for submission)']],
+ 'string_lenient'
+ => [['yes', 'Yes' ],
+ [ 'no', 'No' ],
+ [ 'default', 'Default - only bubblesheet grading is lenient' ]]
);
sub standard_string_options {
@@ -3141,33 +3154,35 @@
}
sub string_selector {
- my ($thistype, $thiskey, $showval) = @_;
+ my ($thistype, $thiskey, $showval, $name) = @_;
if (!exists($strings{$thistype})) {
return &default_selector($thiskey,$showval);
}
my %skiptype;
- if ($thistype eq 'string_questiontype') {
+ if (($thistype eq 'string_questiontype') ||
+ ($thistype eq 'string_lenient')) {
my ($got_chostname,$chostname,$cmajor,$cminor);
foreach my $possibilities (@{ $strings{$thistype} }) {
next unless (ref($possibilities) eq 'ARRAY');
- my ($name, $description) = @{ $possibilities };
- my $needsrelease=$Apache::lonnet::needsrelease{'parameter:type:'.$name};
+ my ($parmval, $description) = @{ $possibilities };
+ my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"};
if ($needsrelease) {
unless ($got_chostname) {
- ($chostname,$cmajor,$cminor)=&questiontype_release_vars();
+ ($chostname,$cmajor,$cminor)=¶meter_release_vars();
$got_chostname = 1;
}
- my $needsnewer=&questiontype_releasecheck($name,$needsrelease,
- $chostname,$cmajor,
- $cminor);
+ my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease,
+ $chostname,$cmajor,
+ $cminor);
if ($needsnewer) {
- $skiptype{$name} = 1;
+ $skiptype{$parmval} = 1;
}
}
}
}
+
my $result;
my $numinrow = 3;
@@ -4572,7 +4587,7 @@
return 0;
}
-sub questiontype_release_vars {
+sub parameter_release_vars {
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
my $chostname = &Apache::lonnet::hostname($chome);
@@ -4581,35 +4596,42 @@
return ($chostname,$cmajor,$cminor);
}
-sub questiontype_releasecheck {
- my ($questiontype,$needsrelease,$chostname,$cmajor,$cminor) = @_;
+sub parameter_releasecheck {
+ my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_;
my $needsnewer;
my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
if (($cmajor < $needsmajor) ||
($cmajor == $needsmajor && $cminor < $needsminor)) {
$needsnewer = 1;
} else {
- &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:type:'.$questiontype});
+ &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value});
}
return $needsnewer;
}
sub oldversion_warning {
- my ($questiontype,$chostname,$cmajor,$cminor,$needsrelease) = @_;
+ my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_;
my $desc;
- if (ref($strings{'string_questiontype'}) eq 'ARRAY') {
- foreach my $possibilities (@{ $strings{'string_questiontype'} }) {
- next unless (ref($possibilities) eq 'ARRAY');
- my ($name, $description) = @{ $possibilities };
- if ($name eq $questiontype) {
- $desc = $description;
- last;
+ my %stringtypes = (
+ type => 'string_questiontype',
+ lenient => 'string_lenient'
+ );
+ if (exists($stringtypes{$name})) {
+ if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {
+ foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) {
+ next unless (ref($possibilities) eq 'ARRAY');
+ my ($parmval, $description) = @{ $possibilities };
+ if ($parmval eq $value) {
+ $desc = $description;
+ last;
+ }
}
}
}
+ my $standard_name = &standard_parameter_names($name);
return '<p class="LC_warning">'.
- &mt('Question Type was [_1]not[_2] set to [_3].',
- '<b>','</b>','"'.$desc.'"').'<br />'.
+ &mt('[_1] was [_2]not[_3] set to [_4].',
+ $standard_name,'<b>','</b>','"'.$desc.'"').'<br />'.
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).',
$cmajor.'.'.$cminor,$chostname,
$needsrelease).
Index: loncom/publisher/packages.tab
diff -u loncom/publisher/packages.tab:1.67 loncom/publisher/packages.tab:1.68
--- loncom/publisher/packages.tab:1.67 Fri Oct 7 22:40:10 2011
+++ loncom/publisher/packages.tab Sat Oct 8 19:03:00 2011
@@ -102,10 +102,10 @@
mathresponse&turnoffeditor&type:string_yesno
mathresponse&turnoffeditor&default:no
mathresponse&turnoffeditor&display:Hide DragMath-Editor
-optionresponse&lenient&type:string
+optionresponse&lenient&type:string_lenient
optionresponse&lenient&default:default
optionresponse&lenient&display:Lenient Grading (Partial Credit)
-matchresponse&lenient&type:string
+matchresponse&lenient&type:string_lenient
matchresponse&lenient&default:default
matchresponse&lenient&display:Lenient Grading (Partial Credit)
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.59 rat/client/parameter.html:1.60
--- rat/client/parameter.html:1.59 Sat Dec 18 23:18:50 2010
+++ rat/client/parameter.html Sat Oct 8 19:03:11 2011
@@ -5,7 +5,7 @@
The LearningOnline Network with CAPA
Parameter Input Window
//
-// $Id: parameter.html,v 1.59 2010/12/18 23:18:50 raeburn Exp $
+// $Id: parameter.html,v 1.60 2011/10/08 19:03:11 raeburn Exp $
//
// Copyright Michigan State University Board of Trustees
//
@@ -657,6 +657,22 @@
if (svalue=='library') { choicewrite(' checked="checked"'); }
choicewrite(' /> Library</label><br />');
}
+ if (pscat=='lenient') {
+ tablestart('Lenient Grading (Partial Credit)');
+ choicewrite('<tr><td>Value:</td><td colspan="2">');
+ choicewrite('<label><input name="stringval" value="yes"'+
+ ' type="radio" '+callradiostringeval('yes'));
+ if (svalue=='yes') { choicewrite(' checked="checked"'); }
+ choicewrite(' /> Yes</label><br />');
+ choicewrite('<label><input name="stringval" value="no"'+
+ ' type="radio" '+callradiostringeval('no'));
+ if (svalue=='no') { choicewrite(' checked="checked"'); }
+ choicewrite(' /> No</label><br />');
+ choicewrite('<label><input name="stringval" value="default"'+
+ ' type="radio" '+callradiostringeval('default'));
+ if (svalue=='default') { choicewrite(' checked="checked"'); }
+ choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
+ }
if (pscat=='ip') {
tablestart('IP Number/Name');
choicewrite('<tr><td>Value:</td><td colspan="2">');
@@ -919,6 +935,7 @@
else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
+ else if (pscat == 'lenient') { sopt('lenient','Lenient Grading (Partial Credit)'); }
else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
More information about the LON-CAPA-cvs
mailing list