--- loncom/interface/lonpreferences.pm 2009/05/11 16:51:27 1.160
+++ loncom/interface/lonpreferences.pm 2009/08/12 20:43:18 1.168
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.160 2009/05/11 16:51:27 bisitz Exp $
+# $Id: lonpreferences.pm,v 1.168 2009/08/12 20:43:18 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -217,7 +217,8 @@ sub texenginechanger {
'tth' => '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);
@@ -232,6 +233,21 @@ sub texenginechanger {
'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'}
-ENDFORM
+|;
return $output;
}
@@ -1936,7 +1940,7 @@ push(@{ $menu[0]->{items} }, {
if ($env{'environment.remote'} eq 'off') {
push(@{ $menu[1]->{items} }, {
linktext => 'Launch Remote Control',
- url => '/adm/remote?url=/adm/preferences?action=launch',
+ url => '/adm/remote?url=/adm/preferences&action=launch',
permission => 'F',
#help => '',
icon => 'network-wireless.png',
@@ -1945,7 +1949,7 @@ push(@{ $menu[1]->{items} }, {
}else{
push(@{ $menu[1]->{items} }, {
linktext => 'Collapse Remote Control',
- url => '/adm/remote?url=/adm/preferences?action=collapse',
+ url => '/adm/remote?url=/adm/preferences&action=collapse',
permission => 'F',
#help => '',
icon => 'network-wireless.png',
@@ -2082,361 +2086,14 @@ sub handler {
&print_main_menu($r);
}
- return OK;
-
-
-}
-#remove when done
-#old handler routine
-sub handler2 {
- my $r = shift;
- my $user = $env{'user.name'};
- my $domain = $env{'user.domain'};
- &Apache::loncommon::content_type($r,'text/html');
- # Some pages contain DES keys and should not be cached.
- &Apache::loncommon::no_cache($r);
- $r->send_http_header;
- return OK if $r->header_only;
- #
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['action','wysiwyg','returnurl','refpage']);
- #
- &Apache::lonhtmlcommon::clear_breadcrumbs();
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href => '/adm/preferences',
- text => 'Set User Preferences'});
-
- my @Options;
- # Determine current authentication method
- my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);
- if ($currentauth =~ /^(unix|internal):/) {
- push (@Options,({ action => 'changepass',
- linktext => 'Change Password',
- href => '/adm/preferences',
- help => 'Change_Password',
- subroutine => \&passwordchanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changepass',
- text => 'Change Password'},
- },
- { action => 'verify_and_change_pass',
- subroutine => \&verify_and_change_password,
- breadcrumb =>
- { href =>'/adm/preferences?action=changepass',
- text => 'Change Password'},
- printmenu => 'not_on_error',
- }));
- }
- push (@Options,({ action => 'changescreenname',
- linktext => 'Change Screen Name',
- href => '/adm/preferences',
- help => 'Prefs_Screen_Name_Nickname',
- subroutine => \&screennamechanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changescreenname',
- text => 'Change Screen Name'},
- },
- { action => 'verify_and_change_screenname',
- subroutine => \&verify_and_change_screenname,
- breadcrumb =>
- { href => '/adm/preferences?action=changescreenname',
- text => 'Change Screen Name'},
- printmenu => 'yes',
- }));
-
- push (@Options,({ action => 'changemsgforward',
- linktext => 'Change Message Forwarding and Notification E-mail Addresses',
- href => '/adm/preferences',
- help => 'Prefs_Messages',
- breadcrumb =>
- { href => '/adm/preferences?action=changemsgforward',
- text => 'Change Message Forwarding/Notification'},
- subroutine => \&msgforwardchanger,
- },
- { action => 'verify_and_change_msgforward',
- help => 'Prefs_Messages',
- breadcrumb =>
- { href => '/adm/preferences?action=changemsgforward',
- text => 'Change Message Forwarding/Notification'},
- printmenu => 'yes',
- subroutine => \&verify_and_change_msgforward }));
- my $aboutmeaction=
- '/adm/'.$env{'user.domain'}.'/'.$env{'user.name'}.'/aboutme';
- push (@Options,{ action => 'none',
- linktext =>
- q{Edit the Personal Information Page},
- help => 'Prefs_About_Me',
- href => $aboutmeaction});
- push (@Options,({ action => 'changecolors',
- linktext => 'Change Color Scheme',
- href => '/adm/preferences',
- help => 'Change_Colors',
- breadcrumb =>
- { href => '/adm/preferences?action=changecolors',
- text => 'Change Colors'},
- subroutine => \&colorschanger,
- },
- { action => 'verify_and_change_colors',
- breadcrumb =>
- { href => '/adm/preferences?action=changecolors',
- text => 'Change Colors'},
- 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, }
- ));
- push (@Options,({ action => 'changewysiwyg',
- linktext => 'Change WYSIWYG Editor Preferences',
- href => '/adm/preferences',
- breadcrumb =>
- { href => '/adm/preferences?action=changewysiwyg',
- text => 'Change WYSIWYG Preferences'},
- subroutine => \&wysiwygchanger,
- },
- { action => 'set_wysiwyg',
- breadcrumb =>
- { href => '/adm/preferences?action=changewysiwyg',
- text => 'Change WYSIWYG Preferences'},
- printmenu => 'yes',
- subroutine => \&verify_and_change_wysiwyg, }
- ));
- push (@Options,({ action => 'changediscussions',
- linktext => 'Change Discussion Display Preferences',
- href => '/adm/preferences',
- help => 'Change_Discussion_Display',
- breadcrumb =>
- { href => '/adm/preferences?action=changediscussions',
- text => 'Change Discussion Preferences'},
- subroutine => \&discussionchanger,
- },
- { action => 'verify_and_change_discussion',
- breadcrumb =>
- { href => '/adm/preferences?action=changediscussions',
- text => 'Change Discussion Preferences'},
- printmenu => 'yes',
- subroutine => \&verify_and_change_discussion, }
- ));
-
- my $role = ($env{'user.adv'} ? 'Roles' : 'Course');
- push (@Options,({ action => 'changerolespref',
- linktext => 'Change '.$role.' Page Preferences',
- href => '/adm/preferences',
- subroutine => \&rolesprefchanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changerolespref',
- text => 'Change '.$role.' Page Pref'},
- },
- { action => 'verify_and_change_rolespref',
- subroutine => \&verify_and_change_rolespref,
- breadcrumb =>
- { href => '/adm/preferences?action=changerolespref',
- text => 'Change '.$role.' Page Preferences'},
- printmenu => 'yes',
- }));
-
- push (@Options,({ action => 'changetexenginepref',
- linktext => 'Change How Math Equations Are Displayed',
- href => '/adm/preferences',
- subroutine => \&texenginechanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changetexenginepref',
- text => 'Change Math Pref'},
- },
- { action => 'verify_and_change_texengine',
- subroutine => \&verify_and_change_texengine,
- breadcrumb =>
- { href => '/adm/preferences?action=changetexenginepref',
- text => 'Change Math Preferences'},
- printmenu => 'yes',
- }));
-
- if ($env{'environment.remote'} eq 'off') {
- push (@Options,({ action => 'launch',
- linktext => 'Launch Remote Control',
- href => '/adm/remote?url=/adm/preferences',
- }));
- } else {
- push (@Options,({ action => 'collapse',
- linktext => 'Collapse Remote Control',
- href => '/adm/remote?url=/adm/preferences',
- }));
- }
-
- push (@Options,({ action => 'changeicons',
- linktext => 'Change How Menus are Displayed',
- href => '/adm/preferences',
- subroutine => \&iconchanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changeicons',
- text => 'Change Main Menu'},
- },
- { action => 'verify_and_change_icons',
- subroutine => \&verify_and_change_icons,
- breadcrumb =>
- { href => '/adm/preferences?action=changeicons',
- 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',
- }));
- my %author_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au']);
- if (keys(%author_roles) > 0) {
- push (@Options,({ action => 'changedomcoord',
- linktext => 'Restrict Domain Coordinator Access',
- href => '/adm/preferences',
- subroutine => \&domcoordchanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changedomcoord',
- text => 'Restrict Domain Coordinator Access'},
- },
- { action => 'verify_and_change_domcoord',
- subroutine => \&verify_and_change_domcoord,
- breadcrumb =>
- { href => '/adm/preferences?action=changedomcoord',
- text => 'Restrict Domain Coordinator Access'},
- printmenu => 'yes',
- }));
- }
-
- push (@Options,({ action => 'lockwarning',
- subroutine => \&lockwarning,
- breadcrumb =>
- { href => '/adm/preferences?action=lockwarning',
- text => 'Lock Warnings'},
- },
- { action => 'verify_and_change_locks',
- subroutine => \&verify_and_change_lockwarning,
- breadcrumb =>
- { href => '/adm/preferences?action=lockwarning',
- text => 'Lockwarnings'},
- printmenu => 'yes',
- }));
-
-
- if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})
- || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'
- .$env{'request.course.sec'})) {
- push (@Options,({ action => 'changecourseinit',
- linktext => 'Change Course Initialization Preference',
- href => '/adm/preferences',
- subroutine => \&coursedisplaychanger,
- breadcrumb =>
- { href => '/adm/preferences?action=changecourseinit',
- text => 'Change Course Init. Pref.'},
- },
- { action => 'verify_and_change_coursepage',
- breadcrumb =>
- { href => '/adm/preferences?action=changecourseinit', text => 'Change Course Initialization Preference'},
- printmenu => 'yes',
- subroutine => \&verify_and_change_coursepage,
- }));
- }
-
- if (($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/)
- && ($env{'user.domain'} =~/^(msu|gerd)$/)){
- push (@Options,({ action => 'debugtoggle',
- printmenu => 'yes',
- subroutine => \&toggle_debug,
- }));
- }
-
- $r->print(&Apache::loncommon::start_page('Change Preferences'));
-
- my $call = undef;
- my $help = undef;
- my $printmenu = 'yes';
- foreach my $option (@Options) {
- if ($option->{'action'} eq $env{'form.action'}) {
- $call = $option->{'subroutine'};
- $printmenu = $option->{'printmenu'};
- if (exists($option->{'breadcrumb'})) {
- &Apache::lonhtmlcommon::add_breadcrumb
- ($option->{'breadcrumb'});
- }
- $help=$option->{'help'};
- }
- }
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Change Preferences',$help));
- my $error;
- if (defined($call)) {
- $error = $call->($r);
- }
- if ( ( ($printmenu eq 'yes')
- || ($printmenu eq 'not_on_error' && !$error) )
- && (!$env{'form.returnurl'})) {
- my $optionlist = '';
- if ($env{'user.name'} =~
- /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/
- ) {
- push (@Options,({ action => 'debugtoggle',
- linktext => 'Toggle Debug Messages',
- text => 'Current Debug status is -'.
- $env{'user.debug'}.'-.',
- href => '/adm/preferences',
- printmenu => 'yes',
- subroutine => \&toggle_debug,
- }));
- }
- foreach my $option(@Options) {
- my $optiontext = '';
- if (exists($option->{'href'})) {
- $option->{'href_args'}{'action'}=$option->{'action'};
- $optiontext .=
- ''.
- &mt($option->{'linktext'}).'';
- }
- if (exists($option->{'text'})) {
- $optiontext .= ' '.&mt($option->{'text'});
- }
- if ($optiontext ne '') {
- $optiontext = ''.$optiontext.'';
- my $helplink = ' ';
- if (exists($option->{'help'})) {
- $helplink = &Apache::loncommon::help_open_topic
- ($option->{'help'});
- }
- $optionlist .= ''.
- ''.$helplink.' | '.
- ''.$optiontext.' | '.
- '
';
- }
- }
- $optionlist .= '
';
- $r->print($optionlist);
- } elsif ($env{'form.returnurl'}) {
- $r->print('
'.
- &mt('Return').'');
+ # Properly end the HTML page of all preference pages
+ # started in each sub routine
+ # Exception: print_main_menu has its own end_page call
+ unless (!exists $env{'form.action'} ||
+ $env{'form.action'} eq 'debugtoggle') {
+ $r->print(&Apache::loncommon::end_page());
}
- $r->print(&Apache::loncommon::end_page());
+
return OK;
}