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

raeburn raeburn@source.lon-capa.org
Fri, 24 Apr 2009 05:14:10 -0000


raeburn		Fri Apr 24 05:14:10 2009 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - New subroutine: select_language() - to select a langauge available in LON-CAPA. 
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.791 loncom/interface/loncommon.pm:1.792
--- loncom/interface/loncommon.pm:1.791	Wed Apr 22 11:21:13 2009
+++ loncom/interface/loncommon.pm	Fri Apr 24 05:14:09 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.791 2009/04/22 11:21:13 tempelho Exp $
+# $Id: loncommon.pm,v 1.792 2009/04/24 05:14:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -715,6 +715,21 @@
     return $output;
 }
 
+sub select_language {
+    my ($name,$selected,$includeempty) = @_;
+    my %langchoices;
+    if ($includeempty) {
+        %langchoices = ('' => 'No language preference');
+    }
+    foreach my $id (&languageids()) {
+        my $code = &supportedlanguagecode($id);
+        if ($code) {
+            $langchoices{$code} = &plainlanguagedescription($id);
+        }
+    }
+    return &select_form($selected,$name,%langchoices);
+}
+
 =pod
 
 =item * &linked_select_forms(...)