--- loncom/interface/domainprefs.pm 2017/08/25 00:33:14 1.313
+++ loncom/interface/domainprefs.pm 2017/10/07 00:50:47 1.314
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.313 2017/08/25 00:33:14 raeburn Exp $
+# $Id: domainprefs.pm,v 1.314 2017/10/07 00:50:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4073,11 +4073,13 @@ sub print_coursedefaults {
coursecredits => 'Credits can be specified for courses',
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)',
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)',
+ texengine => 'Default method to display mathematics',
postsubmit => 'Disable submit button/keypress following student submission',
canclone => "People who may clone a course (besides course's owner and coordinators)",
mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver',
);
my %staticdefaults = (
+ texengine => 'MathJax',
anonsurvey_threshold => 10,
uploadquota => 500,
postsubmit => 60,
@@ -4091,8 +4093,36 @@ sub print_coursedefaults {
'canclone' => 'none',
);
@toggles = ('canuse_pdfforms','uselcmath','usejsme');
+ my $deftex = $staticdefaults{'texengine'};
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'texengine'}) {
+ if ($settings->{'texengine'} =~ /^(MathJax|mimetex|tth)$/) {
+ $deftex = $settings->{'texengine'};
+ }
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $mathdisp = '
'.
+ ''.$choices{'texengine'}.
+ ' | '.
+ ' |
'."\n";
+ $itemcount ++;
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
\%choices,$itemcount);
+ $datatable = $mathdisp.$datatable;
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .=
''.
@@ -13663,7 +13693,11 @@ sub modify_coursedefaults {
postsubmit => 60,
mysqltables => 172800,
);
-
+ my %texoptions = (
+ MathJax => 'MathJax',
+ mimetex => &mt('Convert to Images'),
+ tth => &mt('TeX to HTML'),
+ );
$defaultshash{'coursedefaults'} = {};
if (ref($domconfig{'coursedefaults'}) ne 'HASH') {
@@ -13723,6 +13757,20 @@ sub modify_coursedefaults {
}
}
}
+ my $texengine;
+ if ($env{'form.texengine'} =~ /^(MathJax|mimetex|tth)$/) {
+ $texengine = $env{'form.texengine'};
+ if ($defaultshash{'coursedefaults'}{'texengine'} eq '') {
+ unless ($texengine eq 'MathJax') {
+ $changes{'texengine'} = 1;
+ }
+ } elsif ($defaultshash{'coursedefaults'}{'texengine'} ne $texengine) {
+ $changes{'texengine'} = 1;
+ }
+ }
+ if ($texengine ne '') {
+ $defaultshash{'coursedefaults'}{'texengine'} = $texengine;
+ }
my $currclone = $domconfig{'coursedefaults'}{'canclone'};
my @currclonecode;
if (ref($currclone) eq 'HASH') {
@@ -13843,8 +13891,8 @@ sub modify_coursedefaults {
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
if (($changes{'canuse_pdfforms'}) || ($changes{'uploadquota'}) || ($changes{'postsubmit'}) ||
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) ||
- ($changes{'canclone'}) || ($changes{'mysqltables'})) {
- foreach my $item ('canuse_pdfforms','uselcmath','usejsme') {
+ ($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'})) {
+ foreach my $item ('canuse_pdfforms','uselcmath','usejsme','texengine') {
if ($changes{$item}) {
$domdefaults{$item}=$defaultshash{'coursedefaults'}{$item};
}
@@ -13913,6 +13961,11 @@ sub modify_coursedefaults {
} else {
$resulttext .= ''.&mt('Molecule editor uses JME (Java), if supported by client OS.').'';
}
+ } elsif ($item eq 'texengine') {
+ if ($defaultshash{'coursedefaults'}{'texengine'} ne '') {
+ $resulttext .= ''.&mt('Default method to display mathematics set to: "[_1]"',
+ $texoptions{$defaultshash{'coursedefaults'}{'texengine'}}).'';
+ }
} elsif ($item eq 'anonsurvey_threshold') {
$resulttext .= ''.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'';
} elsif ($item eq 'uploadquota') {
|