';
+
+ }
+
+ return $datatable;
+
}
+
sub radiobutton_prefs {
my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_;
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
@@ -2011,14 +2092,27 @@ sub print_coursedefaults {
my ($css_class,$datatable);
my $itemcount = 1;
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles);
- %choices =
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ my %choices =
&Apache::lonlocal::texthash (
- canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
+ anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
);
- %defaultchecked = ('canuse_pdfforms' => 'off');
- @toggles = ('canuse_pdfforms',);
- ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
- \%choices,$itemcount);
+ my $currdefresponder;
+ if (ref($settings) eq 'HASH') {
+ $currdefresponder = $settings->{'anonsurvey_threshold'};
+ }
+ if (!$currdefresponder) {
+ $currdefresponder = 10;
+ } elsif ($currdefresponder < 1) {
+ $currdefresponder = 1;
+ }
+ $datatable .=
+ '
'.$choices{'anonsurvey_threshold'}.
+ '
'.
+ '
'.
+ ''.
+ '
';
$$rowtotal += $itemcount;
return $datatable;
}
@@ -5343,6 +5437,15 @@ sub modify_defaults {
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def');
my @authtypes = ('internal','krb4','krb5','localauth');
+ my @doms = &Apache::lonnet::current_machine_domains();
+ my @langs;
+ foreach my $dom (@doms) {
+ if ($dom =~ /^(\w+c)itest$/) {
+ push (@langs,$1.'t');
+ } else {
+ push(@langs,$dom);
+ }
+ }
foreach my $item (@items) {
$newvalues{$item} = $env{'form.'.$item};
if ($item eq 'auth_def') {
@@ -5355,7 +5458,8 @@ sub modify_defaults {
if ($newvalues{$item} ne '') {
if ($newvalues{$item} =~ /^(\w+)/) {
my $langcode = $1;
- if ($langcode ne 'x_chef') {
+ if ((!grep(/^\Q$langcode\E,@langs)) &&
+ ($langcode ne 'x_chef')) {
if (code2language($langcode) eq '') {
push(@errors,$item);
}
@@ -5869,12 +5973,20 @@ sub modify_serverstatuses {
}
sub modify_helpsettings {
- my ($dom,%domconfig) = @_;
+ my ($r,$dom,$confname,%domconfig) = @_;
my ($resulttext,$errors,%changes,%helphash);
+ my $customhelpfile = $env{'form.loginhelpurl.filename'};
+ my $defaulthelpfile = 'defaulthelp.html';
+ my $servadm = $r->dir_config('lonAdmEMail');
+ my ($configuserok,$author_ok,$switchserver) =
+ &config_check($dom,$confname,$servadm);
+
my %defaultchecked = ('submitbugs' => 'on');
my @offon = ('off','on');
- my %title = ( submitbugs => 'Display link for users to submit a bug');
+ my %title = ( submitbugs => 'Display link for users to submit a bug',
+ loginhelpurl => 'Unauthenticated login help page set to custom file');
+
my @toggles = ('submitbugs');
$helphash{'helpsettings'} = {};
@@ -5905,11 +6017,53 @@ sub modify_helpsettings {
}
}
$helphash{'helpsettings'}{$item} = $env{'form.'.$item};
- }
+ }
+
+ if ($customhelpfile ne '') {
+ my $error;
+ if ($configuserok eq 'ok') {
+ if ($switchserver) {
+ $error = &mt("Upload of custom help file is not permitted to this server: [_1]",$switchserver);
+ } else {
+ if ($author_ok eq 'ok') {
+ my ($result,$loginhelpurl) =
+ &publishlogo($r,'upload','loginhelpurl',$dom,
+ $confname,'help','','',$customhelpfile);
+ if ($result eq 'ok') {
+ $helphash{'helpsettings'}{'loginhelpurl'} = $loginhelpurl;
+ $changes{'loginhelpurl'} = 1;
+ } else {
+ $error = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$customhelpfile,$result);
+ }
+ } else {
+ $error = &mt("Upload of [_1] failed because an author role could not be assigned to a Domain Configuration user ([_2]) in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$author_ok);
+ }
+ }
+ } else {
+ $error = &mt("Upload of [_1] failed because a Domain Configuration user ([_2]) could not be created in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$configuserok);
+ }
+ if ($error) {
+ &Apache::lonnet::logthis($error);
+ $errors .= '
'.$error.'
';
+ }
+ }
+
+ if ($domconfig{'helpsettings'}{'loginhelpurl'} ne '') {
+ if ($env{'form.loginhelpurl_del'}) {
+ $helphash{'helpsettings'}{'loginhelpurl'} = '';
+ $changes{'loginhelpurl'} = 1;
+ }
+ }
}
- my $putresult = &Apache::lonnet::put_dom('configuration',\%helphash,
- $dom);
+
+ my $putresult;
+
+ if (keys(%changes) > 0) {
+ $putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom);
+ } else {
+ $putresult = 'ok';
+ }
if ($putresult eq 'ok') {
if (keys(%changes) > 0) {
@@ -5918,6 +6072,13 @@ sub modify_helpsettings {
if ($item eq 'submitbugs') {
$resulttext .= '
'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'
';
}
+ if ($item eq 'loginhelpurl') {
+ if ($helphash{'helpsettings'}{'loginhelpurl'} eq '') {
+ $resulttext .= '
'.&mt('[_1] help file removed; [_2] file will be used for the unathorized help page in this domain.',$customhelpfile,$defaulthelpfile).'