Enabled copy between users
authorChristos Stathis <chstath@ebs.gr>
Thu, 29 Sep 2011 15:18:22 +0000 (18:18 +0300)
committerChristos Stathis <chstath@ebs.gr>
Thu, 29 Sep 2011 15:18:22 +0000 (18:18 +0300)
web_client/src/gr/grnet/pithos/web/client/FileContextMenu.java
web_client/src/gr/grnet/pithos/web/client/FolderContextMenu.java
web_client/src/gr/grnet/pithos/web/client/Pithos.java

index d25c08e..92fb0d6 100644 (file)
@@ -203,10 +203,8 @@ public class FileContextMenu extends PopupPanel {
                    if (!selectedFolder.isInTrash()) {
                        if (canWrite && app.getClipboard().hasFiles()) {
                                List<File> files = (List<File>) app.getClipboard().getItem();
-                               if (files.get(0).getOwner().equals(selectedFolder.getOwner())) {
-                                       pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + "&nbsp;Paste</span>", true, new PasteCommand(app, this, selectedFolder));
-                                       contextMenu.addItem(pasteItem);
-                               }
+                               pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + "&nbsp;Paste</span>", true, new PasteCommand(app, this, selectedFolder));
+                               contextMenu.addItem(pasteItem);
                        }
                
                        if (canWrite) {
index c030730..9c59ff6 100644 (file)
@@ -113,16 +113,11 @@ public class FolderContextMenu extends PopupPanel {
                if (canWrite) {
                        if (!app.getClipboard().isEmpty()) {
                                Object item = app.getClipboard().getItem();
-                               boolean showPaste = false;
-                               if (item instanceof List) {
-                                       List<File> files = (List<File>) item;
-                                       if (files.get(0).getOwner().equals(folder.getOwner()))
-                                               showPaste = true;
-                               }
-                               else {
+                               boolean showPaste = true;
+                               if (item instanceof Folder) {
                                        Folder f = (Folder) item;
-                                       if (f.getOwner().equals(folder.getOwner()) && !f.contains(folder))
-                                               showPaste = true;
+                                       if (f.contains(folder))
+                                               showPaste = false;
                                }
                                if (showPaste) {
                                    pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + "&nbsp;Paste</span>", true, new PasteCommand(app, this, folder));
index ec96178..5e2e59f 100644 (file)
@@ -928,6 +928,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
             };
             copyFile.setHeader("X-Auth-Token", getToken());
             copyFile.setHeader("X-Copy-From", file.getUri());
+            if (!file.getOwner().equals(targetUsername))
+               copyFile.setHeader("X-Source-Account", file.getOwner());
             Scheduler.get().scheduleDeferred(copyFile);
         }
         else  if (callback != null) {