[LON-CAPA-cvs] cvs: rat / lonratparms.pm lonuserstate.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 23 Apr 2004 19:39:25 -0000


www		Fri Apr 23 15:39:25 2004 EDT

  Modified files:              
    /rat	lonratparms.pm lonuserstate.pm 
  Log:
  Bug #2944: double listing of randompick (with and without part 0)
  
  
Index: rat/lonratparms.pm
diff -u rat/lonratparms.pm:1.19 rat/lonratparms.pm:1.20
--- rat/lonratparms.pm:1.19	Thu Oct 23 17:01:54 2003
+++ rat/lonratparms.pm	Fri Apr 23 15:39:25 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Set parameters inside of the RAT
 #
-# $Id: lonratparms.pm,v 1.19 2003/10/23 21:01:54 albertel Exp $
+# $Id: lonratparms.pm,v 1.20 2004/04/23 19:39:25 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,21 +25,7 @@
 #
 # http://www.lon-capa.org/
 #
-# (Search Catalog
-#
-# (Internal Server Error Handler
-#
-# (Login Screen
-# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
-# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
-#
-# 3/1/1 Gerd Kortemeyer)
-#
-# 3/1 Gerd Kortemeyer)
-#
-# 03/03/01,06/15,06/25,06/26,06/30,07/02,07/03,07/04 Gerd Kortemeyer
-# 03/11/02 Matthew Hall
-#
+
 package Apache::lonratparms;
 
 use strict;
@@ -67,37 +53,24 @@
   my %display;
   my %value;
   
-  foreach (split(/\,/,&Apache::lonnet::metadata($uri,'keys'))) {
-      if ($_=~/^parameter\_/) {
-         $content{$_}=&Apache::lonnet::metadata($uri,$_);
-         $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
-         $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
-      }
-  }
-
-# -------------------------------------- Additional parms for certain resources
-
-    if ($uri=~/\.(sequence|page)\.meta$/) {
-        $content{'parameter_randompick'}='';
-        $type{'parameter_randompick'}='int_pos';
-	$display{'parameter_randompick'}='Randomly pick number of resources';
-        
-        $content{'parameter_randompickseed'}='';
-        $type{'parameter_randompickseed'}='int_pos';
-	$display{'parameter_randompickseed'}=
- 'Random seed for randomly picking number of resources (optional, only set if you know what you are doing)';
-    } else {
-        $content{'parameter_mapalias'}='';
-        $type{'parameter_mapalias'}='string';
-	$display{'parameter_mapalias'}='Resource alias name for conditions';
-    }
 # ---------------------------------------------------------- Current Parameters
 
   foreach (split(/\:/,$ENV{'form.parms'})) {
       my ($ptype,$pname,$pvalue)=split(/\_\_\_/,$_);
       unless ($type{$pname}) { $type{$pname}=$ptype; }
       $value{$pname}=$pvalue;
+      $content{$pname}=$pvalue;
+      $type{$pname}=$ptype;
+      $display{$pname}=&mt('Custom Parameter');
   } 
+
+  foreach (split(/\,/,&Apache::lonnet::metadata($uri,'keys'))) {
+      if ($_=~/^parameter\_/) {
+         $content{$_}=&Apache::lonnet::metadata($uri,$_);
+         $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
+         $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
+      }
+  }
   
 # --------------------------------------------------- Print input screen header
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.74 rat/lonuserstate.pm:1.75
--- rat/lonuserstate.pm:1.74	Fri Apr 23 11:43:41 2004
+++ rat/lonuserstate.pm	Fri Apr 23 15:39:25 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construct and maintain state and binary representation of course for user
 #
-# $Id: lonuserstate.pm,v 1.74 2004/04/23 15:43:41 www Exp $
+# $Id: lonuserstate.pm,v 1.75 2004/04/23 19:39:25 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -279,21 +279,21 @@
                     } else {
                         $hash{'param_'.$referid}=''.$newparam;
                     }
-                    if ($token->[2]->{'name'} eq 'parameter_mapalias') {
+                    if ($token->[2]->{'name'}=~/^parameter_(0_)*mapalias$/) {
 			$hash{'mapalias_'.$token->[2]->{'value'}}=$referid;
                     }
-                    if ($token->[2]->{'name'} eq 'parameter_randompick') {
+                    if ($token->[2]->{'name'}=~/^parameter_(0_)*randompick$/) {
 			$randompick{$referid}=$token->[2]->{'value'};
                     }
-                    if ($token->[2]->{'name'} eq 'parameter_randompickseed') {
+                    if ($token->[2]->{'name'}=~/^parameter_(0_)*randompickseed$/) {
 			$randompick{$referid}=$token->[2]->{'value'};
                     }
-                    if ($token->[2]->{'name'} eq 'parameter_encrypturl') {
+                    if ($token->[2]->{'name'}=~/^parameter_(0_)*encrypturl$/) {
 			if ($token->[2]->{'value'}=~/^yes$/i) {
 			    $encurl{$referid}=1;
 			}
                     }
-                    if ($token->[2]->{'name'} eq 'parameter_hiddenresource') {
+                    if ($token->[2]->{'name'}=~/^parameter_(0_)*hiddenresource$/) {
 			if ($token->[2]->{'value'}=~/^yes$/i) {
 			    $hiddenurl{$referid}=1;
 			}