enhancements on groups integration

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@97631 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-06-23 13:18:02 +00:00
parent 2d8f467022
commit 1b2757285b
4 changed files with 44 additions and 84 deletions

View File

@ -42,8 +42,22 @@ public class WorkspaceSharingController {
* @param itemId workspace item id
* @param if true, only owner can share, otherwise an alert with an error message is displayed
* @param defaultPermission ACL_TYPE default permission, if is null default ACL_TYPE is loaded from server
*
* base constructor by default do not retrieve groups
*/
public WorkspaceSharingController(String itemId, boolean shareOnlyOwner, ACL_TYPE defaultPermission) {
this(itemId, shareOnlyOwner, defaultPermission, false, false);
}
/**
* This controller instancing sharing dialog
* @param itemId workspace item id
* @param if true, only owner can share, otherwise an alert with an error message is displayed
* @param defaultPermission ACL_TYPE default permission, if is null default ACL_TYPE is loaded from server
* @param readGroupsFromHL - if true read group names from HL
* @param readGroupsFromPortal - if true read group names from Portal (as VRE)
*/
public WorkspaceSharingController(String itemId, boolean shareOnlyOwner, ACL_TYPE defaultPermission, boolean readGroupsFromHL, boolean readGroupsFromPortal) {
this.workspaceItemId = itemId;
this.shareOnlyOwner = shareOnlyOwner;
this.defaultPermission = defaultPermission;
@ -152,71 +166,6 @@ public class WorkspaceSharingController {
}
});
/*sharingDialog.addListener(Events.Hide, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
System.out.println("quaaaaaaaaaaa");
}
});*/
/*sharingDialog.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
System.out.println("quiiiiiiiiiiiiiiiiiii1111111111");
if(sharingDialog.isValidForm(true)){
System.out.println("22222222222222");
FileModel fileModel = sharingDialog.getFileToShare();
//create a lowest object to send to server
fileModel = new FileModel(fileModel.getIdentifier(), fileModel.getName(), fileModel.getParentFileModel(), fileModel.isDirectory(), fileModel.isShared());
fileModel.setDescription(sharingDialog.getDescription());
GWT.log("ACL selected is "+sharingDialog.getSelectedACL());
final String itemName = fileModel.getName();
sharingDialog.mask("Sharing and setting permissions", ConstantsSharing.LOADINGSTYLE);
rpcWorkspaceSharingService.shareFolder(fileModel, sharingDialog.getSharedListUsers(), false, sharingDialog.getSelectedACL(), new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
if(caught instanceof SessionExpiredException){
GWT.log("Session expired");
sharingDialog.unmask();
sharingDialog.hide();
MessageBox.alert("Alert", "Server session expired", null);
return;
}else
MessageBox.alert("Error", caught.getMessage(), null);
}
@Override
public void onSuccess(Boolean result) {
if(result){
MessageBox.info("Info", "The item: "+itemName+" correctly shared", null);
sharingDialog.hide();
}
sharingDialog.unmask();
}
});
}
}
}); */
}
/**

View File

@ -1,6 +1,13 @@
package org.gcube.portlets.widgets.workspacesharingwidget.client;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
@ -14,11 +21,11 @@ public class WorkspaceSharingWidgetEntryPoint implements EntryPoint {
*/
public void onModuleLoad() {
/*try {
try {
WorkspaceSharingController controller = new WorkspaceSharingController(ITEMID, true, ACL_TYPE.READ_ONLY);
final Window sharingWindow = controller.getSharingWindow();
final Window sharingWindow = controller.getSharingDialog();
Button openSharingWindow = new Button("Show Sharing Window",
new ClickHandler() {
@ -32,7 +39,7 @@ public class WorkspaceSharingWidgetEntryPoint implements EntryPoint {
} catch (Exception e) {
e.printStackTrace();
}*/
}
}
}

View File

@ -42,15 +42,11 @@ public class WorkspaceSmartSharingController {
* @param file - a fake file to display the field name ("filename") into dialog
* @param listAlreadySharedContact - list of already shared contacts to show into dialog
*
* base constructor by default do not retrieve groups
*
*/
public WorkspaceSmartSharingController(FileModel file, List<CredentialModel> listAlreadySharedContact) {
this.listAlreadySharedContact = listAlreadySharedContact;
this.fileModel = file;
smartShare = new SmartShare();
smartShare.setSize(ConstantsSharing.WIDTH_DIALOG+20, ConstantsSharing.HEIGHT_DIALOG-170);
updateSharingDialog();
addListenersSharingDialog();
this(file, listAlreadySharedContact, false, false);
}
/**
@ -59,14 +55,15 @@ public class WorkspaceSmartSharingController {
* @param listAlreadySharedContact - list of already shared contacts to show into dialog
* @param readGroupsFromHL - if true read group names from HL
* @param readGroupsFromPortal - if true read group names from Portal (as VRE)
*
*/
public WorkspaceSmartSharingController(FileModel file, List<CredentialModel> listAlreadySharedContact, boolean readGroupsFromHL, boolean readGroupsFromPortal) {
this.listAlreadySharedContact = listAlreadySharedContact;
this.fileModel = file;
this.smartShare = new SmartShare();
this.smartShare.setSize(ConstantsSharing.WIDTH_DIALOG+20, ConstantsSharing.HEIGHT_DIALOG-170);
this.readGroupsFromHL = readGroupsFromHL;
this.readGroupsFromPortal = readGroupsFromPortal;
this.smartShare = new SmartShare(readGroupsFromHL, readGroupsFromPortal);
this.smartShare.setSize(ConstantsSharing.WIDTH_DIALOG+20, ConstantsSharing.HEIGHT_DIALOG-170);
updateSharingDialog();
addListenersSharingDialog();
}

View File

@ -47,21 +47,18 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
private boolean readGroupsFromPortal;
/**
* By DEFAULT DOESN'T READ GROUPS FROM SERVER
*
* base constructor by default do not retrieve groups
*/
public SmartShare() {
this.readGroupsFromHL = false;
this.readGroupsFromPortal = false;
suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal);
initLayout();
this(false, false);
}
/**
*
* @param readGroupsFromHL
* @param readGroupsFromPortal
* @param readGroupsFromHL - if true read group names from HL
* @param readGroupsFromPortal - if true read group names from Portal (as VRE)
*
*/
public SmartShare(boolean readGroupsFromHL, boolean readGroupsFromPortal) {
this.readGroupsFromHL = readGroupsFromHL;
@ -405,4 +402,14 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
}
public boolean isReadGroupsFromHL() {
return readGroupsFromHL;
}
public boolean isReadGroupsFromPortal() {
return readGroupsFromPortal;
}
}