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

www lon-capa-cvs@mail.lon-capa.org
Mon, 14 Nov 2005 13:57:00 -0000


www		Mon Nov 14 08:57:00 2005 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Bug #4369: do not let users copy folders that have subfolders
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.210 loncom/interface/londocs.pm:1.211
--- loncom/interface/londocs.pm:1.210	Fri Nov  4 16:39:26 2005
+++ loncom/interface/londocs.pm	Mon Nov 14 08:56:58 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.210 2005/11/04 21:39:26 albertel Exp $
+# $Id: londocs.pm,v 1.211 2005/11/14 13:56:58 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1453,7 +1453,24 @@
                 'ct' => 'Cut',
 		'rn' => 'Rename',
 		'cp' => 'Copy');
+	my $nocopy=0;
+        if ($url=~/\.(page|sequence)$/) {
+	    foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url))) {
+		my ($title,$url,$ext,$type)=split(/\:/,$_);
+		if (($url=~/\.(page|sequence)/) && ($type ne 'zombie')) {
+		    $nocopy=1;
+		    last;
+		}
+	    }
+	}
+        my $copylink=' ';
         if ($env{'form.pagepath'}) {
+           unless ($nocopy) {
+               $copylink=(<<ENDCOPY);
+<a href='javascript:markcopy("$pagepath","$index","$renametitle","page","$pagesymb");'>
+<font size="-2" color="#000099">$lt{'cp'}</font></a></td>
+ENDCOPY
+            }
             $line.=(<<END);
 <form name="entry_$index" action="/adm/coursedocs" method="post">
 <input type="hidden" name="pagepath" value="$env{'form.pagepath'}" />
@@ -1477,10 +1494,15 @@
 <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");'>
-<font size="-2" color="#000099">$lt{'cp'}</font></a></td>
+$copylink
 END
         } else {
+           unless ($nocopy) {
+               $copylink=(<<ENDCOPY);
+<a href='javascript:markcopy("$folderpath","$index","$renametitle","sequence");'>
+<font size="-2" color="#000099">$lt{'cp'}</font></a></td>
+ENDCOPY
+            }
             $line.=(<<END); 
 <form name="entry_$index" action="/adm/coursedocs" method="post">
 <input type="hidden" name="folderpath" value="$env{'form.folderpath'}" />
@@ -1503,8 +1525,7 @@
 <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");'>
-<font size="-2" color="#000099">$lt{'cp'}</font></a></td>
+$copylink
 END
         }
     }