--- loncom/interface/lonpreferences.pm 2009/04/25 16:53:13 1.152
+++ loncom/interface/lonpreferences.pm 2011/10/07 17:14:43 1.186.2.7
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.152 2009/04/25 16:53:13 www Exp $
+# $Id: lonpreferences.pm,v 1.186.2.7 2011/10/07 17:14:43 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(<
@@ -135,8 +136,9 @@ sub verify_and_change_wysiwyg {
my $newsetting=$env{'form.wysiwyg'};
&Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting});
&Apache::lonnet::appenv({'environment.wysiwygeditor' => $newsetting});
- &print_main_menu($r,'
');
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('WYSIWYG Editor').'',''.&mt($newsetting).''));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ &print_main_menu($r,$message);
}
################################################################
@@ -164,8 +166,12 @@ sub languagechanger {
= &Apache::loncommon::plainlanguagedescription($_);
}
}
- my $selectionbox=&Apache::loncommon::select_form($language,'language',
- %langchoices);
+ %langchoices = &Apache::lonlocal::texthash(%langchoices);
+ my $selectionbox=
+ &Apache::loncommon::select_form(
+ $language,
+ 'language',
+ \%langchoices);
$r->print(<
@@ -186,12 +192,18 @@ 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 new preferred languages to ').'"'.$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');
- $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset preferred language.'));
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Preferred language').''));
}
+ $message=&Apache::loncommon::confirmwrapper($message);
&Apache::loncommon::flush_langs_cache($user,$domain);
&print_main_menu($r, $message);
}
@@ -203,9 +215,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']);
@@ -215,14 +227,19 @@ 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);
+ %mathchoices = &Apache::lonlocal::texthash(%mathchoices);
+ my $selectionbox=
+ &Apache::loncommon::select_form(
+ $texengine,
+ 'texengine',
+ \%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:',
@@ -230,6 +247,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
@@ -608,11 +649,46 @@ sub verify_and_change_icons {
my $r = shift;
my $user = $env{'user.name'};
my $domain = $env{'user.domain'};
- my $newicons = $env{'form.menumode'};
-
+ my $newicons = $env{'form.menumode'};
+ my %lt = &icon_options();
+ my $newchoice = $newicons;
+ if ($lt{$newicons}) {
+ $newchoice = $lt{$newicons};
+ }
&Apache::lonnet::put('environment',{'icons' => $newicons});
&Apache::lonnet::appenv({'environment.icons' => $newicons});
- &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Set menu mode to [_1].',$newicons)));
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Menu Display').'',''.$newchoice.''));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ &print_main_menu($r, $message);
+}
+
+sub icon_options {
+ my %lt = &Apache::lonlocal::texthash(
+ iconic => 'Use icons and text',
+ iconsonly => 'Use icons only',
+ );
+ return %lt;
+}
+
+sub icon_previews {
+ my %icon_text = (
+ annotate => 'Notes',
+ bookmark => 'Bookmark',
+ catalog => 'Info',
+ evaluate => 'Evaluate',
+ feedback => 'Communicate',
+ printout => 'Print',
+ );
+ my %inlinetools = (
+ printout => "s&8&3&prt.png&$icon_text{'printout'}&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document",
+ bookmark => "s&9&1&sbkm.png&$icon_text{'bookmark'}&bookmark[_2]&set_bookmark()&Set a bookmark for this resource",
+ evaluate => "s&8&1&eval.png&$icon_text{'evaluate'}&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource",
+ feedback => "s&8&2&fdbk.png&$icon_text{'feedback'}&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource",
+ annotate => "s&9&3&anot.png&$icon_text{'annotate'}&tations[_1]&annotate()&Make notes and annotations about this resource",
+ catalog => "s&6&3&catalog.png&$icon_text{'catalog'}&info[_1]&catalog_info()&Show Metadata",
+ );
+ my @toolsorder = qw(annotate bookmark evaluate feedback printout catalog);
+ return (\%inlinetools,\@toolsorder);
}
################################################################
@@ -660,7 +736,9 @@ sub verify_and_change_clicker {
$newclickers=~s/\,$//;
&Apache::lonnet::put('environment',{'clickers' => $newclickers});
&Apache::lonnet::appenv({'environment.clickers' => $newclickers});
- &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers)));
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ &print_main_menu($r, $message);
}
################################################################
@@ -669,7 +747,7 @@ sub verify_and_change_clicker {
sub domcoordchanger {
my $r = shift;
- Apache::lonhtmlcommon::add_breadcrumb(
+ &Apache::lonhtmlcommon::add_breadcrumb(
{ href => '/adm/preferences?action=changedomcoord',
text => 'Restrict Domain Coordinator Access'});
$r->print(Apache::loncommon::start_page('Restrict Domain Coordinator Access'));
@@ -680,7 +758,7 @@ sub domcoordchanger {
('environment',['domcoord.author']);
my $constchecked='';
if ($userenv{'domcoord.author'} eq 'blocked') {
- $constchecked='checked="checked"';
+ $constchecked=' checked="checked"';
}
my $text=&mt('By default, the Domain Coordinator can enter your construction space.');
my $construction=&mt('Block access to construction space');
@@ -689,7 +767,7 @@ sub domcoordchanger {
ENDSCREEN
@@ -703,7 +781,15 @@ sub verify_and_change_domcoord {
if ($env{'form.construction'}) { $domcoord{'domcoord.author'}='blocked'; }
&Apache::lonnet::put('environment',\%domcoord);
&Apache::lonnet::appenv({'environment.domcoord.author' => $domcoord{'domcoord.author'}});
- &print_main_menu($r,&Apache::lonhtmlcommon::confirm_success(&mt('Registering Domain Coordinator access restrictions.')));
+ my $status='';
+ if ($domcoord{'domcoord.author'} eq 'blocked') {
+ $status=&mt('on');
+ } else {
+ $status=&mt('off');
+ }
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Block access to construction space').'',''.$status.''));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ &print_main_menu($r,$message);
}
#################################################################
@@ -756,11 +842,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 ',
@@ -770,9 +856,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");
@@ -838,11 +924,12 @@ $validatescript
$r->print(<$lt{'foad'} $forwardingHelp
+
$lt{'fwdm'} $forwardingHelp
ENDCOL
}
@@ -1150,13 +1244,16 @@ sub verify_and_change_colors {
# figure out colors
my $function=&Apache::loncommon::get_users_function();
my $domain=&Apache::loncommon::determinedomain();
- my %colortypes=('pgbg' => 'Page Background',
- 'tabbg' => 'Header Background',
- 'sidebg'=> 'Header Border',
- 'font' => 'Font',
- 'link' => 'Un-Visited Link',
- 'vlink' => 'Visited Link',
- 'alink' => 'Active Link');
+ my %colortypes=&Apache::lonlocal::texthash(
+ 'pgbg' => 'Page Background Color',
+ 'tabbg' => 'Header Background Color',
+ 'sidebg' => 'Header Border Color',
+ 'font' => 'Font Color',
+ 'fontmenu' => 'Font Menu Color',
+ 'link' => 'Un-Visited Link Color',
+ 'vlink' => 'Visited Link Color',
+ 'alink' => 'Active Link Color',
+ );
my $message='';
foreach my $item (keys %colortypes) {
@@ -1165,13 +1262,17 @@ sub verify_and_change_colors {
if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$env{'form.resetall'})) {
&Apache::lonnet::put('environment',{$entry => $color});
&Apache::lonnet::appenv({'environment.'.$entry => $color});
- $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set '.$colortypes{$item}.' to ').'"'.$color.'"').' ';
+ $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.$colortypes{$item}.'','"'.$color.'"'))
+ .' ';
} else {
&Apache::lonnet::del('environment',[$entry]);
&Apache::lonnet::delenv('environment.'.$entry);
- $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset '.$colortypes{$item}.'.')).' ';
+ $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.$colortypes{$item}.''))
+ .' ';
}
}
+ $message=&Apache::loncommon::confirmwrapper($message);
+
my $now = time;
&Apache::lonnet::put('environment',{'color.timestamp' => $now});
&Apache::lonnet::appenv({'environment.color.timestamp' => $now});
@@ -1187,7 +1288,7 @@ sub passwordchanger {
# This function is a bit of a mess....
# Passwords are encrypted using londes.js (DES encryption)
$errormessage = ($errormessage || '');
- my ($user,$domain,$currentpass,$defdom);
+ my ($user,$domain,$currentpass);
&Apache::lonhtmlcommon::add_breadcrumb(
{ href => '/adm/preferences?action=changepass',
text => 'Change Password'});
@@ -1202,10 +1303,11 @@ sub passwordchanger {
$caller = 'preferences';
}
} elsif ($caller eq 'reset_by_email') {
- $defdom = $r->dir_config('lonDefDomain');
my %data = &Apache::lonnet::tmpget($mailtoken);
if (keys(%data) == 0) {
- $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a new request for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'));
+ $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a [_1]new request[_2] for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'
+ ,'','')
+ );
return;
}
if (defined($data{time})) {
@@ -1221,6 +1323,9 @@ sub passwordchanger {
$r->print(&mt('Sorry, the URL generated when you requested reset of your password contained incomplete information.').' ');
return;
}
+ if (&Apache::lonnet::domain($domain) eq '') {
+ $domain = $r->dir_config('lonDefDomain');
+ }
} else {
$r->print(&mt('Page requested in unexpected context').' ');
return;
@@ -1265,7 +1370,7 @@ $errormessage
crappy browser -->
ENDFORM
$r->print(&server_form($logtoken,$caller,$mailtoken));
- $r->print(&client_form($caller,\%hexkey,$currentpass,$defdom));
+ $r->print(&client_form($caller,\%hexkey,$currentpass,$domain));
#
return;
@@ -1302,6 +1407,8 @@ sub jscript_send {
this.document.client.elements.uname.value;
this.document.pserver.elements.udom.value =
this.document.client.elements.udom.options[this.document.client.elements.udom.selectedIndex].value;
+ this.document.pserver.elements.email.value =
+ this.document.client.elements.email.value;
|;
}
$ output .= qq|
@@ -1320,42 +1427,42 @@ sub client_form {
'currentpass' => 'Current Password',
'newpass' => 'New Password',
'confirmpass' => 'Confirm Password',
- 'changepass' => 'Save');
+ 'changepass' => 'Save',
+ );
- my $output = qq|
-
-ENDFORM
+|;
return $output;
}
@@ -1386,6 +1493,7 @@ sub server_form {
+
|;
}
@@ -1530,7 +1638,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 [_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 {
@@ -1538,11 +1647,18 @@ ENDERROR
}
} else {
# error error: run in circles, scream and shout
- $message = &mt("The password for [_1] was not changed.",$user).' '.&mt('Please make sure your old password was entered correctly.');
- 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;
}
@@ -1555,7 +1671,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'};
@@ -1570,7 +1686,7 @@ sub discussionchanger {
}
}
if (defined($userenv{'discmarkread'})) {
- unless ($userenv{'discdisplay'} eq '') {
+ unless ($userenv{'discmarkread'} eq '') {
$discmark = $userenv{'discmarkread'};
}
}
@@ -1588,13 +1704,13 @@ sub discussionchanger {
'sdpf' => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.',
'prca' => 'Preferences can be set that determine',
'whpo' => 'Which posts are displayed when you display a discussion board or resource, and',
- 'unwh' => 'Under what circumstances posts are identfied as "New"',
+ 'unwh' => 'Under what circumstances posts are identfied as "NEW"',
'allposts' => 'All posts',
'unread' => 'New posts only',
'ondisp' => 'Once displayed',
- 'onmark' => 'Once marked as read',
+ 'onmark' => 'Once marked not NEW',
'disa' => 'Posts displayed?',
- 'npmr' => 'New posts cease to be identified as "New"?',
+ 'npmr' => 'New posts cease to be identified as "NEW"?',
'thde' => 'The preferences you set here can be overridden within each individual discussion.',
'chgt' => 'Change to '
);
@@ -1614,15 +1730,16 @@ sub discussionchanger {
$currmark = $lt{'ondisp'};
$newmark = 'onmark';
}
-
+
$r->print(<<"END");