merged with brach release 2.13
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@71675 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ff8bf34e70
commit
bc643e20c2
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
|
||||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
|
|
16
pom.xml
16
pom.xml
|
@ -152,22 +152,6 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- REMOVE THIS -->
|
|
||||||
<!-- <dependency> -->
|
|
||||||
<!-- <groupId>org.gcube.portlets.user</groupId> -->
|
|
||||||
<!-- <artifactId>opengcubeapplication</artifactId> -->
|
|
||||||
<!-- <version>1.0.0-SNAPSHOT</version> -->
|
|
||||||
<!-- <scope>system</scope> -->
|
|
||||||
<!-- <systemPath>/home/backup-old-home/francesco-mangiacrapa/workspace/opengcubeapplication/target/opengcubeapplication-1.0.0-SNAPSHOT.jar</systemPath> -->
|
|
||||||
<!-- <exclusions> -->
|
|
||||||
<!-- <exclusion> -->
|
|
||||||
<!-- <artifactId>opengcubeapplication</artifactId> -->
|
|
||||||
<!-- <groupId>org.gcube.portlets.user</groupId> -->
|
|
||||||
<!-- </exclusion> -->
|
|
||||||
<!-- </exclusions> -->
|
|
||||||
<!-- </dependency> -->
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -119,6 +119,7 @@ import com.extjs.gxt.ui.client.widget.Info;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
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.HasWidgets;
|
import com.google.gwt.user.client.ui.HasWidgets;
|
||||||
|
|
||||||
|
@ -244,7 +245,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
final FileModel parentModel = parent;
|
final FileModel parentModel = parent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
finalDialog.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
finalDialog.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -288,9 +288,17 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(Boolean result) {
|
||||||
if(result)
|
if(result){
|
||||||
eventBus.fireEvent(new RefreshFolderEvent(parentFileModel));
|
FileModel parentToRefresh=null;
|
||||||
|
|
||||||
|
if(isNewFolder)
|
||||||
|
parentToRefresh = parentModel;
|
||||||
|
else
|
||||||
|
parentToRefresh = parentFileModel;
|
||||||
|
|
||||||
|
eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh));
|
||||||
|
GWT.log("share completed refresh folder : "+parentModel.getName());
|
||||||
|
}
|
||||||
explorerPanel.unmask();
|
explorerPanel.unmask();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -383,8 +391,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshItem(RefreshFolderEvent refreshtemEvent) {
|
public void onRefreshItem(RefreshFolderEvent refreshtemEvent) {
|
||||||
|
|
||||||
|
if(refreshtemEvent.getFolderTarget()!=null){
|
||||||
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshtemEvent.getFolderTarget().getIdentifier());
|
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshtemEvent.getFolderTarget().getIdentifier());
|
||||||
notifySubscriber(refreshtemEvent);
|
notifySubscriber(refreshtemEvent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
GWT.log("warn: escape refresh because item is null");
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -824,7 +836,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
if(dgt.isValidForm()){
|
if(dgt.isValidForm()){
|
||||||
|
|
||||||
rpcWorkspaceService.renameItem(target.getIdentifier(), newName, new AsyncCallback<Boolean>(){
|
rpcWorkspaceService.renameItem(target.getIdentifier(), newName, target.getName(), new AsyncCallback<Boolean>(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -859,7 +871,23 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
private void doDeleteItem(final DeleteItemEvent event){
|
private void doDeleteItem(final DeleteItemEvent event){
|
||||||
|
|
||||||
MessageBoxConfirm mbc = new MessageBoxConfirm(ConstantsExplorer.MESSAGE_DELETE, ConstantsExplorer.MESSAGE_CONFIRM_DELETE_ITEM + " "+ event.getFileTarget().getName() +"?");
|
String title = "";
|
||||||
|
String msg = "";
|
||||||
|
|
||||||
|
if(event.getFileTarget().isShared()){
|
||||||
|
title = ConstantsExplorer.MESSAGE_DELETE;
|
||||||
|
msg = "This item is shared. Deleting this item will affect other users. Continue?";
|
||||||
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
|
title = ConstantsExplorer.MESSAGE_DELETE;
|
||||||
|
msg = ConstantsExplorer.MESSAGE_CONFIRM_DELETE_ITEM + " "+ event.getFileTarget().getName() +"?";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MessageBoxConfirm mbc = new MessageBoxConfirm(title, msg);
|
||||||
|
|
||||||
|
|
||||||
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
||||||
|
|
||||||
public void handleEvent(MessageBoxEvent be) {
|
public void handleEvent(MessageBoxEvent be) {
|
||||||
|
@ -882,6 +910,11 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(Boolean result) {
|
||||||
|
|
||||||
|
//Timer is used for chrome
|
||||||
|
Timer t = new Timer() {
|
||||||
|
public void run() {
|
||||||
|
|
||||||
FileModel fileModel = event.getFileTarget();
|
FileModel fileModel = event.getFileTarget();
|
||||||
if(explorerPanel.getAsycTreePanel().deleteItem(fileModel.getIdentifier())){
|
if(explorerPanel.getAsycTreePanel().deleteItem(fileModel.getIdentifier())){
|
||||||
explorerPanel.getAsycTreePanel().selectItem(fileModel.getParentFileModel().getIdentifier()); //Select parent of item deleted
|
explorerPanel.getAsycTreePanel().selectItem(fileModel.getParentFileModel().getIdentifier()); //Select parent of item deleted
|
||||||
|
@ -889,6 +922,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Schedule the timer to run once every second, 1000 ms.
|
||||||
|
t.schedule(250);
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1204,13 +1243,21 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String url) {
|
public void onSuccess(String url) {
|
||||||
|
|
||||||
String reportUrl = url;
|
if(url==null || url.isEmpty()){
|
||||||
// int last = currentUrl.lastIndexOf("/");
|
|
||||||
// String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
|
String currentUrl = portalURL();
|
||||||
|
int last = currentUrl.lastIndexOf("/");
|
||||||
|
String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
|
||||||
// Log.trace("Url: "+reportUrl);
|
// Log.trace("Url: "+reportUrl);
|
||||||
// System.out.println("currentUrl " +currentUrl);
|
System.out.println("currentUrl " +currentUrl);
|
||||||
System.out.println("reportUrl " +reportUrl);
|
System.out.println("reportUrl " +reportUrl);
|
||||||
new WindowOpenUrl(reportUrl, "_self", "");
|
new WindowOpenUrl(reportUrl, "_self", "");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
String reportUrl = url;
|
||||||
|
System.out.println("reportUrl " +reportUrl);
|
||||||
|
new WindowOpenUrl(reportUrl, "_self", "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1234,14 +1281,24 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String url) {
|
public void onSuccess(String url) {
|
||||||
|
|
||||||
String templateUrl = url;
|
if(url==null || url.isEmpty()){
|
||||||
// int last = currentUrl.lastIndexOf("/");
|
|
||||||
// String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
|
|
||||||
|
String currentUrl = portalURL();
|
||||||
|
int last = currentUrl.lastIndexOf("/");
|
||||||
|
String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
|
||||||
// Log.trace("Url: "+templateUrl);
|
// Log.trace("Url: "+templateUrl);
|
||||||
// System.out.println("currentUrl " +currentUrl);
|
System.out.println("currentUrl " +currentUrl);
|
||||||
// System.out.println("reportUrl " +templateUrl);
|
System.out.println("reportUrl " +templateUrl);
|
||||||
new WindowOpenUrl(templateUrl, "_self", "");
|
new WindowOpenUrl(templateUrl, "_self", "");
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
String templateUrl = url;
|
||||||
|
new WindowOpenUrl(templateUrl, "_self", "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1473,10 +1530,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
this.explorerPanel.getAsycTreePanel().setSizeTreePanel(width, height);
|
this.explorerPanel.getAsycTreePanel().setSizeTreePanel(width, height);
|
||||||
this.explorerPanel.getAsycTreePanel().setHeaderTreeVisible(false);
|
this.explorerPanel.getAsycTreePanel().setHeaderTreeVisible(false);
|
||||||
|
|
||||||
|
|
||||||
return explorerPanel.getAsycTreePanel();
|
return explorerPanel.getAsycTreePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void hideSharingFacilities() {
|
||||||
|
explorerPanel.getAsycTreePanel().getContextMenuTree().setHideSharing();
|
||||||
|
}
|
||||||
|
|
||||||
public void refreshRoot(){
|
public void refreshRoot(){
|
||||||
if(explorerPanel.getAsycTreePanel()!=null)
|
if(explorerPanel.getAsycTreePanel()!=null)
|
||||||
|
|
|
@ -256,5 +256,11 @@ public interface Icons extends ClientBundle {
|
||||||
|
|
||||||
@Source("icons/mime/csv.gif")
|
@Source("icons/mime/csv.gif")
|
||||||
ImageResource csv();
|
ImageResource csv();
|
||||||
|
|
||||||
|
@Source("icons/excel.gif")
|
||||||
|
ImageResource excel();
|
||||||
|
|
||||||
|
@Source("icons/ppt.gif")
|
||||||
|
ImageResource ppt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,20 +26,34 @@ public class Resources {
|
||||||
private static final String TIFF = "tiff";
|
private static final String TIFF = "tiff";
|
||||||
private static final String SVG = "svg";
|
private static final String SVG = "svg";
|
||||||
private static final String MSWORD = "msword";
|
private static final String MSWORD = "msword";
|
||||||
// private static final String DOCX = "msword";
|
private static final String DOC = "doc";
|
||||||
private static final String EXCEL = "excel";
|
private static final String DOCX = "vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||||
|
private static final String EXCEL = "vnd.ms-excel";
|
||||||
private static final String TXT = "plain";
|
private static final String TXT = "plain";
|
||||||
private static final String MPEG = "mpeg";
|
private static final String MPEG = "mpeg";
|
||||||
private static final String SWF = "swf";
|
private static final String SWF = "swf";
|
||||||
private static final String FLV = "flv";
|
private static final String FLV = "flv";
|
||||||
private static final String AVI = "avi";
|
private static final String AVI = "avi";
|
||||||
private static final Object CSV = "csv";
|
private static final String CSV = "csv";
|
||||||
|
private static final String PPT = "vnd.ms-powerpoint";
|
||||||
|
private static final String PPTX = "vnd.openxmlformats-officedocument.presentationml.presentation";
|
||||||
|
private static final String XSLX = "vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||||
|
|
||||||
public static AbstractImagePrototype getIconTable(){
|
public static AbstractImagePrototype getIconTable(){
|
||||||
|
|
||||||
return AbstractImagePrototype.create(ICONS.table());
|
return AbstractImagePrototype.create(ICONS.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconPpt(){
|
||||||
|
|
||||||
|
return AbstractImagePrototype.create(ICONS.ppt());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconExcel(){
|
||||||
|
|
||||||
|
return AbstractImagePrototype.create(ICONS.excel());
|
||||||
|
}
|
||||||
|
|
||||||
public static AbstractImagePrototype getIconUsers(){
|
public static AbstractImagePrototype getIconUsers(){
|
||||||
|
|
||||||
return AbstractImagePrototype.create(ICONS.users());
|
return AbstractImagePrototype.create(ICONS.users());
|
||||||
|
@ -441,7 +455,7 @@ public class Resources {
|
||||||
return Resources.getIconJpeg();
|
return Resources.getIconJpeg();
|
||||||
} else if (XHTLXML.equals(fileExtension)) {
|
} else if (XHTLXML.equals(fileExtension)) {
|
||||||
return Resources.getIconXml();
|
return Resources.getIconXml();
|
||||||
} else if (MSWORD.equals(fileExtension) || MSWORD.equals(fileExtension)) {
|
} else if (fileExtension.contains(MSWORD) || DOC.equals(fileExtension) || fileExtension.contains(DOCX)) {
|
||||||
return Resources.getIconDoc();
|
return Resources.getIconDoc();
|
||||||
} else if (XML.equals(fileExtension)) {
|
} else if (XML.equals(fileExtension)) {
|
||||||
return Resources.getIconXml();
|
return Resources.getIconXml();
|
||||||
|
@ -463,6 +477,10 @@ public class Resources {
|
||||||
return Resources.getIconGif();
|
return Resources.getIconGif();
|
||||||
} else if (TXT.equals(fileExtension)) {
|
} else if (TXT.equals(fileExtension)) {
|
||||||
return Resources.getIconTxt();
|
return Resources.getIconTxt();
|
||||||
|
}else if (fileExtension.contains(PPT) || fileExtension.equals(PPTX)) {
|
||||||
|
return Resources.getIconPpt();
|
||||||
|
}else if (fileExtension.contains(EXCEL) || fileExtension.contains(XSLX)) {
|
||||||
|
return Resources.getIconExcel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
|
@ -532,6 +550,8 @@ public class Resources {
|
||||||
int sl = type.indexOf("/");
|
int sl = type.indexOf("/");
|
||||||
String extension = type.substring(sl+1, type.length());
|
String extension = type.substring(sl+1, type.length());
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println("extensions - "+extension);
|
||||||
return Resources.getIconByExtension(extension);
|
return Resources.getIconByExtension(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 130 B |
|
@ -61,7 +61,7 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
|
|
||||||
public Boolean removeItem(String itemId) throws Exception;
|
public Boolean removeItem(String itemId) throws Exception;
|
||||||
|
|
||||||
public Boolean renameItem(String itemId, String newName) throws Exception;
|
public Boolean renameItem(String itemId, String newName, String oldName) throws Exception;
|
||||||
|
|
||||||
public Boolean removeSmartFolder(String itemId, String name) throws Exception;
|
public Boolean removeSmartFolder(String itemId, String name) throws Exception;
|
||||||
|
|
||||||
|
@ -116,27 +116,9 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
|
|
||||||
public InfoContactModel getOwnerByItemId(String itemId) throws Exception;
|
public InfoContactModel getOwnerByItemId(String itemId) throws Exception;
|
||||||
|
|
||||||
// public ArrayList<List<FileModel>> getChildrenListsByParentsIdentifier(String itemIdentifier) throws Exception;
|
public String itemExistsInWorkpaceFolder(String parentId, String itemName) throws Exception;
|
||||||
|
|
||||||
// public List<GWTUser> getUsers() throws Exception;
|
|
||||||
//
|
|
||||||
// public List<PortalUser> getPortalUsers() throws Exception;
|
|
||||||
//
|
|
||||||
// public void importDocumentAlternatives(List<String> alternativesOIDs, String destinationFolderId) throws Exception;
|
|
||||||
//
|
|
||||||
// public void importDocumentParts(List<String> partsOIDs, String destinationFolderId) throws Exception;
|
|
||||||
//
|
|
||||||
// public WorkspaceSelectionState loadSelectionState() throws Exception;
|
|
||||||
|
|
||||||
// public void saveSelectionState(WorkspaceSelectionState selectionState) throws Exception;
|
|
||||||
//
|
|
||||||
// public void sendRequest(String itemId, List<AddresseeUser> addresses) throws Exception;
|
|
||||||
//
|
|
||||||
// public Boolean setItemDescription(String itemId, String newDescription) throws Exception;
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId)
|
||||||
|
throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
|
|
||||||
void removeItem(String itemId, AsyncCallback<Boolean> callback);
|
void removeItem(String itemId, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
void renameItem(String itemId, String newName, AsyncCallback<Boolean> callback);
|
void renameItem(String itemId, String newName, String oldName, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
void createFolder(String nameFolder, String description, FileModel parent, AsyncCallback<FolderModel> callback);
|
void createFolder(String nameFolder, String description, FileModel parent, AsyncCallback<FolderModel> callback);
|
||||||
|
|
||||||
|
@ -122,29 +122,11 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
void getOwnerByItemId(String itemId,
|
void getOwnerByItemId(String itemId,
|
||||||
AsyncCallback<InfoContactModel> callback);
|
AsyncCallback<InfoContactModel> callback);
|
||||||
|
|
||||||
// void getListParentsByItemIdentifier(String itemIdentifier,AsyncCallback<ArrayList<String>> callback);
|
void itemExistsInWorkpaceFolder(String parentId, String itemName,
|
||||||
|
AsyncCallback<String> callback);
|
||||||
// void getChildrenListsByParentsIdentifier(String itemIdentifier,AsyncCallback<ArrayList<List<FileModel>>> callback);
|
|
||||||
|
|
||||||
// public void getUsers(AsyncCallback<List<GWTUser>> callback);
|
|
||||||
//
|
|
||||||
// void getPortalUsers(AsyncCallback<List<PortalUser>> callback);
|
|
||||||
//
|
|
||||||
// public void importDocumentAlternatives(List<String> alternativesOIDs, String destinationFolderId, AsyncCallback<Void> callback);
|
|
||||||
//
|
|
||||||
// public void importDocumentParts(List<String> partsOIDs, String destinationFolderId, AsyncCallback<Void> callback);
|
|
||||||
//
|
|
||||||
// public void loadSelectionState(AsyncCallback<WorkspaceSelectionState> callback);
|
|
||||||
//
|
|
||||||
|
|
||||||
// public void saveSelectionState(WorkspaceSelectionState selectionState, AsyncCallback<Void> callback);
|
|
||||||
//
|
|
||||||
// public void sendRequest(String itemId, List<AddresseeUser> addressees, AsyncCallback<Void> callback);
|
|
||||||
//
|
|
||||||
// public void setItemDescription(String itemId, String newDescription, AsyncCallback<Boolean> callback);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void getListUserSharedBySharedItem(String sharedItemId,
|
||||||
|
AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||||
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
|
||||||
public class ContextMenuTree {
|
public class ContextMenuTree {
|
||||||
|
@ -38,6 +39,7 @@ public class ContextMenuTree {
|
||||||
private HandlerManager eventBus = AppControllerExplorer.getEventBus();
|
private HandlerManager eventBus = AppControllerExplorer.getEventBus();
|
||||||
private List<FileModel> listSelectedItems = null;
|
private List<FileModel> listSelectedItems = null;
|
||||||
|
|
||||||
|
private boolean hideSharing = false;
|
||||||
|
|
||||||
public ContextMenuTree() {
|
public ContextMenuTree() {
|
||||||
this.contextMenu.setWidth(140);
|
this.contextMenu.setWidth(140);
|
||||||
|
@ -59,7 +61,7 @@ public class ContextMenuTree {
|
||||||
previewImage.addSelectionListener(new SelectionListener<MenuEvent>() {
|
previewImage.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||||
public void componentSelected(MenuEvent ce) {
|
public void componentSelected(MenuEvent ce) {
|
||||||
|
|
||||||
// FileModel selected = treePanel.getSelectionModel().getSelectedItem();
|
// FileModel selected = treePanel.getSelectionModel().getSelectedItem();
|
||||||
|
|
||||||
FileModel selected = listSelectedItems.get(0);
|
FileModel selected = listSelectedItems.get(0);
|
||||||
|
|
||||||
|
@ -175,7 +177,6 @@ public class ContextMenuTree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
contextMenu.add(createShareFolder);
|
contextMenu.add(createShareFolder);
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,8 +262,6 @@ public class ContextMenuTree {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
contextMenu.add(share);
|
|
||||||
|
|
||||||
MenuItem unShare = new MenuItem();
|
MenuItem unShare = new MenuItem();
|
||||||
unShare.setId(ConstantsExplorer.USHR);
|
unShare.setId(ConstantsExplorer.USHR);
|
||||||
unShare.setText("UnShare");
|
unShare.setText("UnShare");
|
||||||
|
@ -280,9 +279,15 @@ public class ContextMenuTree {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
contextMenu.add(share);
|
||||||
contextMenu.add(unShare);
|
contextMenu.add(unShare);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MenuItem rename = new MenuItem();
|
MenuItem rename = new MenuItem();
|
||||||
rename.setId(ConstantsExplorer.RNM);
|
rename.setId(ConstantsExplorer.RNM);
|
||||||
rename.setText("Rename Item");
|
rename.setText("Rename Item");
|
||||||
|
@ -465,6 +470,10 @@ public class ContextMenuTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setHideSharing() {
|
||||||
|
hideSharing = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void openContextMenuOnItem(FileModel targetFileModel, int posX, int posY) {
|
public void openContextMenuOnItem(FileModel targetFileModel, int posX, int posY) {
|
||||||
clearListSelectedItems();
|
clearListSelectedItems();
|
||||||
listSelectedItems.add(0, targetFileModel);
|
listSelectedItems.add(0, targetFileModel);
|
||||||
|
@ -485,7 +494,7 @@ public class ContextMenuTree {
|
||||||
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //set invisible unshare
|
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //set invisible unshare
|
||||||
contextMenu.showAt(posX, posY);
|
contextMenu.showAt(posX, posY);
|
||||||
}
|
}
|
||||||
// treePanel.fireEvent(Events.ContextMenu);
|
// treePanel.fireEvent(Events.ContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -530,6 +539,14 @@ public class ContextMenuTree {
|
||||||
contextMenu.getItemByItemId(ConstantsExplorer.ISHF).setVisible(true); //insert shared folder
|
contextMenu.getItemByItemId(ConstantsExplorer.ISHF).setVisible(true); //insert shared folder
|
||||||
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //UNSHARE
|
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //UNSHARE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GWT.log("HideSharing = " + hideSharing);
|
||||||
|
//not supported in tree Reports
|
||||||
|
if (hideSharing) {
|
||||||
|
contextMenu.getItemByItemId(ConstantsExplorer.SHR).setVisible(false); //SHARE
|
||||||
|
contextMenu.getItemByItemId(ConstantsExplorer.ISHF).setVisible(false); //insert shared folder
|
||||||
|
contextMenu.getItemByItemId(ConstantsExplorer.USHR).setVisible(false); //UNSHARE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
contextMenu.getItemByItemId(ConstantsExplorer.SHW).setVisible(true);
|
contextMenu.getItemByItemId(ConstantsExplorer.SHW).setVisible(true);
|
||||||
|
@ -556,8 +573,8 @@ public class ContextMenuTree {
|
||||||
break;
|
break;
|
||||||
case TIME_SERIES:
|
case TIME_SERIES:
|
||||||
break;
|
break;
|
||||||
// case AQUAMAPS_ITEM:
|
// case AQUAMAPS_ITEM:
|
||||||
// break;
|
// break;
|
||||||
case PDF_DOCUMENT:
|
case PDF_DOCUMENT:
|
||||||
break;
|
break;
|
||||||
case IMAGE_DOCUMENT:
|
case IMAGE_DOCUMENT:
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.extjs.gxt.ui.client.widget.form.TextArea;
|
||||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
|
@ -35,7 +36,6 @@ public class DialogAddFolderAndSmart extends Dialog {
|
||||||
layout.setDefaultWidth(300);
|
layout.setDefaultWidth(300);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
// setHideOnButtonClick(true);
|
// setHideOnButtonClick(true);
|
||||||
// setIcon(IconHelper.createStyle("user"));
|
// setIcon(IconHelper.createStyle("user"));
|
||||||
|
|
|
@ -11,7 +11,10 @@ import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
import com.extjs.gxt.ui.client.event.Events;
|
import com.extjs.gxt.ui.client.event.Events;
|
||||||
import com.extjs.gxt.ui.client.event.FormEvent;
|
import com.extjs.gxt.ui.client.event.FormEvent;
|
||||||
import com.extjs.gxt.ui.client.event.Listener;
|
import com.extjs.gxt.ui.client.event.Listener;
|
||||||
|
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||||
|
import com.extjs.gxt.ui.client.widget.Info;
|
||||||
import com.extjs.gxt.ui.client.widget.Window;
|
import com.extjs.gxt.ui.client.widget.Window;
|
||||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||||
import com.extjs.gxt.ui.client.widget.form.FileUploadField;
|
import com.extjs.gxt.ui.client.widget.form.FileUploadField;
|
||||||
|
@ -19,8 +22,11 @@ import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
||||||
import com.extjs.gxt.ui.client.widget.form.FormPanel.Encoding;
|
import com.extjs.gxt.ui.client.widget.form.FormPanel.Encoding;
|
||||||
import com.extjs.gxt.ui.client.widget.form.FormPanel.Method;
|
import com.extjs.gxt.ui.client.widget.form.FormPanel.Method;
|
||||||
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.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.Hidden;
|
import com.google.gwt.user.client.ui.Hidden;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
|
@ -35,25 +41,20 @@ public class DialogUpload extends Window {
|
||||||
private Button btnSubmit = new Button("Submit");
|
private Button btnSubmit = new Button("Submit");
|
||||||
private Button btnCancel = new Button("Cancel");
|
private Button btnCancel = new Button("Cancel");
|
||||||
|
|
||||||
// private Text txtParentPath = new Text();
|
|
||||||
// private int widthSize = 300;
|
|
||||||
// private final Dialog simple = new Dialog();
|
|
||||||
|
|
||||||
|
private String parentIdentifier = "";
|
||||||
|
private String parentName = "";
|
||||||
|
|
||||||
public DialogUpload(String headerTitle, String parentName, final FileModel parent, String fieldLabel){
|
public DialogUpload(String headerTitle, String parentName, final FileModel parent, String fieldLabel){
|
||||||
|
|
||||||
this.setHeaderVisible(true);
|
this.setHeaderVisible(true);
|
||||||
// this.setHeading("File Upload in: " + parentPath);
|
|
||||||
this.setHeading(headerTitle + parentName);
|
this.setHeading(headerTitle + parentName);
|
||||||
// this.setHeading(ConstantsExplorer.FILEUPLOADHEADER + parentPath);
|
this.parentIdentifier = parent.getIdentifier();
|
||||||
|
this.parentName = parentName;
|
||||||
// this.txtParentPath.setText("Parent Folder : " + parentPath);
|
|
||||||
|
|
||||||
this.setStyleAttribute("margin", "10px");
|
this.setStyleAttribute("margin", "10px");
|
||||||
|
|
||||||
// Create a FormPanel and point it at a service.
|
// Create a FormPanel and point it at a service.
|
||||||
|
|
||||||
|
|
||||||
// Create a FormPanel and point it at a service.
|
// Create a FormPanel and point it at a service.
|
||||||
formPanel.setHeaderVisible(false);
|
formPanel.setHeaderVisible(false);
|
||||||
formPanel.setFrame(true);
|
formPanel.setFrame(true);
|
||||||
|
@ -64,36 +65,22 @@ public class DialogUpload extends Window {
|
||||||
formPanel.setButtonAlign(HorizontalAlignment.CENTER);
|
formPanel.setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
formPanel.setWidth(400);
|
formPanel.setWidth(400);
|
||||||
|
|
||||||
// TextField<String> name = new TextField<String>();
|
// TextField<String> name = new TextField<String>();
|
||||||
// name.setFieldLabel("Name");
|
// name.setFieldLabel("Name");
|
||||||
// formPanel.add(name);
|
// formPanel.add(name);
|
||||||
|
|
||||||
fileUploadField.setAllowBlank(false);
|
fileUploadField.setAllowBlank(false);
|
||||||
fileUploadField.setName("uploadFormElement");
|
fileUploadField.setName("uploadFormElement");
|
||||||
// fileUploadField.setRegex("^[a-zA-Z0-9_-]+[ a-zA-Z0-9_().-]+$");
|
|
||||||
// fileUploadField.setAutoValidate(true);
|
|
||||||
// fileUploadField.getMessages().setRegexText(ConstantsExplorer.MESSAGE_NAME_FORCE_APHANUMERIC);
|
|
||||||
|
|
||||||
// Add a label
|
// Add a label
|
||||||
formPanel.add(new Hidden("idFolder",parent.getIdentifier()));
|
formPanel.add(new Hidden("idFolder",parent.getIdentifier()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
formPanel.add(new Hidden("uploadType",fieldLabel));
|
formPanel.add(new Hidden("uploadType",fieldLabel));
|
||||||
// fileUploadField.setFieldLabel(ConstantsExplorer.FILE);
|
// fileUploadField.setFieldLabel(ConstantsExplorer.FILE);
|
||||||
fileUploadField.setFieldLabel(fieldLabel);
|
fileUploadField.setFieldLabel(fieldLabel);
|
||||||
|
|
||||||
// fileUploadField.setWidth(widthSize);
|
|
||||||
|
|
||||||
// fileUploadField.setStyleAttribute("width", "350px");
|
|
||||||
|
|
||||||
// fileUploadField.setSize(400, 50);
|
|
||||||
|
|
||||||
formPanel.add(fileUploadField);
|
formPanel.add(fileUploadField);
|
||||||
|
|
||||||
// formPanel.add(this.txtParentPath);
|
|
||||||
|
|
||||||
|
|
||||||
// formPanel.add(btn);
|
|
||||||
|
|
||||||
formPanel.addButton(btnSubmit);
|
formPanel.addButton(btnSubmit);
|
||||||
|
|
||||||
formPanel.addButton(btnCancel);
|
formPanel.addButton(btnCancel);
|
||||||
|
@ -110,29 +97,37 @@ public class DialogUpload extends Window {
|
||||||
|
|
||||||
isStatusCompleted = true;
|
isStatusCompleted = true;
|
||||||
|
|
||||||
// Log.trace("onSubmitComplete");
|
// Log.trace("onSubmitComplete");
|
||||||
String result = event.getResultHtml();
|
String result = event.getResultHtml();
|
||||||
|
|
||||||
// Log.trace("Result "+result);
|
// Log.trace("Result "+result);
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
messageBoxWait.getMessageBoxWait().close();
|
messageBoxWait.getMessageBoxWait().close();
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
// MessageUtil.showErrorMessage("Error during upload", "An error occurred during file upload.");
|
// MessageUtil.showErrorMessage("Error during upload", "An error occurred during file upload.");
|
||||||
new MessageBoxAlert("Error during upload", "An error occurred during file upload.", null);
|
new MessageBoxAlert("Error during upload", "An error occurred during file upload.", null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//expected <pre>200:Upload complete</pre>
|
//expected <pre>200:Upload complete</pre>
|
||||||
//we strip tags added by webserver
|
/*we strip tags added by webserver,
|
||||||
String strippedResult = result.replace("<pre>", "").replace("</pre>", "");
|
*
|
||||||
|
* Massi fix because webkit returns
|
||||||
|
* <pre style="word-wrap: break-word; white-space: pre-wrap;">OK:File france_flag.png(0) imported correctly in /Workspace</pre>
|
||||||
|
*
|
||||||
|
* TODO: recall it next time
|
||||||
|
*/
|
||||||
|
//String strippedResult = result.replace("<pre>", "").replace("</pre>", ""); //this won't work for webkit
|
||||||
|
//replaced by new HTML(result).getText()
|
||||||
|
String strippedResult = new HTML(result).getText();
|
||||||
|
|
||||||
|
|
||||||
System.out.println(result);
|
// com.google.gwt.user.client.Window.alert(result);
|
||||||
|
// com.google.gwt.user.client.Window.alert("Stripped: " + strippedResult);
|
||||||
|
|
||||||
UploadResultMessage resultMessage = UploadResultMessage.parseResult(strippedResult);
|
final UploadResultMessage resultMessage = UploadResultMessage.parseResult(strippedResult);
|
||||||
// Log.trace("status: "+resultMessage.getStatus());
|
|
||||||
|
|
||||||
switch (resultMessage.getStatus()) {
|
switch (resultMessage.getStatus()) {
|
||||||
case ERROR:
|
case ERROR:
|
||||||
|
@ -142,15 +137,19 @@ public class DialogUpload extends Window {
|
||||||
new MessageBoxAlert("Error during upload", resultMessage.getMessage(), null);
|
new MessageBoxAlert("Error during upload", resultMessage.getMessage(), null);
|
||||||
break;
|
break;
|
||||||
case WARN: {
|
case WARN: {
|
||||||
// workspace.refreshRoot();
|
|
||||||
// MessageUtil.showWarnMessage("Upload completed with warnings", resultMessage.getMessage());
|
|
||||||
new MessageBoxAlert("Upload completed with warnings", resultMessage.getMessage(), null);
|
new MessageBoxAlert("Upload completed with warnings", resultMessage.getMessage(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OK: {
|
case OK: {
|
||||||
// workspace.refreshRoot();
|
Timer t = new Timer() {
|
||||||
|
public void run() {
|
||||||
|
AppControllerExplorer.getEventBus().fireEvent(new CompletedFileUploadEvent(parent, null));
|
||||||
new MessageBoxInfo("Upload completed successfully", resultMessage.getMessage(), null);
|
new MessageBoxInfo("Upload completed successfully", resultMessage.getMessage(), null);
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new CompletedFileUploadEvent(parent,null));
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
t.schedule(250);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,24 +168,6 @@ public class DialogUpload extends Window {
|
||||||
|
|
||||||
private void addListeners() {
|
private void addListeners() {
|
||||||
|
|
||||||
// fileUploadField.addListener(Events.OnChange, new Listener<BaseEvent>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void handleEvent(BaseEvent be) {
|
|
||||||
//// Window.alert("qui");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
// fileUploadField.addKeyListener(new KeyListener() { // KEY ENTER
|
|
||||||
//
|
|
||||||
// public void componentKeyPress(ComponentEvent event) {
|
|
||||||
// if (event.getKeyCode() == KeyboardEvents.Enter.getEventCode())
|
|
||||||
// btnSubmit.fireEvent(Events.OnClick);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
btnSubmit.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
btnSubmit.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,6 +177,73 @@ public class DialogUpload extends Window {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// com.google.gwt.user.client.Window.alert("parentIdentifier "+parentIdentifier);
|
||||||
|
// com.google.gwt.user.client.Window.alert("fileUploadField.getValue() "+fileUploadField.getValue());
|
||||||
|
// com.google.gwt.user.client.Window.alert("parentName "+parentName);
|
||||||
|
/*
|
||||||
|
* TODO: recall: Some browser would write in fileUploadField.getValue() C:\fakepath\$fileName
|
||||||
|
*/
|
||||||
|
String normalizedFileName = fileUploadField.getValue();
|
||||||
|
|
||||||
|
// com.google.gwt.user.client.Window.alert("fileUploadField.getValue() "+fileUploadField.getValue());
|
||||||
|
if (normalizedFileName.contains("\\")) {
|
||||||
|
normalizedFileName = normalizedFileName.substring(normalizedFileName.lastIndexOf("\\")+1); //remove C:\fakepath\ if exists
|
||||||
|
// com.google.gwt.user.client.Window.alert("normalizedFileName= "+normalizedFileName);
|
||||||
|
}
|
||||||
|
final String label = normalizedFileName;
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.itemExistsInWorkpaceFolder(parentIdentifier, normalizedFileName, new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(final String itemId) {
|
||||||
|
|
||||||
|
if(itemId!=null){
|
||||||
|
|
||||||
|
MessageBoxConfirm msg = new MessageBoxConfirm("Replace "+label+"?", label + " exists in folder "+parentName + ". Overwrite?");
|
||||||
|
|
||||||
|
|
||||||
|
msg.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
||||||
|
|
||||||
|
public void handleEvent(MessageBoxEvent be) {
|
||||||
|
|
||||||
|
//IF NOT CANCELLED
|
||||||
|
String clickedButton = be.getButtonClicked().getItemId();
|
||||||
|
|
||||||
|
if(clickedButton.equals(Dialog.YES)){
|
||||||
|
|
||||||
|
removeItemAndSubmitForm(itemId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else
|
||||||
|
submitForm(); //ITEM does NOT EXIST SO SUBMIT FORM;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Info.display("Error", "Sorry an error occurred on the server "+caught.getLocalizedMessage() + ". Please try again later");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
btnCancel.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void submitForm(){
|
||||||
|
|
||||||
messageBoxWait = new MessageBoxWait(ConstantsExplorer.PROGRESS, ConstantsExplorer.SAVINGYOURFILE, fileUploadField.getValue());
|
messageBoxWait = new MessageBoxWait(ConstantsExplorer.PROGRESS, ConstantsExplorer.SAVINGYOURFILE, fileUploadField.getValue());
|
||||||
|
|
||||||
//Progress bar for upload
|
//Progress bar for upload
|
||||||
|
@ -211,37 +259,30 @@ public class DialogUpload extends Window {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
t.scheduleRepeating(500);
|
t.scheduleRepeating(500);
|
||||||
|
|
||||||
|
|
||||||
formPanel.submit();
|
formPanel.submit();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
btnCancel.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
private void removeItemAndSubmitForm(String itemId){
|
||||||
|
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.removeItem(itemId, new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void onFailure(Throwable caught) {
|
||||||
hide();
|
Info.display("Error", "Sorry an error occurred on the server "+caught.getMessage() + ". Please try again later");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
if(result)
|
||||||
|
submitForm();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
|
||||||
// // Add an event handler to the form.
|
|
||||||
// formPanel.addHandler(Events., Type<new FormHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSubmitComplete(FormSubmitCompleteEvent event) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSubmit(FormSubmitEvent event) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ public class MessageBoxInfo {
|
||||||
private MessageBox box = null;
|
private MessageBox box = null;
|
||||||
|
|
||||||
public MessageBoxInfo(String title, String msg) {
|
public MessageBoxInfo(String title, String msg) {
|
||||||
box = MessageBox.info(title, msg, null);
|
InfoDisplay.display(title, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageBoxInfo(String title, String msg, Listener<MessageBoxEvent> listener){
|
public MessageBoxInfo(String title, String msg, Listener<MessageBoxEvent> listener){
|
||||||
box = MessageBox.info(title, msg, listener);
|
InfoDisplay.display(title, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageBox getMessageBoxConfirm(){
|
public MessageBox getMessageBoxConfirm(){
|
||||||
|
|
|
@ -82,7 +82,6 @@ import org.gcube.portlets.user.workspace.server.util.AllScope;
|
||||||
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.Util;
|
import org.gcube.portlets.user.workspace.server.util.Util;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||||
|
import org.gcube.portlets.user.homelibrary.home.HomeLibrary;
|
||||||
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
||||||
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
||||||
|
@ -23,6 +24,7 @@ import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.ItemNotFoun
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderBulkCreator;
|
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderBulkCreator;
|
||||||
|
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderItem;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderItemType;
|
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderItemType;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ExternalUrl;
|
import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ExternalUrl;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ts.TimeSeries;
|
import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ts.TimeSeries;
|
||||||
|
@ -460,6 +462,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
logger.trace("removeItem item: "+itemId);
|
logger.trace("removeItem item: "+itemId);
|
||||||
|
|
||||||
workspace.removeItem(itemId);
|
workspace.removeItem(itemId);
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
|
|
||||||
} catch (InsufficientPrivilegesException e) {
|
} catch (InsufficientPrivilegesException e) {
|
||||||
|
@ -476,7 +479,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean renameItem(String itemId, String newName) throws Exception {
|
public Boolean renameItem(String itemId, String newName, String oldName) throws Exception {
|
||||||
|
|
||||||
workspaceLogger.trace("renameItem itemId: "+itemId+" newName: "+newName);
|
workspaceLogger.trace("renameItem itemId: "+itemId+" newName: "+newName);
|
||||||
|
|
||||||
|
@ -485,16 +488,37 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
|
|
||||||
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
||||||
logger.trace("renameItem itemId: "+itemId+" newName: "+newName);
|
logger.trace("rename item itemId: "+itemId+" old name "+ oldName +", new name: "+newName);
|
||||||
|
|
||||||
workspace.renameItem(itemId, newName);
|
workspace.renameItem(itemId, newName);
|
||||||
|
|
||||||
|
//NOTIFIER
|
||||||
|
WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
|
|
||||||
|
if(wsItem.isShared()){
|
||||||
|
|
||||||
|
try{
|
||||||
|
List<InfoContactModel> listSharedContact = new ArrayList<InfoContactModel>();
|
||||||
|
NotificationsProducer notification = getNotificationProducer();
|
||||||
|
listSharedContact = getListUserSharedByFolderSharedId(wsItem.getIdSharedFolder());
|
||||||
|
if(Util.isASharedFolder(wsItem)){
|
||||||
|
notification.notifyFolderRenamed(listSharedContact, oldName, newName, wsItem.getIdSharedFolder());
|
||||||
|
}else{
|
||||||
|
WorkspaceFolder sharedFolder = (WorkspaceFolder) workspace.getItem(wsItem.getIdSharedFolder());
|
||||||
|
notification.notifyItemUpdated(listSharedContact, wsItem, sharedFolder);
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
workspaceLogger.error("An error occurred in checkNotify ", e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
workspaceLogger.error("Error in server Item rename", e);
|
workspaceLogger.error("Error in server Item rename", e);
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -923,6 +947,32 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
|
ASLSession session = Util.getAslSession(this.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
if(Util.isVRE(session)){
|
||||||
|
|
||||||
|
// GET WORKSPACE
|
||||||
|
Workspace workspace = HomeLibrary.getUserWorkspace(session);
|
||||||
|
|
||||||
|
// GET ITEM FROM WORKSPACE
|
||||||
|
WorkspaceItem item = workspace.getItem(oid);
|
||||||
|
|
||||||
|
// ITEM IS A WorkspaceItemType.FOLDER_ITEM?
|
||||||
|
if (item.getType().equals(WorkspaceItemType.FOLDER_ITEM)) {
|
||||||
|
FolderItem folderItem = (FolderItem) item;
|
||||||
|
|
||||||
|
if(folderItem.getFolderItemType().equals(FolderItemType.REPORT)){
|
||||||
|
setValueInSession("idreport", oid);
|
||||||
|
|
||||||
|
}else if(folderItem.getFolderItemType().equals(FolderItemType.REPORT_TEMPLATE)){
|
||||||
|
setValueInSession("idtemplate", oid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
urlPortlet = app.getURLFromApplicationProfile(oid, Util.getAslSession(this.getThreadLocalRequest().getSession()),this.getThreadLocalRequest().getSession());
|
urlPortlet = app.getURLFromApplicationProfile(oid, Util.getAslSession(this.getThreadLocalRequest().getSession()),this.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1580,7 +1630,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
WorkspaceItem wsItem = workspace.getItem(folderSharedId);
|
WorkspaceItem wsItem = workspace.getItem(folderSharedId);
|
||||||
|
|
||||||
if(wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
|
if(Util.isASharedFolder(wsItem)){
|
||||||
|
|
||||||
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
|
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
|
||||||
|
|
||||||
|
@ -1610,6 +1660,45 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId) throws Exception{
|
||||||
|
|
||||||
|
workspaceLogger.trace("getListUserSharedBySharedItem "+ sharedItemId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
|
WorkspaceItem wsItem = workspace.getItem(sharedItemId);
|
||||||
|
|
||||||
|
if(wsItem!=null && wsItem.isShared()){
|
||||||
|
|
||||||
|
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder());
|
||||||
|
|
||||||
|
if(wsFolder!=null){
|
||||||
|
|
||||||
|
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||||
|
|
||||||
|
List<String> listPortalLogin = wsFolder.getUsers();
|
||||||
|
|
||||||
|
workspaceLogger.trace("getListUserSharedByFolderSharedId return "+ listPortalLogin.size() + " user");
|
||||||
|
|
||||||
|
if(isTestMode())
|
||||||
|
return builder.buildGxtInfoContactFromPortalLoginTestMode(listPortalLogin);
|
||||||
|
|
||||||
|
|
||||||
|
return builder.buildGxtInfoContactFromPortalLogin(listPortalLogin);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return new ArrayList<InfoContactModel>();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
workspaceLogger.error("Error in getListUserSharedByItemId ", e);
|
||||||
|
throw new Exception(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean unSharedFolderByFolderSharedId(String folderSharedId) throws Exception{
|
public boolean unSharedFolderByFolderSharedId(String folderSharedId) throws Exception{
|
||||||
|
|
||||||
|
@ -1641,7 +1730,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
// contacts = new ArrayList<InfoContactModel>();
|
// contacts = new ArrayList<InfoContactModel>();
|
||||||
// contacts.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
// contacts.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
||||||
// }
|
// }
|
||||||
|
workspaceLogger.trace("UNSHARE WITH: ");
|
||||||
printContacts(contacts);
|
printContacts(contacts);
|
||||||
|
|
||||||
np.notifyFolderUnSharing(contacts, unSharedFolder);
|
np.notifyFolderUnSharing(contacts, unSharedFolder);
|
||||||
|
@ -1725,4 +1814,43 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String itemExistsInWorkpaceFolder(String parentId, String itemName) throws Exception {
|
||||||
|
|
||||||
|
workspaceLogger.trace("get itemExistsInWorkpace by parentId: "+parentId);
|
||||||
|
System.out.println("get itemExistsInWorkpace by parentId: "+parentId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
|
WorkspaceItem wsItem = workspace.getItem(parentId); //GET PARENT
|
||||||
|
|
||||||
|
if(wsItem.getType().equals(WorkspaceItemType.FOLDER) || wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
|
||||||
|
|
||||||
|
WorkspaceItem itemFound = workspace.find(itemName, parentId);
|
||||||
|
|
||||||
|
if(itemFound==null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return itemFound.getId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new Exception("Invalid Folder parent");
|
||||||
|
|
||||||
|
|
||||||
|
} catch (InternalErrorException e) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
} catch (ItemNotFoundException e) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
String error = "an error occurred on search item in folder ";
|
||||||
|
workspaceLogger.error(error, e);
|
||||||
|
throw new Exception(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class UploadServlet extends HttpServlet {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getType() != WorkspaceItemType.FOLDER) {
|
if (item.getType() != WorkspaceItemType.FOLDER && item.getType() != WorkspaceItemType.SHARED_FOLDER) {
|
||||||
logger.error("Error processing request in upload servlet: Wrong destination item");
|
logger.error("Error processing request in upload servlet: Wrong destination item");
|
||||||
sendError(response, "Internal error: Wrong destination item");
|
sendError(response, "Internal error: Wrong destination item");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspace.server.notifications;
|
package org.gcube.portlets.user.workspace.server.notifications;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
|
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
|
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSharedFolder;
|
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||||
|
@ -23,7 +24,7 @@ import org.gcube.portlets.user.workspace.server.util.Util;
|
||||||
*/
|
*/
|
||||||
public class NotificationsProducer {
|
public class NotificationsProducer {
|
||||||
|
|
||||||
protected GCUBELog gcubeLogger = new GCUBELog(NotificationsProducer.class);
|
protected GCUBEClientLog gcubeLogger = new GCUBEClientLog(NotificationsProducer.class);
|
||||||
protected GCUBEScope scope;
|
protected GCUBEScope scope;
|
||||||
|
|
||||||
protected NotificationsManager notificationsMng;
|
protected NotificationsManager notificationsMng;
|
||||||
|
@ -70,17 +71,18 @@ public class NotificationsProducer {
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
gcubeLogger.trace("Send notifies new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
gcubeLogger.trace("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Send notifies new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
System.out.println("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
|
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getLogin(), sharedFolder);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getId(), sharedFolder);
|
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
|
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
|
||||||
|
@ -96,6 +98,92 @@ public class NotificationsProducer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs a new thread to notify the contacts passed in input
|
||||||
|
* @param listContacts
|
||||||
|
* @param sharedFolder
|
||||||
|
*/
|
||||||
|
public void notifyFolderRenamed(final List<InfoContactModel> listSharedContact, final String itemOldName, final String itemNewName, final String idsharedFolder) {
|
||||||
|
|
||||||
|
new Thread(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
gcubeLogger.trace("Send notifies shared folder was renamed is running...");
|
||||||
|
|
||||||
|
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||||
|
try{
|
||||||
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
|
gcubeLogger.trace("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
|
//DEBUG
|
||||||
|
System.out.println("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
|
boolean notify = notificationsMng.notifyFolderRenaming(infoContactModel.getLogin(), itemOldName, itemNewName, idsharedFolder);
|
||||||
|
|
||||||
|
|
||||||
|
if(!notify)
|
||||||
|
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
gcubeLogger.error("An error occured in notifyFolderRenamed ", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gcubeLogger.trace("notifies share folder was renamed is completed");
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs a new thread to notify the contacts passed in input
|
||||||
|
* @param listContacts
|
||||||
|
* @param sharedFolder
|
||||||
|
*/
|
||||||
|
public void notifyItemUpdated(final List<InfoContactModel> listSharedContact, final WorkspaceItem item, final WorkspaceFolder sharedFolder) {
|
||||||
|
|
||||||
|
new Thread(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
gcubeLogger.trace("Send notifies shared item was updated is running...");
|
||||||
|
|
||||||
|
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||||
|
try{
|
||||||
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
|
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
||||||
|
|
||||||
|
//DEBUG
|
||||||
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
||||||
|
|
||||||
|
boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(), item, sharedFolder);
|
||||||
|
|
||||||
|
if(!notify)
|
||||||
|
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
gcubeLogger.error("An error occured in notifyItemUpdated ", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gcubeLogger.trace("notifies shared item was updated is completed");
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the new contacts passed in input
|
* Runs a new thread to notify the new contacts passed in input
|
||||||
* @param listSharedContact - list of contacts already shared
|
* @param listSharedContact - list of contacts already shared
|
||||||
|
@ -109,30 +197,37 @@ public class NotificationsProducer {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
//CREATE TEMPORARY HASH
|
||||||
|
HashMap<String, InfoContactModel> hashLoginAlreadyShared = new HashMap<String, InfoContactModel>();
|
||||||
|
|
||||||
|
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||||
|
hashLoginAlreadyShared.put(infoContactModel.getLogin(),infoContactModel);
|
||||||
|
}
|
||||||
|
|
||||||
if(listSharedContact==null)
|
if(listSharedContact==null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listSharingContact) {
|
for (InfoContactModel infoContactModel : listSharingContact) {
|
||||||
|
|
||||||
if(!listSharedContact.contains(infoContactModel)){ //if is new contact.. notifies share
|
|
||||||
|
if(hashLoginAlreadyShared.get(infoContactModel.getLogin())==null){ //if is new contact.. notifies share
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
for (InfoContactModel contact : listSharedContact) { //NOTIFIES ALREADY SHARED CONTACTS
|
for (InfoContactModel contact : listSharedContact) { //NOTIFIES ALREADY SHARED CONTACTS
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
gcubeLogger.trace("Send notifies added user "+ infoContactModel.getId() +" to share folder "+sharedFolder.getName() + " for user "+contact.getId());
|
gcubeLogger.trace("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Send notifies added user "+ infoContactModel.getId() +" to share folder "+sharedFolder.getName() + " for user "+contact.getId());
|
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getId(), sharedFolder, infoContactModel.getId());
|
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(), sharedFolder, infoContactModel.getLogin());
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getId());
|
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
gcubeLogger.error("An error occured in notifyFolderAddedUser ", e);
|
gcubeLogger.error("An error occured in notifyFolderAddedUser ", e);
|
||||||
|
@ -171,17 +266,17 @@ public class NotificationsProducer {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
gcubeLogger.trace("User id: " +userId + " send notifies un shared folder "+unSharedFolder.getName()+" for user "+infoContactModel.getId());
|
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("User id: " +userId + " send notifies un shared folder "+unSharedFolder.getName()+" for user "+infoContactModel.getId());
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getId(), unSharedFolder);
|
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), unSharedFolder);
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getId());
|
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
gcubeLogger.error("An error occured in notifyFolderUnSharing ", e);
|
gcubeLogger.error("An error occured in notifyFolderUnSharing ", e);
|
||||||
|
@ -219,23 +314,22 @@ public class NotificationsProducer {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
gcubeLogger.trace("Send notifies added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Send notifies added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Send notify folder un share user "+infoContactModel.getId());
|
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getId(), workspaceItem, sharedFolder);
|
|
||||||
|
|
||||||
|
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
||||||
|
|
||||||
if(!notify){
|
if(!notify){
|
||||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("An error occured when notify user: "+infoContactModel.getId());
|
System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
@ -271,28 +365,28 @@ public class NotificationsProducer {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
gcubeLogger.trace("Send notifies remove item in shared folder is running...");
|
gcubeLogger.trace("Sending notificationremove item in shared folder is running...");
|
||||||
|
|
||||||
System.out.println("Send notifies remove item in shared folder is running...");
|
System.out.println("Sending notification remove item in shared folder is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
gcubeLogger.trace("Send notifies remove item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Send notifies remove item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()+" for user "+infoContactModel.getId());
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getId(), workspaceItem, sharedFolder);
|
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
||||||
|
|
||||||
if(!notify){
|
if(!notify){
|
||||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("An error occured when notify user: "+infoContactModel.getId());
|
System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.portlets.user.workspace.server.util;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||||
|
@ -16,6 +17,8 @@ import org.gcube.portlets.user.homelibrary.home.HomeLibrary;
|
||||||
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
||||||
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
||||||
|
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
|
||||||
|
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItemType;
|
||||||
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||||
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
||||||
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
||||||
|
@ -41,12 +44,13 @@ public class Util {
|
||||||
// public static final String TEST_SCOPE = "/gcube/devsec";
|
// public static final String TEST_SCOPE = "/gcube/devsec";
|
||||||
// public static final String TEST_USER = "pasquale.pagano";
|
// public static final String TEST_USER = "pasquale.pagano";
|
||||||
|
|
||||||
public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
public static final String TEST_SCOPE = "/gcube";
|
||||||
// public static final String TEST_USER = "federico.defaveri";
|
// public static final String TEST_USER = "federico.defaveri";
|
||||||
// public static final String TEST_USER = "massimiliano.assante";
|
// public static final String TEST_USER = "massimiliano.assante";
|
||||||
// public static final String TEST_USER = "pasquale.pagano";
|
// public static final String TEST_USER = "pasquale.pagano";
|
||||||
// public static final String TEST_USER = "francesco.mangiacrapa";
|
// public static final String TEST_USER = "francesco.mangiacrapa";
|
||||||
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
||||||
|
// public static final String TEST_USER = "aureliano.gentile";
|
||||||
public static final String TEST_USER = "test.user";
|
public static final String TEST_USER = "test.user";
|
||||||
public static final String TEST_USER_FULL_NAME = "Test User";
|
public static final String TEST_USER_FULL_NAME = "Test User";
|
||||||
|
|
||||||
|
@ -65,12 +69,13 @@ public class Util {
|
||||||
//for test only
|
//for test only
|
||||||
// httpSession.setAttribute(USERNAME_ATTRIBUTE, TEST_USER);
|
// httpSession.setAttribute(USERNAME_ATTRIBUTE, TEST_USER);
|
||||||
session = SessionManager.getInstance().getASLSession(sessionID, TEST_USER);
|
session = SessionManager.getInstance().getASLSession(sessionID, TEST_USER);
|
||||||
|
session.setScope(TEST_SCOPE);
|
||||||
if(!withoutPortal){ //TEMPORARY SOLUTION
|
if(!withoutPortal){ //TEMPORARY SOLUTION
|
||||||
defaultLogger.error("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND");
|
defaultLogger.error("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND");
|
||||||
session.setScope(TEST_SCOPE);
|
|
||||||
session.setUserAvatarId(TEST_USER + "Avatar");
|
session.setUserAvatarId(TEST_USER + "Avatar");
|
||||||
session.setUserFullName(TEST_USER_FULL_NAME);
|
session.setUserFullName(TEST_USER_FULL_NAME);
|
||||||
session.setUserEmailAddress(TEST_USER + "@mail.test");
|
session.setUserEmailAddress(TEST_USER + "@mail.test");
|
||||||
|
// httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
withoutPortal = true;
|
withoutPortal = true;
|
||||||
|
@ -215,4 +220,26 @@ public class Util {
|
||||||
return session.getUsername();
|
return session.getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isVRE(ASLSession session){
|
||||||
|
|
||||||
|
String currentScope = session.getScopeName();
|
||||||
|
|
||||||
|
int slashCount = StringUtils.countMatches(currentScope, "/");
|
||||||
|
|
||||||
|
if(slashCount < 3){
|
||||||
|
defaultLogger.trace("currentScope is not VRE");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultLogger.trace("currentScope is VRE");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isASharedFolder(WorkspaceItem wsItem){
|
||||||
|
if(wsItem!=null)
|
||||||
|
return wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue