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

www lon-capa-cvs@mail.lon-capa.org
Thu, 06 May 2004 18:28:16 -0000


www		Thu May  6 14:28:16 2004 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Just saving my work.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.123 loncom/interface/londocs.pm:1.124
--- loncom/interface/londocs.pm:1.123	Thu May  6 13:55:03 2004
+++ loncom/interface/londocs.pm	Thu May  6 14:28:16 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.123 2004/05/06 17:55:03 www Exp $
+# $Id: londocs.pm,v 1.124 2004/05/06 18:28:16 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -321,26 +321,23 @@
 		    &Apache::lonratedt::delparameter($idx,'parameter_encrypturl');
 		}
 
-		($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.sequence');
-		if ($fatal) {
-		    $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;
-		    }
-
+		    my $currentpos=$ENV{'form.currentpos'}-1;
+		    $r->print('Sorting '.$idx.': '.$currentpos.' -> '.$newpos);
 		}
-	       
+# store the changed version
 
+		($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'}) &&
                ($ENV{'form.cmd'}=~/^upload_(\w+)/)) {
@@ -499,6 +496,7 @@
 	my $selectbox='';
 	if ($folder!~/^supplemental/) {
 	    $selectbox=
+		'<input type="hidden" name="currentpos" value="'.$incindex.'" />'.
 		'<select name="newpos" onChange="this.form.submit()">';
 	    for (my $i=1;$i<=$#Apache::lonratedt::order+1;$i++) {
 		if ($i==$incindex) {