[LON-CAPA-cvs] cvs: loncom /interface londocs.pm londropadd.pm lonfeedback.pm lonpopulate.pm lonsearchcat.pm lonstatistics.pm /interface/statistics lonstathelpers.pm lonstudentassessment.pm rat lonratedt.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 07 Apr 2005 07:34:53 -0000


This is a MIME encoded message

--albertel1112859293
Content-Type: text/plain

albertel		Thu Apr  7 03:34:53 2005 EDT

  Modified files:              
    /rat	lonratedt.pm 
    /loncom/interface	londocs.pm londropadd.pm lonfeedback.pm 
                     	lonpopulate.pm lonsearchcat.pm lonstatistics.pm 
    /loncom/interface/statistics	lonstathelpers.pm 
                                	lonstudentassessment.pm 
  Log:
  - increasing the use of loncommon::get_env_multiple
  
  
--albertel1112859293
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20050407033453.txt"

Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.65 rat/lonratedt.pm:1.66
--- rat/lonratedt.pm:1.65	Thu Apr  7 02:56:27 2005
+++ rat/lonratedt.pm	Thu Apr  7 03:34:52 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.65 2005/04/07 06:56:27 albertel Exp $
+# $Id: lonratedt.pm,v 1.66 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -733,24 +733,8 @@
    }
 # ---------------------------------------------------------- Process form input
 
-   my @importselect=();
-   my @targetselect=();
-   undef @importselect;
-   undef @targetselect;
-   if (defined($env{'form.importsel'})) {
-       if (ref($env{'form.importsel'})) {
-	   @importselect=sort(@{$env{'form.importsel'}});
-       } else {
-           @importselect=($env{'form.importsel'});
-       }
-   }
-   if (defined($env{'form.target'})) {
-       if (ref($env{'form.target'})) {
-	   @targetselect=sort(@{$env{'form.target'}});
-       } else {
-           @targetselect=($env{'form.target'});
-       }
-   }
+   my @importselect=&Apache::loncommon::get_env_multiple('form.importsel');
+   my @targetselect=&Apache::loncommon::get_env_multiple('form.target');
 # ============================================================ Process commands
 
    my $targetdetail=$env{'form.targetdetail'};
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.174 loncom/interface/londocs.pm:1.175
--- loncom/interface/londocs.pm:1.174	Thu Apr  7 02:56:23 2005
+++ loncom/interface/londocs.pm	Thu Apr  7 03:34:52 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.174 2005/04/07 06:56:23 albertel Exp $
+# $Id: londocs.pm,v 1.175 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -272,22 +272,8 @@
         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['archive','discussion']);
 
