version 1.505.2.1, 2011/10/07 15:25:40
|
version 1.505.2.1.2.1, 2012/04/30 13:26:37
|
Line 1265 sub parmmenu {
|
Line 1265 sub parmmenu {
|
function checkdisset() { |
function checkdisset() { |
checkthis('discussend','pscat'); |
checkthis('discussend','pscat'); |
checkthis('discusshide','pscat'); |
checkthis('discusshide','pscat'); |
|
checkthis('discussvote','pscat'); |
} |
} |
|
|
function checkcontdates() { |
function checkcontdates() { |
Line 1403 sub lookUpTableParameter {
|
Line 1404 sub lookUpTableParameter {
|
'acc' => 'misc', |
'acc' => 'misc', |
'maxcollaborators' => 'misc', |
'maxcollaborators' => 'misc', |
'scoreformat' => 'misc', |
'scoreformat' => 'misc', |
|
'discussvote' => 'misc', |
|
|
); |
); |
} |
} |
Line 1958 sub standardkeyorder {
|
Line 1960 sub standardkeyorder {
|
'parameter_0_tol' => 16, |
'parameter_0_tol' => 16, |
'parameter_0_sig' => 17, |
'parameter_0_sig' => 17, |
'parameter_0_turnoffunit' => 18, |
'parameter_0_turnoffunit' => 18, |
'parameter_0_discussend' => 19, |
'parameter_0_discussend' => 19, |
'parameter_0_discusshide' => 20); |
'parameter_0_discusshide' => 20, |
|
'parameter_0_discussvote' => 21); |
} |
} |
|
|
|
|
Line 2122 sub assessparms {
|
Line 2125 sub assessparms {
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my $totalstored = 0; |
my $totalstored = 0; |
for (my $i=0;$i<=$#markers;$i++) { |
for (my $i=0;$i<=$#markers;$i++) { |
my ($needsrelease,$needsnewer); |
my ($needsrelease,$needsnewer,$name); |
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 2153 sub assessparms {
|
Line 2156 sub assessparms {
|
} |
} |
} |
} |
} |
} |
} elsif ($markers[$i] =~ /_type\&\d+$/) { |
} elsif ($markers[$i] =~ /_(type|discussvote)\&\d+$/) { |
|
$name = $1; |
$needsrelease = |
$needsrelease = |
$Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]}; |
$Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor) = &questiontype_release_vars(); |
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
$needsnewer = &questiontype_releasecheck($values[$i], |
$needsnewer = ¶meter_releasecheck($name,$values[$i], |
$needsrelease, |
$needsrelease, |
$chostname, |
$chostname, |
$cmajor,$cminor); |
$cmajor,$cminor); |
} |
} |
} |
} |
if ($needsnewer) { |
if ($needsnewer) { |
$message .= &oldversion_warning($values[$i],$chostname,$cmajor, |
$message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor, |
$cminor,$needsrelease); |
$cminor,$needsrelease); |
} else { |
} else { |
$message.=&storeparm(split(/\&/,$markers[$i]), |
$message.=&storeparm(split(/\&/,$markers[$i]), |
Line 2793 sub storedata {
|
Line 2797 sub storedata {
|
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
} |
} |
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, $name); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$key}; |
$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') { |
if ($typeof eq 'string_questiontype') { |
|
$name = $type; |
|
} elsif ($typeof eq 'string_discussvote') { |
|
$name = 'discussvote'; |
|
} |
|
if ($name ne '') { |
my ($needsrelease,$needsnewer); |
my ($needsrelease,$needsnewer); |
$needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data}; |
$needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
$needsnewer = &questiontype_releasecheck($data,$needsrelease, |
$needsnewer = ¶meter_releasecheck($name,$data, |
$chostname,$cmajor, |
$needsrelease, |
$cminor); |
$chostname,$cmajor, |
|
$cminor); |
} |
} |
if ($needsnewer) { |
if ($needsnewer) { |
$r->print('<br />'.&oldversion_warning($data,$chostname,$cmajor, |
$r->print('<br />'.&oldversion_warning($name,$data, |
|
$chostname,$cmajor, |
$cminor,$needsrelease)); |
$cminor,$needsrelease)); |
next; |
next; |
} |
} |
Line 3046 sub listdata {
|
Line 3057 sub listdata {
|
$$resourcedata{$thiskey})); |
$$resourcedata{$thiskey})); |
} elsif ($thistype =~ m/^string/) { |
} elsif ($thistype =~ m/^string/) { |
$r->print(&string_selector($thistype,$thiskey, |
$r->print(&string_selector($thistype,$thiskey, |
$$resourcedata{$thiskey})); |
$$resourcedata{$thiskey},$name)); |
} else { |
} else { |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
} |
} |
Line 3120 my %strings =
|
Line 3131 my %strings =
|
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
[ 'practice', 'Practice'], |
[ 'practice', 'Practice'], |
[ 'surveycred', 'Survey (credit for submission)']], |
[ 'surveycred', 'Survey (credit for submission)']], |
|
'string_discussvote' |
|
=> [['yes','Yes'], |
|
['notended','Yes, unless discussion ended'], |
|
['no','No']], |
); |
); |
|
|
sub standard_string_options { |
sub standard_string_options { |
Line 3131 sub standard_string_options {
|
Line 3146 sub standard_string_options {
|
} |
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval) = @_; |
my ($thistype, $thiskey, $showval, $name) = @_; |
|
|
if (!exists($strings{$thistype})) { |
if (!exists($strings{$thistype})) { |
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval); |
} |
} |
|
|
my %skiptype; |
my %skiptype; |
if ($thistype eq 'string_questiontype') { |
if (($thistype eq 'string_questiontype') || |
|
($thistype eq 'string_discussvote')) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
foreach my $possibilities (@{ $strings{$thistype} }) { |
foreach my $possibilities (@{ $strings{$thistype} }) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($name, $description) = @{ $possibilities }; |
my ($parmval, $description) = @{ $possibilities }; |
my $needsrelease=$Apache::lonnet::needsrelease{'parameter:type:'.$name}; |
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
my $needsnewer=&questiontype_releasecheck($name,$needsrelease, |
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, |
$chostname,$cmajor, |
$chostname,$cmajor, |
$cminor); |
$cminor); |
if ($needsnewer) { |
if ($needsnewer) { |
$skiptype{$name} = 1; |
$skiptype{$parmval} = 1; |
} |
} |
} |
} |
} |
} |
Line 4555 sub check_for_course_info {
|
Line 4571 sub check_for_course_info {
|
return 0; |
return 0; |
} |
} |
|
|
sub questiontype_release_vars { |
sub parameter_release_vars { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my $chostname = &Apache::lonnet::hostname($chome); |
my $chostname = &Apache::lonnet::hostname($chome); |
Line 4564 sub questiontype_release_vars {
|
Line 4580 sub questiontype_release_vars {
|
return ($chostname,$cmajor,$cminor); |
return ($chostname,$cmajor,$cminor); |
} |
} |
|
|
sub questiontype_releasecheck { |
sub parameter_releasecheck { |
my ($questiontype,$needsrelease,$chostname,$cmajor,$cminor) = @_; |
my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_; |
my $needsnewer; |
my $needsnewer; |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
if (($cmajor < $needsmajor) || |
if (($cmajor < $needsmajor) || |
($cmajor == $needsmajor && $cminor < $needsminor)) { |
($cmajor == $needsmajor && $cminor < $needsminor)) { |
$needsnewer = 1; |
$needsnewer = 1; |
} else { |
} 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; |
return $needsnewer; |
} |
} |
|
|
sub oldversion_warning { |
sub oldversion_warning { |
my ($questiontype,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
my $desc; |
my $desc; |
if (ref($strings{'string_questiontype'}) eq 'ARRAY') { |
my %stringtypes = ( |
foreach my $possibilities (@{ $strings{'string_questiontype'} }) { |
type => 'string_questiontype', |
next unless (ref($possibilities) eq 'ARRAY'); |
discussvote => 'string_discussvote', |
my ($name, $description) = @{ $possibilities }; |
); |
if ($name eq $questiontype) { |
if (exists($stringtypes{$name})) { |
$desc = $description; |
if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
last; |
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">'. |
return '<p class="LC_warning">'. |
&mt('Question Type was [_1]not[_2] set to [_3].', |
&mt('[_1] was [_2]not[_3] set to [_4].', |
'<b>','</b>','"'.$desc.'"').'<br />'. |
$standard_name,'<b>','</b>','"'.$desc.'"').'<br />'. |
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
$cmajor.'.'.$cminor,$chostname, |
$cmajor.'.'.$cminor,$chostname, |
$needsrelease). |
$needsrelease). |