--- loncom/interface/lonparmset.pm 2016/03/15 14:25:26 1.558
+++ loncom/interface/lonparmset.pm 2016/05/13 22:48:05 1.559
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.558 2016/03/15 14:25:26 raeburn Exp $
+# $Id: lonparmset.pm,v 1.559 2016/05/13 22:48:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -824,7 +824,16 @@ sub valout {
}
} else {
if ($type eq 'date_interval') {
- my ($totalsecs,$donebutton,$proctor,$secretkey) = split(/_/,$value);
+ my ($totalsecs,$donesuffix) = split(/_/,$value,2);
+ my ($usesdone,$donebuttontext,$proctor,$secretkey);
+ if ($donesuffix =~ /^done\:([^\:]+)\:(.*)$/) {
+ $donebuttontext = $1;
+ (undef,$proctor,$secretkey) = split(/_/,$2);
+ $usesdone = 'done';
+ } elsif ($donesuffix =~ /^done(|_.+)$/) {
+ $donebuttontext = &mt('Done');
+ ($usesdone,$proctor,$secretkey) = split(/_/,$donesuffix);
+ }
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($totalsecs);
my @timer;
$year=$year-70;
@@ -858,12 +867,12 @@ sub valout {
push(@timer,&mt('[quant,_1,sec]',0));
}
$result.=join(", ",@timer);
- if ($donebutton eq 'done') {
+ if ($usesdone eq 'done') {
if ($secretkey) {
- $result .= ' '.&mt('+ "done" with proctor key: [_1]',$secretkey);
+ $result .= ' '.&mt('+ "[_1]" with proctor key: [_2]',$donebuttontext,$secretkey);
} else {
- $result .= ' '.&mt('+ "done"');
- }
+ $result .= ' + "'.$donebuttontext.'"';
+ }
}
} elsif (&isdateparm($type)) {
$result = &Apache::lonlocal::locallocaltime($value).
@@ -3631,8 +3640,17 @@ sub get_date_interval_from_form {
}
}
if (($key =~ /\.interval$/) && (($env{'form.done_'.$key} eq '_done') || ($env{'form.done_'.$key} eq '_done_proctor'))) {
- $seconds .= $env{'form.done_'.$key};
- if ($env{'form.done_'.$key.'_proctorkey'}) {
+ if ($env{'form.done_'.$key.'_buttontext'}) {
+ $env{'form.done_'.$key.'_buttontext'} =~ s/\://g;
+ $seconds .= '_done:'.$env{'form.done_'.$key.'_buttontext'}.':';
+ if ($env{'form.done_'.$key} eq '_done_proctor') {
+ $seconds .= '_proctor';
+ }
+ } else {
+ $seconds .= $env{'form.done_'.$key};
+ }
+ if (($env{'form.done_'.$key} eq '_done_proctor') &&
+ ($env{'form.done_'.$key.'_proctorkey'})) {
$seconds .= '_'.$env{'form.done_'.$key.'_proctorkey'};
}
}
@@ -3941,8 +3959,8 @@ my %intervals =
my %intervalmatches = (
'date_interval'
- => [['done','\d+_done$'],
- ['done_proctor','\d+_done_proctor_']],
+ => [['done','\d+_done(|\:[^\:]+\:)$'],
+ ['done_proctor','\d+_done(|\:[^\:]+\:)_proctor_']],
);
my %intervaltypes = (
@@ -4033,8 +4051,13 @@ sub date_interval_selector {
my $checkedproc = '';
my $currproctorkey = '';
my $currprocdisplay = 'hidden';
+ my $currdonetext = &mt('Done');
my $checkedoff = ' checked="checked"';
- if ($currval =~ /^(\d+)_done$/) {
+ if ($currval =~ /^(?:\d+)_done$/) {
+ $checkedon = ' checked="checked"';
+ $checkedoff = '';
+ } elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:$/) {
+ $currdonetext = $1;
$checkedon = ' checked="checked"';
$checkedoff = '';
} elsif ($currval =~ /^(?:\d+)_done_proctor_(.+)$/) {
@@ -4042,6 +4065,12 @@ sub date_interval_selector {
$checkedproc = ' checked="checked"';
$checkedoff = '';
$currprocdisplay = 'text';
+ } elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:_proctor_(.+)$/) {
+ $currdonetext = $1;
+ $currproctorkey = $2;
+ $checkedproc = ' checked="checked"';
+ $checkedoff = '';
+ $currprocdisplay = 'text';
}
my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"';
$result .= '
'.&mt('Include "done" button').
@@ -4052,7 +4081,9 @@ sub date_interval_selector {
''.
'';
+ 'name="done_'.$thiskey.'_proctorkey" value="'.&HTML::Entities::encode($currproctorkey,'"<>&').'" />
'.
+ ''.&mt('Button text').': '.
+ '&').'" />';
}
}
unless ($readonly) {