--- loncom/interface/domainprefs.pm 2017/08/15 21:02:40 1.308
+++ 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.308 2017/08/15 21:02:40 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 = '
'.
''.$rolename.' | '.
'';
@@ -9270,17 +9299,21 @@ sub modify_quotas {
#FIXME need to obsolete item in RES space
} elsif ($env{'form.'.$type.'_image_'.$i.'.filename'}) {
my ($cdom,$cnum) = split(/_/,$key);
- my ($imgurl,$error) = &process_textbook_image($r,$dom,$confname,$type.'_image_'.$i,
- $cdom,$cnum,$type,$configuserok,
- $switchserver,$author_ok);
- if ($imgurl) {
- $confhash{$type}{$key}{'image'} = $imgurl;
- $changes{$type}{$key} = 1;
+ if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
+ $errors .= ''.&mt('Image not saved: could not find textbook course').'';
+ } else {
+ my ($imgurl,$error) = &process_textbook_image($r,$dom,$confname,$type.'_image_'.$i,
+ $cdom,$cnum,$type,$configuserok,
+ $switchserver,$author_ok);
+ if ($imgurl) {
+ $confhash{$type}{$key}{'image'} = $imgurl;
+ $changes{$type}{$key} = 1;
+ }
+ if ($error) {
+ &Apache::lonnet::logthis($error);
+ $errors .= ''.$error.'';
+ }
}
- if ($error) {
- &Apache::lonnet::logthis($error);
- $errors .= ''.$error.'';
- }
} elsif ($domconfig{$action}{$type}{$key}{'image'}) {
$confhash{$type}{$key}{'image'} =
$domconfig{$action}{$type}{$key}{'image'};
@@ -9313,15 +9346,19 @@ sub modify_quotas {
if ($type eq 'textbooks') {
if ($env{'form.'.$type.'_addbook_image.filename'} ne '') {
my ($cdom,$cnum) = split(/_/,$newbook{$type});
- my ($imageurl,$error) =
- &process_textbook_image($r,$dom,$confname,$type.'_addbook_image',$cdom,$cnum,$type,
- $configuserok,$switchserver,$author_ok);
- if ($imageurl) {
- $confhash{$type}{$newbook{$type}}{'image'} = $imageurl;
- }
- if ($error) {
- &Apache::lonnet::logthis($error);
- $errors .= ''.$error.'';
+ if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
+ $errors .= ''.&mt('Image not saved: could not find textbook course').'';
+ } else {
+ my ($imageurl,$error) =
+ &process_textbook_image($r,$dom,$confname,$type.'_addbook_image',$cdom,$cnum,$type,
+ $configuserok,$switchserver,$author_ok);
+ if ($imageurl) {
+ $confhash{$type}{$newbook{$type}}{'image'} = $imageurl;
+ }
+ if ($error) {
+ &Apache::lonnet::logthis($error);
+ $errors .= ''.$error.'';
+ }
}
}
}
@@ -9813,7 +9850,7 @@ sub process_textbook_image {
} elsif ($author_ok eq 'ok') {
my ($result,$imageurl) =
&publishlogo($r,'upload',$caller,$dom,$confname,
- "$type/$dom/$cnum/cover",$width,$height);
+ "$type/$cdom/$cnum/cover",$width,$height);
if ($result eq 'ok') {
$url = $imageurl;
} else {
@@ -12073,7 +12110,7 @@ sub modify_selfcreation {
if (@types) {
if (@statuses) {
$chgtext .= &mt('Processing of requests to create account with e-mail verification set as follows:').
- '';
+ '';
foreach my $status (@statuses) {
if ($status eq 'default') {
$chgtext .= '- '.$othertitle.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$status}}.'
';
@@ -12274,8 +12311,8 @@ sub modify_selfcreation {
}
}
$chgtext .= ' ';
+ my $typename;
if (@types) {
- my $typename;
if ($type eq 'default') {
$typename = $othertitle;
} else {
@@ -12291,10 +12328,9 @@ sub modify_selfcreation {
'';
} else {
$resulttext .= '- '.
- &mt('There are now no restrictions on e-mail addresses which may be used for verification when a user requests an account.',
- $usertypes{$type}).
+ &mt('There are now no restrictions on e-mail addresses which may be used for verification when a user requests an account.').
'
'.
- &mt('(Affiliation: [_1])',$type);
+ &mt('(Affiliation: [_1])',$typename);
}
}
}
@@ -13657,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') {
@@ -13717,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') {
@@ -13837,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};
}
@@ -13907,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') {
|