--- loncom/interface/lonpreferences.pm 2008/12/12 19:57:58 1.125.2.1
+++ loncom/interface/lonpreferences.pm 2009/12/07 01:41:31 1.125.8.5
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.125.2.1 2008/12/12 19:57:58 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.125.8.5 2009/12/07 01:41:31 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();
#
@@ -120,7 +121,7 @@ $warning
$switchoff
$switchon
ENDLSCREEN
- $r->print(' ');
+ $r->print(' ');
}
@@ -129,7 +130,11 @@ sub verify_and_change_wysiwyg {
my $newsetting=$env{'form.wysiwyg'};
&Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting});
&Apache::lonnet::appenv({'environment.wysiwygeditor' => $newsetting});
- $r->print('
'.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'
');
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('WYSIWYG Editor').' ',''.&mt($newsetting).' '));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ $r->print(<
$pref: $selectionbox
ENDLSCREEN
- $r->print(' ');
+ $r->print(' ');
}
@@ -173,12 +178,14 @@ 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.'" .'));
} else {
&Apache::lonnet::del('environment',['languages']);
- &Apache::lonnet::delenv('environment\.languages');
- $message=&mt('Reset preferred language.');
+ &Apache::lonnet::delenv('environment.languages');
+ $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(< '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);
@@ -206,20 +214,36 @@ sub texenginechanger {
my %lt=&Apache::lonlocal::texthash(
'headline' => 'Change Math Preferences',
'preftxt' => 'Preferred method to display Math',
- 'change' => 'Change',
+ 'change' => 'Save',
'exmpl' => 'Examples',
'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.'
+ ,'
'
+ ,' ')
+ .'
'
+ .'';
+
$r->print(<$lt{'headline'}
@@ -231,18 +255,7 @@ $lt{'exmpl'}
$jsMath_start
@@ -282,14 +295,13 @@ sub verify_and_change_texengine {
if ($newtexengine) {
&Apache::lonnet::put('environment',{'texengine' => $newtexengine});
&Apache::lonnet::appenv({'environment.texengine' => $newtexengine});
- $message=&mt('Set new preferred math display to ').'"'.$newtexengine.'" .';
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Preferred method to display Math').' ','"'.$newtexengine.'" '));
} else {
&Apache::lonnet::del('environment',['texengine']);
- &Apache::lonnet::delenv('environment\.texengine');
- $message=&mt('Reset preferred math display.');
+ &Apache::lonnet::delenv('environment.texengine');
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Preferred method to display Math').' '));
}
-
-
+ $message=&Apache::loncommon::confirmwrapper($message);
$r->print(<'.
- " ".
"".
"$role_text{$role_key} ".
@@ -363,10 +375,10 @@ sub rolesprefchanger {
$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.').'
-');
}
@@ -424,7 +436,7 @@ sub verify_and_change_rolespref {
$message=&mt('Recent '.$role.'s Hotlist is Enabled');
} else {
&Apache::lonnet::del('environment',['recentroles']);
- &Apache::lonnet::delenv('environment\.recentroles');
+ &Apache::lonnet::delenv('environment.recentroles');
$message=&mt('Recent '.$role.'s Hotlist is Disabled');
}
if ($hotlist_n) {
@@ -454,7 +466,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);
}
}
@@ -462,13 +474,13 @@ 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";
-
+ $message=&Apache::loncommon::confirmwrapper($message);
$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
+ $r->print(''
+ .&mt('Change the name that is displayed in your posts.')
+ .'
'
+ );
+ $r->print(''
+ );
}
sub verify_and_change_screenname {
@@ -516,11 +531,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.');
+ &Apache::lonnet::delenv('environment.screenname');
+ $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Screenname').' '));
}
# Nickname
$message.=' ';
@@ -529,13 +544,14 @@ 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.');
+ &Apache::lonnet::delenv('environment.nickname');
+ $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset [_1]',''.&mt('Nickname').' '));
}
&Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain);
+ $message=&Apache::loncommon::confirmwrapper($message);
$r->print(<print(<
@@ -584,7 +600,11 @@ sub verify_and_change_icons {
&Apache::lonnet::put('environment',{'icons' => $newicons});
&Apache::lonnet::appenv({'environment.icons' => $newicons});
- $r->print(&mt('Set menu mode to [_1].',$newicons));
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]',''.&mt('Menu Display').' ',''.$newicons.' '));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ $r->print(<print(<
-$text $helplink
+$helplink $text
+
ENDSCREEN
@@ -626,7 +647,11 @@ sub verify_and_change_clicker {
$newclickers=~s/\,$//;
&Apache::lonnet::put('environment',{'clickers' => $newclickers});
&Apache::lonnet::appenv({'environment.clickers' => $newclickers});
- $r->print(&mt('Registering clickers: [_1]',$newclickers));
+ my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers));
+ $message=&Apache::loncommon::confirmwrapper($message);
+ $r->print(<print(<
$text
- $construction
+ $construction
ENDSCREEN
@@ -664,7 +689,17 @@ 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'}});
- $r->print(&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);
+ $r->print(< 'Forwarding Address(es)',
noti => 'Notification E-mail Address(es)',
foad_exmpl => 'e.g. userA:domain1,userB:domain2,... ',
- mnot => 'Email 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 => 'Change',
+ chg => 'Save',
email => 'The e-mail address entered in row ',
notv => 'is not a valid e-mail address',
- toen => "To enter multiple addresses, enter one address at a time, click 'Change' and then add the next one",
- prme => 'Back to preferences menu',
+ toen => "To enter multiple addresses, enter one address at a time, click 'Save' and then add the next one",
+ prme => 'Back',
);
my $forwardingHelp = &Apache::loncommon::help_open_topic("Prefs_Forwarding");
my $notificationHelp = &Apache::loncommon::help_open_topic("Prefs_Notification");
@@ -893,8 +928,8 @@ ENDMSG
$r->print(qq|
-
+
|);
@@ -928,7 +963,7 @@ sub verify_and_change_msgforward {
if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') {
$newscreen.=$msuser.':'.$msdomain.',';
} else {
- $message.= &mt('No such user: ').''.$msuser.':'.$msdomain.' ';
+ $message.= &mt('No such user: ').''.$msuser.':'.$msdomain.' ';
}
}
}
@@ -940,7 +975,7 @@ sub verify_and_change_msgforward {
.' ';
} else {
&Apache::lonnet::del('environment',['msgforward']);
- &Apache::lonnet::delenv('environment\.msgforward');
+ &Apache::lonnet::delenv('environment.msgforward');
$message.= &mt("Set message forwarding to 'off'.").' ';
}
my $critnotification;
@@ -980,7 +1015,7 @@ sub verify_and_change_msgforward {
$message.=&mt('Set non-critical message notification address(es) to ').'"'.$notification.'" . ';
} else {
&Apache::lonnet::del('environment',['notification']);
- &Apache::lonnet::delenv('environment\.notification');
+ &Apache::lonnet::delenv('environment.notification');
$message.=&mt("Set non-critical message notification to 'off'.").' ';
}
if ($critnotification) {
@@ -989,7 +1024,7 @@ sub verify_and_change_msgforward {
$message.=&mt('Set critical message notification address(es) to ').'"'.$critnotification.'" . ';
} else {
&Apache::lonnet::del('environment',['critnotification']);
- &Apache::lonnet::delenv('environment\.critnotification');
+ &Apache::lonnet::delenv('environment.critnotification');
$message.=&mt("Set critical message notification to 'off'.").' ';
}
if ($critnotification || $notification) {
@@ -999,7 +1034,7 @@ sub verify_and_change_msgforward {
$message.=&mt('Set address(es) to receive excerpts with html retained ').'"'.$notify_with_html.'" .';
} else {
&Apache::lonnet::del('environment',['notifywithhtml']);
- &Apache::lonnet::delenv('environment\.notifywithhtml');
+ &Apache::lonnet::delenv('environment.notifywithhtml');
if ($totaladdresses == 1) {
$message.=&mt("Set notification address to receive excerpts with html stripped.");
} else {
@@ -1008,7 +1043,7 @@ sub verify_and_change_msgforward {
}
} else {
&Apache::lonnet::del('environment',['notifywithhtml']);
- &Apache::lonnet::delenv('environment\.notifywithhtml');
+ &Apache::lonnet::delenv('environment.notifywithhtml');
}
if ($message) {
$message .= ' ';
@@ -1026,13 +1061,13 @@ sub colorschanger {
# 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=('pgbg' => 'Page Background Color',
+ 'tabbg' => 'Header Background Color',
+ 'sidebg'=> 'Header Border Color',
+ 'font' => 'Font Color',
+ 'link' => 'Un-Visited Link Color',
+ 'vlink' => 'Visited Link Color',
+ 'alink' => 'Active Link Color');
my $start_data_table = &Apache::loncommon::start_data_table();
my $chtable='';
foreach my $item (sort(keys(%colortypes))) {
@@ -1043,11 +1078,14 @@ sub colorschanger {
'" size="10" value="'.$curcol.
'" />Select '.
+ .$item."','parmform.pres','psub'".');">'.&mt('Select').''.
&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');
$r->print(<
@@ -1086,8 +1124,8 @@ $start_data_table
$chtable
$end_data_table
-
-
+
+
ENDCOL
}
@@ -1097,13 +1135,13 @@ 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=('pgbg' => 'Page Background Color',
+ 'tabbg' => 'Header Background Color',
+ 'sidebg'=> 'Header Border Color',
+ 'font' => 'Font Color',
+ 'link' => 'Un-Visited Link Color',
+ 'vlink' => 'Visited Link Color',
+ 'alink' => 'Active Link Color');
my $message='';
foreach my $item (keys %colortypes) {
@@ -1112,13 +1150,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.=&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}.'.').' ';
+ &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});
@@ -1150,7 +1192,9 @@ sub passwordchanger {
$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})) {
@@ -1247,6 +1291,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|
@@ -1265,42 +1311,40 @@ sub client_form {
'currentpass' => 'Current Password',
'newpass' => 'New Password',
'confirmpass' => 'Confirm Password',
- 'changepass' => 'Change Password');
-
- my $output = qq|
-
-ENDFORM
+|;
return $output;
}
@@ -1331,6 +1375,7 @@ sub server_form {
+
|;
}
@@ -1473,13 +1518,27 @@ 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.' '));
+ if ($caller eq 'reset_by_email') {
+ $r->print($message.' ');
+ } else {
+ $r->print(&Apache::loncommon::confirmwrapper($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);
+ $r->print(&Apache::loncommon::confirmwrapper($message));
+ }
}
return;
}
@@ -1502,7 +1561,7 @@ sub discussionchanger {
}
}
if (defined($userenv{'discmarkread'})) {
- unless ($userenv{'discdisplay'} eq '') {
+ unless ($userenv{'discmarkread'} eq '') {
$discmark = $userenv{'discmarkread'};
}
}
@@ -1517,9 +1576,9 @@ 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',
+ 'whpo' => 'Which posts are displayed when you display a discussion board or resource, and',
'unwh' => 'Under what circumstances posts are identfied as "New"',
'allposts' => 'All posts',
'unread' => 'New posts only',
@@ -1528,7 +1587,7 @@ sub discussionchanger {
'disa' => 'Posts displayed?',
'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 '
+ 'chgt' => 'Change to ',
);
my $dispchange = $lt{'unread'};
my $markchange = $lt{'ondisp'};
@@ -1552,9 +1611,9 @@ sub discussionchanger {
$lt{'sdpf'} $lt{'prca'} $lt{'whpo'} $lt{'unwh'}
-
-
END
+ $r->print(''.$lt{'thde'}.'
');
+
$r->print(&Apache::loncommon::start_data_table());
$r->print(<<"END");
@@ -1579,15 +1638,9 @@ 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 {
@@ -1598,27 +1651,28 @@ 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');
+ &Apache::lonnet::delenv('environment.discdisplay');
}
}
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 be 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 read by the reader.')).' ';
&Apache::lonnet::del('environment',['discmarkread']);
- &Apache::lonnet::delenv('environment\.discmarkread');
+ &Apache::lonnet::delenv('environment.discmarkread');
}
}
+ $message=&Apache::loncommon::confirmwrapper($message);
$r->print(< '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] page in the course.",'',' ').
+ ' ');
$r->print(<
@@ -1657,7 +1716,7 @@ sub coursedisplaychanger {
$whatsnew_off
$whatsnew_on
ENDLSCREEN
- $r->print('
+ $r->print('
');
}
@@ -1670,7 +1729,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'}.', ';
@@ -1681,7 +1740,7 @@ sub verify_and_change_coursepage {
} else {
$message .= $lt{'apwb'}.' ';
&Apache::lonnet::del('environment',['course_init_display']);
- &Apache::lonnet::delenv('environment\.course_init_display');
+ &Apache::lonnet::delenv('environment.course_init_display');
}
my $refpage = $env{'form.refpage'};
if (($env{'request.course.fn'}) && ($env{'request.course.id'})) {
@@ -1696,9 +1755,9 @@ sub verify_and_change_coursepage {
$refpage.'">'.$lt{'dasp'}.'';
}
}
+ $message = &Apache::lonhtmlcommon::confirm_success($message);
$r->print(<
ENDVCSCREEN
}
@@ -1767,7 +1826,7 @@ sub handler {
}));
push (@Options,({ action => 'changemsgforward',
- linktext => 'Change Message Forwarding and Notification Email Addresses',
+ linktext => 'Messages & Notifications',
href => '/adm/preferences',
help => 'Prefs_Messages',
breadcrumb =>
@@ -1784,10 +1843,9 @@ sub handler {
subroutine => \&verify_and_change_msgforward }));
if (&Apache::lonnet::usertools_access($user,$domain,'aboutme')) {
my $aboutmeaction = '/adm/'.$domain.'/'.$user.'/aboutme';
- push (@Options,{ action => 'none',
- linktext =>
- q{Edit the 'About Me' Personal Information Screen},
- help => 'Prefs_About_Me',
+ push (@Options,{ action => 'none',
+ linktext =>"Edit the Personal Information Page",
+ help => 'Prefs_About_Me',
href => $aboutmeaction});
}
push (@Options,({ action => 'changecolors',
@@ -1806,22 +1864,24 @@ sub handler {
printmenu => 'yes',
subroutine => \&verify_and_change_colors,
}));
- push (@Options,({ action => 'changelanguages',
- linktext => 'Change Language Preferences',
- href => '/adm/preferences',
- help => 'Prefs_Language',
- breadcrumb=>
- { href => '/adm/preferences?action=changelanguages',
- text => 'Change Language'},
- subroutine => \&languagechanger,
- },
- { action => 'verify_and_change_languages',
- breadcrumb=>
- {href => '/adm/preferences?action=changelanguages',
- text => 'Change Language'},
- printmenu => 'yes',
- subroutine=>\&verify_and_change_languages, }
+ if ($env{'user.adv'}) {
+ push (@Options,({ action => 'changelanguages',
+ linktext => 'Change Language Preferences',
+ href => '/adm/preferences',
+ help => 'Prefs_Language',
+ breadcrumb=>
+ { href => '/adm/preferences?action=changelanguages',
+ text => 'Change Language'},
+ subroutine => \&languagechanger,
+ },
+ { action => 'verify_and_change_languages',
+ breadcrumb=>
+ {href => '/adm/preferences?action=changelanguages',
+ text => 'Change Language'},
+ printmenu => 'yes',
+ subroutine=>\&verify_and_change_languages, }
));
+ }
push (@Options,({ action => 'changewysiwyg',
linktext => 'Change WYSIWYG Editor Preferences',
href => '/adm/preferences',
@@ -1914,22 +1974,23 @@ sub handler {
text => 'Change Main Menu'},
printmenu => 'yes',
}));
-
- push (@Options,({ action => 'changeclicker',
- linktext => 'Register Response Devices ("Clickers")',
- href => '/adm/preferences',
- subroutine => \&clickerchanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changeclicker',
- text => 'Register Clicker'},
- },
- { action => 'verify_and_change_clicker',
- subroutine => \&verify_and_change_clicker,
- breadcrumb =>
- { href => '/adm/preferences?action=changeclicker',
- text => 'Register Clicker'},
- printmenu => 'yes',
- }));
+ if ($env{'user.adv'}) {
+ push (@Options,({ action => 'changeclicker',
+ linktext => 'Register Response Devices ("Clickers")',
+ href => '/adm/preferences',
+ subroutine => \&clickerchanger,
+ breadcrumb =>
+ { href => '/adm/preferences?action=changeclicker',
+ text => 'Register Clicker'},
+ },
+ { action => 'verify_and_change_clicker',
+ subroutine => \&verify_and_change_clicker,
+ breadcrumb =>
+ { href => '/adm/preferences?action=changeclicker',
+ text => 'Register Clicker'},
+ printmenu => 'yes',
+ }));
+ }
my %author_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au']);
if (keys(%author_roles) > 0) {
push (@Options,({ action => 'changedomcoord',
@@ -1983,7 +2044,7 @@ sub handler {
}));
}
- if ($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) {
+ if (&can_toggle_debug()) {
push (@Options,({ action => 'debugtoggle',
printmenu => 'yes',
subroutine => \&toggle_debug,
@@ -2015,13 +2076,11 @@ sub handler {
|| ($printmenu eq 'not_on_error' && !$error) )
&& (!$env{'form.returnurl'})) {
my $optionlist = '';
- if ($env{'user.name'} =~
- /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/
- ) {
+ if (&can_toggle_debug()) {
push (@Options,({ action => 'debugtoggle',
linktext => 'Toggle Debug Messages',
- text => 'Current Debug status is -'.
- $env{'user.debug'}.'-.',
+ text => 'Current Debug status is: '.
+ ($env{'user.debug'} ? 'on' : 'off'),
href => '/adm/preferences',
printmenu => 'yes',
subroutine => \&toggle_debug,
@@ -2063,12 +2122,26 @@ sub handler {
}
sub toggle_debug {
- if ($env{'user.debug'}) {
- &Apache::lonnet::delenv('user\.debug');
- } else {
- &Apache::lonnet::appenv({'user.debug' => 1});
+ if (&can_toggle_debug()) {
+ if ($env{'user.debug'}) {
+ &Apache::lonnet::delenv('user.debug');
+ } else {
+ &Apache::lonnet::appenv({'user.debug' => 1});
+ }
+ }
+}
+
+sub can_toggle_debug {
+ my $can_toggle = 0;
+ my $page = 'toggledebug';
+ if (&LONCAPA::lonauthcgi::can_view($page)) {
+ $can_toggle = 1;
+ } elsif (&LONCAPA::lonauthcgi::check_ipbased_access($page)) {
+ $can_toggle = 1;
}
+ return $can_toggle;
}
+
1;
__END__