[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonpreferences.pm
raeburn
raeburn at source.lon-capa.org
Mon Mar 18 20:37:03 EDT 2013
raeburn Tue Mar 19 00:37:03 2013 EDT
Modified files:
/loncom/interface lonpreferences.pm loncommon.pm
Log:
- Use &loncommon::select_language() routine to generate language select box.
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.203 loncom/interface/lonpreferences.pm:1.204
--- loncom/interface/lonpreferences.pm:1.203 Fri Jan 18 12:58:42 2013
+++ loncom/interface/lonpreferences.pm Tue Mar 19 00:37:03 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.203 2013/01/18 12:58:42 bisitz Exp $
+# $Id: lonpreferences.pm,v 1.204 2013/03/19 00:37:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -152,32 +152,16 @@
text => 'Change Language'});
$r->print(Apache::loncommon::start_page('Content Display Settings'));
$r->print(Apache::lonhtmlcommon::breadcrumbs('Change Language'));
- my $user = $env{'user.name'};
- my $domain = $env{'user.domain'};
- my %userenv = &Apache::lonnet::get
- ('environment',['languages']);
+ my %userenv = &Apache::lonnet::get('environment',['languages']);
my $language=$userenv{'languages'};
- my $pref=&mt('Preferred language');
- my %langchoices=('' => &mt('No language preference'));
- foreach (&Apache::loncommon::languageids()) {
- if (&Apache::loncommon::supportedlanguagecode($_)) {
- $langchoices{&Apache::loncommon::supportedlanguagecode($_)}
- = &Apache::loncommon::plainlanguagedescription($_);
- }
- }
- %langchoices = &Apache::lonlocal::texthash(%langchoices);
- my $selectionbox=
- &Apache::loncommon::select_form(
- $language,
- 'language',
- \%langchoices);
- $r->print(<<ENDLSCREEN);
-<form name="prefs" action="/adm/preferences" method="post">
-<input type="hidden" name="action" value="verify_and_change_languages" />
-<br />$pref: $selectionbox
-ENDLSCREEN
- $r->print('<br /><input type="submit" value="'.&mt('Save').'" />');
+ $r->print(
+ '<form name="prefs" action="/adm/preferences" method="post">'."\n".
+ '<input type="hidden" name="action" value="verify_and_change_languages" />'.
+ '<br /><span class="LC_nobreak">'.&mt('Preferred language').': '.
+ &Apache::loncommon::select_language('language',$language,1).'</span>'."\n".
+ '<br /><input type="submit" value="'.&mt('Save').'" /></form>'
+ );
}
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1116 loncom/interface/loncommon.pm:1.1117
--- loncom/interface/loncommon.pm:1.1116 Fri Mar 1 04:48:59 2013
+++ loncom/interface/loncommon.pm Tue Mar 19 00:37:03 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1116 2013/03/01 04:48:59 raeburn Exp $
+# $Id: loncommon.pm,v 1.1117 2013/03/19 00:37:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1003,7 +1003,7 @@
my ($name,$selected,$includeempty) = @_;
my %langchoices;
if ($includeempty) {
- %langchoices = ('' => &mt('No language preference'));
+ %langchoices = ('' => 'No language preference');
}
foreach my $id (&languageids()) {
my $code = &supportedlanguagecode($id);
@@ -1011,6 +1011,7 @@
$langchoices{$code} = &plainlanguagedescription($id);
}
}
+ %langchoices = &Apache::lonlocal::texthash(%langchoices);
return &select_form($selected,$name,\%langchoices);
}
More information about the LON-CAPA-cvs
mailing list