--- loncom/interface/lonpreferences.pm 2009/03/21 04:41:50 1.125.2.3
+++ loncom/interface/lonpreferences.pm 2014/05/26 15:21:27 1.213
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.125.2.3 2009/03/21 04:41:50 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.213 2014/05/26 15:21:27 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,58 +36,13 @@ use strict;
use LONCAPA;
use Apache::Constants qw(:common);
use Apache::File;
-use Crypt::DES;
-use DynaLoader; # for Crypt::DES version
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
use Apache::lonnet;
+use LONCAPA::lonauthcgi();
use LONCAPA();
-#
-# Write lonnet::passwd to do the call below.
-# Use:
-# my $answer=reply("encrypt:passwd:$udom:$uname:$upass",$tryserver);
-#
-##################################################
-# password associated functions #
-##################################################
-sub des_keys {
- # Make a new key for DES encryption.
- # Each key has two parts which are returned separately.
- # Please note: Each key must be passed through the &hex function
- # before it is output to the web browser. The hex versions cannot
- # be used to decrypt.
- my @hexstr=('0','1','2','3','4','5','6','7',
- '8','9','a','b','c','d','e','f');
- my $lkey='';
- for (0..7) {
- $lkey.=$hexstr[rand(15)];
- }
- my $ukey='';
- for (0..7) {
- $ukey.=$hexstr[rand(15)];
- }
- return ($lkey,$ukey);
-}
-
-sub des_decrypt {
- my ($key,$cyphertext) = @_;
- my $keybin=pack("H16",$key);
- my $cypher;
- if ($Crypt::DES::VERSION>=2.03) {
- $cypher=new Crypt::DES $keybin;
- } else {
- $cypher=new DES $keybin;
- }
- my $plaintext=
- $cypher->decrypt(unpack("a8",pack("H16",substr($cyphertext,0,16))));
- $plaintext.=
- $cypher->decrypt(unpack("a8",pack("H16",substr($cyphertext,16,16))));
- $plaintext=substr($plaintext,1,ord(substr($plaintext,0,1)) );
- return $plaintext;
-}
-
################################################################
# Handler subroutines #
################################################################
@@ -98,6 +53,12 @@ sub des_decrypt {
sub wysiwygchanger {
my $r = shift;
+ Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/preferences?action=changewysiwyg',
+ text => 'Change WYSIWYG Preferences'});
+ $r->print(Apache::loncommon::start_page('Content Display Settings'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Change WYSIWYG Preferences'));
+
my %userenv = &Apache::lonnet::get
('environment',['wysiwygeditor']);
my $onselect='checked="checked"';
@@ -110,7 +71,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.")."
');
+ 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);
}
################################################################
@@ -137,28 +100,22 @@ sub verify_and_change_wysiwyg {
################################################################
sub languagechanger {
my $r = shift;
- my $user = $env{'user.name'};
- my $domain = $env{'user.domain'};
- my %userenv = &Apache::lonnet::get
- ('environment',['languages']);
+
+ Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/preferences?action=changelanguages',
+ text => 'Change Language'});
+ $r->print(Apache::loncommon::start_page('Content Display Settings'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Language'));
+ my %userenv = &Apache::lonnet::get('environment',['languages']);
my $language=$userenv{'languages'};
- my $pref=&mt('Preferred language');
- my %langchoices=('' => 'No language preference');
- foreach (&Apache::loncommon::languageids()) {
- if (&Apache::loncommon::supportedlanguagecode($_)) {
- $langchoices{&Apache::loncommon::supportedlanguagecode($_)}
- = &Apache::loncommon::plainlanguagedescription($_);
- }
- }
- my $selectionbox=&Apache::loncommon::select_form($language,'language',
- %langchoices);
- $r->print(<
-
- $pref: $selectionbox
-ENDLSCREEN
- $r->print(' ');
+ $r->print(
+ ''
+ );
}
@@ -173,16 +130,20 @@ sub verify_and_change_languages {
if ($newlanguage) {
&Apache::lonnet::put('environment',{'languages' => $newlanguage});
&Apache::lonnet::appenv({'environment.languages' => $newlanguage});
- $message=&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=&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);
- $r->print(< '/adm/preferences?action=changetexenginepref',
+ text => 'Math display settings'});
+ $r->print(Apache::loncommon::start_page('Content Display Settings'));
+ $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']);
@@ -199,64 +165,87 @@ sub texenginechanger {
'tth' => 'tth (TeX to HTML)',
#'ttm' => 'TeX to MathML',
'jsMath' => 'jsMath',
- 'mimetex' => 'mimetex (Convert to Images)'
+ 'MathJax' => 'MathJax',
+ '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 $MathJax_start=&Apache::lontexconvert::MathJax_header();
my $jsMath_start=&Apache::lontexconvert::jsMath_header();
my %lt=&Apache::lonlocal::texthash(
- 'headline' => 'Change Math Preferences',
- 'preftxt' => 'Preferred method to display Math',
- 'change' => 'Change',
+ 'headline' => 'Change how math is displayed',
+ 'preftxt' => 'Preferred method to display math',
+ 'change' => 'Save',
'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.'
+ ,''
+ ,'')
+ .'
');
+ unless ($checkedon) {
+ $r->print(&mt('LON-CAPA users with several '.$lc_role.'s may wish to enable the Hotlist.').' ');
+ }
$r->print('
-
'.&mt('Some LON-CAPA users have a long list of '.$lc_role.'s. The Recent '.$role.'s Hotlist feature keeps track of the last N '.$lc_role.'s which have been visited and places a table of these at the top of the '.$lc_role.'s page. People with very few '.$lc_role.'s should leave this feature disabled.').'
-
-');
}
@@ -422,19 +452,15 @@ sub verify_and_change_rolespref {
if ($hotlist_flag) {
&Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag});
&Apache::lonnet::appenv({'environment.recentroles' => $hotlist_flag});
- $message=&mt('Recent '.$role.'s Hotlist is Enabled');
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Recent '.$role.'s Hotlist is Enabled.')." ".&mt('Display [_1] Most Recent '.$role.'s.',$hotlist_n));
} else {
&Apache::lonnet::del('environment',['recentroles']);
&Apache::lonnet::delenv('environment.recentroles');
- $message=&mt('Recent '.$role.'s Hotlist is Disabled');
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Recent '.$role.'s Hotlist is Disabled'));
}
if ($hotlist_n) {
&Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n});
&Apache::lonnet::appenv({'environment.recentrolesn' => $hotlist_n});
- if ($hotlist_flag) {
- $message.=" ".
- &mt('Display [_1] Most Recent '.$role.'s',$hotlist_n)."\n";
- }
}
# Get list of froze roles and list of recent roles
@@ -455,7 +481,7 @@ sub verify_and_change_rolespref {
# Unset any roles that were previously frozen but aren't in list
foreach my $role_key (sort(keys(%recent_roles))) {
if (($frozen_roles{$role_key}) && (!exists($freeze{$role_key}))) {
- $message .= " ".&mt('Unfreezing '.$role.': [_1]',$role_text{$role_key})."\n";
+ $message .= " ".&Apache::lonhtmlcommon::confirm_success(&mt('Unfreezing '.$role.': [_1]',''.$role_text{$role_key}.''));
&Apache::lonhtmlcommon::store_recent('roles',$role_key,' ',0);
}
}
@@ -463,16 +489,18 @@ sub verify_and_change_rolespref {
# Freeze selected roles
foreach my $role_key (@freeze_list) {
if (!$frozen_roles{$role_key}) {
- $message .= " ".&mt('Freezing '.$role.': [_1]',$role_text{$role_key})."\n";
+ $message .= " ".
+ &Apache::lonhtmlcommon::confirm_success(&mt('Freezing '.$role.': [_1]',''.$role_text{$role_key}.''));
&Apache::lonhtmlcommon::store_recent('roles',
$role_key,' ',1);
}
}
- $message .= " \n";
-
- $r->print(< 'New screenname (shown if you post anonymously):',
- text_nickname => 'New nickname (shown if you post non-anonymously):',
- text_submit => 'Change',
- );
- $r->print(<
-
- $lt{'text_screenname'}
-
- $lt{'text_nickname'}
-
-
-
-
-ENDSCREEN
+ Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/preferences?action=changescreenname',
+ text => 'Change Screen Name'});
+ $r->print(Apache::loncommon::start_page('Personal Data'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Screen Name'));
+ $r->print('
'
+ .&mt('Change the name that is displayed in your posts.')
+ .'
'
+ );
+ $r->print(''
+ );
}
sub verify_and_change_screenname {
@@ -517,11 +553,11 @@ sub verify_and_change_screenname {
if ($newscreen) {
&Apache::lonnet::put('environment',{'screenname' => $newscreen});
&Apache::lonnet::appenv({'environment.screenname' => $newscreen});
- $message=&mt('Set new screenname to ').'"'.$newscreen.'.".';
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Screenname').'','"'.$newscreen.'"'));
} else {
&Apache::lonnet::del('environment',['screenname']);
&Apache::lonnet::delenv('environment.screenname');
- $message=&mt('Reset screenname.');
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Screenname').''));
}
# Nickname
$message.=' ';
@@ -530,16 +566,15 @@ sub verify_and_change_screenname {
if ($newscreen) {
&Apache::lonnet::put('environment',{'nickname' => $newscreen});
&Apache::lonnet::appenv({'environment.nickname' => $newscreen});
- $message.=&mt('Set new nickname to ').'"'.$newscreen.'".';
+ $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Nickname').'','"'.$newscreen.'"'));
} else {
&Apache::lonnet::del('environment',['nickname']);
&Apache::lonnet::delenv('environment.nickname');
- $message.=&mt('Reset nickname.');
+ $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Nickname').''));
}
&Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain);
- $r->print(< '/adm/preferences?action=changeicons',
+ text => 'Change Menu Display'});
+ $r->print(Apache::loncommon::start_page('Page Display Settings'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Menu Display'));
+
my $user = $env{'user.name'};
my $domain = $env{'user.domain'};
- my %userenv = &Apache::lonnet::get
- ('environment',['icons']);
+ my %userenv = &Apache::lonnet::get('environment',['icons']);
my $iconic='checked="checked"';
- my $classic='';
- my $onlyicon='';
+ my ($classic,$onlyicon,$iconic_preview,$iconsonly_preview);
if ($userenv{'icons'} eq 'classic') {
- $classic='checked="checked"';
- $iconic='';
+ $iconic='';
+ $classic='
'.
+ &mt('Your current selection: "Use buttons and text" is deprecated - it is recommended that you change this to "Use icons and text".').'
';
}
if ($userenv{'icons'} eq 'iconsonly') {
$onlyicon='checked="checked"';
$iconic='';
}
- my $useicons=&mt('Use icons and text');
- my $usebuttons=&mt('Use buttons and text');
- my $useicononly=&mt('Use icons only');
- my $change=&mt('Change');
+ my $change=&mt('Save');
+ my %lt = &icon_options();
+ my ($inlinetools,$toolsorder) = &icon_previews();
+ if ((ref($inlinetools) eq 'HASH') && (ref($toolsorder) eq 'ARRAY')) {
+ foreach my $tool (@{$toolsorder}) {
+ my ($command,$row,$col,$img,$top,$bot,$act,$desc) =
+ split(/\&/,$inlinetools->{$tool});
+ $iconic_preview .= '
'.
&Apache::loncommon::end_data_table_row()."\n";
}
my $end_data_table = &Apache::loncommon::end_data_table();
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
+ my $savebutton = &mt('Save');
+ my $resetbutton = &mt('Reset All');
+ my $resetbuttondesc = &mt('Reset All Colors to Default');
+ my $colorchooser=&Apache::lonhtmlcommon::color_picker();
+ $r->print('
+');
$r->print(<
-
- function pclose() {
- parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
- "height=350,width=350,scrollbars=no,menubar=no");
- parmwin.close();
- }
-
- $pjump_def
-
- function psub() {
- pclose();
- if (document.parmform.pres_marker.value!='') {
- if (document.parmform.pres_type.value!='') {
- eval('document.prefs.'+
- document.parmform.pres_marker.value+
- '.value=document.parmform.pres_value.value;');
- }
- } else {
- document.parmform.pres_value.value='';
- document.parmform.pres_marker.value='';
- }
- }
-
-
-
ENDCOL
}
@@ -1098,38 +1207,43 @@ 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) {
my $color=$env{'form.'.$item};
+ if (!($color =~ /^#/)) {
+ $color = '#' . $color;
+ }
my $entry='color.'.$function.'.'.$item;
if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$env{'form.resetall'})) {
&Apache::lonnet::put('environment',{$entry => $color});
&Apache::lonnet::appenv({'environment.'.$entry => $color});
- $message.=&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.=&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});
- $r->print(<
-
-
-ENDVCCOL
+ &print_main_menu($r, $message);
}
######################################################
@@ -1140,7 +1254,14 @@ 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'});
+ unless ($caller eq 'reset_by_email') {
+ $r->print(Apache::loncommon::start_page('Personal Data'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Password'));
+ }
if ((!defined($caller)) || ($caller eq 'preferences')) {
$user = $env{'user.name'};
$domain = $env{'user.domain'};
@@ -1148,10 +1269,14 @@ 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})) {
@@ -1160,15 +1285,32 @@ sub passwordchanger {
$domain = $data{'domain'};
$currentpass = $data{'temppasswd'};
} else {
- $r->print(&mt('Sorry, the token generated when you requested a password reset has expired.').' ');
+ $r->print(
+ '
'
+ .&mt('Sorry, the token generated when you requested'
+ .' a password reset has expired.')
+ .'
'
+ );
return;
}
} else {
- $r->print(&mt('Sorry, the URL generated when you requested reset of your password contained incomplete information.').' ');
+ $r->print(
+ '
'
+ .&mt('Sorry, the URL generated when you requested reset of'
+ .' your password contained incomplete information.')
+ .'
'
+ .&mt('Page requested in unexpected context')
+ .'
'
+ );
return;
}
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);
@@ -1176,9 +1318,9 @@ sub passwordchanger {
return if ($currentauth !~ /^(unix|internal):/);
#
# Generate keys
- my ($lkey_cpass ,$ukey_cpass ) = &des_keys();
- my ($lkey_npass1,$ukey_npass1) = &des_keys();
- my ($lkey_npass2,$ukey_npass2) = &des_keys();
+ my ($lkey_cpass ,$ukey_cpass ) = &Apache::loncommon::des_keys();
+ my ($lkey_npass1,$ukey_npass1) = &Apache::loncommon::des_keys();
+ my ($lkey_npass2,$ukey_npass2) = &Apache::loncommon::des_keys();
# Store the keys in the log files
my $lonhost = $r->dir_config('lonHostID');
my $logtoken=Apache::lonnet::reply('tmpput:'
@@ -1211,7 +1353,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;
@@ -1248,6 +1390,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|
@@ -1266,42 +1410,42 @@ sub client_form {
'currentpass' => 'Current Password',
'newpass' => 'New Password',
'confirmpass' => 'Confirm Password',
- 'changepass' => 'Change Password');
+ 'changepass' => 'Save',
+ );
- my $output = qq|
-
-ENDFORM
+|;
return $output;
}
@@ -1332,6 +1476,7 @@ sub server_form {
+
|;
}
@@ -1414,9 +1559,9 @@ ENDERROR
}
my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);
#
- $currentpass = &des_decrypt($ckey ,$currentpass);
- $newpass1 = &des_decrypt($n1key,$newpass1);
- $newpass2 = &des_decrypt($n2key,$newpass2);
+ $currentpass = &Apache::loncommon::des_decrypt($ckey ,$currentpass);
+ $newpass1 = &Apache::loncommon::des_decrypt($n1key,$newpass1);
+ $newpass2 = &Apache::loncommon::des_decrypt($n2key,$newpass2);
#
if ($caller eq 'reset_by_email') {
my %data = &Apache::lonnet::tmpget($mailtoken);
@@ -1437,14 +1582,14 @@ ENDERROR
}
if ($newpass1 ne $newpass2) {
&passwordchanger($r,
- ''.
+ ''.
&mt('The new passwords you entered do not match.').' '.
&mt('Please try again.').'',$caller,$mailtoken);
return 1;
}
if (length($newpass1) < 7) {
&passwordchanger($r,
- ''.
+ ''.
&mt('Passwords must be a minimum of 7 characters long.').' '.
&mt('Please try again.').'',$caller,$mailtoken);
return 1;
@@ -1457,7 +1602,7 @@ ENDERROR
}
if ($badpassword) {
# I can't figure out how to enter bad characters on my browser.
- my $errormessage =''.
+ my $errormessage =''.
&mt('The password you entered contained illegal characters.').' '.
&mt('Valid characters are').(<<"ENDERROR");
: space and
@@ -1474,13 +1619,29 @@ ENDERROR
my $result = &Apache::lonnet::changepass
($user,$domain,$currentpass,$newpass1,$homeserver,$caller);
# Inform the user the password has (not?) been changed
+ my $message;
if ($result =~ /^ok$/) {
- $r->print("
".&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 {
+ &print_main_menu($r, $message);
+ }
} else {
# error error: run in circles, scream and shout
- $r->print("
".&mt("The password for [_1] was not changed",$user)."
".
- &mt('Please make sure your old password was entered correctly.'));
- return 1;
+ 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;
}
@@ -1490,6 +1651,11 @@ ENDERROR
################################################################
sub discussionchanger {
my $r = shift;
+ Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/preferences?action=changediscussions',
+ text => 'Change Discussion Preferences'});
+ $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'};
my %userenv = &Apache::lonnet::get
@@ -1503,7 +1669,7 @@ sub discussionchanger {
}
}
if (defined($userenv{'discmarkread'})) {
- unless ($userenv{'discdisplay'} eq '') {
+ unless ($userenv{'discmarkread'} eq '') {
$discmark = $userenv{'discmarkread'};
}
}
@@ -1518,16 +1684,16 @@ sub discussionchanger {
'pref' => 'Display Preference',
'curr' => 'Current setting ',
'actn' => 'Action',
- 'sdpf' => 'Set display preferences for discussion posts for both bulletin boards and individual resources in all your courses.',
+ '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 bulletin board or resource, and',
- 'unwh' => 'Under what circumstances posts are identfied as "New"',
+ 'whpo' => 'Which posts are displayed when you display a discussion board or resource, and',
+ 'unwh' => 'Under what circumstances posts are identified 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 '
);
@@ -1547,15 +1713,16 @@ sub discussionchanger {
$currmark = $lt{'ondisp'};
$newmark = 'onmark';
}
-
+
$r->print(<<"END");
@@ -1580,7 +1747,11 @@ END
END
$r->print(&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table());
- $r->print('
'.&mt('Note').': '.$lt{'thde'}.'');
+
+ $r->print(' '
+ .''
+ .''
+ );
}
sub verify_and_change_discussion {
@@ -1591,11 +1762,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');
}
@@ -1603,18 +1774,17 @@ sub verify_and_change_discussion {
if (defined($env{'form.discmark'}) ) {
my $newmark = $env{'form.newmark'};
if ($newmark eq 'ondisp') {
- $message.=&mt('In discussions: new posts will be cease to be identified as "NEW" after display.').' ';
+ $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: new posts will cease to be identified as "NEW" after display.')).' ';
&Apache::lonnet::put('environment',{'discmarkread' => $newmark});
&Apache::lonnet::appenv({'environment.discmarkread' => $newmark});
} else {
- $message.=&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.').' ';
+ $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: posts will be identified as "NEW" until marked as not "NEW".')).' ';
&Apache::lonnet::del('environment',['discmarkread']);
&Apache::lonnet::delenv('environment.discmarkread');
}
}
- $r->print(< '/adm/preferences?action=changecourseinit',
+ text => 'Change Course Init. Pref.'});
+ $r->print(Apache::loncommon::start_page('Change Course Initialization Preference'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Course Init. Pref.'));
my $user = $env{'user.name'};
my $domain = $env{'user.domain'};
my %userenv = &Apache::lonnet::get('environment',['course_init_display']);
@@ -1657,7 +1832,7 @@ sub coursedisplaychanger {
$whatsnew_off $whatsnew_on
ENDLSCREEN
- $r->print('
+ $r->print('
');
}
@@ -1670,7 +1845,7 @@ sub verify_and_change_coursepage {
'ywbt' => 'you will be taken to the start of the course.',
'apwb' => 'a page will be displayed that lists items in the course that may require action from you.',
'gtts' => 'Go to the start of the course',
- 'dasp' => "Display the What's New page listing course action items",
+ 'dasp' => "Display the What's New Page",
);
my $newdisp = $env{'form.newdisp'};
$message = ''.$lt{'defs'}.': '.$lt{'when'}.', ';
@@ -1690,18 +1865,275 @@ 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 .= ' '.$lt{'dasp'}.'';
}
}
- $r->print(<
-ENDVCSCREEN
+ $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 .= '