--- loncom/interface/lonpreferences.pm 2014/05/26 15:21:27 1.213
+++ loncom/interface/lonpreferences.pm 2016/09/19 03:19:12 1.224
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.213 2014/05/26 15:21:27 bisitz Exp $
+# $Id: lonpreferences.pm,v 1.224 2016/09/19 03:19:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -160,11 +160,13 @@ sub texenginechanger {
my $domain = $env{'user.domain'};
my %userenv = &Apache::lonnet::get('environment',['texengine']);
my $texengine=$userenv{'texengine'};
+ if (lc($texengine) eq 'jsmath') {
+ $texengine = 'MathJax';
+ }
my %mathchoices=('' => 'Default',
'tth' => 'tth (TeX to HTML)',
#'ttm' => 'TeX to MathML',
- 'jsMath' => 'jsMath',
'MathJax' => 'MathJax',
'mimetex' => 'mimetex (Convert to Images)',
'raw' => 'Raw (Screen Reader)'
@@ -176,7 +178,6 @@ sub texenginechanger {
'texengine',
\%mathchoices);
my $MathJax_start=&Apache::lontexconvert::MathJax_header();
- my $jsMath_start=&Apache::lontexconvert::jsMath_header();
my %lt=&Apache::lonlocal::texthash(
'headline' => 'Change how math is displayed',
'preftxt' => 'Preferred method to display math',
@@ -184,26 +185,10 @@ sub texenginechanger {
'exmpl' => 'Examples',
'mathjax' => 'MathJax:',
'mathjaxinfo' => 'MathJax provides rendered equations whose source code can be extracted in TeX and MathML formats by right clicking the equation.',
- 'jsmath' => 'jsMath:',
'tth' => 'tth (TeX to HTML):',
'mimetex' => 'mimetex (Convert to Images):',
);
- my $jsMathWarning='
'
- .'
'
- .&mt("It looks like you don't have the TeX math fonts installed.")
- .'
'
- .''
- .&mt('The jsMath example on this page may not look right without them. '
- .'The [_1]jsMath Home Page[_2] has information on how to download the '
- .'needed fonts. In the meantime, jsMath will do the best it can '
- .'with the fonts you have, but it may not be pretty and some equations '
- .'may not be rendered correctly.'
- ,'
'
- ,'')
- .'
'
- .'';
-
$r->print(<$lt{'headline'}
+ENDSCREEN
+ }
+}
+
+sub change_authoring_settings {
+ my $r = shift;
+ my $user = $env{'user.name'};
+ my $domain = $env{'user.domain'};
+ my %author_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au','ca','aa']);
+ if (keys(%author_roles) > 0) {
+ my %ausettings=('environment.nocodemirror' => '');
+ if ($env{'form.cmoff'}) { $ausettings{'environment.nocodemirror'}='yes'; }
+ &Apache::lonnet::put('environment',\%ausettings);
+ &Apache::lonnet::appenv({'environment.nocodemirror' => $ausettings{'environment.nocodemirror'}});
+ my $status='';
+ if ($ausettings{'environment.nocodemirror'} eq 'yes') {
+ $status=&mt('on');
+ } else {
+ $status=&mt('off');
+ }
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Deactivate CodeMirror in Authoring Space').'',''.$status.''));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ &print_main_menu($r,$message);
+ }
+}
+
sub lockednameschanger {
my $r = shift;
&Apache::lonhtmlcommon::add_breadcrumb(
@@ -2117,6 +2193,18 @@ push(@{ $menu[4]->{items} }, {
});
}
+
+ my %author_coauthor_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au','ca','aa']);
+ if (keys(%author_coauthor_roles) > 0) {
+ push(@{ $menu[4]->{items} }, {
+ linktext => 'Authoring Space Configuration',
+ url => '/adm/preferences?action=authorsettings',
+ permission => 'F',
+ icon => 'codemirror.png',
+ linktitle => 'Settings for your authoring space.',
+ });
+ }
+
if (&can_toggle_debug()) {
push(@{ $menu[4]->{items} }, {
linktext => 'Toggle Debug Messages (Currently '.($env{'user.debug'} ? 'on)' : 'off)'),
@@ -2172,7 +2260,7 @@ sub handler {
}elsif($env{'form.action'} eq 'changepass'){
&passwordchanger($r);
}elsif($env{'form.action'} eq 'verify_and_change_pass'){
- &verify_and_change_password($r);
+ &verify_and_change_password($r,'preferences');
}elsif($env{'form.action'} eq 'changescreenname'){
&screennamechanger($r);
}elsif($env{'form.action'} eq 'verify_and_change_screenname'){
@@ -2225,6 +2313,10 @@ sub handler {
&coursedisplaychanger($r);
}elsif($env{'form.action'} eq 'verify_and_change_coursepage'){
&verify_and_change_coursepage($r);
+ }elsif($env{'form.action'} eq 'authorsettings'){
+ &author_space_settings($r);
+ }elsif($env{'form.action'} eq 'change_authoring_settings'){
+ &change_authoring_settings($r);
}elsif($env{'form.action'} eq 'debugtoggle'){
if (&can_toggle_debug()) {
&toggle_debug();