From af5fb13d9e36810186f2cfb36dd4c309b893fa20 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 20 Sep 2019 14:03:05 +0000 Subject: [PATCH] working on https://support.d4science.org/issues/17552 git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@181796 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../view/windows/DialogShareableLink.java | 49 ++++--- .../view/windows/DialogShareableLink.ui.xml | 122 ++++++++++-------- 2 files changed, 101 insertions(+), 70 deletions(-) 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 6a3d2d5..6f759c5 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 @@ -32,7 +32,6 @@ import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Widget; @@ -55,8 +54,8 @@ public class DialogShareableLink extends Composite { // @UiField // ControlGroup cgRemovePublicLink; - @UiField - ControlGroup cgPrivateLink; +// @UiField +// ControlGroup cgPrivateLink; @UiField TextBox textPublicLink; @@ -80,19 +79,28 @@ public class DialogShareableLink extends Composite { Well alertFolderPublicLink; @UiField - Fieldset fieldSet; + Fieldset fieldSetPrivate; + + @UiField + Fieldset fieldSetPublic; @UiField SwitchButton switchButton; + @UiField + Row fieldPrivateSharing; + + @UiField + SwitchButton switchButtonPrivate; + @UiField Row filedEnableDisableSharing; @UiField Label labelLinkSharing; - @UiField - HTMLPanel panelFieldsContainer; +// @UiField +// HTMLPanel panelFieldsContainer; private FileModel fileItem; @@ -125,6 +133,7 @@ public class DialogShareableLink extends Composite { this.fileItem = item; this.fileVersion = version; this.actionAlert.setAnimation(true); + switchButtonPrivate.setValue(true); showShareableLinkOptions(item, version); //getElement().setClassName("gwt-DialogBoxNew"); @@ -132,7 +141,7 @@ public class DialogShareableLink extends Composite { ModalFooter modalFooter = new ModalFooter(); final Button buttClose = new Button("Close"); modalFooter.add(buttClose); - + switchButton.addValueChangeHandler(new ValueChangeHandler() { @Override @@ -167,12 +176,13 @@ public class DialogShareableLink extends Composite { public void showShareableLinkOptions(FileModel item, String version) { //cgRemovePublicLink.setVisible(false); - cgPrivateLink.setVisible(false); - cgPublicLink.setVisible(true); + fieldSetPrivate.setVisible(false); + fieldPrivateSharing.setVisible(false); + cgPublicLink.setVisible(false); alertFilePublicLink.setVisible(false); alertFolderPublicLink.setVisible(false); filedEnableDisableSharing.setVisible(false); - panelFieldsContainer.setVisible(false); + //panelFieldsContainer.setVisible(false); showMessage("", false); this.itemIsPublicStatus = item.isPublic(); @@ -184,13 +194,14 @@ public class DialogShareableLink extends Composite { //cgRemovePublicLink.setVisible(true); filedEnableDisableSharing.setVisible(true); labelLinkSharing.setText("Anyone with the Public Link can access to the content"); - panelFieldsContainer.setVisible(true); + cgPublicLink.setVisible(true); acessToFolderLink(item, true); } if(item.isShared()) { //CASE SHARED FOLDER - panelFieldsContainer.setVisible(true); - cgPrivateLink.setVisible(true); + //panelFieldsContainer.setVisible(true); + fieldSetPrivate.setVisible(true); + fieldPrivateSharing.setVisible(true); loadAndShowPrivateLink(item, textPrivateLink); if(!item.isPublic()) { //THE FOLDER IS NOT PUBLIC @@ -209,7 +220,8 @@ public class DialogShareableLink extends Composite { } }else { //CASE FILE - MANAGING AS PUBLIC LINK TO FILE - panelFieldsContainer.setVisible(true); + //panelFieldsContainer.setVisible(true); + cgPublicLink.setVisible(true); alertFilePublicLink.setVisible(true); if(!item.isPublic()) { //THE FILE IS PRIVATE if(version!=null && !version.isEmpty()) { @@ -351,14 +363,15 @@ public class DialogShareableLink extends Composite { */ private void acessToFolderLink(final FileModel item, final boolean setAsPublic) { - panelFieldsContainer.setVisible(false); + //panelFieldsContainer.setVisible(false); + fieldSetPublic.setVisible(false); WorkspaceSharingServiceAsync.INSTANCE.accessToFolderLink(item.getIdentifier(), new AsyncCallback() { @Override public void onFailure(Throwable caught) { - panelFieldsContainer.setVisible(false); + fieldSetPublic.setVisible(false); if (caught instanceof SessionExpiredException) { GWT.log("Session expired"); AppControllerExplorer.getEventBus().fireEvent(new SessionExpiredEvent()); @@ -369,7 +382,7 @@ public class DialogShareableLink extends Composite { @Override public void onSuccess(AllowAccess result) { - panelFieldsContainer.setVisible(true); + fieldSetPublic.setVisible(true); GWT.log("AllowAccess? " + result); if (result.getAccessGranted()) { String msg = setAsPublic ? "Getting" : "Removing"; @@ -454,7 +467,7 @@ public class DialogShareableLink extends Composite { @Override public void onFailure(Throwable caught) { - panelFieldsContainer.setVisible(false); + fieldSetPublic.setVisible(false); if (caught instanceof SessionExpiredException) { GWT.log("Session expired"); AppControllerExplorer.getEventBus().fireEvent(new SessionExpiredEvent()); 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 9d28057..aba0716 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 @@ -24,71 +24,42 @@ .text-bold { font-weight: bold; } + + .not-active { + pointer-events: none; + cursor: default; + opacity: .5; + } - + + + - - Link Sharing + + Link Sharing with Coworkers - + - - - - - - - - - - - - - - + + - - By sharing - via Public - Link - to folder with - your coworkers you will - enact anyone - with the - link to - view the - content, no login will be - requested - By sharing a - Public Link - to - file your coworkers can download it. - No login will be - requested. - The link will always point to the version - of file at the - time of - public link creation - Public Link - - - - - - - + - By sharing via Private Link + By sharing the following Private Link with your - coworkers you will - enact users (only the members belonging to the shared folder), + coworkers, + you will + enact users (only the members belonging to the shared + folder), after login, to access the content @@ -102,6 +73,53 @@ + + + + Link Sharing with Everyone + + + + + + + + + + + + + + By sharing + the following Public + Link + to folder with + your coworkers, you will + enact anyone + with the + link to + view the + content, no login will be + requested + By sharing + the following + Public Link to file, your coworkers can download it. + No login will be + requested. + The link will always point to the + version + of the file at the + time of link creation + Public Link + + + + + + + +