'
- .&mt('Display').' '
- .''
- .&mt('Do not display').'
';
}
}
} else {
@@ -2814,6 +2998,9 @@ sub coursecategories_javascript {
$jstext = ' var categories = Array(1);'."\n".
' categories[0] = Array("instcode_pos");'."\n";
}
+ my $instcode_reserved = &mt('The name: "instcode" is a reserved category');
+ my $communities_reserved = &mt('The name: "communities" is a reserved category');
+ my $choose_again = '\\n'.&mt('Please use a different name for the new top level category');
$output = <<"ENDSCRIPT";
@@ -2882,25 +3082,40 @@ ENDSCRIPT
sub initialize_categories {
my ($itemcount) = @_;
- my $datatable;
- my $css_class = $itemcount%2?' class="LC_odd_row"':'';
- my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','0'".');"';
-
- $datatable = '
';
+ }
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) {
my $cathash;
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
@@ -5560,7 +5819,7 @@ sub modify_coursecategories {
&mt('An error occurred: [_1]',$putresult).'
';
}
} else {
- $resulttext = &mt('No changes made to course categories');
+ $resulttext = &mt('No changes made to course and community categories');
}
return $resulttext;
}
@@ -5691,12 +5950,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'} = {};
@@ -5727,11 +5994,46 @@ 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 = &Apache::lonnet::put_dom('configuration',\%helphash,$dom);
if ($putresult eq 'ok') {
if (keys(%changes) > 0) {
@@ -5740,6 +6042,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).'
';
+ } else {
+ $resulttext .= '
'.&mt("$title{$item} [_1]",$customhelpfile).'
';
+ }
+ }
}
$resulttext .= '';
} else {
@@ -5755,6 +6064,72 @@ sub modify_helpsettings {
}
return $resulttext;
}
+
+sub modify_coursedefaults {
+ my ($dom,%domconfig) = @_;
+ my ($resulttext,$errors,%changes,%defaultshash);
+ my %defaultchecked = ('canuse_pdfforms' => 'off');
+ my @offon = ('off','on');
+ my @toggles = ('canuse_pdfforms');
+
+ $defaultshash{'coursedefaults'} = {};
+
+ if (ref($domconfig{'coursedefaults'}) ne 'HASH') {
+ if ($domconfig{'coursedefaults'} eq '') {
+ $domconfig{'coursedefaults'} = {};
+ }
+ }
+
+ if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
+ foreach my $item (@toggles) {
+ if ($defaultchecked{$item} eq 'on') {
+ if (($domconfig{'coursedefaults'}{$item} eq '') &&
+ ($env{'form.'.$item} eq '0')) {
+ $changes{$item} = 1;
+ } elsif ($domconfig{'coursdefaults'}{$item} ne $env{'form.'.$item}) {
+ $changes{$item} = 1;
+ }
+ } elsif ($defaultchecked{$item} eq 'off') {
+ if (($domconfig{'coursedefaults'}{$item} eq '') &&
+ ($env{'form.'.$item} eq '1')) {
+ $changes{$item} = 1;
+ } elsif ($domconfig{'coursedefaults'}{$item} ne $env{'form.'.$item}) {
+ $changes{$item} = 1;
+ }
+ }
+ $defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item};
+ }
+ }
+ my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
+ $dom);
+ if ($putresult eq 'ok') {
+ if (keys(%changes) > 0) {
+ if ($changes{'canuse_pdfforms'}) {
+ my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
+ $domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'};
+ my $cachetime = 24*60*60;
+ &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
+ }
+ $resulttext = &mt('Changes made:').'
';
+ foreach my $item (sort(keys(%changes))) {
+ if ($item eq 'canuse_pdfforms') {
+ if ($env{'form.'.$item} eq '1') {
+ $resulttext .= '
'.&mt("Course/Community users can create/upload PDF forms set to 'on'").'
';
+ } else {
+ $resulttext .= '
'.&mt('Course/Community users can create/upload PDF forms set to "off"').'