diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index 405f60b..adeb1af 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -52,9 +52,9 @@ import org.gcube.portlets.user.workspace.client.event.GetFolderLinkEvent; import org.gcube.portlets.user.workspace.client.event.GetFolderLinkEventHandler; import org.gcube.portlets.user.workspace.client.event.GetInfoEvent; import org.gcube.portlets.user.workspace.client.event.GetInfoEventHandler; -import org.gcube.portlets.user.workspace.client.event.GetPublicLinkEvent; import org.gcube.portlets.user.workspace.client.event.GetPublicLinkEventHandler; import org.gcube.portlets.user.workspace.client.event.GetShareLinkEvent; +import org.gcube.portlets.user.workspace.client.event.GetShareableLink; import org.gcube.portlets.user.workspace.client.event.GetSharedLinkEventHandler; import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent; import org.gcube.portlets.user.workspace.client.event.ImagePreviewEventHandler; @@ -916,18 +916,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } }); - eventBus.addHandler(GetPublicLinkEvent.TYPE, new GetPublicLinkEventHandler() { + eventBus.addHandler(GetShareableLink.TYPE, new GetPublicLinkEventHandler() { @Override - public void onGetPublicLink(GetPublicLinkEvent getPublicLinkEvent) { + public void onGetPublicLink(GetShareableLink getPublicLinkEvent) { // TODO Auto-generated method stub if (getPublicLinkEvent.getSourceFile() != null) { -// DialogGetLink dialog = new DialogGetLink("Copy to clipboard Public Link: Ctrl+C", -// getPublicLinkEvent.getSourceFile(), getPublicLinkEvent.getVersion(), Link_Type.PUBLIC_LINK, -// false); -// dialog.show(); - - new DialogShareableLink(getPublicLinkEvent.getSourceFile(), getPublicLinkEvent.getVersion()); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java index a50d5d0..5dee0b2 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java @@ -89,9 +89,9 @@ public class ConstantsExplorer { public static final String MESSAGE_REFRESH_FOLDER = "Refresh Folder"; public static final String MESSAGE_GET_INFO = "Get Info"; public static final String FILE_VERSIONS = "Versions"; - public static final String MESSAGE_PUBLIC_LINK = "Get Public Link"; - public static final String MESSAGE_FOLDER_LINK = "Get Public Link"; - public static final String MESSAGE_FOLDER_LINK_REMOVE = "Remove Public Link"; + public static final String MESSAGE_SHAREABLE_LINK = "Get Shareable Link"; +// public static final String MESSAGE_FOLDER_LINK = "Get Public Link"; +// public static final String MESSAGE_FOLDER_LINK_REMOVE = "Remove Public Link"; public static final String LISTATTACHMENTSNAMES = "Attachments Names"; public static final String LISTCONTACTSTOSTRING = "ListContactToString"; public static final String STATUS = "Status"; diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java b/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java index 0f49cac..873fe09 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java @@ -28,13 +28,13 @@ public enum WorkspaceOperation { GET_INFO("GTI", "GTI"), // GET INFO HISTORY("HST", "HST"), // HISTORY ACCREAD("ACR", "ACR"), // ACCOUNTING READ - SHARE_LINK("SLK", "SLK"), // SHARE URL LINK + //SHARE_LINK("SLK", "SLK"), // SHARE URL LINK PUBLIC_LINK("PLK", "PLK"), // PUBLIC LINK // ADD_ADMINISTRATOR("AAD", "AAD"), // ADD_ADMINISTRATOR VRE_CHANGE_PERIMISSIONS("CHP", "CHP"), EDIT_PERMISSIONS("EDP", "EDP"), // EDIT PERMISSIONS - FOLDER_LINK("FRL", "FRL"), // FOLDER LINK - FOLDER_LINK_REMOVE("FPR", "FPR"), + //FOLDER_LINK("FRL", "FRL"), // FOLDER LINK + //FOLDER_LINK_REMOVE("FPR", "FPR"), VERSIONING("VRN", "VRN"), // VERSIONING EXECUTE_DM_TASK("EDT", "EDT"), //EXECUTE DM TASK SEND_TO_SWITCHBOARD("SDSB", "SDSB"), //SEND_TO_SWITCHBOARD diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GetPublicLinkEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetPublicLinkEventHandler.java index f5fee61..e117271 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/GetPublicLinkEventHandler.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetPublicLinkEventHandler.java @@ -9,5 +9,5 @@ import com.google.gwt.event.shared.EventHandler; */ public interface GetPublicLinkEventHandler extends EventHandler { - void onGetPublicLink(GetPublicLinkEvent getPublicLinkEvent); + void onGetPublicLink(GetShareableLink getPublicLinkEvent); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GetPublicLinkEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetShareableLink.java similarity index 81% rename from src/main/java/org/gcube/portlets/user/workspace/client/event/GetPublicLinkEvent.java rename to src/main/java/org/gcube/portlets/user/workspace/client/event/GetShareableLink.java index 9b0fc7a..e9f70ac 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/GetPublicLinkEvent.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GetShareableLink.java @@ -6,12 +6,13 @@ import com.google.gwt.event.shared.GwtEvent; /** - * The Class GetPublicLinkEvent. + * The Class GetShareableLink. * - * @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it - * Jan 8, 2019 + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) + * + * Sep 20, 2019 */ -public class GetPublicLinkEvent extends GwtEvent { +public class GetShareableLink extends GwtEvent { public static Type TYPE = new Type(); private FileModel targetFile = null; @@ -23,7 +24,7 @@ public class GetPublicLinkEvent extends GwtEvent { * @param target the target * @param version the version */ - public GetPublicLinkEvent(FileModel target, String version) { + public GetShareableLink(FileModel target, String version) { this.targetFile = target; this.version = version; } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java index 6e209b9..5d5f900 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java @@ -23,10 +23,8 @@ import org.gcube.portlets.user.workspace.client.event.ExecuteDataMinerTaskEvent; import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent; import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType; import org.gcube.portlets.user.workspace.client.event.FileUploadEvent; -import org.gcube.portlets.user.workspace.client.event.GetFolderLinkEvent; import org.gcube.portlets.user.workspace.client.event.GetInfoEvent; -import org.gcube.portlets.user.workspace.client.event.GetPublicLinkEvent; -import org.gcube.portlets.user.workspace.client.event.GetShareLinkEvent; +import org.gcube.portlets.user.workspace.client.event.GetShareableLink; import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent; import org.gcube.portlets.user.workspace.client.event.MoveItemsEvent; import org.gcube.portlets.user.workspace.client.event.OpenUrlEvent; @@ -169,39 +167,41 @@ public class ContextMenuTree { contextMenu.add(mnFileVersioning); - //SHARE LINK - MenuItem mnGetLink = new MenuItem(); - mnGetLink.setId(WorkspaceOperation.SHARE_LINK.getId()); - mnGetLink.setText(ConstantsExplorer.MESSAGE_SHARE_LINK); - mnGetLink.setIcon(Resources.getIconShareLink()); - - mnGetLink.addSelectionListener(new SelectionListener() { - public void componentSelected(MenuEvent ce) { - - for (FileModel sel : listSelectedItems) { - eventBus.fireEvent(new GetShareLinkEvent(sel)); - } - } - }); - - contextMenu.add(mnGetLink); +// //SHARE LINK +// MenuItem mnGetLink = new MenuItem(); +// mnGetLink.setId(WorkspaceOperation.SHARE_LINK.getId()); +// mnGetLink.setText(ConstantsExplorer.MESSAGE_SHARE_LINK); +// mnGetLink.setIcon(Resources.getIconShareLink()); +// +// mnGetLink.addSelectionListener(new SelectionListener() { +// public void componentSelected(MenuEvent ce) { +// +// for (FileModel sel : listSelectedItems) { +// eventBus.fireEvent(new GetShareLinkEvent(sel)); +// } +// } +// }); +// +// contextMenu.add(mnGetLink); //PUBLIC LINK MenuItem mnPublicLink = new MenuItem(); mnPublicLink.setId(WorkspaceOperation.PUBLIC_LINK.getId()); - mnPublicLink.setText(ConstantsExplorer.MESSAGE_PUBLIC_LINK); - mnPublicLink.setIcon(Resources.getIconPublicLink()); + mnPublicLink.setText(ConstantsExplorer.MESSAGE_SHAREABLE_LINK); + mnPublicLink.setIcon(Resources.getIconShareLink()); mnPublicLink.addSelectionListener(new SelectionListener() { public void componentSelected(MenuEvent ce) { for (FileModel sel : listSelectedItems) { //see Task #17552 - if(sel.isDirectory()) { - eventBus.fireEvent(new GetFolderLinkEvent(sel, true)); - }else { - eventBus.fireEvent(new GetPublicLinkEvent(sel, null)); - } +// if(sel.isDirectory()) { +// eventBus.fireEvent(new GetFolderLinkEvent(sel, true)); +// }else { +// eventBus.fireEvent(new GetShareableLink(sel, null)); +// } +// + AppControllerExplorer.getEventBus().fireEvent(new GetShareableLink(sel, null)); } } }); @@ -209,43 +209,43 @@ public class ContextMenuTree { contextMenu.add(mnPublicLink); - //FOLDER LINK - MenuItem mnFolderLink = new MenuItem(); - mnFolderLink.setId(WorkspaceOperation.FOLDER_LINK.getId()); - mnFolderLink.setText(ConstantsExplorer.MESSAGE_FOLDER_LINK); - mnFolderLink.setIcon(Resources.getIconFolderPublic()); - - mnFolderLink.addSelectionListener(new SelectionListener() { - public void componentSelected(MenuEvent ce) { - - for (FileModel sel : listSelectedItems) { - if(sel.isDirectory()) - eventBus.fireEvent(new GetFolderLinkEvent(sel, true)); - } - } - }); - - //see Task #17552 - contextMenu.add(mnFolderLink); +// //FOLDER LINK +// MenuItem mnFolderLink = new MenuItem(); +// mnFolderLink.setId(WorkspaceOperation.FOLDER_LINK.getId()); +// mnFolderLink.setText(ConstantsExplorer.MESSAGE_FOLDER_LINK); +// mnFolderLink.setIcon(Resources.getIconFolderPublic()); +// +// mnFolderLink.addSelectionListener(new SelectionListener() { +// public void componentSelected(MenuEvent ce) { +// +// for (FileModel sel : listSelectedItems) { +// if(sel.isDirectory()) +// eventBus.fireEvent(new GetFolderLinkEvent(sel, true)); +// } +// } +// }); +// +// //see Task #17552 +// contextMenu.add(mnFolderLink); //FOLDER LINK REMOVE - MenuItem mnFolderLinkRemove = new MenuItem(); - mnFolderLinkRemove.setId(WorkspaceOperation.FOLDER_LINK_REMOVE.getId()); - mnFolderLinkRemove.setText(ConstantsExplorer.MESSAGE_FOLDER_LINK_REMOVE); - mnFolderLinkRemove.setIcon(Resources.getIconFolderPublicRemove()); +// MenuItem mnFolderLinkRemove = new MenuItem(); +// mnFolderLinkRemove.setId(WorkspaceOperation.FOLDER_LINK_REMOVE.getId()); +// mnFolderLinkRemove.setText(ConstantsExplorer.MESSAGE_FOLDER_LINK_REMOVE); +// mnFolderLinkRemove.setIcon(Resources.getIconFolderPublicRemove()); +// +// mnFolderLinkRemove.addSelectionListener(new SelectionListener() { +// public void componentSelected(MenuEvent ce) { +// +// for (FileModel sel : listSelectedItems) { +// if(sel.isDirectory()) +// eventBus.fireEvent(new GetFolderLinkEvent(sel, false)); +// } +// } +// }); - mnFolderLinkRemove.addSelectionListener(new SelectionListener() { - public void componentSelected(MenuEvent ce) { - - for (FileModel sel : listSelectedItems) { - if(sel.isDirectory()) - eventBus.fireEvent(new GetFolderLinkEvent(sel, false)); - } - } - }); - - contextMenu.add(mnFolderLinkRemove); +// contextMenu.add(mnFolderLinkRemove); MenuItem mnHistory = new MenuItem(); mnHistory.setIcon(Resources.getIconHistory()); @@ -864,6 +864,7 @@ public class ContextMenuTree { contextMenu.getItemByItemId(WorkspaceOperation.RENAME.getId()).setVisible(true); contextMenu.getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(true); contextMenu.getItemByItemId(WorkspaceOperation.HISTORY.getId()).setVisible(true); + contextMenu.getItemByItemId(WorkspaceOperation.PUBLIC_LINK.getId()).setVisible(false); //SELECTED ITEM IS A FOLDER @@ -875,12 +876,13 @@ public class ContextMenuTree { contextMenu.getItemByItemId(WorkspaceOperation.SHARE.getId()).setVisible(true); //contextMenu.getItemByItemId(WorkspaceOperation.SHOW.getId()).setVisible(false); contextMenu.getItemByItemId(WorkspaceOperation.REFRESH_FOLDER.getId()).setVisible(true); - contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK.getId()).setVisible(true); //create folder link, set folder as public + //contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK.getId()).setVisible(true); //create folder link, set folder as public contextMenu.getItemByItemId(WorkspaceOperation.EXECUTE_DM_TASK.getId()).setVisible(true); + contextMenu.getItemByItemId(WorkspaceOperation.PUBLIC_LINK.getId()).setVisible(true); if(selectedItem.isShared()){//IS SHARED contextMenu.getItemByItemId(WorkspaceOperation.INSERT_SHARED_FOLDER.getId()).setVisible(false); - contextMenu.getItemByItemId(WorkspaceOperation.SHARE_LINK.getId()).setVisible(true); + //contextMenu.getItemByItemId(WorkspaceOperation.SHARE_LINK.getId()).setVisible(true); if(selectedItem.isShareable()){ //IS SHARABLE contextMenu.getItemByItemId(WorkspaceOperation.UNSHARE.getId()).setVisible(true); }else { //IS SUBFOLDER @@ -888,6 +890,7 @@ public class ContextMenuTree { } } + if(selectedItem.isRoot()){ //IS ROOT contextMenu.getItemByItemId(WorkspaceOperation.SHARE.getId()).setVisible(false); contextMenu.getItemByItemId(WorkspaceOperation.INSERT_SHARED_FOLDER.getId()).setVisible(true); @@ -896,12 +899,14 @@ public class ContextMenuTree { contextMenu.getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(false); contextMenu.getItemByItemId(WorkspaceOperation.MOVE.getId()).setVisible(false); contextMenu.getItemByItemId(WorkspaceOperation.DOWNLOAD.getId()).setVisible(false); - contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK.getId()).setVisible(false); + contextMenu.getItemByItemId(WorkspaceOperation.PUBLIC_LINK.getId()).setVisible(false); + //contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK.getId()).setVisible(false); showExecuteOperations(false); } - if(selectedItem.isPublic()) - contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK_REMOVE.getId()).setVisible(true); + if(selectedItem.isPublic()) { + //contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK_REMOVE.getId()).setVisible(true); + } GWT.log("HideSharing = " + hideSharing); //not supported in tree Reports @@ -984,7 +989,7 @@ public class ContextMenuTree { contextMenu.getItemByItemId(WorkspaceOperation.RENAME.getId()).setVisible(false); contextMenu.getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(false); contextMenu.getItemByItemId(WorkspaceOperation.MOVE.getId()).setVisible(false); - contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK.getId()).setVisible(false); + contextMenu.getItemByItemId(WorkspaceOperation.PUBLIC_LINK.getId()).setVisible(false); showExecuteOperations(false); //ADDED 14/03/2014 @@ -995,7 +1000,7 @@ public class ContextMenuTree { showExecuteOperations(false); showWriteOperations(false); contextMenu.getItemByItemId(WorkspaceOperation.DOWNLOAD.getId()).setVisible(false); - contextMenu.getItemByItemId(WorkspaceOperation.FOLDER_LINK.getId()).setVisible(false); + contextMenu.getItemByItemId(WorkspaceOperation.PUBLIC_LINK.getId()).setVisible(false); } } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.java index 6f759c5..26a238f 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.java @@ -193,7 +193,7 @@ public class DialogShareableLink extends Composite { alertFolderPublicLink.setVisible(true); //cgRemovePublicLink.setVisible(true); filedEnableDisableSharing.setVisible(true); - labelLinkSharing.setText("Anyone with the Public Link can access to the content"); + labelLinkSharing.setText("Anyone with the Public Link can view"); cgPublicLink.setVisible(true); acessToFolderLink(item, true); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.ui.xml b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.ui.xml index aba0716..6aa2f8d 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.ui.xml +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogShareableLink.ui.xml @@ -37,6 +37,7 @@ visible="false"> + @@ -46,7 +47,13 @@ + + + (Only the) Members belonging to the share can view + + + @@ -54,7 +61,7 @@ By sharing the following Private Link - with + to folder with your coworkers, you will @@ -94,8 +101,7 @@ By sharing the following Public Link - to folder with - your coworkers, you will + to folder, you will enact anyone with the link to