/*
- * Copyright 2011 GRNET S.A. All rights reserved.
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
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;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
*/
@Source("gr/grnet/pithos/resources/translate.png")
ImageResource selectAll();
+
+ @Source("gr/grnet/pithos/resources/internet.png")
+ ImageResource internet();
}
public static native String getDate()/*-{
*
* @param newImages the image bundle passed on by the parent object
*/
- public FileContextMenu(final Pithos app, Images newImages, TreeView selectedTree, Folder selectedFolder, List<File> selectedFiles) {
+ public FileContextMenu(final Pithos app, Images newImages, TreeView selectedTree, Folder selectedFolder, final List<File> selectedFiles) {
// The popup's constructor's argument is a boolean specifying that it
// auto-close itself when the user clicks outside of it.
super(true);
}
}
boolean isFolderTreeSelected = selectedTree.equals(app.getFolderTreeView());
+ boolean isMysharedSelected = selectedTree.equals(app.getMySharedTreeView());
if (selectedFolder != null) {
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() + " Paste</span>", true, new PasteCommand(app, this, selectedFolder));
- contextMenu.addItem(pasteItem);
- }
+ if (canWrite && app.getClipboard().hasFiles() && !isMysharedSelected) {
+ pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " 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() + " 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() + " Cut</span>", true, new CutCommand(app, this, selectedFiles));
contextMenu.addItem(cutItem);
}
+ copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " 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() + " Move to Trash</span>", true, new ToTrashCommand(app, this, selectedFiles));
contextMenu.addItem(trashItem);
}
contextMenu.addItem(restore);
}
}
- copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " 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() + " Delete</span>", true, new DeleteCommand(app, this, selectedFiles, MessagePanel.images));
contextMenu.addItem(deleteItem);
}
-// MenuItem refresh = new MenuItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
-// contextMenu.addItem(refresh);
-// sharingItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1));
-// contextMenu.addItem(sharingItem);
if (selectedFolder != null && !selectedFolder.isInTrash()) {
- if (isFolderTreeSelected && selectedFiles.size() == 1)
- contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(app, this, selectedFiles, images, 0)));
+ if ((isFolderTreeSelected || isMysharedSelected) && selectedFiles.size() == 1) {
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.PROPERTIES)));
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.PERMISSIONS)));
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.internet()).getHTML() + " Publish</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.PUBLISH)));
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + " Versions</span>", true, new PropertiesCommand(app, this, selectedFiles, PropertiesCommand.VERSIONS)));
+ }
}
- if (selectedFiles.size() == 1)
- contextMenu.addItem(new MenuItem("<span><a class='hidden-link' href='" + app.getApiPath() + selectedFiles.get(0).getOwner() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + app.getToken() + "' target='_blank'>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</a></span>", true, (Command) null));
- MenuItem unSelect = new MenuItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, new Command() {
- @Override
- public void execute() {
- hide();
- app.getFileList().clearSelectedRows();
- }
- });
- contextMenu.addItem(unSelect);
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</span>", true, new Command() {
+
+ @Override
+ public void execute() {
+ for (File f : selectedFiles)
+ Window.open(app.getApiPath() + f.getOwner() + f.getUri(), "_blank", "");
+ }
+ }));
add(contextMenu);
}