--- loncom/interface/lonpreferences.pm 2006/10/23 21:22:51 1.94
+++ 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.94 2006/10/23 21:22:51 raeburn 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,56 +36,12 @@ 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;
-
-#
-# 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;
-}
+use LONCAPA::lonauthcgi();
+use LONCAPA();
################################################################
# Handler subroutines #
@@ -97,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"';
@@ -107,14 +69,19 @@ sub wysiwygchanger {
}
my $switchoff=&mt('Disable WYSIWYG editor');
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.")."
";
+ }
$r->print(<
+$warning
ENDLSCREEN
- $r->print(' ');
+ $r->print(' ');
}
@@ -122,8 +89,10 @@ sub verify_and_change_wysiwyg {
my $r = shift;
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 roles. The Recent Roles Hotlist feature keeps track of the last N roles which have been visited and places a table of these at the top of the roles page. People with very few roles should leave this feature disabled.').'
-
-');
}
@@ -388,6 +415,7 @@ sub rolespref_get_role_text {
sub verify_and_change_rolespref {
my $r = shift;
+ my $role = ($env{'user.adv'} ? 'Role' : 'Course');
my $user = $env{'user.name'};
my $domain = $env{'user.domain'};
# Recent Roles Hotlist Flag
@@ -396,20 +424,16 @@ sub verify_and_change_rolespref {
my $message='';
if ($hotlist_flag) {
&Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag});
- &Apache::lonnet::appenv('environment.recentroles' => $hotlist_flag);
- $message=&mt('Recent Roles Hotlist is Enabled');
+ &Apache::lonnet::appenv({'environment.recentroles' => $hotlist_flag});
+ $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 Roles Hotlist is Disabled');
+ &Apache::lonnet::delenv('environment.recentroles');
+ $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 Roles',$hotlist_n)."\n";
- }
+ &Apache::lonnet::appenv({'environment.recentrolesn' => $hotlist_n});
}
# Get list of froze roles and list of recent roles
@@ -430,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);
}
}
@@ -438,16 +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(<
-
- New screenname (shown if you post anonymously):
-
- New nickname (shown if you post non-anonymously):
-
-
-
-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 {
@@ -485,12 +525,12 @@ sub verify_and_change_screenname {
my $message='';
if ($newscreen) {
&Apache::lonnet::put('environment',{'screenname' => $newscreen});
- &Apache::lonnet::appenv('environment.screenname' => $newscreen);
- $message='Set new screenname to '.$newscreen;
+ &Apache::lonnet::appenv({'environment.screenname' => $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='Reset screenname';
+ &Apache::lonnet::delenv('environment.screenname');
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Screenname').''));
}
# Nickname
$message.=' ';
@@ -498,51 +538,471 @@ sub verify_and_change_screenname {
$newscreen=~s/[^ \w]//g;
if ($newscreen) {
&Apache::lonnet::put('environment',{'nickname' => $newscreen});
- &Apache::lonnet::appenv('environment.nickname' => $newscreen);
- $message.='Set new nickname to '.$newscreen;
+ &Apache::lonnet::appenv({'environment.nickname' => $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.='Reset nickname';
+ &Apache::lonnet::delenv('environment.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 $iconic='checked="checked"';
+ my ($classic,$onlyicon,$iconic_preview,$iconsonly_preview);
+ if ($userenv{'icons'} eq 'classic') {
+ $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 $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();
- $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
}
@@ -680,38 +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.='Set '.$colortypes{$item}.' to '.$color.' ';
+ &Apache::lonnet::appenv({'environment.'.$entry => $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.='Reset '.$colortypes{$item}.' ';
+ &Apache::lonnet::delenv('environment.'.$entry);
+ $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);
+ &Apache::lonnet::appenv({'environment.color.timestamp' => $now});
- $r->print(<
-
-
-ENDVCCOL
+ &print_main_menu($r, $message);
}
######################################################
@@ -722,7 +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);
+ 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'};
@@ -730,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})) {
@@ -742,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.')
+ .'
",
$caller,$mailtoken);
return 1;
}
@@ -944,8 +1506,9 @@ sub verify_and_change_password {
# Check for authentication types that allow changing of the password.
if ($currentauth !~ /^(unix|internal):/) {
if ($caller eq 'reset_by_email') {
- &passwordchanger($r,"
\nERROR".
- "Authentication type for this user can not be changed by this mechanism..\n
",
+ &passwordchanger($r,"
\n".
+ &mt("Authentication type for this user can not be changed by this mechanism").
+ "\n
\nERROR".
- "One or more password fields were blank.\n
",$caller,$mailtoken);
+ &passwordchanger($r,"
\n".
+ &mt("One or more password fields were blank").
+ "\n
",$caller,$mailtoken);
return;
}
# Get the keys
@@ -974,10 +1538,10 @@ sub verify_and_change_password {
if ($caller eq 'reset_by_email') {
$tryagain_text = &mt('Please try again later.');
}
+ my $unable=&mt("Unable to retrieve saved token for password decryption");
$r->print(<
-ERROR: Unable to retrieve stored token for
-password decryption. $tryagain_text
+$unable. $tryagain_text
ENDERROR
# Probably should log an error here
@@ -985,32 +1549,39 @@ 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);
+ if (keys(%data) == 0) {
+ &passwordchanger($r,
+ ''.
+ &mt('Could not verify current authentication.').' '.
+ &mt('Please try again.').'',$caller,$mailtoken);
+ return 1;
+ }
if ($currentpass ne $data{'temppasswd'}) {
&passwordchanger($r,
- 'ERROR:'.
- 'Could not verify current authentication. '.
- 'Please try again.',$caller,$mailtoken);
+ ''.
+ &mt('Could not verify current authentication.').' '.
+ &mt('Please try again.').'',$caller,$mailtoken);
return 1;
}
}
if ($newpass1 ne $newpass2) {
&passwordchanger($r,
- 'ERROR:'.
- 'The new passwords you entered do not match. '.
- 'Please try again.',$caller,$mailtoken);
+ ''.
+ &mt('The new passwords you entered do not match.').' '.
+ &mt('Please try again.').'',$caller,$mailtoken);
return 1;
}
if (length($newpass1) < 7) {
&passwordchanger($r,
- 'ERROR:'.
- 'Passwords must be a minimum of 7 characters long. '.
- 'Please try again.',$caller,$mailtoken);
+ ''.
+ &mt('Passwords must be a minimum of 7 characters long.').' '.
+ &mt('Please try again.').'',$caller,$mailtoken);
return 1;
}
#
@@ -1021,14 +1592,14 @@ ENDERROR
}
if ($badpassword) {
# I can't figure out how to enter bad characters on my browser.
- my $errormessage = <<"ENDERROR";
-ERROR:
-The password you entered contained illegal characters.
-Valid characters are: space and
+ my $errormessage =''.
+ &mt('The password you entered contained illegal characters.').' '.
+ &mt('Valid characters are').(<<"ENDERROR");
+: space and
+
ENDERROR
&passwordchanger($r,$errormessage,$caller,$mailtoken);
return 1;
@@ -1038,17 +1609,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(<<"ENDTEXT");
-
The password for $user was successfully changed
-ENDTEXT
+ $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(<The password for $user was not changed
-Please make sure your old password was entered correctly.
-ENDERROR
- 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;
}
@@ -1058,6 +1641,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
@@ -1071,7 +1659,7 @@ sub discussionchanger {
}
}
if (defined($userenv{'discmarkread'})) {
- unless ($userenv{'discdisplay'} eq '') {
+ unless ($userenv{'discmarkread'} eq '') {
$discmark = $userenv{'discmarkread'};
}
}
@@ -1086,16 +1674,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 '
);
@@ -1115,15 +1703,16 @@ sub discussionchanger {
$currmark = $lt{'ondisp'};
$newmark = 'onmark';
}
-
+
$r->print(<<"END");
@@ -1148,15 +1737,11 @@ END
END
$r->print(&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table());
- $r->print(<<"END");
-
-
-
-
-
-Note: $lt{'thde'}
-
-END
+
+ $r->print(' '
+ .''
+ .''
+ );
}
sub verify_and_change_discussion {
@@ -1167,30 +1752,29 @@ sub verify_and_change_discussion {
if (defined($env{'form.discdisp'}) ) {
my $newdisp = $env{'form.newdisp'};
if ($newdisp eq 'unread') {
- $message .='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);
+ &Apache::lonnet::appenv({'environment.discdisplay' => $newdisp});
} else {
- $message .= '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');
+ &Apache::lonnet::delenv('environment.discdisplay');
}
}
if (defined($env{'form.discmark'}) ) {
my $newmark = $env{'form.newmark'};
if ($newmark eq 'ondisp') {
- $message.='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);
+ &Apache::lonnet::appenv({'environment.discmarkread' => $newmark});
} else {
- $message.='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');
+ &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']);
@@ -1211,14 +1800,21 @@ sub coursedisplaychanger {
$whatsnewselect = '';
}
}
- my %pagenames = (
+ my %pagenames = &Apache::lonlocal::texthash(
firstres => 'First resource',
- whatsnew => "What's new page",
+ whatsnew => "What's New Page",
);
- my $whatsnew_off=&mt('Display the [_1] in the course.','first resource');
- my $whatsnew_on=&mt('Display the "[_1]" page - a summary of items in the course which require attention.',"What's New");
+ my $whatsnew_off=&mt('Display the [_1]first resource[_2] in the course.','','');
+ my $whatsnew_on=&mt("Display the [_1]What's New Page[_2] - a summary of items in the course which require attention.",'','');
- $r->print(' '.&mt('Set the default page to be displayed when you select a course role').' '.&mt('(Currently: [_1])',$pagenames{$currvalue}).' '.&mt('The global user preference you set for your courses can be overridden in an individual course by setting a course specific setting via the "[_1]" page in the course',"What's New").'
');
+ $r->print(' '
+ .&mt('Set the default page to be displayed when you select a course role')
+ .' '
+ .&mt('(Currently: [_1])',$pagenames{$currvalue})
+ .' '
+ .&mt("The global user preference you set for your courses can be overridden in an individual course by setting a course specific setting via the [_1]What's New Page[_2] in the course.",'','')
+ .'