';
+ }
+ return $datatable;
}
-
sub radiobutton_prefs {
my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_;
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
(ref($choices) eq 'HASH'));
- my (%checkedon,%checkedoff,$datatable,$css_class);
+ my (%checkedon,%checkedoff,$datatable,$css_class,$cell_colspan);
foreach my $item (@{$toggles}) {
if ($defaultchecked->{$item} eq 'on') {
@@ -7440,80 +7407,75 @@ sub modify_serverstatuses {
sub modify_helpsettings {
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',
- loginhelpurl => 'Unauthenticated login help page set to custom file');
-
+ my ($resulttext,$errors,%changes,%helphash);
+ my $customhelpfile = $env{'form.loginhelpurl.filename'};
+ my $defaulthelpfile = '/adm/loginproblems.html';
+ my $defaulttext = &mt('Default in use');
+ 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',
+ loginhelpurl => 'Unauthenticated login help page set to custom file'
+ );
my @toggles = ('submitbugs');
-
$helphash{'helpsettings'} = {};
-
if (ref($domconfig{'helpsettings'}) ne 'HASH') {
if ($domconfig{'helpsettings'} eq '') {
$domconfig{'helpsettings'} = {};
}
}
-
if (ref($domconfig{'helpsettings'}) eq 'HASH') {
-
foreach my $item (@toggles) {
-
- if ($defaultchecked{$item} eq 'on') {
- if (($domconfig{'helpsettings'}{$item} eq '') &&
- ($env{'form.'.$item} eq '0')) {
- $changes{$item} = 1;
- } elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) {
- $changes{$item} = 1;
- }
- } elsif ($defaultchecked{$item} eq 'off') {
- if (($domconfig{'helpsettings'}{$item} eq '') &&
- ($env{'form.'.$item} eq '1')) {
- $changes{$item} = 1;
- } elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) {
- $changes{$item} = 1;
- }
- }
- $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 ($defaultchecked{$item} eq 'on') {
+ if ($domconfig{'helpsettings'}{$item} eq '') {
+ if ($env{'form.'.$item} eq '0') {
+ $changes{$item} = 1;
+ }
+ } elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) {
+ $changes{$item} = 1;
+ }
+ } elsif ($defaultchecked{$item} eq 'off') {
+ if ($domconfig{'helpsettings'}{$item} eq '') {
+ if ($env{'form.'.$item} eq '1') {
+ $changes{$item} = 1;
+ }
+ } elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) {
+ $changes{$item} = 1;
+ }
+ }
+ if (($env{'form.'.$item} eq '0') || ($env{'form.'.$item} eq '1')) {
+ $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'} = '';
@@ -7521,38 +7483,42 @@ sub modify_helpsettings {
}
}
}
-
-
my $putresult;
-
if (keys(%changes) > 0) {
- $putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom);
+ $putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom);
} else {
- $putresult = 'ok';
+ $putresult = 'ok';
}
-
if ($putresult eq 'ok') {
if (keys(%changes) > 0) {
- $resulttext = &mt('Changes made:').'
';
- foreach my $item (sort(keys(%changes))) {
- 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).'
';
+ $resulttext = &mt('Changes made:').'
';
+ foreach my $item (sort(keys(%changes))) {
+ if ($item eq 'submitbugs') {
+ $resulttext .= '
'.&mt('Display link to: [_1] set to "'.$offon[$env{'form.'.$item}].'".',
+ &Apache::loncommon::modal_link('http://bugs.loncapa.org',
+ &mt('LON-CAPA bug tracker'),600,500)).'
';
+ }
+ if ($item eq 'loginhelpurl') {
+ if ($helphash{'helpsettings'}{'loginhelpurl'} eq '') {
+ $resulttext .= '
'.&mt('custom log-in help file removed.').' '.
+ &Apache::loncommon::modal_link($defaulthelpfile,
+ $defaulttext,600,500).'