Francesco Mangiacrapa 2019-09-20 14:03:05 +00:00
parent 48d3f2f3c9
commit af5fb13d9e
2 changed files with 101 additions and 70 deletions

View File

@ -32,7 +32,6 @@ import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite; 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.Label;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
@ -55,8 +54,8 @@ public class DialogShareableLink extends Composite {
// @UiField // @UiField
// ControlGroup cgRemovePublicLink; // ControlGroup cgRemovePublicLink;
@UiField // @UiField
ControlGroup cgPrivateLink; // ControlGroup cgPrivateLink;
@UiField @UiField
TextBox textPublicLink; TextBox textPublicLink;
@ -80,19 +79,28 @@ public class DialogShareableLink extends Composite {
Well alertFolderPublicLink; Well alertFolderPublicLink;
@UiField @UiField
Fieldset fieldSet; Fieldset fieldSetPrivate;
@UiField
Fieldset fieldSetPublic;
@UiField @UiField
SwitchButton switchButton; SwitchButton switchButton;
@UiField
Row fieldPrivateSharing;
@UiField
SwitchButton switchButtonPrivate;
@UiField @UiField
Row filedEnableDisableSharing; Row filedEnableDisableSharing;
@UiField @UiField
Label labelLinkSharing; Label labelLinkSharing;
@UiField // @UiField
HTMLPanel panelFieldsContainer; // HTMLPanel panelFieldsContainer;
private FileModel fileItem; private FileModel fileItem;
@ -125,6 +133,7 @@ public class DialogShareableLink extends Composite {
this.fileItem = item; this.fileItem = item;
this.fileVersion = version; this.fileVersion = version;
this.actionAlert.setAnimation(true); this.actionAlert.setAnimation(true);
switchButtonPrivate.setValue(true);
showShareableLinkOptions(item, version); showShareableLinkOptions(item, version);
//getElement().setClassName("gwt-DialogBoxNew"); //getElement().setClassName("gwt-DialogBoxNew");
@ -132,7 +141,7 @@ public class DialogShareableLink extends Composite {
ModalFooter modalFooter = new ModalFooter(); ModalFooter modalFooter = new ModalFooter();
final Button buttClose = new Button("Close"); final Button buttClose = new Button("Close");
modalFooter.add(buttClose); modalFooter.add(buttClose);
switchButton.addValueChangeHandler(new ValueChangeHandler<Boolean>() { switchButton.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override @Override
@ -167,12 +176,13 @@ public class DialogShareableLink extends Composite {
public void showShareableLinkOptions(FileModel item, String version) { public void showShareableLinkOptions(FileModel item, String version) {
//cgRemovePublicLink.setVisible(false); //cgRemovePublicLink.setVisible(false);
cgPrivateLink.setVisible(false); fieldSetPrivate.setVisible(false);
cgPublicLink.setVisible(true); fieldPrivateSharing.setVisible(false);
cgPublicLink.setVisible(false);
alertFilePublicLink.setVisible(false); alertFilePublicLink.setVisible(false);
alertFolderPublicLink.setVisible(false); alertFolderPublicLink.setVisible(false);
filedEnableDisableSharing.setVisible(false); filedEnableDisableSharing.setVisible(false);
panelFieldsContainer.setVisible(false); //panelFieldsContainer.setVisible(false);
showMessage("", false); showMessage("", false);
this.itemIsPublicStatus = item.isPublic(); this.itemIsPublicStatus = item.isPublic();
@ -184,13 +194,14 @@ public class DialogShareableLink extends Composite {
//cgRemovePublicLink.setVisible(true); //cgRemovePublicLink.setVisible(true);
filedEnableDisableSharing.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 access to the content");
panelFieldsContainer.setVisible(true); cgPublicLink.setVisible(true);
acessToFolderLink(item, true); acessToFolderLink(item, true);
} }
if(item.isShared()) { //CASE SHARED FOLDER if(item.isShared()) { //CASE SHARED FOLDER
panelFieldsContainer.setVisible(true); //panelFieldsContainer.setVisible(true);
cgPrivateLink.setVisible(true); fieldSetPrivate.setVisible(true);
fieldPrivateSharing.setVisible(true);
loadAndShowPrivateLink(item, textPrivateLink); loadAndShowPrivateLink(item, textPrivateLink);
if(!item.isPublic()) { //THE FOLDER IS NOT PUBLIC 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 }else { //CASE FILE - MANAGING AS PUBLIC LINK TO FILE
panelFieldsContainer.setVisible(true); //panelFieldsContainer.setVisible(true);
cgPublicLink.setVisible(true);
alertFilePublicLink.setVisible(true); alertFilePublicLink.setVisible(true);
if(!item.isPublic()) { //THE FILE IS PRIVATE if(!item.isPublic()) { //THE FILE IS PRIVATE
if(version!=null && !version.isEmpty()) { if(version!=null && !version.isEmpty()) {
@ -351,14 +363,15 @@ public class DialogShareableLink extends Composite {
*/ */
private void acessToFolderLink(final FileModel item, final boolean setAsPublic) { private void acessToFolderLink(final FileModel item, final boolean setAsPublic) {
panelFieldsContainer.setVisible(false); //panelFieldsContainer.setVisible(false);
fieldSetPublic.setVisible(false);
WorkspaceSharingServiceAsync.INSTANCE.accessToFolderLink(item.getIdentifier(), WorkspaceSharingServiceAsync.INSTANCE.accessToFolderLink(item.getIdentifier(),
new AsyncCallback<AllowAccess>() { new AsyncCallback<AllowAccess>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
panelFieldsContainer.setVisible(false); fieldSetPublic.setVisible(false);
if (caught instanceof SessionExpiredException) { if (caught instanceof SessionExpiredException) {
GWT.log("Session expired"); GWT.log("Session expired");
AppControllerExplorer.getEventBus().fireEvent(new SessionExpiredEvent()); AppControllerExplorer.getEventBus().fireEvent(new SessionExpiredEvent());
@ -369,7 +382,7 @@ public class DialogShareableLink extends Composite {
@Override @Override
public void onSuccess(AllowAccess result) { public void onSuccess(AllowAccess result) {
panelFieldsContainer.setVisible(true); fieldSetPublic.setVisible(true);
GWT.log("AllowAccess? " + result); GWT.log("AllowAccess? " + result);
if (result.getAccessGranted()) { if (result.getAccessGranted()) {
String msg = setAsPublic ? "Getting" : "Removing"; String msg = setAsPublic ? "Getting" : "Removing";
@ -454,7 +467,7 @@ public class DialogShareableLink extends Composite {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
panelFieldsContainer.setVisible(false); fieldSetPublic.setVisible(false);
if (caught instanceof SessionExpiredException) { if (caught instanceof SessionExpiredException) {
GWT.log("Session expired"); GWT.log("Session expired");
AppControllerExplorer.getEventBus().fireEvent(new SessionExpiredEvent()); AppControllerExplorer.getEventBus().fireEvent(new SessionExpiredEvent());

View File

@ -24,71 +24,42 @@
.text-bold { .text-bold {
font-weight: bold; font-weight: bold;
} }
.not-active {
pointer-events: none;
cursor: default;
opacity: .5;
}
</ui:style> </ui:style>
<g:HTMLPanel> <g:HTMLPanel>
<b:Form type="HORIZONTAL"> <b:Form type="HORIZONTAL">
<b:Row ui:field="filedEnableDisableSharing" <b:Alert ui:field="actionAlert" close="false" type="INFO"
visible="false">
<b:Icon type="ROTATE_RIGHT" spin="true" />
</b:Alert>
<b:Row ui:field="fieldPrivateSharing"
addStyleNames="{style.margin-bottom-20}"> addStyleNames="{style.margin-bottom-20}">
<b:Column size="1"> <b:Column size="2">
<b:Label type="INFO">Link Sharing</b:Label> <b:Label type="INFO">Link Sharing with Coworkers</b:Label>
</b:Column> </b:Column>
<b:Column size="2"> <b:Column size="2">
<citem:SwitchButton ui:field="switchButton"></citem:SwitchButton> <citem:SwitchButton
ui:field="switchButtonPrivate" addStyleNames="{style.not-active}"></citem:SwitchButton>
</b:Column> </b:Column>
<b:Row>
<b:Column size="4" addStyleNames="{style.padding-left-30}">
<g:Label ui:field="labelLinkSharing"></g:Label>
</b:Column>
</b:Row>
</b:Row> </b:Row>
<b:Fieldset ui:field="fieldSetPrivate">
<b:Fieldset ui:field="fieldSet"> <g:HTMLPanel>
<!-- <b:Alert close="false" ui:field="actionAlert" type="ERROR" -->
<!-- visible="false"></b:Alert> -->
<b:Alert ui:field="actionAlert" close="false" type="INFO"
visible="false">
<b:Icon type="ROTATE_RIGHT" spin="true" />
</b:Alert>
<g:HTMLPanel ui:field="panelFieldsContainer">
<!-- <b:Legend>sharing....</b:Legend> --> <!-- <b:Legend>sharing....</b:Legend> -->
<b:ControlGroup ui:field="cgPublicLink">
<b:Well ui:field="alertFolderPublicLink" visible="false">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</b:Well>
<b:Well ui:field="alertFilePublicLink" visible="false">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</b:Well>
<b:ControlLabel>Public Link</b:ControlLabel>
<b:Controls>
<b:InputAddOn prependIcon="GLOBE">
<b:TextBox ui:field="textPublicLink" readOnly="true">
</b:TextBox>
</b:InputAddOn>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="cgPrivateLink"> <b:ControlGroup ui:field="cgPrivateLink">
<b:Well> <b:Well>
By sharing via Private Link By sharing the following Private Link
with with
your your
coworkers you will coworkers,
enact users (only the members belonging to the shared folder), you will
enact users (only the members belonging to the shared
folder),
after login, to access after login, to access
the the
content</b:Well> content</b:Well>
@ -102,6 +73,53 @@
</b:ControlGroup> </b:ControlGroup>
</g:HTMLPanel> </g:HTMLPanel>
</b:Fieldset> </b:Fieldset>
<b:Row ui:field="filedEnableDisableSharing"
addStyleNames="{style.margin-bottom-20}">
<b:Column size="2">
<b:Label type="INFO">Link Sharing with Everyone</b:Label>
</b:Column>
<b:Column size="2">
<citem:SwitchButton ui:field="switchButton"></citem:SwitchButton>
</b:Column>
<b:Row>
<b:Column size="4" addStyleNames="{style.padding-left-30}">
<g:Label ui:field="labelLinkSharing"></g:Label>
</b:Column>
</b:Row>
</b:Row>
<b:Fieldset ui:field="fieldSetPublic">
<b:ControlGroup ui:field="cgPublicLink">
<b:Well ui:field="alertFolderPublicLink" visible="false">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</b:Well>
<b:Well ui:field="alertFilePublicLink" visible="false">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</b:Well>
<b:ControlLabel>Public Link</b:ControlLabel>
<b:Controls>
<b:InputAddOn prependIcon="GLOBE">
<b:TextBox ui:field="textPublicLink" readOnly="true">
</b:TextBox>
</b:InputAddOn>
</b:Controls>
</b:ControlGroup>
</b:Fieldset>
<b:Alert close="false" ui:field="errorAlert" type="ERROR" <b:Alert close="false" ui:field="errorAlert" type="ERROR"
visible="false"></b:Alert> visible="false"></b:Alert>
</b:Form> </b:Form>