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

www lon-capa-cvs@mail.lon-capa.org
Thu, 10 Mar 2005 16:11:32 -0000


www		Thu Mar 10 11:11:32 2005 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  "Cut" functionality
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.170 loncom/interface/londocs.pm:1.171
--- loncom/interface/londocs.pm:1.170	Wed Mar  9 21:34:58 2005
+++ loncom/interface/londocs.pm	Thu Mar 10 11:11:32 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.170 2005/03/10 02:34:58 www Exp $
+# $Id: londocs.pm,v 1.171 2005/03/10 16:11:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1093,6 +1093,13 @@
                           $Apache::lonratedt::order[$i+1];
                     }
                     $#Apache::lonratedt::order--;
+                } elsif ($cmd eq 'cut') {
+		    my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]);
+		    for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {
+                        $Apache::lonratedt::order[$i]=
+                          $Apache::lonratedt::order[$i+1];
+                    }
+                    $#Apache::lonratedt::order--;
                 } elsif ($cmd eq 'up') {
 		  if (($idx) && (defined($Apache::lonratedt::order[$idx-1]))) {
                     my $i=$Apache::lonratedt::order[$idx-1];
@@ -1280,6 +1287,7 @@
                 'up' => 'Move Up',
 		'dw' => 'Move Down',
 		'rm' => 'Remove',
+                'ct' => 'Cut',
 		'rn' => 'Rename',
 		'cp' => 'Copy');
         if ($ENV{'form.pagepath'}) {
@@ -1302,6 +1310,8 @@
 </td><td bgcolor="#DDDDDD">
 <a href='javascript:removeres("$pagepath","$index","$renametitle","page","$pagesymb");'>
 <font size="-2" color="#990000">$lt{'rm'}</font></a>
+<a href='javascript:cutres("$pagepath","$index","$renametitle","page","$pagesymb");'>
+<font size="-2" color="#550044">$lt{'ct'}</font></a>
 <a href='javascript:changename("$pagepath","$index","$renametitle","page","$pagesymb");'>
 <font size="-2" color="#009900">$lt{'rn'}</font></a>
 <a href='javascript:markcopy("$pagepath","$index","$renametitle","page","$pagesymb");'>
@@ -1326,6 +1336,8 @@
 </td><td bgcolor="#DDDDDD">
 <a href='javascript:removeres("$folderpath","$index","$renametitle","sequence");'>
 <font size="-2" color="#990000">$lt{'rm'}</font></a>
+<a href='javascript:cutres("$folderpath","$index","$renametitle","sequence");'>
+<font size="-2" color="#550044">$lt{'ct'}</font></a>
 <a href='javascript:changename("$folderpath","$index","$renametitle","sequence");'>
 <font size="-2" color="#009900">$lt{'rn'}</font></a>
 <a href='javascript:markcopy("$folderpath","$index","$renametitle","sequence");'>
@@ -2094,7 +2106,7 @@
 }
 
 function removeres(folderpath,index,oldtitle,container,pagesymb) {
-    if (confirm('Remove "'+oldtitle+'"?')) {
+    if (confirm('WARNING: Removing a resource makes associated grades and scores inaccessible!\\nRemove "'+oldtitle+'"?')) {
 	this.document.forms.renameform.cmd.value='del_'+index;
         if (container == 'sequence') {
             this.document.forms.renameform.folderpath.value=folderpath;
@@ -2107,6 +2119,21 @@
     }
 }
 
+function cutres(folderpath,index,oldtitle,container,pagesymb) {
+    if (confirm('WARNING: Cutting a resource makes associated grades and scores inaccessible,\\neven if it is pasted in again elsewhere!\\nCut "'+oldtitle+'"?')) {
+	this.document.forms.renameform.cmd.value='cut_'+index;
+	this.document.forms.renameform.markcopy.value=index;
+        if (container == 'sequence') {
+            this.document.forms.renameform.folderpath.value=folderpath;
+        }
+        if (container == 'page') {
+            this.document.forms.renameform.pagepath.value=folderpath;
+            this.document.forms.renameform.pagesymb.value=pagesymb;
+        }
+        this.document.forms.renameform.submit();
+    }
+}
+
 function markcopy(folderpath,index,oldtitle,container,pagesymb) {
     this.document.forms.renameform.markcopy.value=index;
     if (container == 'sequence') {