[LON-CAPA-cvs] cvs: rat / lonratedt.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 25 Oct 2002 13:40:52 -0000
www Fri Oct 25 09:40:52 2002 EDT
Modified files:
/rat lonratedt.pm
Log:
Bug #881
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.38 rat/lonratedt.pm:1.39
--- rat/lonratedt.pm:1.38 Fri Oct 11 10:00:42 2002
+++ rat/lonratedt.pm Fri Oct 25 09:40:52 2002
@@ -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 @@
}
&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 @@
} split(/\&/,$importdetail));
$idx=0;
+ $targetdetail='';
my $targetwindow=
'<option value="0"> ------- Target Edit Map ------- </option>'.
join("\n",map {
@@ -748,6 +775,19 @@
[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();
+ }
+ }
+
</script>
</head>
$bodytag
@@ -755,6 +795,9 @@
<font color=red>$errtext</font>
<form name=simpleedit method=post>
<input type=hidden name=forcesmp value=1>
+<input type=hidden name=renameres value=0>
+<input type=hidden name=renametitle value=''>
+<input type=hidden name=renameidx value=0>
<table>
<tr><th width="40%">Temporary Assembly Workspace</th>
<th> </th>
@@ -779,6 +822,10 @@
<input type=button onClick=
"javascript:impfortarget.value=1;groupimport();" value="Import">
after selected
+<hr>
+<input type=submit name="moveup" value="Move Up">
+<input type=submit name="movedown" value="Move Down">
+<input type=button onClick="javascript:renametarget()" value="Rename">
<hr>$targetmsg
<input type=submit name="revert" value="Revert to Last Saved">
<input type=submit name="save" value="Save">