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.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<Boolean>() {
@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<AllowAccess>() {
@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());

View File

@ -24,71 +24,42 @@
.text-bold {
font-weight: bold;
}
.not-active {
pointer-events: none;
cursor: default;
opacity: .5;
}
</ui:style>
<g:HTMLPanel>
<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}">
<b:Column size="1">
<b:Label type="INFO">Link Sharing</b:Label>
<b:Column size="2">
<b:Label type="INFO">Link Sharing with Coworkers</b:Label>
</b:Column>
<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: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="fieldSet">
<!-- <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:Fieldset ui:field="fieldSetPrivate">
<g:HTMLPanel>
<!-- <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:Well>
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</b:Well>
@ -102,6 +73,53 @@
</b:ControlGroup>
</g:HTMLPanel>
</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"
visible="false"></b:Alert>
</b:Form>