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

www lon-capa-cvs@mail.lon-capa.org
Tue, 28 Nov 2006 15:03:19 -0000


www		Tue Nov 28 10:03:19 2006 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Store (and log) only the parameters that actually changed.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.257 loncom/interface/londocs.pm:1.258
--- loncom/interface/londocs.pm:1.257	Mon Nov 27 16:20:29 2006
+++ loncom/interface/londocs.pm	Tue Nov 28 10:03:19 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.257 2006/11/27 21:20:29 www Exp $
+# $Id: londocs.pm,v 1.258 2006/11/28 15:03:19 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1215,27 +1215,33 @@
 	    if ($env{'form.changeparms'}) {
 		my $idx=$env{'form.setparms'};
 # set parameters
-		if ($env{'form.randpick_'.$idx}) {
-		    &LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos');
-                    &remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx});
-		} else {
-		    &LONCAPA::map::delparameter($idx,'parameter_randompick');
-                    &remember_parms($idx,'randompick','del');
+		if ($env{'form.changeparms'} eq 'randompick') {
+		    if ($env{'form.randpick_'.$idx}) {
+			&LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos');
+			&remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx});
+		    } else {
+			&LONCAPA::map::delparameter($idx,'parameter_randompick');
+			&remember_parms($idx,'randompick','del');
+		    }
+		}
+		if ($env{'form.changeparms'} eq 'hiddenresource') {
+		    if ($env{'form.hidprs_'.$idx}) {
+			&LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno');
+			&remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx});
+		    } else {
+			&LONCAPA::map::delparameter($idx,'parameter_hiddenresource');
+			&remember_parms($idx,'hiddenresource','del');
+		    }
+		}
+		if ($env{'form.changeparms'} eq 'encrypturl') {
+		    if ($env{'form.encprs_'.$idx}) {
+			&LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno');
+			&remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx});
+		    } else {
+			&LONCAPA::map::delparameter($idx,'parameter_encrypturl');
+			&remember_parms($idx,'encrypturl','del');
+		    }
 		}
-		if ($env{'form.hidprs_'.$idx}) {
-		    &LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno');
-                    &remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx});
- 		} else {
-		    &LONCAPA::map::delparameter($idx,'parameter_hiddenresource');
-                    &remember_parms($idx,'hiddenresource','del');
- 		}
-		if ($env{'form.encprs_'.$idx}) {
-		    &LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno');
-                    &remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx});
- 		} else {
-		    &LONCAPA::map::delparameter($idx,'parameter_encrypturl');
-                    &remember_parms($idx,'encrypturl','del');
- 		}
 # store the changed version
 		($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
 		if ($fatal) {
@@ -1834,7 +1840,7 @@
                                               'parameter_encrypturl'))[0]=~/^yes$/i);
 	$url.='folderpath='.&escape($folderpath).$cpinfo;
 	$parameterset='<label>'.&mt('Randomly Pick: ').
-	    '<input type="text" size="4" onChange="this.form.changeparms.value=1;this.form.submit()" name="randpick_'.$orderidx.'" value="'.
+	    '<input type="text" size="4" onChange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randpick_'.$orderidx.'" value="'.
 	    (&LONCAPA::map::getparameter($orderidx,
                                               'parameter_randompick'))[0].
                                               '" />'.
@@ -1873,9 +1879,9 @@
 	    ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');
 	$line.=(<<ENDPARMS);
 <td bgcolor="#BBBBFF"><font size='-2'>
-<nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value=1;this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td>
+<nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td>
 <td bgcolor="#BBBBFF"><font size='-2'>
-<nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value=1;this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td>
+<nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td>
 <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>
 ENDPARMS
     }