version 1.501, 2010/08/16 16:02:09
|
version 1.505, 2010/12/24 16:48:46
|
Line 1376 sub lookUpTableParameter {
|
Line 1376 sub lookUpTableParameter {
|
'handgrade' => 'grading', |
'handgrade' => 'grading', |
'maxtries' => 'tries', |
'maxtries' => 'tries', |
'hinttries' => 'tries', |
'hinttries' => 'tries', |
|
'randomizeontries' => 'tries', |
'type' => 'problem_appearance', |
'type' => 'problem_appearance', |
'problemstatus' => 'problem_appearance', |
'problemstatus' => 'problem_appearance', |
'display' => 'problem_appearance', |
'display' => 'problem_appearance', |
Line 2118 sub assessparms {
|
Line 2119 sub assessparms {
|
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
my $totalstored = 0; |
for (my $i=0;$i<=$#markers;$i++) { |
for (my $i=0;$i<=$#markers;$i++) { |
|
my ($needsrelease,$needsnewer); |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
my (@ok_slots,@fail_slots,@del_slots); |
my (@ok_slots,@fail_slots,@del_slots); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
Line 2150 sub assessparms {
|
Line 2155 sub assessparms {
|
} |
} |
} |
} |
} elsif ($markers[$i] =~ /_type\&\d+$/) { |
} elsif ($markers[$i] =~ /_type\&\d+$/) { |
if (($values[$i] eq 'anonsurvey') || ($values[$i] eq 'anonsurveycred')) { |
$needsrelease = |
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]}); |
$Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor) = &questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = &questiontype_releasecheck($values[$i], |
|
$needsrelease, |
|
$chostname, |
|
$cmajor,$cminor); |
} |
} |
} |
} |
$message.=&storeparm(split(/\&/,$markers[$i]), |
if ($needsnewer) { |
$values[$i], |
$message .= &oldversion_warning($values[$i],$chostname,$cmajor, |
$types[$i], |
$cminor,$needsrelease); |
$uname,$udom,$csec,$cgroup); |
} else { |
|
$message.=&storeparm(split(/\&/,$markers[$i]), |
|
$values[$i], |
|
$types[$i], |
|
$uname,$udom,$csec,$cgroup); |
|
$totalstored ++; |
|
} |
} |
} |
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
$message.='<p class="LC_warning">' |
if ($totalstored) { |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
$message.='<p class="LC_warning">' |
.&Apache::loncommon::help_open_topic('Caching') |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
.'</p>'; |
.&Apache::loncommon::help_open_topic('Caching') |
|
.'</p>'; |
|
} |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
Line 2761 sub storedata {
|
Line 2783 sub storedata {
|
undef %newdata; |
undef %newdata; |
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
foreach (keys %env) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
foreach my $key (keys(%env)) { |
|
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
my ($tuname,$tudom)=&extractuser($thiskey); |
my ($tuname,$tudom)=&extractuser($thiskey); |
Line 2773 sub storedata {
|
Line 2796 sub storedata {
|
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my ($data, $typeof, $text); |
my ($data, $typeof, $text); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$_}; |
$data=$env{$key}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified parameter for'); |
$text = &mt('Saved modified parameter for'); |
|
if ($typeof eq 'string_questiontype') { |
|
my ($needsrelease,$needsnewer); |
|
$needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = &questiontype_releasecheck($data,$needsrelease, |
|
$chostname,$cmajor, |
|
$cminor); |
|
} |
|
if ($needsnewer) { |
|
$r->print('<br />'.&oldversion_warning($data,$chostname,$cmajor, |
|
$cminor,$needsrelease)); |
|
next; |
|
} |
|
} |
} elsif ($cmd eq 'datepointer') { |
} elsif ($cmd eq 'datepointer') { |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified date for'); |
$text = &mt('Saved modified date for'); |
} elsif ($cmd eq 'dateinterval') { |
} elsif ($cmd eq 'dateinterval') { |
Line 3071 my %strings =
|
Line 3112 my %strings =
|
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
|
'string_questiontype' |
|
=> [[ 'problem', 'Standard Problem'], |
|
[ 'survey', 'Survey'], |
|
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], |
|
[ 'exam', 'Exam'], |
|
[ 'anonsurvey', 'Anonymous Survey'], |
|
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
|
[ 'practice', 'Practice'], |
|
[ 'surveycred', 'Survey (credit for submission)']], |
); |
); |
|
|
|
sub standard_string_options { |
|
my ($string_type) = @_; |
|
if (ref($strings{$string_type}) eq 'ARRAY') { |
|
return $strings{$string_type}; |
|
} |
|
return; |
|
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval) = @_; |
my ($thistype, $thiskey, $showval) = @_; |
Line 3081 sub string_selector {
|
Line 3138 sub string_selector {
|
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval); |
} |
} |
|
|
|
my %skiptype; |
|
if ($thistype eq 'string_questiontype') { |
|
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}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
my $needsnewer=&questiontype_releasecheck($name,$needsrelease, |
|
$chostname,$cmajor, |
|
$cminor); |
|
if ($needsnewer) { |
|
$skiptype{$name} = 1; |
|
} |
|
} |
|
} |
|
} |
|
|
my $result; |
my $result; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
my $numinrow = 3; |
my ($name, $description) = @{ $possibilities }; |
if ($thistype eq 'string_problemstatus') { |
$result .= '<label><input type="radio" name="set_'.$thiskey. |
$numinrow = 2; |
'" value="'.$name.'"'; |
} elsif ($thistype eq 'string_questiontype') { |
if ($showval eq $name) { |
if (keys(%skiptype) > 0) { |
$result .= ' checked="checked"'; |
$numinrow = 4; |
|
} |
|
} |
|
my $rem; |
|
if (ref($strings{$thistype}) eq 'ARRAY') { |
|
my $i=0; |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
next if ($skiptype{$name}); |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$result .= '</tr>'; |
|
} |
|
$result .= '<tr>'; |
|
} |
|
$result .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="set_'.$thiskey. |
|
'" value="'.$name.'"'; |
|
if ($showval eq $name) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />'.&mt($description).'</label></span></td>'; |
|
$i++; |
|
} |
|
$rem = @{ $strings{$thistype} }%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$result .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$result .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$result .= '</tr>'; |
} |
} |
$result .= ' />'.&mt($description).'</label> '; |
if ($result) { |
|
$result = '<table border="0">'.$result.'</table>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 4441 sub check_for_course_info {
|
Line 4556 sub check_for_course_info {
|
return 0; |
return 0; |
} |
} |
|
|
|
sub questiontype_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); |
|
my ($cmajor,$cminor) = |
|
split(/\./,&Apache::lonnet::get_server_loncaparev($cdom,$chome)); |
|
return ($chostname,$cmajor,$cminor); |
|
} |
|
|
|
sub questiontype_releasecheck { |
|
my ($questiontype,$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}); |
|
} |
|
return $needsnewer; |
|
} |
|
|
|
sub oldversion_warning { |
|
my ($questiontype,$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; |
|
} |
|
} |
|
} |
|
return '<p class="LC_warning">'. |
|
&mt('Question Type was [_1]not[_2] set to [_3].', |
|
'<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). |
|
'</p>'; |
|
} |
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |