--- loncom/interface/lonpreferences.pm 2009/05/05 16:01:50 1.158
+++ loncom/interface/lonpreferences.pm 2010/03/12 15:09:23 1.186
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.158 2009/05/05 16:01:50 bisitz Exp $
+# $Id: lonpreferences.pm,v 1.186 2010/03/12 15:09:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,6 +42,7 @@ use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
use Apache::lonnet;
+use LONCAPA::lonauthcgi();
use LONCAPA();
#
@@ -116,7 +117,7 @@ sub wysiwygchanger {
my $switchon=&mt('Enable WYSIWYG editor');
my $warning='';
if ($env{'user.adv'}) {
- $warning.="
".&mt("The WYSIWYG editor only supports simple HTML and is in many cases unsuited for advanced authoring. In a number of cases, it may destroy advanced authoring involving LaTeX and script function calls.")."
";
+ $warning.='
'.&mt("The WYSIWYG editor only supports simple HTML and is in many cases unsuited for advanced authoring. In a number of cases, it may destroy advanced authoring involving LaTeX and script function calls.")."
";
}
$r->print(<
@@ -165,8 +166,11 @@ sub languagechanger {
= &Apache::loncommon::plainlanguagedescription($_);
}
}
- my $selectionbox=&Apache::loncommon::select_form($language,'language',
- %langchoices);
+ my $selectionbox=
+ &Apache::loncommon::select_form(
+ $language,
+ 'language',
+ &Apache::lonlocal::texthash(%langchoices));
$r->print(<
@@ -187,7 +191,12 @@ sub verify_and_change_languages {
if ($newlanguage) {
&Apache::lonnet::put('environment',{'languages' => $newlanguage});
&Apache::lonnet::appenv({'environment.languages' => $newlanguage});
- $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Preferred language').'','"'.$newlanguage.'".'));
+ $message=&Apache::lonhtmlcommon::confirm_success(
+ &mt('Set [_1] to [_2]',
+ ''.&mt('Preferred language').'',
+ '"'.$newlanguage.'".'))
+ .' '
+ .&mt('The change will become active on the next page.');
} else {
&Apache::lonnet::del('environment',['languages']);
&Apache::lonnet::delenv('environment.languages');
@@ -205,9 +214,9 @@ sub texenginechanger {
my $r = shift;
Apache::lonhtmlcommon::add_breadcrumb(
{ href => '/adm/preferences?action=changetexenginepref',
- text => 'Change How Math Equations Are Displayed'});
+ text => 'Math display settings'});
$r->print(Apache::loncommon::start_page('Content Display Settings'));
- $r->print(Apache::lonhtmlcommon::breadcrumbs('Change How Math Equations Are Displayed'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Math display settings'));
my $user = $env{'user.name'};
my $domain = $env{'user.domain'};
my %userenv = &Apache::lonnet::get('environment',['texengine']);
@@ -217,14 +226,18 @@ sub texenginechanger {
'tth' => 'tth (TeX to HTML)',
#'ttm' => 'TeX to MathML',
'jsMath' => 'jsMath',
- 'mimetex' => 'mimetex (Convert to Images)'
+ 'mimetex' => 'mimetex (Convert to Images)',
+ 'raw' => 'Raw (Screen Reader)'
);
- my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',
- %mathchoices);
+ my $selectionbox=
+ &Apache::loncommon::select_form(
+ $texengine,
+ 'texengine',
+ &Apache::lonlocal::texthash(%mathchoices));
my $jsMath_start=&Apache::lontexconvert::jsMath_header();
my %lt=&Apache::lonlocal::texthash(
- 'headline' => 'Change Math Preferences',
- 'preftxt' => 'Preferred method to display Math',
+ 'headline' => 'Change how math is displayed',
+ 'preftxt' => 'Preferred method to display math',
'change' => 'Save',
'exmpl' => 'Examples',
'jsmath' => 'jsMath:',
@@ -232,6 +245,21 @@ sub texenginechanger {
'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
@@ -773,11 +793,11 @@ sub msgforwardchanger {
all => 'All',
crit => 'Critical only',
reg => 'Non-critical only',
- foad => 'Forwarding Address(es)',
- noti => 'Notification E-mail Address(es)',
+ foad => 'Forward to account(s)',
+ fwdm => 'Forward messages to other account(s) in LON-CAPA',
+ noti => 'E-mail notification of LON-CAPA messages',
foad_exmpl => 'e.g. userA:domain1,userB:domain2,...',
- mnot => 'E-mail Address(es) which should be notified about new LON-CAPA messages',
- # old: 'Message Notification Email Address(es)',
+ mnot => 'E-mail address(es) which should be notified about new LON-CAPA messages',
mnot_exmpl => 'e.g. joe@doe.com',
chg => 'Save',
email => 'The e-mail address entered in row ',
@@ -787,9 +807,9 @@ sub msgforwardchanger {
);
Apache::lonhtmlcommon::add_breadcrumb(
{ href => '/adm/preferences?action=changemsgforward',
- text => 'Change Message Forwarding/Notification'});
- $r->print(Apache::loncommon::start_page('Message Management'));
- $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Message Forwarding/Notification'));
+ text => 'Messages & Notifications'});
+ $r->print(Apache::loncommon::start_page('Messages & Notifications'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Messages & Notifications'));
my $forwardingHelp = &Apache::loncommon::help_open_topic("Prefs_Forwarding");
my $notificationHelp = &Apache::loncommon::help_open_topic("Prefs_Notification");
my $criticalMessageHelp = &Apache::loncommon::help_open_topic("Course_Critical_Message");
@@ -855,11 +875,12 @@ $validatescript
$r->print(<$lt{'foad'} $forwardingHelp
+
$lt{'fwdm'} $forwardingHelp
-ENDFORM
+|;
return $output;
}
@@ -1417,6 +1442,7 @@ sub server_form {
+
|;
}
@@ -1561,7 +1587,8 @@ ENDERROR
# Inform the user the password has (not?) been changed
my $message;
if ($result =~ /^ok$/) {
- $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for user [_1] was successfully changed.',''.$user.''));
+ $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for user [_1] was successfully changed.',''.$user.''));
+ $message = &Apache::loncommon::confirmwrapper($message);
if ($caller eq 'reset_by_email') {
$r->print($message.' ');
} else {
@@ -1569,13 +1596,18 @@ ENDERROR
}
} else {
# error error: run in circles, scream and shout
- $message = &Apache::lonhtmlcommon::confirm_success(
- &mt("The password for user [_1] was not changed.",''.$user.'').' '.&mt('Please make sure your old password was entered correctly.'),1);
- unless ($caller eq 'reset_by_email') {
+ if ($caller eq 'reset_by_email') {
+ if (!$result) {
+ return 1;
+ } else {
+ return $result;
+ }
+ } else {
+ $message = &Apache::lonhtmlcommon::confirm_success(
+ &mt("The password for user [_1] was not changed.",''.$user.'').' '.&mt('Please make sure your old password was entered correctly.'),1);
$message=&Apache::loncommon::confirmwrapper($message);
&print_main_menu($r, $message);
}
- return 1;
}
return;
}
@@ -1588,7 +1620,7 @@ sub discussionchanger {
Apache::lonhtmlcommon::add_breadcrumb(
{ href => '/adm/preferences?action=changediscussions',
text => 'Change Discussion Preferences'});
- $r->print(Apache::loncommon::start_page('Message Management'));
+ $r->print(Apache::loncommon::start_page('Change Discussion Preferences'));
$r->print(Apache::lonhtmlcommon::breadcrumbs('Change Discussion Preferences'));
my $user = $env{'user.name'};
my $domain = $env{'user.domain'};
@@ -1603,7 +1635,7 @@ sub discussionchanger {
}
}
if (defined($userenv{'discmarkread'})) {
- unless ($userenv{'discdisplay'} eq '') {
+ unless ($userenv{'discmarkread'} eq '') {
$discmark = $userenv{'discmarkread'};
}
}
@@ -1647,7 +1679,7 @@ sub discussionchanger {
$currmark = $lt{'ondisp'};
$newmark = 'onmark';
}
-
+
$r->print(<<"END");
@@ -1696,11 +1728,11 @@ sub verify_and_change_discussion {
if (defined($env{'form.discdisp'}) ) {
my $newdisp = $env{'form.newdisp'};
if ($newdisp eq 'unread') {
- $message .=&mt('In discussions: only new posts will be displayed.').' ';
+ $message .=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: only new posts will be displayed.')).' ';
&Apache::lonnet::put('environment',{'discdisplay' => $newdisp});
&Apache::lonnet::appenv({'environment.discdisplay' => $newdisp});
} else {
- $message .= &mt('In discussions: all posts will be displayed.').' ';
+ $message .= &Apache::lonhtmlcommon::confirm_success(&mt('In discussions: all posts will be displayed.')).' ';
&Apache::lonnet::del('environment',['discdisplay']);
&Apache::lonnet::delenv('environment.discdisplay');
}
@@ -1799,13 +1831,102 @@ sub verify_and_change_coursepage {
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my ($furl,$ferr)=
&Apache::lonuserstate::readmap($cdom.'/'.$cnum);
- $message .= ' '.$lt{'gtts'}.' '.&mt('now').'';
+ $message .= ' '.$lt{'gtts'}.' '.&mt('now').'';
+ } else {
+ $message .= ' '.$lt{'dasp'}.'';
+ }
+ }
+ $message = &Apache::lonhtmlcommon::confirm_success($message);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ &print_main_menu($r,$message);
+}
+
+sub lockednameschanger {
+ my $r = shift;
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/preferences?action=changelockednames',
+ text => 'Automatic name changes'});
+ $r->print(Apache::loncommon::start_page('Automatic name changes'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Allow/disallow name updates'));
+ my %userenv = &Apache::lonnet::get('environment',['lockedname']);
+ my $lockedname='';
+ if (&can_toggle_namelocking()) {
+ if ($userenv{'lockedname'}) {
+ $lockedname = ' checked="checked"';
+ }
+ my %updateable;
+ my %domconfig =
+ &Apache::lonnet::get_dom('configuration',['autoupdate'],$env{'user.domain'});
+ if (ref($domconfig{'autoupdate'}) eq 'HASH') {
+ if ($domconfig{'autoupdate'}{'run'}) {
+ my @inststatuses = split(':',$env{'environment.inststatus'});
+ unless (@inststatuses) {
+ @inststatuses = ('default');
+ }
+ %updateable = &updateable_userinfo($domconfig{'autoupdate'},\@inststatuses);
+ }
+ }
+ if (keys(%updateable)) {
+ my %longnames = &Apache::lonlocal::texthash (
+ firstname => 'First Name',
+ middlename => 'Middle Name',
+ lastname => 'Last Name',
+ );
+ my $text=&mt('By default, based on your institutional affiliation, your LON-CAPA account can be automatically updated nightly based on directory information from your institution.').' '.&mt('The following may be updated, unless you disallow updates:').
+ '
';
+ foreach my $item ('firstname','middlename','lastname') {
+ if ($updateable{$item}) {
+ $text .= '
'.$longnames{$item}.'
';
+ }
+ }
+ $text .= '
';
+ my $locking=&mt('Disallow automatic updates to name information for your LON-CAPA account');
+ my $change=&mt('Save');
+ $r->print(<
+
+$text
+
+
+