-        my @exportitems = ();
-        if (defined($env{'form.archive'})) {
-            if (ref($env{'form.archive'}) eq 'ARRAY') {
-                @exportitems = @{$env{'form.archive'}};
-            } else {
-                $exportitems[0] = $env{'form.archive'};
-            }
-        }
-        my @discussions = ();
-        if (defined($env{'form.discussion'})) {
-            if (ref($env{'form.discussion'}) eq 'ARRAY') {
-                @discussions = $env{'form.discussion'};
-            } else {
-                $discussions[0] = $env{'form.discussion'};
-            }
-        }
+        my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');
+        my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');
         if (@exportitems == 0 && @discussions == 0) {
             $outcome = '<br />As you did not select any content items or discussions for export, an IMS package has not been created.  Please <a href="javascript:history.go(-1)">go back</a> to select either content items or discussions for export';
         } else {
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.127 loncom/interface/londropadd.pm:1.128
--- loncom/interface/londropadd.pm:1.127	Thu Apr  7 02:56:23 2005
+++ loncom/interface/londropadd.pm	Thu Apr  7 03:34:52 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.127 2005/04/07 06:56:23 albertel Exp $
+# $Id: londropadd.pm,v 1.128 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2208,12 +2208,7 @@
 sub drop_student_list {
     my $r=shift;
     my $count=0;
-    my @droplist;
-    if (ref($env{'form.droplist'})) {
-        @droplist = @{$env{'form.droplist'}};
-    } else {
-        @droplist = ($env{'form.droplist'});
-    }
+    my @droplist = &Apache::loncommon::get_env_multiple('form.droplist');
     foreach (@droplist) {
         my ($uname,$udom)=split(/\:/,$_);
         # drop student
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.157 loncom/interface/lonfeedback.pm:1.158
--- loncom/interface/lonfeedback.pm:1.157	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lonfeedback.pm	Thu Apr  7 03:34:52 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.157 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonfeedback.pm,v 1.158 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2686,28 +2686,15 @@
 
 sub process_attachments {
     my ($currnewattach,$currdelold,$keepold) = @_;
-    if (exists($env{'form.currnewattach'})) {
-        if (ref($env{'form.currnewattach'}) eq 'ARRAY') {
-            @{$currnewattach} = @{$env{'form.currnewattach'}};
-        } else {
-            $$currnewattach[0] = $env{'form.currnewattach'};
-        }
-    }
-    if (exists($env{'form.deloldattach'})) {
-        if (ref($env{'form.deloldattach'}) eq 'ARRAY') {
-            @{$currdelold} = @{$env{'form.deloldattach'}};
-        } else {
-            $$currdelold[0] = $env{'form.deloldattach'};
-        }
-    }
+
+    @{$currnewattach}=
+	&Apache::loncommon::get_env_multiple('form.currnewattach');
+    @{$currdelold}=
+	&Apache::loncommon::get_env_multiple('form.deloldattach');
     if (exists($env{'form.delnewattach'})) {
-        my @currdelnew = ();
+        my @currdelnew =
+	    &Apache::loncommon::get_env_multiple('form.delnewattach');
         my @currnew = ();
-        if (ref($env{'form.delnewattach'}) eq 'ARRAY') {
-            @currdelnew = @{$env{'form.delnewattach'}};
-        } else {
-            $currdelnew[0] = $env{'form.delnewattach'};
-        }
         foreach my $newone (@{$currnewattach}) {
             my $delflag = 0;
             foreach (@currdelnew) {
@@ -2722,13 +2709,7 @@
         }
         @{$currnewattach} = @currnew;
     }
-    if (exists($env{'form.keepold'})) {
-        if (ref($env{'form.keepold'}) eq 'ARRAY') {
-            @{$keepold} = @{$env{'form.keepold'}};
-        } else {
-            $$keepold[0] = $env{'form.keepold'};
-        }
-    }
+    @{$keepold} = &Apache::loncommon::get_env_multiple('form.keepold');
 }
 
 sub generate_attachments_button {
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.23 loncom/interface/lonpopulate.pm:1.24
--- loncom/interface/lonpopulate.pm:1.23	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lonpopulate.pm	Thu Apr  7 03:34:52 2005
@@ -1,5 +1,5 @@
 # automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.23 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonpopulate.pm,v 1.24 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2248,37 +2248,12 @@
     my $secidx=&Apache::loncoursedata::CL_SECTION;
     my $typeidx=&Apache::loncoursedata::CL_TYPE;
     my $lockedidx=&Apache::loncoursedata::CL_LOCKEDTYPE;
-    my @typechglist = ();
-    my @lockchglist = ();
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chgauto','chgmanual','lockchg','unlockchg']);
-    if ($env{'form.chgauto'}) {
-        if (ref($env{'form.chgauto'}) eq 'ARRAY') {
-            push @typechglist, @{$env{'form.chgauto'}};
-        } else {
-            push @typechglist, $env{'form.chgauto'};
-        }
-    }
-    if ($env{'form.chgmanual'}) {
-        if (ref($env{'form.chgmanual'}) eq 'ARRAY') {
-            push @typechglist, @{$env{'form.chgmanual'}};
-        } else {
-            push @typechglist, $env{'form.chgmanual'};
-        }
-    }
-    if ($env{'form.lockchg'}) {
-        if (ref($env{'form.lockchg'}) eq 'ARRAY') {
-            push @lockchglist, @{$env{'form.lockchg'}};
-        } else {
-            push @lockchglist, $env{'form.lockchg'};
-        }
-    }
-    if ($env{'form.unlockchg'}) {
-        if (ref($env{'form.unlockchg'}) eq 'ARRAY') {
-            push @lockchglist, @{$env{'form.unlockchg'}};
-        } else {
-            push @lockchglist, $env{'form.unlockchg'};
-        }
-    }
+    my @typechglist = (&Apache::loncommon::get_env_multiple('form.chgauto'),
+		       &Apache::loncommon::get_env_multiple('form.chgmanual'));
+    my @lockchglist = (&Apache::loncommon::get_env_multiple('form.lockchg'),
+		       &Apache::loncommon::get_env_multiple('form.unlockchg'));
+
     foreach my $student (sort @typechglist) {
         my ($uname,$udom) = split/:/,$student;
         my $sdata    = $classlist->{$student};
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.244 loncom/interface/lonsearchcat.pm:1.245
--- loncom/interface/lonsearchcat.pm:1.244	Thu Apr  7 02:59:55 2005
+++ loncom/interface/lonsearchcat.pm	Thu Apr  7 03:34:52 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.244 2005/04/07 06:59:55 albertel Exp $
+# $Id: lonsearchcat.pm,v 1.245 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1557,12 +1557,7 @@
     if (! exists($env{'form.domains'}) || $env{'form.domains'} eq '') {
         return (undef,'',undef);
     }
-    my @allowed_domains;
-    if (ref($env{'form.domains'})) {
-        @allowed_domains =  @{$env{'form.domains'}};
-    } else {
-        @allowed_domains = ($env{'form.domains'});
-    }
+    my @allowed_domains = &Apache::loncommon::get_env_multiple('form.domains');
     #
     my %domain_hash = ();
     my $pretty_domains_string;
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.123 loncom/interface/lonstatistics.pm:1.124
--- loncom/interface/lonstatistics.pm:1.123	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lonstatistics.pm	Thu Apr  7 03:34:52 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.123 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonstatistics.pm,v 1.124 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -298,11 +298,8 @@
     }
     #
     if (exists($env{'form.StudentData'})) {
-        if (ref($env{'form.StudentData'}) eq 'ARRAY') {
-            @SelectedStudentData = @{$env{'form.StudentData'}};
-        } else {
-            @SelectedStudentData = ($env{'form.StudentData'});
-        }
+	@SelectedStudentData = 
+	    &Apache::loncommon::get_env_multiple('form.StudentData');
     } else {
         @SelectedStudentData = ('username');
     }
@@ -330,14 +327,8 @@
 #######################################################
 #######################################################
 sub get_selected_sections {
-    my @selected_sections;
-    if (exists($env{'form.Section'})) {
-        if (ref($env{'form.Section'})) {
-            @selected_sections = @{$env{'form.Section'}};
-        } elsif ($env{'form.Section'} !~ /^\s*$/) {
-            @selected_sections = ($env{'form.Section'});
-        }
-    }
+    my @selected_sections = 
+	&Apache::loncommon::get_env_multiple('form.Section');
     @selected_sections = ('all') if (! @selected_sections);
     foreach (@selected_sections) {
         if ($_ eq 'all') {
@@ -569,16 +560,9 @@
 #######################################################
 sub get_selected_maps {
     my ($elementname) = @_;
-    my @selected_maps;
-    if (exists($env{'form.'.$elementname})) {
-        if (ref($env{'form.'.$elementname})) {
-            @selected_maps = @{$env{'form.'.$elementname}};
-        } else {
-            @selected_maps = ($env{'form.'.$elementname});
-        }
-    } else {
-        @selected_maps = ('all');
-    }
+    my @selected_maps = 
+	&Apache::loncommon::get_env_multiple('form.'.$elementname);
+    @selected_maps = ('all') if (! @selected_maps);
     foreach my $map (@selected_maps) {
         if ($map eq 'all') {
             @selected_maps = ('all');
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.46 loncom/interface/statistics/lonstathelpers.pm:1.47
--- loncom/interface/statistics/lonstathelpers.pm:1.46	Thu Apr  7 02:56:24 2005
+++ loncom/interface/statistics/lonstathelpers.pm	Thu Apr  7 03:34:52 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstathelpers.pm,v 1.46 2005/04/07 06:56:24 albertel Exp $
+# $Id: lonstathelpers.pm,v 1.47 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -338,14 +338,8 @@
 sub get_selected_symbs {
     my ($inputfield) = @_;
     my $field = 'form.'.$inputfield;
-    my @Symbs;
-    if (exists($env{$field})) {
-        if (! ref($env{$field})) {
-            @Symbs = (&Apache::lonnet::unescape($env{$field}));
-        } else {
-            @Symbs = (map {&Apache::lonnet::unescape($_);} @{$env{$field}});
-        }
-    }
+    my @Symbs = &Apache::loncommon::get_env_multiple($field);
+    @Symbs = (map {&Apache::lonnet::unescape($_);} @{$env{$field}});
     return @Symbs;
 }
 
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.121 loncom/interface/statistics/lonstudentassessment.pm:1.122
--- loncom/interface/statistics/lonstudentassessment.pm:1.121	Thu Apr  7 02:56:24 2005
+++ loncom/interface/statistics/lonstudentassessment.pm	Thu Apr  7 03:34:52 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.121 2005/04/07 06:56:24 albertel Exp $
+# $Id: lonstudentassessment.pm,v 1.122 2005/04/07 07:34:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -430,14 +430,9 @@
                                             [$elementname]);
     #
     # Format for output options is 'mode, restrictions';
-    my $selected = 'html, without links';
-    if (exists($env{'form.'.$elementname})) {
-        if (ref($env{'form.'.$elementname} eq 'ARRAY')) {
-            $selected = $env{'form.'.$elementname}->[0];
-        } else {
-            $selected = $env{'form.'.$elementname};
-        }
-    }
+    my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0];
+    $selected = 'html, without links' if (!$selected);
+
     #
     # Set package variables describing output mode
     $show_links  = 'no';
@@ -551,14 +546,9 @@
     my $Str = '';
     my $elementname = 'chartoutputdata';
     #
-    my $selected = 'scores';
-    if (exists($env{'form.'.$elementname})) {
-        if (ref($env{'form.'.$elementname} eq 'ARRAY')) {
-            $selected = $env{'form.'.$elementname}->[0];
-        } else {
-            $selected = $env{'form.'.$elementname};
-        }
-    }
+    my $selected = (&Apache::loncommon::get_env_multiple('form.'.$elementname))[0];
+    $selected = 'scores' if (!$selected);
+
     #
     $chosen_output = $OutputDataOptions[0];
     foreach my $option (@OutputDataOptions) {

--albertel1112859293--