version 1.29, 2003/09/17 01:45:14
|
version 1.33, 2003/11/08 01:45:26
|
Line 51 use Crypt::DES;
|
Line 51 use Crypt::DES;
|
use DynaLoader; # for Crypt::DES version |
use DynaLoader; # for Crypt::DES version |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
|
use Apache::lonlocal; |
|
|
# |
# |
# Write lonnet::passwd to do the call below. |
# Write lonnet::passwd to do the call below. |
Line 108 sub languagechanger {
|
Line 109 sub languagechanger {
|
my $user = $ENV{'user.name'}; |
my $user = $ENV{'user.name'}; |
my $domain = $ENV{'user.domain'}; |
my $domain = $ENV{'user.domain'}; |
my %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
('environment',['languages','translator']); |
('environment',['languages']); |
my $language=$userenv{'languages'}; |
my $language=$userenv{'languages'}; |
my $translator=$userenv{'translator'}; |
|
my $bodytag=&Apache::loncommon::bodytag( |
my $bodytag=&Apache::loncommon::bodytag( |
'Change Your Language Preferences'); |
'Change Your Language Preferences'); |
|
my $pref=&mt('Preferred language'); |
|
my %langchoices=('' => 'No language preference'); |
|
foreach (&Apache::loncommon::languageids()) { |
|
if (&Apache::loncommon::supportedlanguagecode($_)) { |
|
$langchoices{&Apache::loncommon::supportedlanguagecode($_)} |
|
= &Apache::loncommon::plainlanguagedescription($_); |
|
} |
|
} |
|
my $selectionbox=&Apache::loncommon::select_form($language,'language', |
|
%langchoices); |
$r->print(<<ENDLSCREEN); |
$r->print(<<ENDLSCREEN); |
<html> |
<html> |
$bodytag |
$bodytag |
|
|
<form name="server" action="/adm/preferences" method="post"> |
<form name="server" action="/adm/preferences" method="post"> |
<input type="hidden" name="action" value="verify_and_change_languages" /> |
<input type="hidden" name="action" value="verify_and_change_languages" /> |
<br />Preferred language: |
<br />$pref: $selectionbox |
<input type="text" size="5" value="$language" name="language" /> |
|
ENDLSCREEN |
ENDLSCREEN |
if ($ENV{'user.adv'}) { |
$r->print('<br /><input type="submit" value="'.&mt('Change').'" /></form></body></html>'); |
$r->print (<<ENDTRSC); |
|
<br />Willing to translate for language: |
|
<input type="text" size="5" value="$translator" name="translator" /> |
|
ENDTRSC |
|
} |
|
$r->print('<br /><input type="submit" value="Change" /></form></body></html>'); |
|
} |
} |
|
|
|
|
Line 149 sub verify_and_change_languages {
|
Line 153 sub verify_and_change_languages {
|
&Apache::lonnet::delenv('environment\.languages'); |
&Apache::lonnet::delenv('environment\.languages'); |
$message='Reset preferred language'; |
$message='Reset preferred language'; |
} |
} |
if ($ENV{'user.adv'}) { |
|
$message.='<br />'; |
|
my $newtrans = $ENV{'form.translator'}; |
|
$newtrans=~s/[^\-\w]//g; |
|
if ($newtrans) { |
|
&Apache::lonnet::put('environment',{'translator' => $newtrans}); |
|
&Apache::lonnet::appenv('environment.translator' => $newtrans); |
|
$message.='Set translator to '.$newtrans; |
|
} else { |
|
&Apache::lonnet::del('environment',['translator']); |
|
&Apache::lonnet::delenv('environment\.translator'); |
|
$message.='Reset translator'; |
|
} |
|
} |
|
|
|
my $bodytag=&Apache::loncommon::bodytag( |
my $bodytag=&Apache::loncommon::bodytag( |
'Change Your Language Preferences'); |
'Change Your Language Preferences'); |
$r->print(<<ENDVCSCREEN); |
$r->print(<<ENDVCSCREEN); |
Line 711 sub handler {
|
Line 700 sub handler {
|
my $r = shift; |
my $r = shift; |
my $user = $ENV{'user.name'}; |
my $user = $ENV{'user.name'}; |
my $domain = $ENV{'user.domain'}; |
my $domain = $ENV{'user.domain'}; |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
# Some pages contain DES keys and should not be cached. |
# Some pages contain DES keys and should not be cached. |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |