--- loncom/interface/lonpreferences.pm 2010/12/05 22:00:00 1.179.2.5 +++ loncom/interface/lonpreferences.pm 2009/12/15 13:15:32 1.180 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.179.2.5 2010/12/05 22:00:00 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.180 2009/12/15 13:15:32 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -455,19 +455,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 @@ -995,33 +991,27 @@ sub verify_and_change_msgforward { my $domain = $env{'user.domain'}; my $newscreen = ''; my $message=''; - foreach my $recip (split(/\,/,$env{'form.msgforward'})) { - my ($msuser,$msdomain); - if ($recip =~ /:/) { - ($msuser,$msdomain)=split(':',$recip); - } else { - ($msuser,$msdomain)=split(/\@/,$recip); - } + foreach (split(/\,/,$env{'form.msgforward'})) { + my ($msuser,$msdomain)=split(/[\@\:]/,$_); $msuser = &LONCAPA::clean_username($msuser); $msdomain = &LONCAPA::clean_domain($msdomain); if (($msuser) && ($msdomain)) { - if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') { - $newscreen.=$msuser.':'.$msdomain.','; - } else { - $message.= &mt('No such user: ').''.$msuser.':'.$msdomain.'
'; - } + if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') { + $newscreen.=$msuser.':'.$msdomain.','; + } else { + $message.= &mt('No such user: ').''.$msuser.':'.$msdomain.'
'; + } } } $newscreen=~s/\,$//; if ($newscreen) { &Apache::lonnet::put('environment',{'msgforward' => $newscreen}); &Apache::lonnet::appenv({'environment.msgforward' => $newscreen}); - $message .= &mt('Set message forwarding to ').'"'.$newscreen.'".' - .'
'; + $message .= &Apache::lonhtmlcommon::confirm_success(&mt('Set message forwarding to ').'"'.$newscreen.'".
'); } else { &Apache::lonnet::del('environment',['msgforward']); &Apache::lonnet::delenv('environment.msgforward'); - $message.= &mt("Set message forwarding to 'off'.").'
'; + $message.= &Apache::lonhtmlcommon::confirm_success(&mt("Set message forwarding to 'off'.").'
'); } my $critnotification; my $notification; @@ -1057,43 +1047,41 @@ sub verify_and_change_msgforward { if ($notification) { &Apache::lonnet::put('environment',{'notification' => $notification}); &Apache::lonnet::appenv({'environment.notification' => $notification}); - $message.=&mt('Set non-critical message notification address(es) to ').'"'.$notification.'".
'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set non-critical message notification address(es) to ').'"'.$notification.'".
'); } else { &Apache::lonnet::del('environment',['notification']); &Apache::lonnet::delenv('environment.notification'); - $message.=&mt("Set non-critical message notification to 'off'.").'
'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set non-critical message notification to 'off'.").'
'); } if ($critnotification) { &Apache::lonnet::put('environment',{'critnotification' => $critnotification}); &Apache::lonnet::appenv({'environment.critnotification' => $critnotification}); - $message.=&mt('Set critical message notification address(es) to ').'"'.$critnotification.'".
'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set critical message notification address(es) to ').'"'.$critnotification.'".
'); } else { &Apache::lonnet::del('environment',['critnotification']); &Apache::lonnet::delenv('environment.critnotification'); - $message.=&mt("Set critical message notification to 'off'.").'
'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set critical message notification to 'off'.").'
'); } if ($critnotification || $notification) { if ($notify_with_html) { &Apache::lonnet::put('environment',{'notifywithhtml' => $notify_with_html}); &Apache::lonnet::appenv({'environment.notifywithhtml' => $notify_with_html}); - $message.=&mt('Set address(es) to receive excerpts with html retained ').'"'.$notify_with_html.'".'; + $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set address(es) to receive excerpts with html retained ').'"'.$notify_with_html.'".'); } else { &Apache::lonnet::del('environment',['notifywithhtml']); &Apache::lonnet::delenv('environment.notifywithhtml'); if ($totaladdresses == 1) { - $message.=&mt("Set notification address to receive excerpts with html stripped."); + $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set notification address to receive excerpts with html stripped.")); } else { - $message.=&mt("Set all notification addresses to receive excerpts with html stripped."); + $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set all notification addresses to receive excerpts with html stripped.")); } } } else { &Apache::lonnet::del('environment',['notifywithhtml']); &Apache::lonnet::delenv('environment.notifywithhtml'); } - if ($message) { - $message .= '

'; - } &Apache::loncommon::flush_email_cache($user,$domain); + $message=&Apache::loncommon::confirmwrapper($message); &msgforwardchanger($r,$message); } @@ -1383,7 +1371,7 @@ sub client_form { .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title( '') - .'' + .'' .'' .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title( @@ -1583,6 +1571,7 @@ ENDERROR my $message; if ($result =~ /^ok$/) { $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 { @@ -1825,13 +1814,15 @@ 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'}.''; } } - &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success($message)); + $message = &Apache::lonhtmlcommon::confirm_success($message); + $message = &Apache::loncommon::confirmwrapper($message); + &print_main_menu($r,$message); } sub print_main_menu { @@ -1850,8 +1841,23 @@ if (&Apache::lonnet::usertools_access($u } my @menu= ({ categorytitle=>'Personal Data', - items =>[] - }, + items =>[ + { linktext => 'Personal Information Page', + url => $aboutmeurl, + permission => $permissions{'aboutme'}, + #help => 'Prefs_About_Me', + icon => 'system-users.png', + linktitle => 'Edit information about yourself that should be displayed on your public profile.' + }, + { linktext => 'Screen Name', + url => '/adm/preferences?action=changescreenname', + permission => 'F', + #help => 'Prefs_Screen_Name_Nickname', + icon => 'preferences-desktop-font.png', + linktitle => 'Change the name that is displayed in your posts.' + }, + ] + }, { categorytitle=>'Page Display Settings', items =>[ { linktext => 'Color Scheme', @@ -1861,10 +1867,25 @@ my @menu= icon => 'preferences-desktop-theme.png', linktitle => 'Change LON-CAPA default colors.' }, + { linktext => 'Menu Display', + url => '/adm/preferences?action=changeicons', + permission => 'F', + #help => '', + icon => 'preferences-system-windows.png', + linktitle => 'Change whether the menus are displayed with buttons, icons or icons and text.' + } + ] }, { categorytitle=>'Content Display Settings', items =>[ + { linktext => 'Language', + url => '/adm/preferences?action=changelanguages', + permission => 'F', + #help => 'Prefs_Language', + icon => 'preferences-desktop-locale.png', + linktitle => 'Choose the default language for this user.' + }, { linktext => 'WYSIWYG Editor', url => '/adm/preferences?action=changewysiwyg', permission => 'F', @@ -1872,6 +1893,13 @@ my @menu= icon => 'edit-select-all.png', linktitle => 'Enable or disable the WYSIWYG-Editor.' }, + { linktext => $role.' Page', + url => '/adm/preferences?action=changerolespref', + permission => 'F', + #help => '', + icon => 'sctr.png', + linktitle => 'Configure the roles hotlist.' + }, { linktext => 'Math display settings', url => '/adm/preferences?action=changetexenginepref', permission => 'F', @@ -1890,36 +1918,28 @@ my @menu= icon => 'mail-reply-all.png', linktitle => 'Change messageforwarding or notifications settings.' }, + { linktext => 'Discussion Display', + url => '/adm/preferences?action=changediscussions', + permission => 'F', + #help => 'Change_Discussion_Display', + icon => 'mail-message-new.png', + linktitle => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.' + }, ] }, { categorytitle=>'Other', - items =>[] + items =>[ + { linktext => 'Register Response Devices ("Clickers")', + url => '/adm/preferences?action=changeclicker', + permission => 'F', + #help => '', + icon => 'network-workgroup.png', + linktitle => 'Register your clicker.' + }, + ] }, ); - if (&Apache::lonnet::usertools_access($env{'user.name'}, - $env{'user.domain'},'aboutme')) { - push(@{ $menu[0]->{items} }, - { linktext => 'Personal Information Page', - url => $aboutmeurl, - permission => $permissions{'aboutme'}, - #help => 'Prefs_About_Me', - icon => 'system-users.png', - linktitle => 'Edit information about yourself that should be displayed on your public profile.' - }); - } - - unless ($env{'user.domain'} =~ /^\w+citest$/) { - push(@{ $menu[0]->{items} }, - { linktext => 'Screen Name', - url => '/adm/preferences?action=changescreenname', - permission => 'F', - #help => 'Prefs_Screen_Name_Nickname', - icon => 'preferences-desktop-font.png', - linktitle => 'Change the name that is displayed in your posts.' - }); - } - if ($currentauth =~ /^(unix|internal):/) { push(@{ $menu[0]->{items} }, { linktext => 'Password', @@ -1930,29 +1950,25 @@ push(@{ $menu[0]->{items} }, { linktitle => 'Change your password.', }); } - - unless ((&Apache::loncommon::needs_gci_custom()) || ($env{'user.domain'} =~ /^\w+citest$/)) { - push(@{ $menu[1]->{items} }, - { linktext => 'Menu Display', - url => '/adm/preferences?action=changeicons', - permission => 'F', - #help => '', - icon => 'preferences-system-windows.png', - linktitle => 'Change whether the menus are displayed with buttons, icons or icons and text.' - }); - } - - unless ($env{'user.domain'} =~ /^\w+citest$/) { - push(@{ $menu[3]->{items} }, - { linktext => 'Discussion Display', - url => '/adm/preferences?action=changediscussions', - permission => 'F', - #help => 'Change_Discussion_Display', - icon => 'mail-message-new.png', - linktitle => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.' - }); + if ($env{'environment.remote'} eq 'off') { +push(@{ $menu[1]->{items} }, { + linktext => 'Launch Remote Control', + url => '/adm/remote?url=/adm/preferences&action=launch', + permission => 'F', + #help => '', + icon => 'remotecontrol.png', + linktitle => 'Launch the remote control for LON-CAPA.', + }); + }else{ +push(@{ $menu[1]->{items} }, { + linktext => 'Collapse Remote Control', + url => '/adm/remote?url=/adm/preferences&action=collapse', + permission => 'F', + #help => '', + icon => 'remotecontrol.png', + linktitle => 'Collapse the remote control for LON-CAPA.', + }); } - my %author_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au']); if (keys(%author_roles) > 0) { push(@{ $menu[4]->{items} }, { @@ -1965,10 +1981,9 @@ push(@{ $menu[4]->{items} }, { }); } - unless ((&Apache::loncommon::needs_gci_custom()) || ($env{'user.domain'} =~ /^\w+citest/)) { - if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) - || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' - .$env{'request.course.sec'})) { + if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) + || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' + .$env{'request.course.sec'})) { push(@{ $menu[4]->{items} }, { linktext => 'Course Initialization', url => '/adm/preferences?action=changecourseinit', @@ -1978,7 +1993,6 @@ push(@{ $menu[4]->{items} }, { linktitle => 'Set the default page to be displayed when you select a course role.', }); - } } if (&can_toggle_debug()) { push(@{ $menu[4]->{items} }, { @@ -1989,7 +2003,7 @@ push(@{ $menu[4]->{items} }, { icon => 'blog.png', linktitle => 'Toggle Debug Messages.', }); - } + } $r->print(&Apache::loncommon::start_page('My Space')); $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Preferences'));