--- loncom/interface/lonpreferences.pm 2004/05/25 22:00:21 1.43 +++ loncom/interface/lonpreferences.pm 2004/06/08 01:32:02 1.44 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.43 2004/05/25 22:00:21 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.44 2004/06/08 01:32:02 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -92,6 +92,41 @@ sub des_decrypt { ################################################################ # Language Change Subroutines # ################################################################ + +sub wysiwygchanger { + my $r = shift; + my %userenv = &Apache::lonnet::get + ('environment',['wysiwygeditor']); + my $offselect=''; + my $onselect='checked="1"'; + if ($userenv{'wysiwygeditor'}) { + $onselect=''; + $offselect='checked="1"'; + } + my $switchoff=&mt('Disable WYSIWYG editor'); + my $switchon=&mt('Enable WYSIWYG editor'); + $r->print(< + +
+ $switchoff
+ $switchon +ENDLSCREEN + $r->print('
'); +} + + +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('

'.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'

'); +} + +################################################################ +# Language Change Subroutines # +################################################################ sub languagechanger { my $r = shift; my $user = $ENV{'user.name'}; @@ -787,7 +822,7 @@ sub handler { return OK if $r->header_only; # &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['action']); + ['action','wysiwyg','returnurl']); # &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb @@ -885,6 +920,21 @@ sub handler { 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', @@ -931,7 +981,7 @@ ENDHEADER if (defined($call)) { $call->($r); } - if ($printmenu eq 'yes') { + if (($printmenu eq 'yes') && (!$ENV{'form.returnurl'})) { my $optionlist = ''; if ($ENV{'user.name'} =~ /^(albertel|kortemey|korte|hallmat3|turtle)$/ @@ -971,6 +1021,9 @@ ENDHEADER } $optionlist .= '
'; $r->print($optionlist); + } elsif ($ENV{'form.returnurl'}) { + $r->print('
'. + &mt('Return').''); } $r->print(<