[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 06 May 2004 17:55:03 -0000
www Thu May 6 13:55:03 2004 EDT
Modified files:
/loncom/interface londocs.pm
Log:
I really don't want to do this, but here we go: position selection boxes in
DOCS (just starting, not wired up yet).
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.122 loncom/interface/londocs.pm:1.123
--- loncom/interface/londocs.pm:1.122 Mon Apr 26 13:50:37 2004
+++ loncom/interface/londocs.pm Thu May 6 13:55:03 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.122 2004/04/26 17:50:37 www Exp $
+# $Id: londocs.pm,v 1.123 2004/05/06 17:55:03 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -301,9 +301,10 @@
# ---------------- if they are for this folder and user allowed to make changes
if (($allowed) && ($ENV{'form.folder'} eq $folder)) {
-# set parameters
+# set parameters and change order
if (defined($ENV{'form.setparms'})) {
my $idx=$ENV{'form.setparms'};
+# set parameters
if ($ENV{'form.randpick_'.$idx}) {
&Apache::lonratedt::storeparameter($idx,'parameter_randompick',$ENV{'form.randpick_'.$idx},'int_pos');
} else {
@@ -325,6 +326,20 @@
$r->print('<p><font color="red">'.$errtext.'</font></p>');
return;
}
+ if ($ENV{'form.newpos'}) {
+# change order
+
+ my $newpos=$ENV{'form.newpos'}-1;
+ $r->print('Sorting '.$idx.' -> '.$newpos);
+ ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.sequence');
+ if ($fatal) {
+ $r->print('<p><font color="red">'.$errtext.'</font></p>');
+ return;
+ }
+
+ }
+
+
}
# upload a file, if present
if (($ENV{'form.uploaddoc.filename'}) &&
@@ -480,6 +495,20 @@
# $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"');
}
if ($allowed) {
+ my $incindex=$index+1;
+ my $selectbox='';
+ if ($folder!~/^supplemental/) {
+ $selectbox=
+ '<select name="newpos" onChange="this.form.submit()">';
+ for (my $i=1;$i<=$#Apache::lonratedt::order+1;$i++) {
+ if ($i==$incindex) {
+ $selectbox.='<option value="" selected="1">('.$i.')</option>';
+ } else {
+ $selectbox.='<option value="'.$i.'">'.$i.'</option>';
+ }
+ }
+ $selectbox.='</select>';
+ }
my %lt=&Apache::lonlocal::texthash(
'up' => 'Move Up',
'dw' => 'Move Down',
@@ -496,7 +525,9 @@
<tr><td bgcolor="#DDDDDD">
<a href='/adm/coursedocs?cmd=down_$index&folderpath=$folderpath'>
<img src="${iconpath}move_down.gif" alt='$lt{'dw'}' border='0' /></a></td></tr>
-</table></td><td bgcolor="#DDDDDD">
+</table></td>
+<td>$selectbox
+</td><td bgcolor="#DDDDDD">
<a href='javascript:removeres("$folderpath","$index","$renametitle");'>
<font size="-2" color="#990000">$lt{'rm'}</font></a>
<a href='javascript:changename("$folderpath","$index","$renametitle");'>