--- loncom/interface/domainprefs.pm 2015/05/12 00:20:42 1.160.6.63
+++ loncom/interface/domainprefs.pm 2016/08/12 19:49:56 1.160.6.69
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.63 2015/05/12 00:20:42 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.69 2016/08/12 19:49:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2398,7 +2398,7 @@ ENDSCRIPT
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
- my ($defdom,$runon,$runoff,$coownerson,$coownersoff);
+ my ($defdom,$runon,$runoff,$coownerson,$coownersoff,$failsafe);
if (ref($settings) eq 'HASH') {
if (exists($settings->{'run'})) {
if ($settings->{'run'} eq '0') {
@@ -2432,6 +2432,9 @@ sub print_autoenroll {
if (exists($settings->{'sender_domain'})) {
$defdom = $settings->{'sender_domain'};
}
+ if (exists($settings->{'autofailsafe'})) {
+ $failsafe = $settings->{'autofailsafe'};
+ }
} else {
if ($autorun) {
$runon = ' checked="checked" ';
@@ -2467,8 +2470,12 @@ sub print_autoenroll {
$coownerson.' value="1" />'.&mt('Yes').' '.
''.
- '';
- $$rowtotal += 3;
+ '
'.
+ ''.&mt('Failsafe for no drops when institutional data missing').' | '.
+ ''.
+ ' |
';
+ $$rowtotal += 4;
return $datatable;
}
@@ -2891,6 +2898,7 @@ sub print_coursedefaults {
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)',
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)',
postsubmit => 'Disable submit button/keypress following student submission',
+ canclone => "People who may clone a course (besides course's owner and coordinators)",
);
my %staticdefaults = (
anonsurvey_threshold => 10,
@@ -2901,10 +2909,82 @@ sub print_coursedefaults {
%defaultchecked = (
'uselcmath' => 'on',
'usejsme' => 'on',
+ 'canclone' => 'none',
);
@toggles = ('uselcmath','usejsme');
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
\%choices,$itemcount);
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .=
+ ''.
+ ''.$choices{'canclone'}.
+ ' | ';
+ my $currcanclone = 'none';
+ my $onclick;
+ my @cloneoptions = ('none','domain');
+ my %clonetitles = (
+ none => 'No additional course requesters',
+ domain => "Any course requester in course's domain",
+ instcode => 'Course requests for official courses ...',
+ );
+ my (%codedefaults,@code_order,@posscodes);
+ if (&Apache::lonnet::auto_instcode_defaults($dom,\%codedefaults,
+ \@code_order) eq 'ok') {
+ if (@code_order > 0) {
+ push(@cloneoptions,'instcode');
+ $onclick = ' onclick="toggleDisplay(this.form,'."'cloneinstcode'".');"';
+ }
+ }
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'canclone'}) {
+ if (ref($settings->{'canclone'}) eq 'HASH') {
+ if (ref($settings->{'canclone'}{'instcode'}) eq 'ARRAY') {
+ if (@code_order > 0) {
+ $currcanclone = 'instcode';
+ @posscodes = @{$settings->{'canclone'}{'instcode'}};
+ }
+ }
+ } elsif ($settings->{'canclone'} eq 'domain') {
+ $currcanclone = $settings->{'canclone'};
+ }
+ }
+ }
+ foreach my $option (@cloneoptions) {
+ my ($checked,$additional);
+ if ($currcanclone eq $option) {
+ $checked = ' checked="checked"';
+ }
+ if ($option eq 'instcode') {
+ if (@code_order) {
+ my $show = 'none';
+ if ($checked) {
+ $show = 'block';
+ }
+ $additional = ''.
+ &mt('Institutional codes for new and cloned course have identical:').
+ ' ';
+ foreach my $item (@code_order) {
+ my $codechk;
+ if ($checked) {
+ if (grep(/^\Q$item\E$/,@posscodes)) {
+ $codechk = ' checked="checked"';
+ }
+ }
+ $additional .= '';
+ }
+ $additional .= (' 'x2).'('.&mt('check as many as needed').')';
+ }
+ }
+ $datatable .=
+ ' '.$additional.' ';
+ }
+ $datatable .= ' | '.
+ '
';
+ $itemcount ++;
} else {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout);
@@ -4462,7 +4542,8 @@ sub email_as_username {
sub captcha_choice {
my ($context,$settings,$itemcount) = @_;
- my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext);
+ my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext,
+ $vertext,$currver);
my %lt = &captcha_phrases();
$keyentry = 'hidden';
if ($context eq 'cancreate') {
@@ -4480,6 +4561,11 @@ sub captcha_choice {
$pubtext = $lt{'pub'};
$privtext = $lt{'priv'};
$keyentry = 'text';
+ $vertext = $lt{'ver'};
+ $currver = $settings->{'recaptchaversion'};
+ if ($currver ne '2') {
+ $currver = 1;
+ }
}
if (ref($settings->{'recaptchakeys'}) eq 'HASH') {
$currpub = $settings->{'recaptchakeys'}{'public'};
@@ -4513,7 +4599,11 @@ sub captcha_choice {
$currpub.'" size="40" />
'."\n".
''.$privtext.' '."\n".
''."\n".
+ $currpriv.'" size="40" />
'.
+ ''.$vertext.' '."\n".
+ '
'.
+ ''."\n".
'';
return $output;
}
@@ -5393,7 +5483,10 @@ sub coursecategories_javascript {
}
my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');
my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');
- my $choose_again = '\\n'.&mt('Please use a different name for the new top level category.');
+ my $choose_again = "\n".&mt('Please use a different name for the new top level category.');
+ &js_escape(\$instcode_reserved);
+ &js_escape(\$communities_reserved);
+ &js_escape(\$choose_again);
$output = <<"ENDSCRIPT";