From 82eb3458cb35e9d60efcc02a0fda69519ea13f2d Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Tue, 24 Sep 2019 09:28:28 +0000 Subject: [PATCH] Applied the changes requested at https://support.d4science.org/issues/17552#note-11 git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@181830 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../view/windows/DialogShareableLink.java | 36 +++++++++++-- .../view/windows/DialogShareableLink.ui.xml | 54 ++++++++++--------- .../user/workspace/public/workspacetree.css | 28 ++++++++-- .../server/GWTWorkspaceServiceImpl.java | 2 +- 4 files changed, 86 insertions(+), 34 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 744c9a4..4a23ba1 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 @@ -116,7 +116,7 @@ public class DialogShareableLink extends Composite { private boolean itemIsPublicStatus; private final String privateShareToFileDescription = "By sharing the following Private Link " - + "to file with your coworkers, you will enact users (only the members belonging to the shared folder), " + + "to file with your coworkers, you will enact the users of the group the folder is shared with, " + "after login, to access the file and the shared folder content"; @@ -201,6 +201,7 @@ public class DialogShareableLink extends Composite { alertFolderPublicLink.setVisible(false); filedEnableDisableSharing.setVisible(false); buttonShareSettings.setVisible(false); + switchButton.setVisible(true); //panelFieldsContainer.setVisible(false); showMessage("", false); this.itemIsPublicStatus = item.isPublic(); @@ -237,6 +238,14 @@ public class DialogShareableLink extends Composite { //THE FOLDER IS PRIVATE - NO SHARED AND NO PUBLIC if(!item.isPublic() && !item.isShared()) { + + //SHARING WITH COWORKERS + if(item.isShareable()) { + fieldPrivateSharing.setVisible(true); + buttonShareSettings.setVisible(true); + } + + //SHARING WITH EVERYONE filedEnableDisableSharing.setVisible(true); alertFolderPublicLink.setVisible(true); labelLinkSharing.setText("The folder is private, not shared"); @@ -245,8 +254,10 @@ public class DialogShareableLink extends Composite { }else { //CASE FILE - MANAGING AS PUBLIC LINK TO FILE //panelFieldsContainer.setVisible(true); cgPublicLink.setVisible(true); + filedEnableDisableSharing.setVisible(true); alertFilePublicLink.setVisible(true); if(!item.isPublic()) { //THE FILE IS PRIVATE + switchButton.setVisible(false); if(version!=null && !version.isEmpty()) { showPublicLinkForFileItemIdToVersion(item, textPublicLink, version); }else { @@ -272,14 +283,33 @@ public class DialogShareableLink extends Composite { * @param item the item * @param toTextBox the to text box */ - private void loadAndShowPrivateLink(FileModel item, TextBox toTextBox) { + private void loadAndShowPrivateLink(FileModel item, final TextBox toTextBox) { String currentUrl = portalURL(); int lastChar = currentUrl.lastIndexOf("?"); currentUrl = lastChar > -1 ? currentUrl.substring(0, lastChar) : currentUrl; String shareLinkUrl = currentUrl + "?" + ConstantsExplorer.GET_ITEMID_PARAMETER + "=" + item.getIdentifier(); shareLinkUrl += "&" + ConstantsExplorer.GET_OPERATION_PARAMETER + "=" + WsPortletInitOperation.gotofolder; - toTextBox.setText(shareLinkUrl); + + final String longURL = shareLinkUrl; + AppControllerExplorer.rpcWorkspaceService.getShortUrl(shareLinkUrl, new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + toTextBox.setText(longURL); + } + + @Override + public void onSuccess(String shorURL) { + + if(shorURL!=null && !shorURL.isEmpty()) { + toTextBox.setText(shorURL); + }else { + toTextBox.setText(longURL); + } + + } + }); } /** 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 33317d8..42a1711 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 @@ -4,10 +4,6 @@ xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:citem="urn:import:org.gcube.portlets.widgets.switchbutton.client"> - .textbox-width { - width: 200px; - } - .back-color-info { background-color: #fafaff !important; } @@ -43,6 +39,11 @@ vertical-align: top; padding-top: 0px !important; } + + .no-border { + border: 0px; + } + @@ -54,41 +55,43 @@ - Link Sharing with - Coworkers + Link shareable with + coworkers - Share settings + Share settings - (Only the) Members belonging to the - share - can view + (Only the) Members of the group the + folder is shared with are enacted to view - + - + By sharing the following Private Link - to folder with + to + folder with your coworkers, - you will - enact users (only the members belonging to the - shared - folder), - after login, to access - the - content + you will enact the users of the group + the folder is shared with, + after login, to access the shared + folder content Private Link - + @@ -100,8 +103,8 @@ - Link Sharing with - Everyone + Link shareable with + everyone @@ -113,7 +116,7 @@ - + By sharing the following Public Link @@ -135,7 +138,8 @@ time of link creation Public Link - + diff --git a/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css b/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css index 853801a..3f63045 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css +++ b/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css @@ -1,10 +1,10 @@ @CHARSET "UTF-8"; -.gwt-DialogBoxNew{ +.gwt-DialogBoxNew { border: 8px solid #99C0E8; border-radius: 6px 6px 6px 6px; box-shadow: none; -/* line-height: 7px; */ + /* line-height: 7px; */ opacity: 1; z-index: 1500; background-color: #FFFFFF; @@ -253,9 +253,9 @@ table.userssuggest th { cursor: pointer; } -.disabledDIV{ - pointer-events: none; - opacity: 0.5; +.disabledDIV { + pointer-events: none; + opacity: 0.5; } /** For the data catalogue modal **/ @@ -271,4 +271,22 @@ table.userssuggest th { .modal-top-custom { top: 2% !important; +} + +.my-control-group .controls{ + margin-left: 70px; +} + +.my-control-group .control-label { + width: 80px; + text-align: center; + padding-right: 10px; +} + +.my-control-group .add-on{ + width: 20px !important; +} + +.my-control-group .gwt-TextBox { + width: 370px !important; } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java index 8dc7d0c..e2824de 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java @@ -1705,7 +1705,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT if (shortenUrl) { shortURL = getShortUrl(httpURL); - shortURL = shortURL != null ? shortURL : "not available"; + shortURL = shortURL != null ? shortURL : ""; } return new PublicLink(httpURL, shortURL);