--- loncom/interface/londocs.pm	2002/10/21 20:31:06	1.35
+++ loncom/interface/londocs.pm	2002/10/25 13:39:36	1.36
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.35 2002/10/21 20:31:06 albertel Exp $
+# $Id: londocs.pm,v 1.36 2002/10/25 13:39:36 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -127,6 +127,18 @@ sub editor {
                     $Apache::lonratedt::order[$idx+1]=
 			$Apache::lonratedt::order[$idx];
                     $Apache::lonratedt::order[$idx]=$i;
+                } elsif ($cmd eq 'rename') {
+                    my ($rtitle,@rrest)=split(/\:/,
+                       $Apache::lonratedt::resources[
+				       $Apache::lonratedt::order[$idx]]);
+                    my $comment=$ENV{'form.title'};
+                    $comment=~s/\</\&lt\;/g;
+                    $comment=~s/\>/\&gt\;/g;
+                    $comment=~s/\:/\&colon;/g;
+                    $Apache::lonratedt::resources[
+				       $Apache::lonratedt::order[$idx]]=
+                             $comment.':'.join(':',@rrest);
+                    
                 }
 # Store the changed version
 		&storemap($coursenum,$coursedom,$folder.'.sequence');
@@ -183,7 +195,10 @@ sub entryline {
 <tr><td><a href='/adm/coursedocs?folder=$folder&cmd=down_$index'>
 <img src="${iconpath}move_down.gif" alt='DOWN' border='0' /></a></td></tr>
 </table></td><td>
-<a href='/adm/coursedocs?folder=$folder&cmd=del_$index'>Remove</td>
+<a href='/adm/coursedocs?folder=$folder&cmd=del_$index'>
+<font size="-2">Remove</font></a>
+<a href='javascript:changename("$folder","$index","$title");'>
+<font size="-2">Rename</font></a></td>
 END
     }
 # Figure out what kind of a resource this is
@@ -517,7 +532,22 @@ function finishpick() {
      ('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+
     '";this.document.forms.'+form+'.submit();');
 }
+
+function changename(folder,index,oldtitle) {
+    var title=prompt('New Title',oldtitle);
+    if (title) {
+	this.document.forms.renameform.title.value=title;
+	this.document.forms.renameform.cmd.value='rename_'+index;
+	this.document.forms.renameform.folder.value=folder;
+        this.document.forms.renameform.submit();
+    }
+}
 </script>
+<form name="renameform" method="post" action="/adm/coursedocs">
+<input type="hidden" name="title" />
+<input type="hidden" name="cmd" />
+<input type="hidden" name="folder" />
+</form>
 ENDNEWSCRIPT
   }
 # -------------------------------------------------------------------- Body tag