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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 10 Nov 2003 16:33:57 -0000


albertel		Mon Nov 10 11:33:57 2003 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonparmset.pm 
  Log:
  - moved get_env_multiple to loncommon
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.148 loncom/interface/loncommon.pm:1.149
--- loncom/interface/loncommon.pm:1.148	Mon Nov 10 10:15:08 2003
+++ loncom/interface/loncommon.pm	Mon Nov 10 11:33:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.148 2003/11/10 15:15:08 www Exp $
+# $Id: loncommon.pm,v 1.149 2003/11/10 16:33:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2363,6 +2363,32 @@
     $ENV{$name}=$value;
   }
 }
+
+=pod
+
+=item * get_env_multiple($name) 
+
+gets $name from the %ENV hash, it seemlessly handles the cases where multiple
+values may be defined and end up as an array ref.
+
+returns an array of values
+
+=cut
+
+sub get_env_multiple {
+    my ($name) = @_;
+    my @values;
+    if (defined($ENV{$name})) {
+        # exists is it an array
+        if (ref($ENV{$name})) {
+            @values=@{ $ENV{$name} };
+        } else {
+            $values[0]=$ENV{$name};
+        }
+    }
+    return(@values);
+}
+
 
 =pod
 
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.133 loncom/interface/lonparmset.pm:1.134
--- loncom/interface/lonparmset.pm:1.133	Fri Oct 10 12:56:16 2003
+++ loncom/interface/lonparmset.pm	Mon Nov 10 11:33:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.133 2003/10/10 16:56:16 www Exp $
+# $Id: lonparmset.pm,v 1.134 2003/11/10 16:33:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -518,20 +518,6 @@
     $r->print('</td>'."\n");
 }
 
-sub get_env_multiple {
-    my ($name) = @_;
-    my @values;
-    if (defined($ENV{$name})) {
-        # exists is it an array
-        if (ref($ENV{$name})) {
-            @values=@{ $ENV{$name} };
-        } else {
-            $values[0]=$ENV{$name};
-        }
-    }
-    return(@values);
-}
-
 =pod
 
 =item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
@@ -693,9 +679,9 @@
     $udom=$ENV{'form.udom'};
     unless ($udom) { $udom=$r->dir_config('lonDefDomain'); }
 
-    my @pscat=&get_env_multiple('form.pscat');
+    my @pscat=&Apache::loncommon::get_env_multiple('form.pscat');
     my $pschp=$ENV{'form.pschp'};
-    my @psprt=&get_env_multiple('form.psprt');
+    my @psprt=&Apache::loncommon::get_env_multiple('form.psprt');
     if (!@psprt) { $psprt[0]='0'; }
     my $showoptions=$ENV{'form.showoptions'};