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)));
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(app, this, selectedFiles, 0)));
}
contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</span>", true, new Command() {
MenuItem delete = new MenuItem("<span id = 'folderContextMenu.delete'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(app, this, folder, MessagePanel.images));
contextMenu.addItem(delete);
- MenuItem properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(app, this, folder, newImages, 0));
+ MenuItem properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(app, this, folder, 0));
contextMenu.addItem(properties);
}
}
package gr.grnet.pithos.web.client;
import gr.grnet.pithos.web.client.commands.NewFolderCommand;
+import gr.grnet.pithos.web.client.commands.PropertiesCommand;
import gr.grnet.pithos.web.client.commands.UploadFileCommand;
import gr.grnet.pithos.web.client.foldertree.AccountResource;
import gr.grnet.pithos.web.client.foldertree.File;
});
toolbar.add(newFolderButton);
+ Anchor shareFolderButton = new Anchor("<span class='ico'></span><span class='title'>Share folder</span>", true);
+ shareFolderButton.getElement().setId("sharefolder-button");
+ shareFolderButton.addStyleName("pithos-toolbarItem");
+ shareFolderButton.addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(@SuppressWarnings("unused") ClickEvent event) {
+ Folder folder = getSelectedTree().getSelection();
+ if (folder != null) {
+ Boolean[] permissions = folder.getPermissions().get(getUsername());
+ boolean canWrite = folder.getOwner().equals(getUsername()) || (permissions!= null && permissions[1] != null && permissions[1]);
+ boolean isFolderTreeSelected = selectedTree.equals(getFolderTreeView());
+
+ if (!folder.isInTrash() && canWrite && isFolderTreeSelected && !folder.isContainer())
+ new PropertiesCommand(Pithos.this, null, folder, 1).execute();
+ }
+ }
+ });
+ toolbar.add(shareFolderButton);
+
refreshButton = new Anchor("<span class='ico'></span><span class='title'>Refresh</span>", true);
refreshButton.getElement().setId("refresh-button");
refreshButton.addStyleName("pithos-toolbarItem");
MenuItem properties = null;
if (files != null && files.size() == 1)
- properties = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " File properties</span>", true, new PropertiesCommand(app, this, files, images, 0));
+ properties = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " File properties</span>", true, new PropertiesCommand(app, this, files, 0));
else if (!folder.isContainer())
- properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Folder properties</span>", true, new PropertiesCommand(app, this, folder, newImages, 0));
+ properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Folder properties</span>", true, new PropertiesCommand(app, this, folder, 0));
if (properties != null)
contextMenu.addItem(properties);
}
*/
public class PropertiesCommand implements Command {
- final FileContextMenu.Images newImages;
-
private PopupPanel containerPanel;
private int tabToShow = 0;
* @param _newImages the images of all the possible delete dialogs
* @param _tab the tab to switch to
*/
- public PropertiesCommand(Pithos _app, PopupPanel _containerPanel, Object _resource, final FileContextMenu.Images _newImages, int _tab) {
+ public PropertiesCommand(Pithos _app, PopupPanel _containerPanel, Object _resource, int _tab) {
containerPanel = _containerPanel;
- newImages = _newImages;
tabToShow = _tab;
resource = _resource;
app = _app;
background-image: url(images/folder_new.png);
}
+#shareFolder-button span.ico {
+ background-image: url(images/myshared22.png);
+}
+
/*move background from inner to centerinner to wrap action buttons too*/
.dialogMiddleCenterInner.dialogContent {
background: url(images/white50.png);