[LON-CAPA-cvs] cvs: rat /client parameter.html loncom/interface courseprefs.pm lonblockingmenu.pm lonparmset.pm lonrelrequtils.pm loncom/misc releaseslist.xml
raeburn
raeburn at source.lon-capa.org
Sun Sep 13 17:48:37 EDT 2015
raeburn Sun Sep 13 21:48:37 2015 EDT
Modified files:
/loncom/interface lonrelrequtils.pm lonblockingmenu.pm
courseprefs.pm lonparmset.pm
/loncom/misc releaseslist.xml
/rat/client parameter.html
Log:
- Bug 6763: Time-Limit parameter ("interval") can include trailing "_done".
Detection of release required includes 2.12 if interval parameter has
trailing "_done".
-------------- next part --------------
Index: loncom/interface/lonrelrequtils.pm
diff -u loncom/interface/lonrelrequtils.pm:1.3 loncom/interface/lonrelrequtils.pm:1.4
--- loncom/interface/lonrelrequtils.pm:1.3 Tue Apr 28 13:20:41 2015
+++ loncom/interface/lonrelrequtils.pm Sun Sep 13 21:48:05 2015
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# The LearningOnline Network
#
-# $Id: lonrelrequtils.pm,v 1.3 2015/04/28 13:20:41 raeburn Exp $
+# $Id: lonrelrequtils.pm,v 1.4 2015/09/13 21:48:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -302,9 +302,9 @@
}
}
($Apache::lonrelrequtils::anonsurvey{major},$Apache::lonrelrequtils::anonsurvey{minor}) =
- split(/\./,$Apache::lonnet::needsrelease{'parameter:type:anonsurvey'});
+ split(/\./,$Apache::lonnet::needsrelease{'parameter:type:anonsurvey:'});
($Apache::lonrelrequtils::randomizetry{major},$Apache::lonrelrequtils::randomizetry{minor}) =
- split(/\./,$Apache::lonnet::needsrelease{'parameter:type:randomizetry'});
+ split(/\./,$Apache::lonnet::needsrelease{'parameter:type:randomizetry:'});
return;
}
@@ -371,14 +371,16 @@
}
foreach my $item (keys(%Apache::lonrelrequtils::checkparmsmatch)) {
if ($key =~ /(\Q$item\E)$/) {
- if (ref($Apache::lonrelrequtils::checkparms{$item}) eq 'ARRAY') {
+ if (ref($Apache::lonrelrequtils::checkparmsmatch{$item}) eq 'ARRAY') {
my $value = $resourcedata->{$key};
- foreach my $entry (@{$Apache::lonrelrequtils::checkparms{$item}}) {
+ foreach my $entry (@{$Apache::lonrelrequtils::checkparmsmatch{$item}}) {
my $regexp;
if (($item eq 'lenient') && ($entry eq 'weighted')) {
$regexp = '^[\-\.\d]+,[\-\.\d]+,[\-\.\d]+,[\-\.\d]+$';
} elsif (($item eq 'acc') && ($entry eq '_denyfrom_')) {
$regexp = '\!';
+ } elsif (($item eq 'interval') && ($entry eq 'done')) {
+ $regexp = '^\d+_done$';
}
if ($regexp ne '') {
if ($value =~ /$regexp/) {
@@ -415,7 +417,7 @@
if (keys(%comm_blocks) > 0) {
foreach my $block (keys(%comm_blocks)) {
if ($block =~ /^firstaccess____(.+)$/) {
- my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:timer'});
+ my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:timer:'});
($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
last;
} elsif ($block =~ /^(\d+)____(\d+)$/) {
@@ -426,13 +428,13 @@
if (ref($comm_blocks{$block}{'blocks'}) eq 'HASH') {
if (ref($comm_blocks{$block}{'blocks'}{'docs'}) eq 'HASH') {
if (keys(%{$comm_blocks{$block}{'blocks'}{'docs'}}) > 0) {
- my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:docs'});
+ my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:docs:'});
($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
last;
}
}
if ($comm_blocks{$block}{'blocks'}{'printout'} eq 'on') {
- my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:printout'});
+ my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:printout:'});
($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor);
last;
}
Index: loncom/interface/lonblockingmenu.pm
diff -u loncom/interface/lonblockingmenu.pm:1.14 loncom/interface/lonblockingmenu.pm:1.15
--- loncom/interface/lonblockingmenu.pm:1.14 Wed Apr 15 03:28:19 2015
+++ loncom/interface/lonblockingmenu.pm Sun Sep 13 21:48:05 2015
@@ -2,7 +2,7 @@
# Routines for configuring blocking of access to collaborative functions,
# and specific resources during an exam
#
-# $Id: lonblockingmenu.pm,v 1.14 2015/04/15 03:28:19 raeburn Exp $
+# $Id: lonblockingmenu.pm,v 1.15 2015/09/13 21:48:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -950,7 +950,7 @@
sub check_release_required {
my ($value,$chomemajor,$chomeminor) = @_;
- my $needsrelease = $Apache::lonnet::needsrelease{'course:commblock:'.$value};
+ my $needsrelease = $Apache::lonnet::needsrelease{'course:commblock:'.$value.':'};
if ($needsrelease) {
my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
if (($chomemajor < $needsmajor) ||
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.73 loncom/interface/courseprefs.pm:1.74
--- loncom/interface/courseprefs.pm:1.73 Sun Sep 13 19:55:34 2015
+++ loncom/interface/courseprefs.pm Sun Sep 13 21:48:05 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set configuration settings for a course
#
-# $Id: courseprefs.pm,v 1.73 2015/09/13 19:55:34 raeburn Exp $
+# $Id: courseprefs.pm,v 1.74 2015/09/13 21:48:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2568,7 +2568,7 @@
foreach my $valuematch (@{$Apache::lonrelrequtils::checkparmsmatch{$item}}) {
if ($value =~ /$valuematch/) {
my $stdtype = &Apache::lonparmset::standard_parameter_types($item);
- $found{$item}{'valname'} = &get_param_description($stdtype,$value,1);
+ $found{$item}{'valname'} = &get_param_description($stdtype,$value,1);
$found{$item}{'rev'} =
$Apache::lonnet::needsrelease{'parameter:'.$item.'::'.$valuematch};
last;
@@ -2703,7 +2703,7 @@
if (keys(%comm_blocks) > 0) {
foreach my $block (keys(%comm_blocks)) {
if ($block =~ /^firstaccess____(.+)$/) {
- my $rev = $Apache::lonnet::needsrelease{'course:commblock:timer'};
+ my $rev = $Apache::lonnet::needsrelease{'course:commblock:timer:'};
if (ref($comm_blocks{$block}) eq 'HASH') {
push(@{$fromblocks{'timer'}{$rev}},&unescape($comm_blocks{$block}{'event'}).
' '.&mt('set by [_1]',
@@ -2718,14 +2718,14 @@
if (ref($comm_blocks{$block}{'blocks'}) eq 'HASH') {
if (ref($comm_blocks{$block}{'blocks'}{'docs'}) eq 'HASH') {
if (keys(%{$comm_blocks{$block}{'blocks'}{'docs'}}) > 0) {
- my $rev = $Apache::lonnet::needsrelease{'course:commblock:docs'};
+ my $rev = $Apache::lonnet::needsrelease{'course:commblock:docs:'};
push(@{$fromblocks{'docs'}{$rev}},&unescape($comm_blocks{$block}{'event'}).
' '.
&mt('set by [_1]',
&Apache::loncommon::plainname(split(/:/,$comm_blocks{$block}{'setter'}))));
}
} elsif ($comm_blocks{$block}{'blocks'}{'printout'} eq 'on') {
- my $rev = $Apache::lonnet::needsrelease{'course:commblock:printout'};
+ my $rev = $Apache::lonnet::needsrelease{'course:commblock:printout:'};
push(@{$fromblocks{'printout'}{$rev}},&unescape($comm_blocks{$block}{'event'}).
' '.
&mt('set by [_1]',
@@ -2769,9 +2769,9 @@
if (defined($navmap)) {
my %anonsubms=&Apache::lonnet::dump('nohist_anonsurveys',$cdom,$cnum);
- my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey'};
+ my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey:'};
my %randtrysubms=&Apache::lonnet::dump('nohist_randomizetry',$cdom,$cnum);
- my $rev_randtry=$Apache::lonnet::needsrelease{'parameter:type:randomizetry'};
+ my $rev_randtry=$Apache::lonnet::needsrelease{'parameter:type:randomizetry:'};
my $stdtype=&Apache::lonparmset::standard_parameter_types('type');
my $stdname=&Apache::lonparmset::standard_parameter_names('type');
my $valanon=&get_param_description($stdtype,'anonsurvey');
@@ -3083,9 +3083,17 @@
sub get_param_description {
my ($stdtype,$value,$regexp) = @_;
my ($name,$parammatches,$paramstrings, at possibles);
- $paramstrings = &Apache::lonparmset::standard_string_options($stdtype);
+ if ($stdtype =~ /^string/) {
+ $paramstrings = &Apache::lonparmset::standard_string_options($stdtype);
+ } elsif ($stdtype eq 'date_interval') {
+ $paramstrings = &Apache::lonparmset::standard_interval_options($stdtype);
+ }
if ($regexp) {
- $parammatches = &Apache::lonparmset::standard_string_matches($stdtype);
+ if ($stdtype =~ /^string/) {
+ $parammatches = &Apache::lonparmset::standard_string_matches($stdtype);
+ } elsif ($stdtype eq 'date_interval') {
+ $parammatches = &Apache::lonparmset::standard_interval_matches($stdtype);
+ }
if (ref($parammatches) eq 'ARRAY') {
@possibles = @{$parammatches};
} else {
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.553 loncom/interface/lonparmset.pm:1.554
--- loncom/interface/lonparmset.pm:1.553 Fri Aug 28 22:44:59 2015
+++ loncom/interface/lonparmset.pm Sun Sep 13 21:48:05 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.553 2015/08/28 22:44:59 raeburn Exp $
+# $Id: lonparmset.pm,v 1.554 2015/09/13 21:48:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -777,7 +777,7 @@
sub valout {
- my ($value,$type,$editable)=@_;
+ my ($value,$type,$name,$editable)=@_;
my $result = '';
# Values of zero are valid.
if (! $value && $value ne '0') {
@@ -791,7 +791,8 @@
}
} else {
if ($type eq 'date_interval') {
- my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
+ my ($totalsecs,$donebutton) = split(/_/,$value);
+ my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($totalsecs);
my @timer;
$year=$year-70;
$mday--;
@@ -824,6 +825,9 @@
push(@timer,&mt('[quant,_1,sec]',0));
}
$result.=join(", ", at timer);
+ if ($donebutton eq 'done') {
+ $result .= ' '.&mt('+ "done"');
+ }
} elsif (&isdateparm($type)) {
$result = &Apache::lonlocal::locallocaltime($value).
&date_sanity_info($value);
@@ -850,7 +854,7 @@
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/);
my ($hour,$min,$sec,$val)=&preset_defaults($parmname);
unless (defined($winvalue)) { $winvalue=$val; }
- my $valout = &valout($value,$type,1);
+ my $valout = &valout($value,$type,$parmname,1);
my $unencmarker = $marker;
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call,
\$hour, \$min, \$sec) {
@@ -1178,7 +1182,7 @@
my $thismarker=$which;
$thismarker=~s/^parameter\_//;
my $mprefix=$rid.'&'.$thismarker.'&';
- my $effective_parm = &valout($outpar[$result],$typeoutpar[$result]);
+ my $effective_parm = &valout($outpar[$result],$typeoutpar[$result],$thismarker);
my ($othergrp,$grp_parm,$controlgrp);
if ($parmlev eq 'general') {
@@ -1256,7 +1260,7 @@
my $sessionvaltype=$typeoutpar[$result];
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
$r->print('<td style="background-color:#999999;" align="center"><font color="#FFFFFF">'.
- &valout($sessionval,$sessionvaltype).' '.
+ &valout($sessionval,$sessionvaltype,$$name{$which}).' '.
'</font></td>');
}
$r->print('</tr>');
@@ -1286,7 +1290,7 @@
}
}
if ($nolink) {
- $r->print(&valout($$outpar[$which],$$typeoutpar[$which]));
+ $r->print(&valout($$outpar[$which],$$typeoutpar[$which],$mprefix));
} else {
$r->print(&plink($$typeoutpar[$which],
$$display{$value},$$outpar[$which],
@@ -1311,9 +1315,9 @@
if (($coursereply) && ($cgroup ne $resultgroup)) {
if ($result > 3) {
$bgcolor = '#AAFFAA';
- $grp_parm = &valout($coursereply,$resulttype);
+ $grp_parm = &valout($coursereply,$resulttype,$what);
}
- $grp_parm = &valout($coursereply,$resulttype);
+ $grp_parm = &valout($coursereply,$resulttype,$what);
$output = '<td style="background-color:'.$bgcolor.';" align="center">';
if ($resultgroup && $resultlevel) {
$output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm;
@@ -1819,7 +1823,7 @@
// ]]>
</script>
|;
- } elsif ($currsec eq '') {
+ } else {
$sections .= qq|
<script type="text/javascript">
// <![CDATA[
@@ -1859,6 +1863,8 @@
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section')));
$r->print($sections.$groups);
$r->print(&Apache::lonhtmlcommon::row_closure());
+ } else {
+ $r->print($sections);
}
$r->print(&Apache::lonhtmlcommon::row_title(&mt('User')));
@@ -2399,7 +2405,7 @@
}
}
}
- } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate|acc)\&\d+$/) {
+ } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate|acc|interval)\&\d+$/) {
$name = $1;
my $val = $values[$i];
my $valmatch = '';
@@ -2436,6 +2442,23 @@
}
}
}
+ } elsif ($name eq 'interval') {
+ my $intervaltype = &get_intervaltype($name);
+ my $intervalmatch = &standard_interval_matches($intervaltype);
+ if (ref($intervalmatch) eq 'ARRAY') {
+ foreach my $item (@{$intervalmatch}) {
+ if (ref($item) eq 'ARRAY') {
+ my ($regexpname,$pattern) = @{$item};
+ if ($pattern ne '') {
+ if ($val =~ /$pattern/) {
+ $valmatch = $regexpname;
+ $val = '';
+ last;
+ }
+ }
+ }
+ }
+ }
}
$needsrelease =
$Apache::lonnet::needsrelease{"parameter:$name:$val:$valmatch"};
@@ -3143,6 +3166,25 @@
}
} elsif ($cmd eq 'dateinterval') {
$data=&get_date_interval_from_form($thiskey);
+ if ($thiskey =~ /\.interval$/) {
+ $name = 'interval';
+ my $intervaltype = &get_intervaltype($name);
+ my $intervalmatch = &standard_interval_matches($intervaltype);
+ if (ref($intervalmatch) eq 'ARRAY') {
+ foreach my $item (@{$intervalmatch}) {
+ if (ref($item) eq 'ARRAY') {
+ my ($regexpname,$pattern) = @{$item};
+ if ($pattern ne '') {
+ if ($data =~ /$pattern/) {
+ $valmatch = $regexpname;
+ $valchk = '';
+ last;
+ }
+ }
+ }
+ }
+ }
+ }
$typeof=$env{'form.typeof_'.$thiskey};
$text = &mt('Saved modified date for');
}
@@ -3425,7 +3467,7 @@
);
}
} elsif ($thistype eq 'date_interval') {
- $r->print(&date_interval_selector($thiskey,
+ $r->print(&date_interval_selector($thiskey,$name,
$$resourcedata{$thiskey},$readonly));
} elsif ($thistype =~ m/^string/) {
$r->print(&string_selector($thistype,$thiskey,
@@ -3443,30 +3485,6 @@
return $foundkeys;
}
-
-sub date_interval_selector {
- my ($thiskey, $showval, $readonly) = @_;
- my $result;
- foreach my $which (['days', 86400, 31],
- ['hours', 3600, 23],
- ['minutes', 60, 59],
- ['seconds', 1, 59]) {
- my ($name, $factor, $max) = @{ $which };
- my $amount = int($showval/$factor);
- $showval %= $factor;
- my %select = ((map {$_ => $_} (0..$max)),
- 'select_form_order' => [0..$max]);
- $result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey,
- \%select,'',$readonly);
- $result .= ' '.&mt($name);
- }
- unless ($readonly) {
- $result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />';
- }
- return $result;
-
-}
-
sub get_date_interval_from_form {
my ($key) = @_;
my $seconds = 0;
@@ -3479,6 +3497,9 @@
$seconds += $env{'form.'.$name.'_'.$key} * $factor;
}
}
+ if (($key =~ /\.interval$/) && ($env{'form.done_'.$key} eq '_done')) {
+ $seconds .= $env{'form.done_'.$key};
+ }
return $seconds;
}
@@ -3774,6 +3795,121 @@
return $result;
}
+my %intervals =
+ (
+ 'date_interval'
+ => [[ 'done', 'Yes' ],
+ [ '', 'No' ]],
+ );
+
+my %intervalmatches = (
+ 'date_interval'
+ => [['done','\d+_done$'],],
+ );
+
+my %intervaltypes = (
+ interval => 'date_interval',
+ );
+
+sub standard_interval_matches {
+ my ($interval_type) = @_;
+ if (ref($intervalmatches{$interval_type}) eq 'ARRAY') {
+ return $intervalmatches{$interval_type};
+ }
+ return;
+}
+
+sub get_intervaltype {
+ my ($name) = @_;
+ if (exists($intervaltypes{$name})) {
+ return $intervaltypes{$name};
+ }
+ return;
+}
+
+sub standard_interval_options {
+ my ($interval_type) = @_;
+ if (ref($intervals{$interval_type}) eq 'ARRAY') {
+ return $intervals{$interval_type};
+ }
+ return;
+}
+
+sub date_interval_selector {
+ my ($thiskey, $name, $showval, $readonly) = @_;
+ my ($result,%skipval);
+ if ($name eq 'interval') {
+ my $intervaltype = &get_intervaltype($name);
+ my ($got_chostname,$chostname,$cmajor,$cminor);
+ foreach my $possibilities (@{ $intervals{$intervaltype} }) {
+ next unless (ref($possibilities) eq 'ARRAY');
+ my ($parmval, $description) = @{ $possibilities };
+ my $parmmatch;
+ if (ref($intervalmatches{$intervaltype}) eq 'ARRAY') {
+ foreach my $item (@{$intervalmatches{$intervaltype}}) {
+ if (ref($item) eq 'ARRAY') {
+ if ($parmval eq $item->[0]) {
+ $parmmatch = $parmval;
+ $parmval = '';
+ last;
+ }
+ }
+ }
+ }
+ my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval:$parmmatch"};
+ if ($needsrelease) {
+ unless ($got_chostname) {
+ ($chostname,$cmajor,$cminor)=¶meter_release_vars();
+ $got_chostname = 1;
+ }
+ my $needsnewer=¶meter_releasecheck($name,$parmval,$parmmatch,
+ $needsrelease,$cmajor,$cminor);
+ if ($needsnewer) {
+ if ($parmmatch ne '') {
+ $skipval{$parmmatch} = 1;
+ } elsif ($parmval ne '') {
+ $skipval{$parmval} = 1;
+ }
+ }
+ }
+ }
+ }
+
+ my $currval = $showval;
+ foreach my $which (['days', 86400, 31],
+ ['hours', 3600, 23],
+ ['minutes', 60, 59],
+ ['seconds', 1, 59]) {
+ my ($name, $factor, $max) = @{ $which };
+ my $amount = int($showval/$factor);
+ $showval %= $factor;
+ my %select = ((map {$_ => $_} (0..$max)),
+ 'select_form_order' => [0..$max]);
+ $result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey,
+ \%select,'',$readonly);
+ $result .= ' '.&mt($name);
+ }
+ if ($name eq 'interval') {
+ unless ($skipval{'done'}) {
+ my $checkedon = '';
+ my $checkedoff = ' checked="checked"';
+ if ($currval =~ /^(\d+)_done$/) {
+ $checkedon = ' checked="checked"';
+ $checkedoff = '';
+ }
+ $result .= '<span class="LC_nobreak">'.(' ' x 3).'('.&mt('Include "done" button').
+ '<label><input type="radio" value="_done" name="done_'.$thiskey.'"'.$checkedon.' />'.
+ &mt('Yes').'</label>'.
+ '<label><input type="radio" value="" name="done_'.$thiskey.'"'.$checkedoff.' />'.
+ &mt('No').'</label>)</span>';
+ }
+ }
+ unless ($readonly) {
+ $result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />';
+ }
+ return $result;
+}
+
sub oldversion_warning {
my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_;
my $desc;
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.11 loncom/misc/releaseslist.xml:1.12
--- loncom/misc/releaseslist.xml:1.11 Tue Apr 28 13:20:48 2015
+++ loncom/misc/releaseslist.xml Sun Sep 13 21:48:18 2015
@@ -17,6 +17,7 @@
<parameter name="printstartdate" value="future">2.11</parameter>
<parameter name="printenddate" value="past">2.11</parameter>
<parameter name="acc" valuematch="_denyfrom_">2.12</parameter>
+<parameter name="interval" valuematch="done">2.12</parameter>
<resourcetag name="responsetype" value="custom">2.1</resourcetag>
<resourcetag name="responsetype" value="math">2.2</resourcetag>
<resourcetag name="responsetype" value="functionplot">2.10</resourcetag>
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.67 rat/client/parameter.html:1.68
--- rat/client/parameter.html:1.67 Fri Jan 23 19:35:48 2015
+++ rat/client/parameter.html Sun Sep 13 21:48:37 2015
@@ -5,7 +5,7 @@
The LearningOnline Network with CAPA
Parameter Input Window
//
-// $Id: parameter.html,v 1.67 2015/01/23 19:35:48 raeburn Exp $
+// $Id: parameter.html,v 1.68 2015/09/13 21:48:37 raeburn Exp $
//
// Copyright Michigan State University Board of Trustees
//
@@ -39,6 +39,7 @@
var ptype='';
var pvalue='';
+var pmodval='';
var preturn='';
var pcode='';
var pscat='';
@@ -301,7 +302,25 @@
sform.hours.options[sform.hours.selectedIndex].value*1)*60+
sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+
sform.seconds.options[sform.seconds.selectedIndex].value*1;
- draw();
+ if ((ptype=='date') && (pscat=='interval')) {
+ var newpmodval = '';
+ if (sform.donebutton.length) {
+ for (var i=0; i<sform.donebutton.length; i++) {
+ if (sform.donebutton[i].checked) {
+ if (sform.donebutton[i].value == '_done') {
+ newpmodval = sform.donebutton[i].value;
+ }
+ }
+ }
+ }
+ pmodval = newpmodval;
+ draw();
+ if (pmodval) {
+ svalue += pmodval;
+ }
+ } else {
+ draw();
+ }
}
function integereval() {
@@ -345,6 +364,10 @@
return 'onclick="parent.radiostringeval(\''+newval+'\')"';
}
+function callintervalpmodval() {
+ return 'onclick="parent.intcalc()"';
+}
+
function intervaldis() {
csecs=svalue;
cdays=Math.floor(csecs/86400);
@@ -478,8 +501,20 @@
intday();choicewrite('days ');
inthour();choicewrite('hours ');
intminute(); choicewrite('mins '); intsecond();
- choicewrite('secs</td></tr></table>');
- } else {
+ choicewrite('secs</td></tr></table>');
+ choicewrite('<br />');
+ tablestart('Provide a "Done" button to students?');
+ choicewrite('<tr><td>Value:</td><td colspan="2">');
+ choicewrite('<label><input name="donebutton" value="_done"'+
+ ' type="radio" '+callintervalpmodval());
+ if (pmodval =='_done') { choicewrite(' checked="checked"'); }
+ choicewrite(' /> Yes</label><br />');
+ choicewrite('<label><input name="donebutton" value=""'+
+ ' type="radio" '+callintervalpmodval());
+ if (pmodval != '_done') { choicewrite(' checked="checked"'); }
+ choicewrite(' /> No</label><br />');
+ choicewrite('</td></tr></table>');
+ } else {
choicewrite('<tr><td colspan="3">'
+cdate.toString()+
'</td></tr><tr><td>Date:</td><td colspan="2">');
@@ -830,6 +865,7 @@
function init() {
var i;
var subs=new Array();
+ var doneRegExp = /_done/;
var namevalue=this.window.location.search.split('&');
namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
@@ -859,6 +895,13 @@
if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
}
+ if (ptype=='date' && pscat == 'interval') {
+ if (doneRegExp.test(pvalue)) {
+ var pnumval = pvalue.replace(doneRegExp,'');
+ pmodval = pvalue.match(doneRegExp);
+ pvalue = pnumval;
+ }
+ }
svalue=pvalue;
if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
(pscat=='default') &&
More information about the LON-CAPA-cvs
mailing list