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

www lon-capa-cvs@mail.lon-capa.org
Fri, 03 Jun 2005 19:16:29 -0000


www		Fri Jun  3 15:16:29 2005 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Being able to pass more than one parameter
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.204 loncom/interface/lonparmset.pm:1.205
--- loncom/interface/lonparmset.pm:1.204	Fri Jun  3 11:47:29 2005
+++ loncom/interface/lonparmset.pm	Fri Jun  3 15:16:25 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.204 2005/06/03 15:47:29 www Exp $
+# $Id: lonparmset.pm,v 1.205 2005/06/03 19:16:25 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -635,11 +635,6 @@
     if ($parmlev eq 'full') {
         my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
                                         '.'.$$name{$which},$$symbp{$rid});
-
-# this doesn't seem to work, and I don't think is correct
-#    my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}.
-#                                      '.'.$$name{$which}.'.type',$symbp{$rid});
-# this seems to work
         my $sessionvaltype=$typeoutpar[$result];
         if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
         $r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'.
@@ -939,10 +934,15 @@
 
 # ---------------------------------------------------------- Anything to store?
     if ($env{'form.pres_marker'}) {
-	$message.=&storeparm(split(/\&/,$env{'form.pres_marker'}),
-			     $env{'form.pres_value'},
-			     $env{'form.pres_type'},
-                             $uname,$udom,$csec);
+        my @markers=split(/\&\&\&/,$env{'form.pres_marker'});
+        my @values=split(/\&\&\&/,$env{'form.pres_value'});
+        my @types=split(/\&\&\&/,$env{'form.pres_type'});
+	for (my $i=0;$i<=$#markers;$i++) {
+	    $message.=&storeparm(split(/\&/,$markers[$i]),
+				 $values[$i],
+				 $types[$i],
+				 $uname,$udom,$csec);
+	}
 # ---------------------------------------------------------------- Done storing
 	$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>';
     }
@@ -1877,6 +1877,7 @@
 	    $r->print('<h2><font color="red">'.
 		      &mt('Error deleting parameters').'</font></h2>');
 	}
+	&Apache::lonnet::devalidatecourseresdata($crs,$dom);
     }
     if ($putentries) {
 	if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {
@@ -1885,6 +1886,7 @@
 	    $r->print('<h2><font color="red">'.
 		      &mt('Error storing parameters').'</font></h2>');
 	}
+	&Apache::lonnet::devalidatecourseresdata($crs,$dom);
     }
 # Read and display
     my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs);
@@ -2149,7 +2151,10 @@
 	return OK;
     }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-					    ['action','state']);
+					    ['action','state',
+                                             'pres_marker',
+                                             'pres_value',
+                                             'pres_type']);
 
 
     &Apache::lonhtmlcommon::clear_breadcrumbs();