version 1.437, 2024/03/03 00:08:37
|
version 1.438, 2024/04/14 17:12:27
|
Line 6917 sub print_coursedefaults {
|
Line 6917 sub print_coursedefaults {
|
domexttool => 'External Tools defined in the domain may be used in courses/communities (by type)', |
domexttool => 'External Tools defined in the domain may be used in courses/communities (by type)', |
exttool => 'External Tools can be defined and configured in courses/communities (by type)', |
exttool => 'External Tools can be defined and configured in courses/communities (by type)', |
crsauthor => 'Standard LON-CAPA problems can be created within a course/community (by type)', |
crsauthor => 'Standard LON-CAPA problems can be created within a course/community (by type)', |
|
crseditors => 'Available editors for web pages and/or problems created in a course/community', |
); |
); |
my %staticdefaults = ( |
my %staticdefaults = ( |
anonsurvey_threshold => 10, |
anonsurvey_threshold => 10, |
Line 6927 sub print_coursedefaults {
|
Line 6928 sub print_coursedefaults {
|
domexttool => 1, |
domexttool => 1, |
exttool => 0, |
exttool => 0, |
crsauthor => 1, |
crsauthor => 1, |
|
crseditors => ['edit','xml'], |
); |
); |
if ($position eq 'top') { |
if ($position eq 'top') { |
%defaultchecked = ( |
%defaultchecked = ( |
Line 7048 sub print_coursedefaults {
|
Line 7050 sub print_coursedefaults {
|
my %domexttool; |
my %domexttool; |
my %exttool; |
my %exttool; |
my %crsauthor; |
my %crsauthor; |
|
my %crseditors; |
my @types = ('official','unofficial','community','textbook','placement'); |
my @types = ('official','unofficial','community','textbook','placement'); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'ltiauth'}) { |
if ($settings->{'ltiauth'}) { |
Line 7086 sub print_coursedefaults {
|
Line 7089 sub print_coursedefaults {
|
} |
} |
} |
} |
} |
} |
|
if (ref($settings->{'crseditors'}) eq 'ARRAY') { |
|
foreach my $editor (@{$settings->{'crseditors'}}) { |
|
$crseditors{$editor} = ' checked="checked"'; |
|
} |
|
} else { |
|
foreach my $editor (@{$staticdefaults{'crseditors'}}) { |
|
$crseditors{$editor} = ' checked="checked"'; |
|
} |
|
} |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
if (ref($settings->{'uploadquota'}) eq 'HASH') { |
if (ref($settings->{'uploadquota'}) eq 'HASH') { |
foreach my $type (keys(%{$settings->{'uploadquota'}})) { |
foreach my $type (keys(%{$settings->{'uploadquota'}})) { |
Line 7149 sub print_coursedefaults {
|
Line 7161 sub print_coursedefaults {
|
$crsauthor{$type} = ' checked="checked"'; |
$crsauthor{$type} = ' checked="checked"'; |
} |
} |
} |
} |
|
foreach my $editor (@{$staticdefaults{'crseditors'}}) { |
|
$crseditors{$editor} = ' checked="checked"'; |
|
} |
} |
} |
if (!$currdefresponder) { |
if (!$currdefresponder) { |
$currdefresponder = $staticdefaults{'anonsurvey_threshold'}; |
$currdefresponder = $staticdefaults{'anonsurvey_threshold'}; |
Line 7276 sub print_coursedefaults {
|
Line 7291 sub print_coursedefaults {
|
foreach my $type (@types) { |
foreach my $type (@types) { |
$datatable .= '<td style="text-align: left">'. |
$datatable .= '<td style="text-align: left">'. |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<input type="checkbox" name="domexttool"'. |
'<label><input type="checkbox" name="domexttool"'. |
' value="'.$type.'"'.$domexttool{$type}.' />'. |
' value="'.$type.'"'.$domexttool{$type}.' />'. |
&mt($type).'</span></td>'."\n"; |
&mt($type).'</label></span></td>'."\n"; |
} |
} |
$datatable .= '</tr></table></td></tr>'."\n"; |
$datatable .= '</tr></table></td></tr>'."\n"; |
$itemcount ++; |
$itemcount ++; |
Line 7291 sub print_coursedefaults {
|
Line 7306 sub print_coursedefaults {
|
foreach my $type (@types) { |
foreach my $type (@types) { |
$datatable .= '<td style="text-align: left">'. |
$datatable .= '<td style="text-align: left">'. |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<input type="checkbox" name="exttool"'. |
'<label><input type="checkbox" name="exttool"'. |
' value="'.$type.'"'.$exttool{$type}.' />'. |
' value="'.$type.'"'.$exttool{$type}.' />'. |
&mt($type).'</span></td>'."\n"; |
&mt($type).'</label></span></td>'."\n"; |
} |
} |
$datatable .= '</tr></table></td></tr>'."\n"; |
$datatable .= '</tr></table></td></tr>'."\n"; |
$itemcount ++; |
$itemcount ++; |
Line 7306 sub print_coursedefaults {
|
Line 7321 sub print_coursedefaults {
|
foreach my $type (@types) { |
foreach my $type (@types) { |
$datatable .= '<td style="text-align: left">'. |
$datatable .= '<td style="text-align: left">'. |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<input type="checkbox" name="crsauthor"'. |
'<label><input type="checkbox" name="crsauthor"'. |
' value="'.$type.'"'.$crsauthor{$type}.' />'. |
' value="'.$type.'"'.$crsauthor{$type}.' />'. |
&mt($type).'</span></td>'."\n"; |
&mt($type).'</label></span></td>'."\n"; |
|
} |
|
$datatable .= '</tr></table></td></tr>'."\n"; |
|
$itemcount ++; |
|
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'. |
|
$choices{'crseditors'}. |
|
'</span></td>'. |
|
'<td style="text-align: right" class="LC_right_item">'. |
|
'<table><tr>'; |
|
my @editors = ('edit','xml','daxe'); |
|
my %editornames = &crseditor_titles(); |
|
foreach my $editor (@editors) { |
|
$datatable .= '<td style="text-align: left">'. |
|
'<span class="LC_nobreak">'. |
|
'<label><input type="checkbox" name="crseditors"'. |
|
' value="'.$editor.'"'.$crseditors{$editor}.' />'. |
|
$editornames{$editor}.'</label></span></td>'."\n"; |
} |
} |
$datatable .= '</tr></table></td></tr>'."\n"; |
$datatable .= '</tr></table></td></tr>'."\n"; |
} |
} |
Line 7316 sub print_coursedefaults {
|
Line 7348 sub print_coursedefaults {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub crseditor_titles { |
|
return &Apache::lonlocal::texthash( |
|
edit => 'Standard editor (Edit)', |
|
xml => 'Text editor (EditXML)', |
|
daxe => 'Daxe editor (Daxe)', |
|
); |
|
} |
|
|
sub print_authordefaults { |
sub print_authordefaults { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($css_class,$datatable,%checkedon,%checkedoff); |
my ($css_class,$datatable,%checkedon,%checkedoff); |
Line 21213 sub modify_coursedefaults {
|
Line 21253 sub modify_coursedefaults {
|
mysqltables => 172800, |
mysqltables => 172800, |
domexttool => 1, |
domexttool => 1, |
crsauthor => 1, |
crsauthor => 1, |
|
crseditors => ['edit','xml'], |
); |
); |
my %texoptions = ( |
my %texoptions = ( |
MathJax => 'MathJax', |
MathJax => 'MathJax', |
mimetex => &mt('Convert to Images'), |
mimetex => &mt('Convert to Images'), |
tth => &mt('TeX to HTML'), |
tth => &mt('TeX to HTML'), |
); |
); |
|
|
|
my @editors = ('edit','xml','daxe'); |
|
my %editornames = &crseditor_titles(); |
|
|
$defaultshash{'coursedefaults'} = {}; |
$defaultshash{'coursedefaults'} = {}; |
|
|
if (ref($domconfig{'coursedefaults'}) ne 'HASH') { |
if (ref($domconfig{'coursedefaults'}) ne 'HASH') { |
Line 21404 sub modify_coursedefaults {
|
Line 21449 sub modify_coursedefaults {
|
$changes{'postsubmit'} = 1; |
$changes{'postsubmit'} = 1; |
} |
} |
} |
} |
my (%newdomexttool,%newexttool,%newcrsauthor,%olddomexttool,%oldexttool,%oldcrsauthor); |
my (%newdomexttool,%newexttool,%newcrsauthor,%olddomexttool,%oldexttool,%oldcrsauthor, |
|
%posscrseditors); |
map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool'); |
map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool'); |
map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool'); |
map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool'); |
map { $newcrsauthor{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crsauthor'); |
map { $newcrsauthor{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crsauthor'); |
|
map { $posscrseditors{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crseditors'); |
if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') { |
if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') { |
%olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}}; |
%olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}}; |
} else { |
} else { |
Line 21441 sub modify_coursedefaults {
|
Line 21488 sub modify_coursedefaults {
|
} |
} |
} |
} |
} |
} |
|
my @newcrseditors = (); |
|
foreach my $editor (@editors) { |
|
if ($posscrseditors{$editor}) { |
|
push(@newcrseditors,$editor); |
|
} |
|
} |
|
if (ref($domconfig{'coursedefaults'}{'crseditors'}) eq 'ARRAY') { |
|
my @diffs = |
|
&Apache::loncommon::compare_arrays($domconfig{'coursedefaults'}{'crseditors'}, |
|
\@newcrseditors); |
|
if (@diffs) { |
|
$changes{'crseditors'} = 1; |
|
} |
|
} else { |
|
my @diffs = |
|
&Apache::loncommon::compare_arrays($staticdefaults{'crseditors'}, |
|
\@newcrseditors); |
|
unless (@diffs == 0) { |
|
$changes{'crseditors'} = 1; |
|
} |
|
} |
foreach my $type (@types) { |
foreach my $type (@types) { |
unless ($newdomexttool{$type}) { |
unless ($newdomexttool{$type}) { |
$newdomexttool{$type} = 0; |
$newdomexttool{$type} = 0; |
Line 21464 sub modify_coursedefaults {
|
Line 21532 sub modify_coursedefaults {
|
$defaultshash{'coursedefaults'}{'domexttool'} = \%newdomexttool; |
$defaultshash{'coursedefaults'}{'domexttool'} = \%newdomexttool; |
$defaultshash{'coursedefaults'}{'exttool'} = \%newexttool; |
$defaultshash{'coursedefaults'}{'exttool'} = \%newexttool; |
$defaultshash{'coursedefaults'}{'crsauthor'} = \%newcrsauthor; |
$defaultshash{'coursedefaults'}{'crsauthor'} = \%newcrsauthor; |
|
$defaultshash{'coursedefaults'}{'crseditors'} = \@newcrseditors; |
} |
} |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
$dom); |
$dom); |
Line 21547 sub modify_coursedefaults {
|
Line 21616 sub modify_coursedefaults {
|
} |
} |
} |
} |
} |
} |
|
if ($changes{'crseditors'}) { |
|
if (ref($defaultshash{'coursedefaults'}{'crseditors'}) eq 'ARRAY') { |
|
$domdefaults{'crseditors'}=join(',',@{$defaultshash{'coursedefaults'}{'crseditors'}}); |
|
} |
|
} |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
Line 21726 sub modify_coursedefaults {
|
Line 21800 sub modify_coursedefaults {
|
} else { |
} else { |
$resulttext .= '<li>'.$status{$item}{'default'}.'</li>'; |
$resulttext .= '<li>'.$status{$item}{'default'}.'</li>'; |
} |
} |
|
} elsif ($item eq 'crseditors') { |
|
if (ref($defaultshash{'coursedefaults'}{$item}) eq 'ARRAY') { |
|
my $shown; |
|
if (@{$defaultshash{'coursedefaults'}{$item}}) { |
|
$shown = join(', ', map { $editornames{$_} } @{$defaultshash{'coursedefaults'}{$item}}); |
|
} else { |
|
$shown = &mt('None'); |
|
} |
|
$resulttext .= '<li>'.&mt('Available editors for course/community resources: [_1]',$shown).'</li>'; |
|
} |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |