[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonpreferences.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 08 Nov 2003 01:45:26 -0000


www		Fri Nov  7 20:45:26 2003 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonpreferences.pm 
  Log:
  Pulldown menu to select language preference.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.144 loncom/interface/loncommon.pm:1.145
--- loncom/interface/loncommon.pm:1.144	Fri Nov  7 16:04:37 2003
+++ loncom/interface/loncommon.pm	Fri Nov  7 20:45:26 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.144 2003/11/07 21:04:37 matthew Exp $
+# $Id: loncommon.pm,v 1.145 2003/11/08 01:45:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1497,6 +1497,16 @@
     return  ($supported_language{$code}?'* ':'').
             $language{$code}.
 	    ($supported_language{$code}?' ('.&mt('interface available').')':'');
+}
+
+sub plainlanguagedescription {
+    my $code=shift;
+    return $language{$code};
+}
+
+sub supportedlanguagecode {
+    my $code=shift;
+    return $supported_language{$code};
 }
 
 =pod
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.32 loncom/interface/lonpreferences.pm:1.33
--- loncom/interface/lonpreferences.pm:1.32	Fri Nov  7 18:22:21 2003
+++ loncom/interface/lonpreferences.pm	Fri Nov  7 20:45:26 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.32 2003/11/07 23:22:21 www Exp $
+# $Id: lonpreferences.pm,v 1.33 2003/11/08 01:45:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -114,14 +114,23 @@
 
     my $bodytag=&Apache::loncommon::bodytag(
               '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);
 <html>
 $bodytag
 
 <form name="server" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_languages" />
-<br />Preferred language:
-<input type="text" size="5" value="$language" name="language" />
+<br />$pref: $selectionbox
 ENDLSCREEN
     $r->print('<br /><input type="submit" value="'.&mt('Change').'" /></form></body></html>');
 }