Merge branch 'packaging' into debian
[pithos-web-client] / src / gr / grnet / pithos / web / client / FileContextMenu.java
index 6273de7..d06f79f 100644 (file)
@@ -47,6 +47,7 @@ import gr.grnet.pithos.web.client.foldertree.Folder;
 
 import java.util.List;
 
+import com.google.gwt.http.client.URL;
 import com.google.gwt.resources.client.ClientBundle;
 import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.user.client.Command;
@@ -169,6 +170,9 @@ public class FileContextMenu extends PopupPanel {
          */
         @Source("gr/grnet/pithos/resources/translate.png")
         ImageResource selectAll();
+        
+        @Source("gr/grnet/pithos/resources/internet.png")
+        ImageResource internet();
     }
 
        public static native String getDate()/*-{
@@ -200,24 +204,27 @@ public class FileContextMenu extends PopupPanel {
                }
         }
         boolean isFolderTreeSelected = selectedTree.equals(app.getFolderTreeView());
+        boolean isMysharedSelected = selectedTree.equals(app.getMySharedTreeView());
         if (selectedFolder != null) {
                    if (!selectedFolder.isInTrash()) {
-                       if (canWrite && app.getClipboard().hasFiles()) {
+                       if (canWrite && app.getClipboard().hasFiles() && !isMysharedSelected) {
                                pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + "&nbsp;Paste</span>", true, new PasteCommand(app, this, selectedFolder));
                                contextMenu.addItem(pasteItem);
                        }
                
-                       if (canWrite) {
+                       if (canWrite && !isMysharedSelected) {
                                MenuItem upload = new MenuItem("<span>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(app, this, selectedFolder));
                                contextMenu.addItem(upload);
                        }
-                       if (isFolderTreeSelected) {
+                       if (isFolderTreeSelected || isMysharedSelected) {
                                        cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut</span>", true, new CutCommand(app, this, selectedFiles));
                            contextMenu.addItem(cutItem);
                        }
                
+                               copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + "&nbsp;Copy</span>", true, new CopyCommand(app, this, selectedFiles));
+                       contextMenu.addItem(copyItem);
                
-                       if (isFolderTreeSelected) {
+                       if (isFolderTreeSelected || isMysharedSelected) {
                                        trashItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + "&nbsp;Move to Trash</span>", true, new ToTrashCommand(app, this, selectedFiles));
                            contextMenu.addItem(trashItem);
                        }
@@ -227,19 +234,18 @@ public class FileContextMenu extends PopupPanel {
                                contextMenu.addItem(restore);
                    }
         }
-               copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + "&nbsp;Copy</span>", true, new CopyCommand(app, this, selectedFiles));
-        contextMenu.addItem(copyItem);
 
-        if (isFolderTreeSelected) {
+        if (isFolderTreeSelected || isMysharedSelected) {
                        deleteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(app, this, selectedFiles, MessagePanel.images));
                contextMenu.addItem(deleteItem);
         }
 
         if (selectedFolder != null && !selectedFolder.isInTrash()) {
-               if (isFolderTreeSelected && selectedFiles.size() == 1) {
+               if ((isFolderTreeSelected || isMysharedSelected) && selectedFiles.size() == 1) {
                        contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.PROPERTIES)));
                        contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.PERMISSIONS)));
-                       contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + "&nbsp;Versions</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.VERSIONS)));
+                       contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.internet()).getHTML() + "&nbsp;Publish</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.PUBLISH)));
+                               contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + "&nbsp;Versions</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.VERSIONS)));
                }
 
         }
@@ -248,7 +254,7 @@ public class FileContextMenu extends PopupPanel {
                        @Override
                        public void execute() {
                                for (File f : selectedFiles)
-                                       Window.open(app.getApiPath() + f.getOwner() + f.getUri() + "?X-Auth-Token=" + app.getToken(), "_blank", "");
+                                       Window.open(app.getApiPath() + f.getOwner() + f.getUri(), "_blank", "");
                        }
                }));