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

www lon-capa-cvs@mail.lon-capa.org
Mon, 26 Apr 2004 17:50:37 -0000


www		Mon Apr 26 13:50:37 2004 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
    /rat	lonratedt.pm 
  Log:
  Bug #883: Being able to set parameters in DOCS
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.121 loncom/interface/londocs.pm:1.122
--- loncom/interface/londocs.pm:1.121	Mon Apr 26 12:56:26 2004
+++ loncom/interface/londocs.pm	Mon Apr 26 13:50:37 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.121 2004/04/26 16:56:26 www Exp $
+# $Id: londocs.pm,v 1.122 2004/04/26 17:50:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -305,19 +305,19 @@
 	    if (defined($ENV{'form.setparms'})) {
 		my $idx=$ENV{'form.setparms'};
 		if ($ENV{'form.randpick_'.$idx}) {
-		    &Apache::lonratedt::storeparameter($idx,'randompick',$ENV{'form.randpick_'.$idx},'int_pos');
+		    &Apache::lonratedt::storeparameter($idx,'parameter_randompick',$ENV{'form.randpick_'.$idx},'int_pos');
 		} else {
-		    &Apache::lonratedt::delparameter($idx,'randompick');
+		    &Apache::lonratedt::delparameter($idx,'parameter_randompick');
 		}
 		if ($ENV{'form.hidprs_'.$idx}) {
-		    &Apache::lonratedt::storeparameter($idx,'hiddenresource','yes','string_yesno');
+		    &Apache::lonratedt::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno');
 		} else {
-		    &Apache::lonratedt::delparameter($idx,'hiddenresource');
+		    &Apache::lonratedt::delparameter($idx,'parameter_hiddenresource');
 		}
 		if ($ENV{'form.encprs_'.$idx}) {
-		    &Apache::lonratedt::storeparameter($idx,'encrypturl','yes','string_yesno');
+		    &Apache::lonratedt::storeparameter($idx,'parameter_encrypturl','yes','string_yesno');
 		} else {
-		    &Apache::lonratedt::delparameter($idx,'encrypturl');
+		    &Apache::lonratedt::delparameter($idx,'parameter_encrypturl');
 		}
 
 		($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.sequence');
@@ -463,6 +463,7 @@
      &Apache::lonnet::unescape($title)),'"<>&\'');
     my $renametitle=$title;
     my $foldertitle=$title;
+    my $orderidx=$Apache::lonratedt::order[$index];
     if ($title=~ /^(\d+)___&amp;&amp;&amp;___(\w+)___&amp;&amp;&amp;___(\w+)___&amp;&amp;&amp;___(.*)$/	) { 
 	$foldertitle=&Apache::lontexconvert::msgtexconverted($4);
 	$renametitle=$4;
@@ -487,7 +488,7 @@
 	$line.=(<<END);
 <form name="entry_$index" action="/adm/coursedocs" method="post">
 <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
-<input type="hidden" name="setparms" value="$index" />
+<input type="hidden" name="setparms" value="$orderidx" />
 <td><table border='0' cellspacing='2' cellpadding='0'>
 <tr><td bgcolor="#DDDDDD">
 <a href='/adm/coursedocs?cmd=up_$index&folderpath=$folderpath'>
@@ -538,8 +539,8 @@
 	$folderpath.=$folderarg.'&'.$foldername;
 	$url.='folderpath='.&Apache::lonnet::escape($folderpath);
 	$parameterset=&mt('Randomly Pick: ').
-	    '<input type="text" size="4" name="randpick_'.$index.'" value="'.
-	    &Apache::lonratedt::getparameter($index,'randompick').'" />';
+	    '<input type="text" size="4" name="randpick_'.$orderidx.'" value="'.
+	    (&Apache::lonratedt::getparameter($orderidx,'parameter_randompick'))[0].'" />';
     }
     $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'"><img src="'.$icon.
 	'" border="0"></a></td>'.
@@ -549,11 +550,15 @@
  			      'hd' => 'Hidden',
  			      'ec' => 'URL hidden',
  			      'sp' => 'Store Parameters');
+	my $enctext=
+	    ((&Apache::lonratedt::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');
+	my $hidtext=
+	    ((&Apache::lonratedt::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');
 	$line.=(<<ENDPARMS);
 <td bgcolor="#BBBBFF"><font size='-2'>
-<input type="checkbox" name="hidprs_$index" /> $lt{'hd'}</td>
+<input type="checkbox" name="hidprs_$orderidx" $hidtext/> $lt{'hd'}</td>
 <td bgcolor="#BBBBFF"><font size='-2'>
-<input type="checkbox" name="encprs_$index" /> $lt{'ec'}</td>
+<input type="checkbox" name="encprs_$orderidx" $enctext/> $lt{'ec'}</td>
 <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>
 <td bgcolor="#BBBBFF"><font size='-2'>
 <input type="submit" value="$lt{'sp'}" />
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.57 rat/lonratedt.pm:1.58
--- rat/lonratedt.pm:1.57	Mon Apr 26 12:56:26 2004
+++ rat/lonratedt.pm	Mon Apr 26 13:50:37 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.57 2004/04/26 16:56:26 www Exp $
+# $Id: lonratedt.pm,v 1.58 2004/04/26 17:50:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -187,8 +187,10 @@
     undef @links;
     undef @resources;
     undef @order;
+    undef @resparms;
     @resources=('');
     @order=();
+    @resparms=();
 
     my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,'');
     if ($errtext) { return ($errtext,2); }
@@ -574,7 +576,7 @@
 }
 
 sub getparameter {
-    my ($to,$name);
+    my ($to,$name)=@_;
     my $value=undef;
     my $ptype=undef;
     foreach (split('&&&',$resparms[$to])) {