--- rat/lonratedt.pm 2002/10/11 14:00:42 1.38 +++ rat/lonratedt.pm 2002/10/25 13:40:52 1.39 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.38 2002/10/11 14:00:42 www Exp $ +# $Id: lonratedt.pm,v 1.39 2002/10/25 13:40:52 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -686,7 +686,33 @@ sub smpedt { } &pastetarget($lastsel,@newsequence); &storemap(&Apache::lonnet::filelocation('',$url)); -# ------------------------------------------------ +# -------------------------------------------------------------------- Move up + } elsif ($ENV{'form.moveup'}) { + foreach (sort @targetselect) { + if ($_-1>0) { + my $movethis=$order[$_-1]; + $order[$_-1]=$order[$_-2]; + $order[$_-2]=$movethis; + } + } + &storemap(&Apache::lonnet::filelocation('',$url)); +# ------------------------------------------------------------------ Move down + } elsif ($ENV{'form.movedown'}) { + foreach (reverse sort @targetselect) { + if ($_-1<$#order) { + my $movethis=$order[$_-1]; + $order[$_-1]=$order[$_]; + $order[$_]=$movethis; + } + } + &storemap(&Apache::lonnet::filelocation('',$url)); +# --------------------------------------------------------------------- Rename + } elsif ($ENV{'form.renameres'}) { + my $residx=$Apache::lonratedt::order[$ENV{'form.renameidx'}-1]; + my ($name,@resrest)=split(/\:/,$Apache::lonratedt::resources[$residx]); + $name=&Apache::lonnet::escape($ENV{'form.renametitle'}); + $Apache::lonratedt::resources[$residx]=$name.':'.join(':'.@resrest); + &storemap(&Apache::lonnet::filelocation('',$url)); } # ------------------------------------------------------------ Assemble windows @@ -707,6 +733,7 @@ sub smpedt { } split(/\&/,$importdetail)); $idx=0; + $targetdetail=''; my $targetwindow= ''. join("\n",map { @@ -748,6 +775,19 @@ sub smpedt { [document.forms.simpleedit.importsel.selectedIndex]); } + function renametarget() { + var selidx=document.forms.simpleedit.target.selectedIndex; + var entry=(document.forms.simpleedit.targetdetail.value.split('&')) + [selidx]; + var newtitle=prompt('New Title',unescape((entry.split('='))[0])); + if (newtitle) { + document.forms.simpleedit.renameres.value=1; + document.forms.simpleedit.renameidx.value=selidx; + document.forms.simpleedit.renametitle.value=newtitle; + document.forms.simpleedit.submit(); + } + } + $bodytag @@ -755,6 +795,9 @@ $buttons $errtext