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
This commit is contained in:
Francesco Mangiacrapa 2014-03-17 13:57:21 +00:00
parent 9532f5891e
commit 7096dd9acf
10 changed files with 90 additions and 314 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/workspace-6.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/workspace-6.6.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -25,5 +25,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/workspace-6.6.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/workspace-6.6.1-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -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

View File

@ -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<Void>() {
@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
}
}

View File

@ -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<SettingPermissionEventHandler> {
public static Type<SettingPermissionEventHandler> TYPE = new Type<SettingPermissionEventHandler>();
private FileModel targetFile = null;
private DialogPermission dialogPermission;
public SettingPermissionEvent(FileModel target, DialogPermission dialog) {
this.targetFile = (FileGridModel) target;
this.dialogPermission = dialog;
}
@Override
public Type<SettingPermissionEventHandler> 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;
}
}

View File

@ -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);
}

View File

@ -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<VREChangePermissionsEventHandler> {
public static Type<VREChangePermissionsEventHandler> TYPE = new Type<VREChangePermissionsEventHandler>();
private FileModel fileModel = null; //Folder source click
/**
* @param fileModel
*/
public VREChangePermissionsEvent(FileModel fileModel) {
this.fileModel = fileModel;
}
@Override
public Type<VREChangePermissionsEventHandler> 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;
}
}

View File

@ -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);
}

View File

@ -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<InfoContactModel> callcack = new AsyncCallback<InfoContactModel>() {
@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<List<WorkspaceACL>>() {
@Override
public void onSuccess(List<WorkspaceACL> 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<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
});
this.getButtonById(Dialog.OK).addSelectionListener(
new SelectionListener<ButtonEvent>() {
@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<InfoContactModel> callback) {
AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(sharedFolderId, new AsyncCallback<InfoContactModel>() {
@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;
}
}

View File

@ -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();
}
}

View File

@ -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;
}
}