--- loncom/interface/lonpreferences.pm 2002/12/03 19:57:26 1.17
+++ loncom/interface/lonpreferences.pm 2004/12/22 11:58:32 1.51
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.17 2002/12/03 19:57:26 matthew Exp $
+# $Id: lonpreferences.pm,v 1.51 2004/12/22 11:58:32 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,18 +25,6 @@
#
# http://www.lon-capa.org/
#
-# (Internal Server Error Handler
-#
-# (Login Screen
-# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
-# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
-#
-# 3/1/1 Gerd Kortemeyer)
-#
-# 3/1 Gerd Kortemeyer
-#
-# 2/13/02 2/14 2/15 Matthew Hall
-#
# This package uses the "londes.js" javascript code.
#
# TODOs that have to be completed:
@@ -50,6 +38,8 @@ use Apache::File;
use Crypt::DES;
use DynaLoader; # for Crypt::DES version
use Apache::loncommon();
+use Apache::lonhtmlcommon();
+use Apache::lonlocal;
#
# Write lonnet::passwd to do the call below.
@@ -61,7 +51,7 @@ use Apache::loncommon();
##################################################
sub des_keys {
# Make a new key for DES encryption.
- # Each key has two parts which are returned seperately.
+ # 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.
@@ -100,6 +90,172 @@ 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(< '.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'
+ $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('
$pref: $selectionbox
+ENDLSCREEN
+ $r->print('
');
+}
+
+
+sub verify_and_change_languages {
+ my $r = shift;
+ my $user = $ENV{'user.name'};
+ my $domain = $ENV{'user.domain'};
+# Screenname
+ my $newlanguage = $ENV{'form.language'};
+ $newlanguage=~s/[^\-\w]//g;
+ my $message='';
+ if ($newlanguage) {
+ &Apache::lonnet::put('environment',{'languages' => $newlanguage});
+ &Apache::lonnet::appenv('environment.languages' => $newlanguage);
+ $message='Set new preferred languages to '.$newlanguage;
+ } else {
+ &Apache::lonnet::del('environment',['languages']);
+ &Apache::lonnet::delenv('environment\.languages');
+ $message='Reset preferred language';
+ }
+ $r->print(<