--- loncom/interface/lonpreferences.pm 2009/04/04 21:47:41 1.149
+++ loncom/interface/lonpreferences.pm 2016/09/19 03:21:20 1.196.4.23
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.149 2009/04/04 21:47:41 bisitz Exp $
+# $Id: lonpreferences.pm,v 1.196.4.23 2016/09/19 03:21:20 raeburn 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 #
################################################################
@@ -116,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.")."
";
}
$r->print(<
@@ -135,9 +90,9 @@ sub verify_and_change_wysiwyg {
my $newsetting=$env{'form.wysiwyg'};
&Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting});
&Apache::lonnet::appenv({'environment.wysiwygeditor' => $newsetting});
-# $r->print('
');
+ 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.').'
-
-');
}
@@ -449,19 +425,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
@@ -482,7 +454,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);
}
}
@@ -490,17 +462,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(<print('
ENDSCREEN
@@ -624,12 +609,45 @@ 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});
-# $r->print(&mt('Set menu mode to [_1].',$newicons));
- print_main_menu($r, &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 {
+ return &Apache::lonlocal::texthash(
+ iconic => 'Use icons and text',
+ iconsonly => 'Use icons only',
+ );
+}
+
+sub icon_previews {
+ my %icon_text = (
+ annotate => 'Notes',
+ wishlist => 'Stored Links',
+ 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",
+ wishlist => "s&9&1&wishlist-link.png&$icon_text{'wishlist'}&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository",
+ 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 wishlist evaluate feedback printout catalog);
+ return (\%inlinetools,\@toolsorder);
}
################################################################
@@ -638,7 +656,7 @@ sub verify_and_change_icons {
sub clickerchanger {
my $r = shift;
- Apache::lonhtmlcommon::add_breadcrumb(
+ &Apache::lonhtmlcommon::add_breadcrumb(
{ href => '/adm/preferences?action=changeclicker',
text => 'Register Clicker'});
$r->print(Apache::loncommon::start_page('Other'));
@@ -650,14 +668,15 @@ sub clickerchanger {
my $clickers=$userenv{'clickers'};
$clickers=~s/\,/\n/gs;
my $text=&mt('Enter response device ("clicker") numbers');
- my $change=&mt('Register');
+ my $change=&mt('Save');
my $helplink=&Apache::loncommon::help_open_topic('Clicker_Registration',&mt('Locating your clicker ID'));
$r->print(<
-'.
'
';
my %chk;
if (defined($allnot{$item}{'crit'})) {
@@ -905,7 +933,7 @@ ENDMSG
''.
- $lt{$type}.' ';
+ $lt{$type}.''.(' ' x4);
}
my $htmlon = '';
my $htmloff = '';
@@ -917,7 +945,7 @@ ENDMSG
$output .= '
'.
+ &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 $save = &mt('Save');
- my $rstall = &mt('Reset All');
- my $resetdefault = &mt('Reset All Colors to Default');
- $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='';
- }
- }
+ 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(<
-
ENDCOL
}
@@ -1168,39 +1181,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) {
+ 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});
- print_main_menu($r, $message);
-# $r->print(<
-#
-#
-#ENDVCCOL
+ &print_main_menu($r, $message);
}
######################################################
@@ -1211,14 +1228,20 @@ 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);
- Apache::lonhtmlcommon::add_breadcrumb(
+ 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'));
}
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('passwd');
+ if ($blocked) {
+ $r->print('
'.$blocktext.'
');
+ return;
+ }
if ((!defined($caller)) || ($caller eq 'preferences')) {
$user = $env{'user.name'};
$domain = $env{'user.domain'};
@@ -1226,10 +1249,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})) {
@@ -1238,15 +1265,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);
@@ -1254,9 +1298,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:'
@@ -1289,7 +1333,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;
@@ -1304,21 +1348,18 @@ sub jscript_send {
uextkey=this.document.client.elements.ukey_cpass.value;
lextkey=this.document.client.elements.lkey_cpass.value;
initkeys();
-
- this.document.pserver.elements.currentpass.value
- =crypted(this.document.client.elements.currentpass.value);
-
+ this.document.pserver.elements.currentpass.value =
+ getCrypted(this.document.client.elements.currentpass.value);
uextkey=this.document.client.elements.ukey_npass1.value;
lextkey=this.document.client.elements.lkey_npass1.value;
initkeys();
this.document.pserver.elements.newpass_1.value
- =crypted(this.document.client.elements.newpass_1.value);
-
+ =getCrypted(this.document.client.elements.newpass_1.value);
uextkey=this.document.client.elements.ukey_npass2.value;
lextkey=this.document.client.elements.lkey_npass2.value;
initkeys();
this.document.pserver.elements.newpass_2.value
- =crypted(this.document.client.elements.newpass_2.value);
+ =getCrypted(this.document.client.elements.newpass_2.value);
|;
if ($caller eq 'reset_by_email') {
$output .= qq|
@@ -1326,11 +1367,14 @@ 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|
this.document.pserver.submit();
}
+
|;
}
@@ -1344,42 +1388,48 @@ sub client_form {
'currentpass' => 'Current Password',
'newpass' => 'New Password',
'confirmpass' => 'Confirm Password',
- 'changepass' => 'Save');
+ 'changepass' => 'Save',
+ );
- my $output = qq|
-
-ENDFORM
+|;
return $output;
}
@@ -1410,6 +1460,7 @@ sub server_form {
+
|;
}
@@ -1423,6 +1474,12 @@ sub server_form {
sub verify_and_change_password {
my ($r,$caller,$mailtoken) = @_;
my ($user,$domain,$homeserver);
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('passwd');
+ if ($blocked) {
+ $r->print('
'.$blocktext.'
');
+ return;
+ }
if ($caller eq 'reset_by_email') {
$user = $env{'form.uname'};
$domain = $env{'form.udom'};
@@ -1492,9 +1549,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);
@@ -1515,14 +1572,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;
@@ -1535,7 +1592,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
@@ -1554,22 +1611,27 @@ ENDERROR
# Inform the user the password has (not?) been changed
my $message;
if ($result =~ /^ok$/) {
- $message = &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);
}
-# $r->print("
".&mt('The password for [_1] was successfully changed',$user)."
");
} 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);
}
-# $r->print("
".&mt("The password for [_1] was not changed",$user)."
".
-# &mt('Please make sure your old password was entered correctly.'));
- return 1;
}
return;
}
@@ -1582,7 +1644,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'};
@@ -1597,7 +1659,7 @@ sub discussionchanger {
}
}
if (defined($userenv{'discmarkread'})) {
- unless ($userenv{'discdisplay'} eq '') {
+ unless ($userenv{'discmarkread'} eq '') {
$discmark = $userenv{'discmarkread'};
}
}
@@ -1615,13 +1677,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 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 '
);
@@ -1641,15 +1703,16 @@ sub discussionchanger {
$currmark = $lt{'ondisp'};
$newmark = 'onmark';
}
-
+
$r->print(<<"END");
@@ -1675,7 +1738,10 @@ 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 {
@@ -1686,11 +1752,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');
}
@@ -1698,19 +1764,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'));
@@ -1791,17 +1855,154 @@ 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 author_space_settings {
+ my $r = shift;
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/preferences?action=authorsettings',
+ text => 'Authoring Space Settings'});
+ 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) {
+ $r->print(Apache::loncommon::start_page('Authoring Space Settings'));
+ $r->print(Apache::lonhtmlcommon::breadcrumbs('Authoring Space Settings'));
+ my %userenv = &Apache::lonnet::get('environment',['nocodemirror']);
+ my $constchecked='';
+ if ($env{'environment.nocodemirror'}) {
+ $constchecked=' checked="checked"';
+ }
+ my $text=&mt('By default, CodeMirror an editor with advanced functionality for editing code is activated for authors.');
+ my $cmoff=&mt('Deactivate CodeMirror. This can improve performance on slow computers and accessibility.');
+ my $change=&mt('Save');
+ $r->print(<
+
+ $text
+ $cmoff
+
+
+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(
+ { 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 .= '