From 7096dd9acf8ff9a232d6033859bb8e3953b933a0 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Mon, 17 Mar 2014 13:57:21 +0000 Subject: [PATCH] merged with SocialISti branch at version 93150 git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@93188 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 4 +- .settings/com.google.gdt.eclipse.core.prefs | 2 +- .../user/workspace/client/AppController.java | 45 ++--- .../client/event/SettingPermissionEvent.java | 49 ----- .../event/SettingPermissionEventHandler.java | 12 -- .../event/VREChangePermissionsEvent.java | 37 ++++ .../VREChangePermissionsEventHandler.java | 11 + .../client/view/dialog/DialogPermission.java | 191 ------------------ .../toolbars/GxtToolBarItemFunctionality.java | 12 +- src/main/webapp/workspaceportlet.css | 41 ++-- 10 files changed, 90 insertions(+), 314 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEvent.java delete mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEventHandler.java create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEventHandler.java delete mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/view/dialog/DialogPermission.java diff --git a/.classpath b/.classpath index 85f6c03..21d9f47 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -25,5 +25,5 @@ - + diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs index d6d1b34..980fcea 100644 --- a/.settings/com.google.gdt.eclipse.core.prefs +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -1,5 +1,5 @@ eclipse.preferences.version=1 jarsExcludedFromWebInfLib= -lastWarOutDir=/home/francesco-mangiacrapa/wseclipse/workspace-TRUNK/target/workspace-6.6.0-SNAPSHOT +lastWarOutDir=/home/francesco-mangiacrapa/wseclipse/workspace-TRUNK/target/workspace-6.6.1-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java index 6f5147c..928ec03 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java @@ -72,9 +72,10 @@ import org.gcube.portlets.user.workspace.client.event.SearchTextEventHandler; import org.gcube.portlets.user.workspace.client.event.SendMessageEvent; import org.gcube.portlets.user.workspace.client.event.SendMessageEventHandler; import org.gcube.portlets.user.workspace.client.event.SettingPermissionEvent; -import org.gcube.portlets.user.workspace.client.event.SettingPermissionEventHandler; import org.gcube.portlets.user.workspace.client.event.TrashEvent; import org.gcube.portlets.user.workspace.client.event.TrashEventHandler; +import org.gcube.portlets.user.workspace.client.event.VREChangePermissionsEvent; +import org.gcube.portlets.user.workspace.client.event.VREChangePermissionsEventHandler; import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent; import org.gcube.portlets.user.workspace.client.event.WebDavUrlEventHandler; import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum; @@ -84,7 +85,6 @@ import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.model.FolderModel; import org.gcube.portlets.user.workspace.client.model.ScopeModel; import org.gcube.portlets.user.workspace.client.view.WorskpacePortlet; -import org.gcube.portlets.user.workspace.client.view.dialog.DialogPermission; import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel; import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel; import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBreadcrumbPathPanel; @@ -933,35 +933,16 @@ public class AppController implements SubscriberInterface { } }); - eventBus.addHandler(SettingPermissionEvent.TYPE, new SettingPermissionEventHandler() { + eventBus.addHandler(VREChangePermissionsEvent.TYPE, new VREChangePermissionsEventHandler() { @Override - public void onPermissionSetting(SettingPermissionEvent settingPermissionEvent) { - - final DialogPermission dialog = settingPermissionEvent.getDialogPermission(); - FileModel folder = settingPermissionEvent.getSourceFile(); - dialog.mask("Changing permissions"); - if(dialog!=null && folder!=null && dialog.getSelectedACL().getId()!=null){ - - AppControllerExplorer.rpcWorkspaceService.updateACLForVREbyGroupIds(folder.getIdentifier(), dialog.getSelectedACL().getId(), new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - dialog.hide(); - new MessageBoxAlert("Error", caught.getMessage(),null); - } - - @Override - public void onSuccess(Void result) { - dialog.unmask(); - dialog.hide(); - new InfoDisplay("Permission updated", "The permissions have been changed correctly"); - } - }); - } + public void onChangePermissionsOpen(VREChangePermissionsEvent vreChangePermissionsEvent) { + if(vreChangePermissionsEvent.getFileModel()!=null) + AppControllerExplorer.getEventBus().fireEvent(new SettingPermissionEvent(vreChangePermissionsEvent.getFileModel())); } }); + } private void accountingSetItemAsRead(boolean read) { @@ -1075,7 +1056,7 @@ public class AppController implements SubscriberInterface { FileModel parent = breadCrumb.getLastParent(); - GWT.log("Update Breadcrumb for : "+parent); + GWT.log("Updated Breadcrumb for : "+parent); if(parent!=null){ if(parent.isDirectory() && parent.isShared()){ //IS SHARED FOLDER, ENABLING OPERATION FOR ACTIVE BREADCRUMB @@ -1692,4 +1673,14 @@ public class AppController implements SubscriberInterface { } + + /* (non-Javadoc) + * @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#changePermission(org.gcube.portlets.user.workspace.client.model.FileModel) + */ + @Override + public void changePermission(FileModel fileModel) { + // TODO Auto-generated method stub + + } + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEvent.java deleted file mode 100644 index b6ebf94..0000000 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEvent.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.gcube.portlets.user.workspace.client.event; - -import org.gcube.portlets.user.workspace.client.model.FileGridModel; -import org.gcube.portlets.user.workspace.client.model.FileModel; -import org.gcube.portlets.user.workspace.client.view.dialog.DialogPermission; - -import com.google.gwt.event.shared.GwtEvent; - -/** - * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * - */ -public class SettingPermissionEvent extends GwtEvent { - public static Type TYPE = new Type(); - - private FileModel targetFile = null; - - private DialogPermission dialogPermission; - - - public SettingPermissionEvent(FileModel target, DialogPermission dialog) { - this.targetFile = (FileGridModel) target; - this.dialogPermission = dialog; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(SettingPermissionEventHandler handler) { - handler.onPermissionSetting(this); - - } - - public FileModel getSourceFile() { - return targetFile; - } - - public DialogPermission getDialogPermission() { - return dialogPermission; - } - - public void setDialogPermission(DialogPermission dialogPermission) { - this.dialogPermission = dialogPermission; - } -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEventHandler.java deleted file mode 100644 index 3574d39..0000000 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/SettingPermissionEventHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.gcube.portlets.user.workspace.client.event; - -import com.google.gwt.event.shared.EventHandler; - -/** - * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * - */ -public interface SettingPermissionEventHandler extends EventHandler { - void onPermissionSetting(SettingPermissionEvent settingPermissionEvent); -} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEvent.java new file mode 100644 index 0000000..598640f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEvent.java @@ -0,0 +1,37 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.FileModel; + +import com.google.gwt.event.shared.GwtEvent; + +public class VREChangePermissionsEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private FileModel fileModel = null; //Folder source click + + /** + * @param fileModel + */ + public VREChangePermissionsEvent(FileModel fileModel) { + this.fileModel = fileModel; + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(VREChangePermissionsEventHandler handler) { + handler.onChangePermissionsOpen(this); + + } + + public FileModel getFileModel() { + return fileModel; + } + + public void setFileModel(FileModel fileModel) { + this.fileModel = fileModel; + } +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEventHandler.java new file mode 100644 index 0000000..7ac611f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/VREChangePermissionsEventHandler.java @@ -0,0 +1,11 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +public interface VREChangePermissionsEventHandler extends EventHandler { + /** + * @param vreChangePermissionsEvent + */ + void onChangePermissionsOpen( + VREChangePermissionsEvent vreChangePermissionsEvent); +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/dialog/DialogPermission.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/dialog/DialogPermission.java deleted file mode 100644 index 0212982..0000000 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/dialog/DialogPermission.java +++ /dev/null @@ -1,191 +0,0 @@ -package org.gcube.portlets.user.workspace.client.view.dialog; - -import java.util.List; - -import org.gcube.portlets.user.workspace.client.AppController; -import org.gcube.portlets.user.workspace.client.AppControllerExplorer; -import org.gcube.portlets.user.workspace.client.event.SettingPermissionEvent; -import org.gcube.portlets.user.workspace.client.model.FileModel; -import org.gcube.portlets.user.workspace.client.model.InfoContactModel; -import org.gcube.portlets.user.workspace.client.resources.Resources; -import org.gcube.portlets.user.workspace.client.view.sharing.PanelTogglePermission; -import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert; -import org.gcube.portlets.user.workspace.shared.WorkspaceACL; - -import com.extjs.gxt.ui.client.Style.HorizontalAlignment; -import com.extjs.gxt.ui.client.Style.Scroll; -import com.extjs.gxt.ui.client.Style.VerticalAlignment; -import com.extjs.gxt.ui.client.event.ButtonEvent; -import com.extjs.gxt.ui.client.event.SelectionListener; -import com.extjs.gxt.ui.client.widget.Dialog; -import com.extjs.gxt.ui.client.widget.HorizontalPanel; -import com.extjs.gxt.ui.client.widget.layout.FormLayout; -import com.google.gwt.core.shared.GWT; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Label; - -/** - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * - */ -public class DialogPermission extends Dialog { - - private int widthDialog = 400; - private FileModel parentFolder = null; - - private PanelTogglePermission permission; - private HorizontalPanel hpPermission = new HorizontalPanel(); - private FileModel folder; - - private DialogPermission INSTANCE = this; - - public FileModel getParentFolder() { - return parentFolder; - } - - public void initLayout(String folderParentName) { - FormLayout layout = new FormLayout(); - layout.setLabelWidth(90); - layout.setDefaultWidth(380); - setLayout(layout); - setModal(true); - setScrollMode(Scroll.AUTOY); - setBodyStyle("padding: 9px; background: none"); - setWidth(widthDialog); - setHeight(140); - setResizable(true); - setButtonAlign(HorizontalAlignment.CENTER); - setWidth(widthDialog); - setButtons(Dialog.OKCANCEL); - } - - /** - * Use to set permission to VRE Folder - */ - public DialogPermission(FileModel folder) { - - this.folder = folder; - - Label labelProperty = new Label("Permissions"); - - hpPermission.add(labelProperty); - hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE); - hpPermission.mask("Checking authorization"); - - - AsyncCallback callcack = new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - new MessageBoxAlert("Alert", "Sorry, an error occurred on recovering ACLs",null); - hpPermission.unmask(); - } - - @Override - public void onSuccess(InfoContactModel result) { - permissionControl(result.getLogin(), true); - hpPermission.unmask(); - } - }; - - getOwner(folder.getIdentifier(), callcack); - - //TODO GET ACL FOR USER - AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback>() { - - @Override - public void onSuccess(List result) { - permission = new PanelTogglePermission(result); - hpPermission.add(permission); - hpPermission.layout(); - layout(); - } - - @Override - public void onFailure(Throwable caught) { - new MessageBoxAlert("Alert", "Sorry, an error occurred on recovering ACLs",null); - } - }); - - initLayout(folder.getName()); - this.setIcon(Resources.getIconVREFolder()); - setHeading("Change permissions to folder: " + folder.getName()); - - setWidth(widthDialog); - setButtons(Dialog.OKCANCEL); - - add(hpPermission); - addListners(); - getButtonById(Dialog.OK).setEnabled(false); - enableFormDialog(false); - } - - public void addListners() { - - this.getButtonById(Dialog.CANCEL).addSelectionListener( - new SelectionListener() { - - @Override - public void componentSelected(ButtonEvent ce) { - hide(); - } - }); - - this.getButtonById(Dialog.OK).addSelectionListener( - new SelectionListener() { - - @Override - public void componentSelected(ButtonEvent ce) { - - AppController.getEventBus().fireEvent(new SettingPermissionEvent(folder, INSTANCE)); -// hide(); - } - }); - - } - - - private void permissionControl(String owner, boolean showAlert){ - GWT.log("DialogPermission control compare between owner: "+owner +" and my login: "+AppControllerExplorer.myLogin); - if(AppControllerExplorer.myLogin.compareToIgnoreCase(owner)!=0){ - enableFormDialog(false); - if(showAlert) - new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not owner of \""+folder.getName()+"\"", null); - }else{ - enableFormDialog(true); - } - } - - private void enableFormDialog(boolean bool){ - getButtonById(Dialog.OK).setEnabled(bool); - - if(permission!=null) - permission.setEnabled(bool); - } - - public void getOwner(final String sharedFolderId,final AsyncCallback callback) { - - AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(sharedFolderId, new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - GWT.log("an error occured in get Owner by Id "+sharedFolderId + " "+caught.getMessage()); - new MessageBoxAlert("Alert", "Sorry, an error occurred on owner property",null); - - } - - @Override - public void onSuccess(InfoContactModel result) { - callback.onSuccess(result); - - } - }); - } - - public WorkspaceACL getSelectedACL(){ - if(permission!=null) - return permission.getSelectedACL(); - - return null; - } -} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java index 4b4012f..de95116 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java @@ -20,12 +20,12 @@ import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent; import org.gcube.portlets.user.workspace.client.event.OpenReportsEvent; import org.gcube.portlets.user.workspace.client.event.PasteItemEvent; import org.gcube.portlets.user.workspace.client.event.RenameItemEvent; +import org.gcube.portlets.user.workspace.client.event.VREChangePermissionsEvent; import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent; import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum; import org.gcube.portlets.user.workspace.client.model.FileGridModel; import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.resources.Resources; -import org.gcube.portlets.user.workspace.client.view.dialog.DialogPermission; import org.gcube.portlets.user.workspace.client.view.grids.GxtGridFilterGroupPanel; import org.gcube.portlets.user.workspace.client.view.tree.CutCopyAndPaste; import org.gcube.portlets.user.workspace.client.view.tree.CutCopyAndPaste.OperationType; @@ -206,8 +206,8 @@ public class GxtToolBarItemFunctionality { btnAccessFromDesktop.setIconAlign(IconAlign.TOP); btnAccessFromDesktop.setArrowAlign(ButtonArrowAlign.BOTTOM); - toolBar.add(btnAccessFromDesktop); - toolBar.add(new SeparatorToolItem()); +// toolBar.add(btnAccessFromDesktop); +// toolBar.add(new SeparatorToolItem()); // toolBar.add(new SeparatorToolItem()); // toolBar.add(new SeparatorToolItem()); @@ -465,8 +465,10 @@ public class GxtToolBarItemFunctionality { final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem(); if(fileGridModel!=null && fileGridModel.isVreFolder()){ - DialogPermission dialog = new DialogPermission(fileGridModel); - dialog.show(); + + AppController.getEventBus().fireEvent(new VREChangePermissionsEvent(fileGridModel)); +// DialogPermission dialog = new DialogPermission(fileGridModel); +// dialog.show(); } } diff --git a/src/main/webapp/workspaceportlet.css b/src/main/webapp/workspaceportlet.css index 10079bf..5e186d3 100644 --- a/src/main/webapp/workspaceportlet.css +++ b/src/main/webapp/workspaceportlet.css @@ -1,5 +1,7 @@ @import url(http://fonts.googleapis.com/css?family=Architects+Daughter); + @import url(newtheme.css); + @import url(workspace/old-dialog.css); #SearchAndFilter { @@ -14,7 +16,7 @@ /* W3C Markup, IE10 Release Preview */ background-image: linear-gradient(to bottom, #DFEAF8 0%, #d0def0 100%); /* IE10 Consumer Preview */ - background-image: -ms-linear-gradient(top, #DFEAF8 0%, #052045 100%); + background-image: -ms-linear-gradient(top, #DFEAF8 0%, #d0def0 100%); } .nofeed-message { @@ -26,9 +28,8 @@ background-color: white; } - -.x-form-text, textarea.x-form-field { - -moz-border-radius: 3px !important; +.x-form-text,textarea.x-form-field { + -moz-border-radius: 3px !important; -webkit-border-radius: 3px !important; border-radius: 3px !important; } @@ -71,7 +72,6 @@ } /** Example rules used by the template application (remove for your app) */ - .sendButton { display: block; font-size: 16pt; @@ -183,21 +183,13 @@ /* remove images */ .button-hyperlink .x-btn-tl,.button-hyperlink.x-btn-tr,.button-hyperlink .x-btn-tc,.button-hyperlink .x-btn-ml,.button-hyperlink .x-btn-mr,.button-hyperlink .x-btn-mc,.button-hyperlink .x-btn-bl,.button-hyperlink .x-btn-br,.button-hyperlink .x-btn-bc -{ + { background-image: none !important; background: none !important; } -.button-hyperlink .x-btn-small .x-btn-mr, -.button-hyperlink .x-btn-small .x-btn-ml, -.button-hyperlink .x-btn-small .x-btn-mc, -.button-hyperlink .x-btn-small .x-btn-br, -.button-hyperlink .x-btn-small .x-btn-bl, -.button-hyperlink .x-btn-small .x-btn-bc, -.button-hyperlink .x-btn-small .x-btn-tc, -.button-hyperlink .x-btn-small .x-btn-tr, -.button-hyperlink .x-btn-small .x-btn-tl -{ +.button-hyperlink .x-btn-small .x-btn-mr,.button-hyperlink .x-btn-small .x-btn-ml,.button-hyperlink .x-btn-small .x-btn-mc,.button-hyperlink .x-btn-small .x-btn-br,.button-hyperlink .x-btn-small .x-btn-bl,.button-hyperlink .x-btn-small .x-btn-bc,.button-hyperlink .x-btn-small .x-btn-tc,.button-hyperlink .x-btn-small .x-btn-tr,.button-hyperlink .x-btn-small .x-btn-tl + { background-image: none !important; background: none !important; } @@ -277,13 +269,10 @@ background: #A9BFD3 !important; color: whitesmoke; font-weight: 500; - } - - .myToolbar { - background-color:transparent !important; + background-color: transparent !important; } .smartButton { @@ -299,14 +288,12 @@ } .button-hyperlink .x-btn-text { - top: -4px; !important; + top: -4px; + ! + important; } - - -.myWebDavStyle{ - +.myWebDavStyle { font-family: Arial, "Times New Roman", Times; font-size: 12px; - -} +} \ No newline at end of file